π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Fix issue when opening links in app
ashilkn4706fff599ab
diff --git a/mobile/lib/app.dart b/mobile/lib/app.dartindex 4f590e4399..96111aa10b 100644--- a/mobile/lib/app.dart+++ b/mobile/lib/app.dart@@ -108,7 +108,12 @@ class _EnteAppState extends State<EnteApp> with WidgetsBindingObserver {theme: lightTheme,darkTheme: dartTheme,home: AppLifecycleService.instance.mediaExtensionAction.action ==- IntentAction.view+ IntentAction.view &&+ (AppLifecycleService.instance.mediaExtensionAction.type ==+ MediaType.image ||+ AppLifecycleService+ .instance.mediaExtensionAction.type ==+ MediaType.video)? const FileViewer(): const HomeWidget(),debugShowCheckedModeBanner: false,diff --git a/mobile/lib/ui/tabs/home_widget.dart b/mobile/lib/ui/tabs/home_widget.dartindex 0093b64d2c..dbf9c26e41 100644--- a/mobile/lib/ui/tabs/home_widget.dart+++ b/mobile/lib/ui/tabs/home_widget.dart@@ -259,71 +259,75 @@ class _HomeWidgetState extends State<HomeWidget> {}Future<void> _handlePublicAlbumLink(Uri uri) async {- bool result = true;- final Collection collection =- await CollectionsService.instance.getPublicCollection(context, uri);-- if (collection.owner!.id! == Configuration.instance.getUserID()) {- await routeToPage(- context,- CollectionPage(- CollectionWithThumbnail(collection, null),- ),- );- return;- }+ try {+ bool result = true;+ final Collection collection =+ await CollectionsService.instance.getPublicCollection(context, uri);- final publicUrl = collection.publicURLs![0];- if (publicUrl!.passwordEnabled) {- await showTextInputDialog(- context,- title: S.of(context).enterPassword,- submitButtonLabel: S.of(context).ok,- alwaysShowSuccessState: false,- onSubmit: (String text) async {- if (text.trim() == "") {- return;- }- try {- final hashedPassword = await CryptoUtil.deriveKey(- utf8.encode(text),- CryptoUtil.base642bin(publicUrl.nonce!),- publicUrl.memLimit!,- publicUrl.opsLimit!,- );+ if (collection.owner!.id! == Configuration.instance.getUserID()) {+ await routeToPage(+ context,+ CollectionPage(+ CollectionWithThumbnail(collection, null),+ ),+ );+ return;+ }- result = await CollectionsService.instance- .verifyPublicCollectionPassword(- context,- CryptoUtil.bin2base64(hashedPassword),- collection.id,- );- } catch (e, s) {- _logger.severe("Failed to decrypt password for album", e, s);- await showGenericErrorDialog(context: context, error: e);- }- },- );- }+ final publicUrl = collection.publicURLs![0];+ if (publicUrl!.passwordEnabled) {+ await showTextInputDialog(+ context,+ title: S.of(context).enterPassword,+ submitButtonLabel: S.of(context).ok,+ alwaysShowSuccessState: false,+ onSubmit: (String text) async {+ if (text.trim() == "") {+ return;+ }+ try {+ final hashedPassword = await CryptoUtil.deriveKey(+ utf8.encode(text),+ CryptoUtil.base642bin(publicUrl.nonce!),+ publicUrl.memLimit!,+ publicUrl.opsLimit!,+ );++ result = await CollectionsService.instance+ .verifyPublicCollectionPassword(+ context,+ CryptoUtil.bin2base64(hashedPassword),+ collection.id,+ );+ } catch (e, s) {+ _logger.severe("Failed to decrypt password for album", e, s);+ await showGenericErrorDialog(context: context, error: e);+ }+ },+ );+ }++ if (result) {+ final dialog = createProgressDialog(context, "Loading...");+ await dialog.show();- if (result) {- final dialog = createProgressDialog(context, "Loading...");- await dialog.show();-- final List<EnteFile> sharedFiles =- await _diffFetcher.getPublicFiles(context, collection.id);- await dialog.hide();-- await routeToPage(- context,- SharedPublicCollectionPage(- files: sharedFiles,- CollectionWithThumbnail(- collection,- null,+ final List<EnteFile> sharedFiles =+ await _diffFetcher.getPublicFiles(context, collection.id);+ await dialog.hide();++ await routeToPage(+ context,+ SharedPublicCollectionPage(+ files: sharedFiles,+ CollectionWithThumbnail(+ collection,+ null,+ ),),- ),- );+ );+ }+ } catch (e, s) {+ _logger.severe("Failed to handle public album link", e, s);}}diff --git a/mobile/lib/ui/viewer/gallery/shared_public_collection_page.dart b/mobile/lib/ui/viewer/gallery/shared_public_collection_page.dartindex ac079f203d..165b9f2035 100644--- a/mobile/lib/ui/viewer/gallery/shared_public_collection_page.dart+++ b/mobile/lib/ui/viewer/gallery/shared_public_collection_page.dart@@ -1,4 +1,5 @@import "package:flutter/material.dart";+import "package:logging/logging.dart";import "package:photos/core/event_bus.dart";import "package:photos/events/collection_meta_event.dart";import "package:photos/events/collection_updated_event.dart";@@ -34,6 +35,8 @@ class SharedPublicCollectionPage extends StatelessWidget {@overrideWidget build(BuildContext context) {+ final logger = Logger("SharedPublicCollectionPage");+ logger.info("Building SharedPublicCollectionPage");final bool isPublicDownload = c.collection.isPublicDownload();final bool isisEnableCollect = c.collection.isEnableCollect();final List<EnteFile>? initialFiles =diff --git a/mobile/pubspec.lock b/mobile/pubspec.lockindex eb9773526a..e846279541 100644--- a/mobile/pubspec.lock+++ b/mobile/pubspec.lock@@ -1510,9 +1510,9 @@ packages:dependency: "direct main"description:path: "."- ref: handle_incoming_links- resolved-ref: ca5c4960e05cd5dcf0eb16ad1bab72febffc6676- url: "https://github.com/AmanRajSinghMourya/media_extension.git"+ ref: deeplink_fixes+ resolved-ref: "520a200a6f76dece843f3e0eedb9b1f89c805cdf"+ url: "https://github.com/ente-io/media_extension.git"source: gitversion: "1.0.2"media_kit:diff --git a/mobile/pubspec.yaml b/mobile/pubspec.yamlindex 1edb6644b6..a0f2f9ff18 100644--- a/mobile/pubspec.yaml+++ b/mobile/pubspec.yaml@@ -114,8 +114,8 @@ dependencies:maps_launcher: ^2.2.1media_extension:git:- url: "https://github.com/AmanRajSinghMourya/media_extension.git"- ref: handle_incoming_links+ url: "https://github.com/ente-io/media_extension.git"+ ref: deeplink_fixesmedia_kit: ^1.1.10+1media_kit_libs_video: ^1.0.4media_kit_video: ^1.2.4