-
Notifications
You must be signed in to change notification settings - Fork 335
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
UI Preview Mode: mock products #4735
Conversation
// For mocking purposes: all yearly subscriptions have a 1-week free trial | ||
guard productType.period?.unit == .year else { return nil } | ||
return TestStoreProductDiscount( | ||
identifier: "intro", | ||
price: 0, | ||
localizedPriceString: "$0.00", | ||
paymentMode: .freeTrial, | ||
subscriptionPeriod: SubscriptionPeriod(value: 1, unit: .week), | ||
numberOfPeriods: 1, | ||
type: .introductory | ||
) |
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.
Based on @JayShortway's comment here, I'm only adding mocked introductory offers for yearly subscriptions
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.
Looking good so far!
} else { | ||
packageType = .custom | ||
} | ||
return ProductTypeMock(packageType: packageType) ?? .default |
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.
Hmm I'm wondering if we should default always to a lifetime in this case.... But then again, I don't have a better alternative, so I think this is ok for now!
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.
A couple of suggestions but LGTM!
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.
LGTM!
@@ -12,7 +12,7 @@ | |||
// Created by Juanpe Catalán on 9/8/21. | |||
|
|||
import Nimble | |||
@testable import RevenueCat | |||
@testable @_spi(Internal) import RevenueCat |
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.
neat 💅
Checklist
Motivation
The UI Preview Mode of the SDK should limit all the functionality of the SDK to only enable implementing the Paywall Previews functionality in the RevenueCat app.
Description
Mock the
StoreProducts
, as we cannot fetch them from StoreKit