From 5d8af5f94ca7442e657d40d2607985c63c01280e Mon Sep 17 00:00:00 2001 From: Fynn Petersen-Frey <10599762+fyfrey@users.noreply.github.com> Date: Tue, 14 Nov 2023 21:32:38 +0100 Subject: [PATCH] fix(mobile): partner assets in albums & share (#5029) --- mobile/assets/i18n/en-US.json | 2 +- mobile/lib/modules/home/views/home_page.dart | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/mobile/assets/i18n/en-US.json b/mobile/assets/i18n/en-US.json index 65a75bf327..49b99db6fa 100644 --- a/mobile/assets/i18n/en-US.json +++ b/mobile/assets/i18n/en-US.json @@ -174,9 +174,9 @@ "home_page_first_time_notice": "If this is your first time using the app, please make sure to choose a backup album(s) so that the timeline can populate photos and videos in the album(s).", "home_page_upload_err_limit": "Can only upload a maximum of 30 assets at a time, skipping", "home_page_favorite_err_partner": "Can not favorite partner assets yet, skipping", - "home_page_album_err_partner": "Can not add partner assets to an album yet, skipping", "home_page_archive_err_partner": "Can not archive partner assets, skipping", "home_page_delete_err_partner": "Can not delete partner assets, skipping", + "home_page_share_err_local": "Can not share local assets via link, skipping", "image_viewer_page_state_provider_download_error": "Download Error", "image_viewer_page_state_provider_download_success": "Download Success", "image_viewer_page_state_provider_share_error": "Share Error", diff --git a/mobile/lib/modules/home/views/home_page.dart b/mobile/lib/modules/home/views/home_page.dart index 07397ecd12..4383ed21b0 100644 --- a/mobile/lib/modules/home/views/home_page.dart +++ b/mobile/lib/modules/home/views/home_page.dart @@ -131,12 +131,19 @@ class HomePage extends HookConsumerWidget { ); } + Iterable remoteSelection({String? errorMessage}) => remoteOnly( + selection.value, + errorCallback: errorBuilder(errorMessage), + ); + void onShareAssets(bool shareLocal) { processing.value = true; if (shareLocal) { handleShareAssets(ref, context, selection.value.toList()); } else { - final ids = ownedRemoteSelection().map((e) => e.remoteId!); + final ids = + remoteSelection(errorMessage: "home_page_share_err_local".tr()) + .map((e) => e.remoteId!); context.autoPush(SharedLinkEditRoute(assetsList: ids.toList())); } processing.value = false; @@ -217,9 +224,8 @@ class HomePage extends HookConsumerWidget { void onAddToAlbum(Album album) async { processing.value = true; try { - final Iterable assets = ownedRemoteSelection( - localErrorMessage: "home_page_add_to_album_err_local".tr(), - ownerErrorMessage: "home_page_album_err_partner".tr(), + final Iterable assets = remoteSelection( + errorMessage: "home_page_add_to_album_err_local".tr(), ); if (assets.isEmpty) { return; @@ -266,9 +272,8 @@ class HomePage extends HookConsumerWidget { void onCreateNewAlbum() async { processing.value = true; try { - final Iterable assets = ownedRemoteSelection( - localErrorMessage: "home_page_add_to_album_err_local".tr(), - ownerErrorMessage: "home_page_album_err_partner".tr(), + final Iterable assets = remoteSelection( + errorMessage: "home_page_add_to_album_err_local".tr(), ); if (assets.isEmpty) { return;