fix(mobile): partner assets in albums & share (#5029)

This commit is contained in:
Fynn Petersen-Frey 2023-11-14 21:32:38 +01:00 committed by GitHub
parent 5145c33ed4
commit 5d8af5f94c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View file

@ -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",

View file

@ -131,12 +131,19 @@ class HomePage extends HookConsumerWidget {
);
}
Iterable<Asset> 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<Asset> assets = ownedRemoteSelection(
localErrorMessage: "home_page_add_to_album_err_local".tr(),
ownerErrorMessage: "home_page_album_err_partner".tr(),
final Iterable<Asset> 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<Asset> assets = ownedRemoteSelection(
localErrorMessage: "home_page_add_to_album_err_local".tr(),
ownerErrorMessage: "home_page_album_err_partner".tr(),
final Iterable<Asset> assets = remoteSelection(
errorMessage: "home_page_add_to_album_err_local".tr(),
);
if (assets.isEmpty) {
return;