Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] remove redundant logging

Aman Raj Singh Mourya119ae6d345a5
diff --git a/mobile/lib/services/collections_service.dart b/mobile/lib/services/collections_service.dart
index e174c50122..bb2031750b 100644
--- a/mobile/lib/services/collections_service.dart
+++ b/mobile/lib/services/collections_service.dart
@@ -1036,7 +1036,11 @@ class CollectionsService {
}
Future<Collection> getPublicCollection(Uri uri) async {
- final String authToken = uri.queryParameters["t"] ?? "Not found";
+ final String? authToken = uri.queryParameters["t"];
+ if (authToken == null) {
+ _logger.severe("Authorization token not found in URI query parameters");
+ throw Exception("Authorization token is required");
+ }
final String albumKey = uri.fragment;
try {
final response = await _enteDio.get(
@@ -1051,7 +1055,6 @@ class CollectionsService {
final Uint8List collectionKey =
Uint8List.fromList(Base58Decode(albumKey));
- _logger.severe("Public collection fetched: $collectionData");
_cachedKeys[collection.id] = collectionKey;
_cachedPublicAlbumToken[collection.id] = authToken;
return collection;
@@ -1082,15 +1085,13 @@ class CollectionsService {
),
);
final jwtToken = response.data["jwtToken"];
- _logger.severe("TOKEN $authToken");
- _logger.severe("JWT TOKEN $jwtToken");
if (response.statusCode == 200) {
await setPublicAlbumTokenJWT(collectioID, jwtToken);
return true;
}
return false;
} catch (e) {
- _logger.severe("Failed to verify public collection password $e");
+ _logger.warning("Failed to verify public collection password $e");
return false;
}
}
diff --git a/mobile/lib/ui/tabs/home_widget.dart b/mobile/lib/ui/tabs/home_widget.dart
index 38fade8d17..3d9192326c 100644
--- a/mobile/lib/ui/tabs/home_widget.dart
+++ b/mobile/lib/ui/tabs/home_widget.dart
@@ -106,6 +106,7 @@ class _HomeWidgetState extends State<HomeWidget> {
late StreamSubscription<BackupFoldersUpdatedEvent> _backupFoldersUpdatedEvent;
late StreamSubscription<AccountConfiguredEvent> _accountConfiguredEvent;
late StreamSubscription<CollectionUpdatedEvent> _collectionUpdatedEvent;
+ late StreamSubscription<Uri?> _uriLinkEventSubscription;
final DiffFetcher _diffFetcher = DiffFetcher();
@override
@@ -245,7 +246,7 @@ class _HomeWidgetState extends State<HomeWidget> {
}
// Handle the background state
- uriLinkStream.listen((Uri? uri) async {
+ _uriLinkEventSubscription = uriLinkStream.listen((Uri? uri) async {
if (uri != null) {
await _handlePublicAlbumLink(uri);
}
@@ -269,14 +270,11 @@ class _HomeWidgetState extends State<HomeWidget> {
}
try {
final hashedPassword = await CryptoUtil.deriveKey(
- utf8.encode(text) as Uint8List,
+ utf8.encode(text),
CryptoUtil.base642bin(publicUrl.nonce!),
publicUrl.memLimit!,
publicUrl.opsLimit!,
);
- _logger.info(
- "Hashed password: ${CryptoUtil.bin2base64(hashedPassword)}",
- );
result = await CollectionsService.instance
.verifyPublicCollectionPassword(
@@ -286,8 +284,8 @@ class _HomeWidgetState extends State<HomeWidget> {
if (!result) {
await showErrorDialog(
context,
- "Incorrect Password",
- "Plesae try again",
+ S.of(context).incorrectPasswordTitle,
+ S.of(context).pleaseTryAgain,
);
}
} catch (e, s) {
@@ -363,6 +361,7 @@ class _HomeWidgetState extends State<HomeWidget> {
_collectionUpdatedEvent.cancel();
isOnSearchTabNotifier.dispose();
_pageController.dispose();
+ _uriLinkEventSubscription.cancel();
super.dispose();
}
diff --git a/mobile/lib/utils/file_download_util.dart b/mobile/lib/utils/file_download_util.dart
index c9ed08ab2e..a1b080c613 100644
--- a/mobile/lib/utils/file_download_util.dart
+++ b/mobile/lib/utils/file_download_util.dart
@@ -32,7 +32,6 @@ Future<File?> downloadAndDecryptPublicFile(
final String logPrefix = 'Public File-${file.uploadedFileID}:';
_logger
.info('$logPrefix starting download ${formatBytes(file.fileSize ?? 0)}');
- _logger.severe("File id ${file.uploadedFileID}");
final String tempDir = Configuration.instance.getTempDirectory();
final String encryptedFilePath = "$tempDir${file.uploadedFileID}.encrypted";