π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add logs for debugging
ashilkn6056dc4dd8c0
diff --git a/mobile/apps/photos/lib/core/configuration.dart b/mobile/apps/photos/lib/core/configuration.dartindex 765e29f071..0cd95f32b2 100644--- a/mobile/apps/photos/lib/core/configuration.dart+++ b/mobile/apps/photos/lib/core/configuration.dart@@ -108,14 +108,23 @@ class Configuration {_documentsDirectory + "/ente-shared-media";Directory(_sharedDocumentsMediaDirectory).createSync(recursive: true);if (!_preferences.containsKey(tokenKey)) {+ _logger+ .info("------ Token not found, deleting all secure storage data");await _secureStorage.deleteAll();} else {+ _logger.info("------ Token found, loading secure storage data");_key = await _secureStorage.read(key: keyKey,);+ _logger.info(+ "------ Key loaded from secure storage, is null: ${_key == null}",+ );_secretKey = await _secureStorage.read(key: secretKeyKey,);+ _logger.info(+ "------ Secret Key loaded from secure storage, is null: ${_secretKey == null}",+ );if (_key == null) {await logout(autoLogout: true);}@@ -180,6 +189,7 @@ class Configuration {}Future<void> logout({bool autoLogout = false}) async {+ _logger.info("Logging out, autoLogout: $autoLogout");if (!autoLogout) {if (SyncService.instance.isSyncInProgress()) {SyncService.instance.stopSync();@@ -692,13 +702,16 @@ class Configuration {}Future<void> _migrateSecurityStorageToFirstUnlock() async {+ _logger.info("------ Migrating secure storage to first unlock if needed");final hasMigratedSecureStorage =_preferences.getBool(hasMigratedSecureStorageKey) ?? false;if (!hasMigratedSecureStorage && _key != null && _secretKey != null) {+ _logger.info("------ Migrating secure storage to first unlock");await _secureStorage.write(key: keyKey, value: _key);await _secureStorage.write(key: secretKeyKey, value: _secretKey);await _preferences.setBool(hasMigratedSecureStorageKey, true);}+ _logger.info("------ Migration check complete");}Future<String> _getOrCreateAnonymousUserID() async {diff --git a/mobile/apps/photos/lib/main.dart b/mobile/apps/photos/lib/main.dartindex a575787c5e..91ee6e1272 100644--- a/mobile/apps/photos/lib/main.dart+++ b/mobile/apps/photos/lib/main.dart@@ -141,7 +141,9 @@ Future<void> _runMinimally(String taskId, TimeLogger tlog) async {final PackageInfo packageInfo = await PackageInfo.fromPlatform();final SharedPreferences prefs = await SharedPreferences.getInstance();+ _logger.info("------ Configuration init $tlog");await Configuration.instance.init();+ _logger.info("------ Configuration done $tlog");// App LifeCycleAppLifecycleService.instance.init(prefs);@@ -162,7 +164,9 @@ Future<void> _runMinimally(String taskId, TimeLogger tlog) async {packageInfo,);+ _logger.info("------ CollectionsService init $tlog");await CollectionsService.instance.init(prefs);+ _logger.info("------ CollectionsService init done $tlog");// Upload & Sync Relatedawait FileUploader.instance.init(prefs, true);diff --git a/mobile/apps/photos/lib/services/account/user_service.dart b/mobile/apps/photos/lib/services/account/user_service.dartindex 96cb0f253e..77a7a25c29 100644--- a/mobile/apps/photos/lib/services/account/user_service.dart+++ b/mobile/apps/photos/lib/services/account/user_service.dart@@ -1278,7 +1278,10 @@ class UserService {Future<void> _saveConfiguration(dynamic response) async {final responseData = response is Map ? response : response.data as Map?;- if (responseData == null) return;+ if (responseData == null) {+ _logger.warning("------ Response data is null");+ return;+ }await Configuration.instance.setUserID(responseData["id"]);if (responseData["encryptedToken"] != null) {