Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Keep offline opt-in unchanged

Neeraj Gupta0eb65ecf3b05
diff --git a/mobile/apps/auth/lib/core/configuration.dart b/mobile/apps/auth/lib/core/configuration.dart
index 9f29d94beb..50b7375b5e 100644
--- a/mobile/apps/auth/lib/core/configuration.dart
+++ b/mobile/apps/auth/lib/core/configuration.dart
@@ -94,15 +94,15 @@ class Configuration extends BaseConfiguration
}
Future<void> optForOfflineMode() async {
- var offlineAuthKey = await _secureStorage.read(key: offlineAuthSecretKey);
- if (offlineAuthKey == null) {
- offlineAuthKey = CryptoUtil.bin2base64(CryptoUtil.generateKey());
+ if ((await _secureStorage.containsKey(key: offlineAuthSecretKey))) {
+ _offlineAuthKey = await _secureStorage.read(key: offlineAuthSecretKey);
+ } else {
+ _offlineAuthKey = CryptoUtil.bin2base64(CryptoUtil.generateKey());
await _secureStorage.write(
key: offlineAuthSecretKey,
- value: offlineAuthKey,
+ value: _offlineAuthKey,
);
}
- _offlineAuthKey = offlineAuthKey;
await _preferences.setBool(hasOptedForOfflineModeKey, true);
}