-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change Strings to enums #769
Change Strings to enums #769
Conversation
Also fix file headers. resolves RevenueCat#763
@@ -212,7 +212,7 @@ class ProductInfoExtractorTests: XCTestCase { | |||
|
|||
let receivedProductInfo = productInfoExtractor.extractInfo(from: product) | |||
|
|||
expect(receivedProductInfo.discounts).to(beEmpty()) | |||
expect(receivedProductInfo.discounts).to(beNil()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The extractor returns nil
instead of an empty array
@@ -181,14 +181,14 @@ class ProductInfoExtractorTests: XCTestCase { | |||
|
|||
let receivedProductInfo = productInfoExtractor.extractInfo(from: product) | |||
|
|||
expect(receivedProductInfo.subscriptionGroup).to(beEmpty()) | |||
expect(receivedProductInfo.subscriptionGroup).to(beNil()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The extractor returns nil
instead of an empty array
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
@@ -40,7 +40,7 @@ class MockSKProduct: SKProduct { | |||
@available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) | |||
lazy var mockDiscount: SKProductDiscount? = nil | |||
|
|||
@available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) | |||
@available(iOS 12.2, tvOS 12.2, macOS 10.13.2, *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the main change related to the failed tests. The problem is that although SKProductDiscount
is available from iOS 11.2, the property discounts
is available from iOS 12.2 😓 So, we have to update the availability of this property and the derived tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch!
static let purchaserInfo = PurchaserInfoStrings.self | ||
static let receipt = ReceiptStrings.self | ||
static let restore = RestoreStrings.self | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order not to make a lot of changes in the codebase, I left these "aliases" there.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think leaving the aliases in this PR makes sense, and we can do another PR to remove them and change the code.
Conflicts: PurchasesCoreSwift/Logging/Strings/AttributionStrings.swift PurchasesCoreSwift/Logging/Strings/ConfigureStrings.swift PurchasesCoreSwift/Logging/Strings/NetworkStrings.swift PurchasesCoreSwift/Logging/Strings/OfferingStrings.swift PurchasesCoreSwift/Logging/Strings/PurchaserInfoStrings.swift PurchasesCoreSwift/Logging/Strings/ReceiptStrings.swift PurchasesCoreSwift/Logging/Strings/RestoreStrings.swift PurchasesCoreSwift/Logging/Strings/Strings.swift
@@ -22,6 +22,7 @@ extension String { | |||
|
|||
} | |||
|
|||
// swiftlint:disable identifier_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exist a var
called i
, and due to that, it's breaking this rule.
In fact, there are other parts of the code that break this rule as well. I found these:
Data+Extensions.swift:35
Data+Extensions.swift:40
SwiftStyleGuide.swift:140
These errors will be fixed when this rule will be enabled again, I guess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm working on enabling swiftlint right now, so these will be addressed very soon!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥅 ⚽ 🐐
Thanks for the review 🙂 |
Resolves #768
The goal of this PR is to convert the
Strings
classes toenums
based on this discussion.Moreover, I've updated some failed tests for devices with versions prior to 12.2. I'll give you more details throughout the code.
Thank you for contributing to Purchases. Before pressing the "Create Pull Request" button, please provide the following: