From 1d803552dacdf3fe5b46f4cc93ef604f18e1c02e Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Tue, 7 Jan 2025 09:47:35 +0530 Subject: [PATCH] extract strings --- mobile/lib/generated/intl/messages_en.dart | 6 +++ mobile/lib/generated/l10n.dart | 40 +++++++++++++++++++ mobile/lib/l10n/intl_en.arb | 7 +++- .../shared_public_collection_page.dart | 25 +++++++----- 4 files changed, 68 insertions(+), 10 deletions(-) diff --git a/mobile/lib/generated/intl/messages_en.dart b/mobile/lib/generated/intl/messages_en.dart index 9d163ebe9b..cfbe9ae799 100644 --- a/mobile/lib/generated/intl/messages_en.dart +++ b/mobile/lib/generated/intl/messages_en.dart @@ -1037,6 +1037,12 @@ class MessageLookup extends MessageLookupByLibrary { "Items show the number of days remaining before permanent deletion"), "itemsWillBeRemovedFromAlbum": MessageLookupByLibrary.simpleMessage( "Selected items will be removed from this album"), + "join": MessageLookupByLibrary.simpleMessage("Join"), + "joinAlbum": MessageLookupByLibrary.simpleMessage("Join album"), + "joinAlbumSubtext": + MessageLookupByLibrary.simpleMessage("to view and add your photos"), + "joinAlbumSubtextViewer": MessageLookupByLibrary.simpleMessage( + "to add this to shared albums"), "joinDiscord": MessageLookupByLibrary.simpleMessage("Join Discord"), "keepPhotos": MessageLookupByLibrary.simpleMessage("Keep Photos"), "kiloMeterUnit": MessageLookupByLibrary.simpleMessage("km"), diff --git a/mobile/lib/generated/l10n.dart b/mobile/lib/generated/l10n.dart index b754a6fee4..b5d5c166fc 100644 --- a/mobile/lib/generated/l10n.dart +++ b/mobile/lib/generated/l10n.dart @@ -10838,6 +10838,46 @@ class S { args: [], ); } + + /// `Join album` + String get joinAlbum { + return Intl.message( + 'Join album', + name: 'joinAlbum', + desc: '', + args: [], + ); + } + + /// `to view and add your photos` + String get joinAlbumSubtext { + return Intl.message( + 'to view and add your photos', + name: 'joinAlbumSubtext', + desc: '', + args: [], + ); + } + + /// `to add this to shared albums` + String get joinAlbumSubtextViewer { + return Intl.message( + 'to add this to shared albums', + name: 'joinAlbumSubtextViewer', + desc: '', + args: [], + ); + } + + /// `Join` + String get join { + return Intl.message( + 'Join', + name: 'join', + desc: '', + args: [], + ); + } } class AppLocalizationDelegate extends LocalizationsDelegate { diff --git a/mobile/lib/l10n/intl_en.arb b/mobile/lib/l10n/intl_en.arb index d9d547f927..3d317b7e7a 100644 --- a/mobile/lib/l10n/intl_en.arb +++ b/mobile/lib/l10n/intl_en.arb @@ -1580,5 +1580,10 @@ "authToManageLegacy": "Please authenticate to manage your trusted contacts", "useDifferentPlayerInfo": "Having trouble playing this video? Long press here to try a different player.", "hideSharedItemsFromHomeGallery": "Hide shared items from home gallery", - "gallery": "Gallery" + "gallery": "Gallery", + "joinAlbum": "Join album", + "joinAlbumSubtext": "to view and add your photos", + "joinAlbumSubtextViewer": "to add this to shared albums", + "join": "Join" + } \ No newline at end of file diff --git a/mobile/lib/ui/viewer/gallery/shared_public_collection_page.dart b/mobile/lib/ui/viewer/gallery/shared_public_collection_page.dart index 225e3338b9..ed4536d89b 100644 --- a/mobile/lib/ui/viewer/gallery/shared_public_collection_page.dart +++ b/mobile/lib/ui/viewer/gallery/shared_public_collection_page.dart @@ -5,6 +5,7 @@ import "package:photos/events/collection_meta_event.dart"; import "package:photos/events/collection_updated_event.dart"; import "package:photos/events/files_updated_event.dart"; import "package:photos/generated/l10n.dart"; +import "package:photos/l10n/l10n.dart"; import "package:photos/models/collection/collection_items.dart"; import "package:photos/models/file/file.dart"; import "package:photos/models/file_load_result.dart"; @@ -15,7 +16,6 @@ import "package:photos/services/remote_sync_service.dart"; import "package:photos/ui/components/buttons/button_widget.dart"; import "package:photos/ui/components/models/button_type.dart"; import "package:photos/ui/components/notification_widget.dart"; -import "package:photos/ui/sharing/share_collection_page.dart"; import "package:photos/ui/viewer/actions/file_selection_overlay_bar.dart"; import "package:photos/ui/viewer/gallery/collection_page.dart"; import "package:photos/ui/viewer/gallery/gallery.dart"; @@ -24,6 +24,7 @@ import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.da import "package:photos/ui/viewer/gallery/state/selection_state.dart"; import "package:photos/utils/dialog_util.dart"; import "package:photos/utils/navigation_util.dart"; +import "package:photos/utils/toast_util.dart"; class SharedPublicCollectionPage extends StatefulWidget { final CollectionWithThumbnail c; @@ -100,18 +101,19 @@ class _SharedPublicCollectionPageState ? Padding( padding: const EdgeInsets.all(8.0), child: NotificationWidget( - startIcon: Icons.people_alt_outlined, + startIcon: Icons.people_outline, actionIcon: null, actionWidget: ButtonWidget( buttonType: ButtonType.primary, - labelText: "Join", + labelText: context.l10n.join, buttonSize: ButtonSize.small, + shouldSurfaceExecutionStates: false, onTap: _joinAlbum, ), - text: 'Join album', + text: context.l10n.joinAlbum, subText: widget.c.collection.isCollectEnabledForPublicLink() - ? "to view and add your photos" - : 'to add this to shared albums', + ? context.l10n.joinAlbumSubtext + : context.l10n.joinAlbumSubtextViewer, type: NotificationType.notice, onTap: () async {}, ), @@ -151,7 +153,11 @@ class _SharedPublicCollectionPageState } Future _joinAlbum() async { - final dialog = createProgressDialog(context, S.of(context).pleaseWait); + final dialog = createProgressDialog( + context, + S.of(context).pleaseWait, + isDismissible: true, + ); await dialog.show(); try { logger.info("Joining collection ${widget.c.collection.id}"); @@ -171,9 +177,10 @@ class _SharedPublicCollectionPageState ); } catch (e, s) { logger.severe("Failed to join collection", e, s); - showGenericErrorDialog(context: context, error: e).ignore(); - } finally { await dialog.hide(); + showToast(context, S.of(context).somethingWentWrong); + // wait for 400ms to show the error dialog + await Future.delayed(const Duration(milliseconds: 400)); } } }