-
Notifications
You must be signed in to change notification settings - Fork 338
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 CustomerInfo
#4786
Conversation
# Conflicts: # RevenueCat.xcodeproj/project.pbxproj
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.
Makes sense!
@@ -189,6 +189,10 @@ class CustomerInfoManager { | |||
} | |||
|
|||
func cachedCustomerInfo(appUserID: String) -> CustomerInfo? { | |||
guard !self.systemInfo.dangerousSettings.uiPreviewMode else { |
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 guess if we don't cache it, this would always be null and this might not be needed... But I guess I'm ok keeping it just in case.
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.
What you say makes total sense. The main reason why I also put this there is to always receive a nonnil CustomerInfo
object, even when using CacheFetchPolicy.fromCacheOnly
. Like: in UI Preview mode, you consistently get the mocked CustomerInfo
every time and in any case (e.g. for any CacheFetchPolicy
).
Checklist
Motivation
In UI Preview mode, the SDK should not make the requests to obtain the
CustomerInfo
.Description
When in UI Preview mode, the SDK:
CustomerInfo
CustomerInfo
(if requested either from the cache or from the backend)