Skip to content
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

RCDeviceCache: synchronize NSUserDefaults after writes #1003

Merged
merged 1 commit into from Nov 30, 2021

Conversation

NachoSoto
Copy link
Contributor

This ensures that data isn't lost if the app is closed before it's had a chance to be saved.

This backports the Swift implementation (see https://github.com/RevenueCat/purchases-ios/blob/main/Purchases/Misc/SynchronizedUserDefaults.swift#L33-L45).

This ensures that data isn't lost if the app is closed before it's had a chance to be saved.
@NachoSoto NachoSoto requested review from taquitos, aboedo and a team November 29, 2021 23:01
@NachoSoto
Copy link
Contributor Author

NachoSoto commented Nov 29, 2021

How are we handling Objective-C releases? I pointed this PR to release/3.13.0 but I have a feeling that's not right.

Pointing this to new release/3.13.1 branch.

@NachoSoto NachoSoto changed the base branch from release/3.13.0 to release/3.13.1 November 30, 2021 00:01
Copy link
Contributor

@taquitos taquitos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔄 🐐

/**
* Invokes the given block and synchronizes `NSUserDefaults` afterwards.
*/
- (void)storeInUserDefaults:(void(^)(NSUserDefaults *))block {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧡 Love this.

@NachoSoto NachoSoto merged commit 4ea6b6c into release/3.13.1 Nov 30, 2021
@NachoSoto NachoSoto deleted the user-defaults-objc-synchronize branch November 30, 2021 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants