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

Don't reset the storage when the manifest file cannot be read because of iOS data protection #270

Conversation

aleh
Copy link
Contributor

@aleh aleh commented Dec 27, 2019

Summary:

This is to distinguish "manifest file does not exist or is corrupted" and "have no access to the manifest file yet" cases.

Starting with an empty dictionary is a reasonable fallback in case the manifest does not exist or cannot be parsed because of being corrupted or incompatible. However doing so might lead to unnecessary data loss when the app simply has no access to its documents yet due to iOS data protection (if enabled and when the app launches while the device is locked due to e.g. geofencing, silent notification, external accessory, etc).

Test Plan:

Enable data protection in your RN iOS app, then trigger a geofencing event or a silent push notification to launch the app while the phone is locked and files are not readable. If the app tries to access async storage in this case, then it'll end up erasing it without this fix.

…cause of iOS data protection

This is to distinguish "manifest file does not exist or is corrupted" and "have no access to the manifest file yet" cases.

Starting with an empty dictionary is a reasonable fallback in case the manifest does not exist or cannot be parsed because of being corrupted or incompatible. However doing so might lead to unnecessary data loss when the app simply has no access to its documents yet due to iOS data protection (if enabled and when the app launches while the device is locked due to e.g. geofencing, silent notification, external accessory, etc).
@krizzu krizzu added the LEGACY label Dec 29, 2019
@krizzu
Copy link
Member

krizzu commented Dec 29, 2019

@aleh Thanks for working on that. I'll have a look as soon as I can.
cc @tido64

@tido64 tido64 added the platform: iOS This is iOS specific label Jan 7, 2020
@tido64 tido64 added bug Something isn't working PR ready 💯 labels Jan 7, 2020
ios/RNCAsyncStorage.m Outdated Show resolved Hide resolved
Co-Authored-By: Krzysztof Borowy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working platform: iOS This is iOS specific
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants