Skip to content

armgit / ente

Public Imported from GitHub
0

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

Update share link copy with descriptive text

ashilkn18f16bd5b620
diff --git a/mobile/apps/photos/lib/ui/components/menu_item_widget/menu_item_child_widgets.dart b/mobile/apps/photos/lib/ui/components/menu_item_widget/menu_item_child_widgets.dart
index 22c5b1afb0..939ae1108c 100644
--- a/mobile/apps/photos/lib/ui/components/menu_item_widget/menu_item_child_widgets.dart
+++ b/mobile/apps/photos/lib/ui/components/menu_item_widget/menu_item_child_widgets.dart
@@ -46,7 +46,8 @@ class _TrailingWidgetState extends State<TrailingWidget> {
if (oldWidget.showExecutionStates && !widget.showExecutionStates) {
// Was true, now false: remove listener and reset to icon
if (_listenerAdded) {
- oldWidget.executionStateNotifier.removeListener(_executionStateListener);
+ oldWidget.executionStateNotifier
+ .removeListener(_executionStateListener);
_listenerAdded = false;
}
_setTrailingIcon();
diff --git a/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dart b/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dart
index 6ef3dd2792..d9ce7be85c 100644
--- a/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dart
+++ b/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dart
@@ -162,7 +162,8 @@ class _ApplyCodeContentState extends State<_ApplyCodeContent> {
Text(
_errorMessage ?? AppLocalizations.of(context).enterCodeDescription,
style: textTheme.mini.copyWith(
- color: _errorMessage != null ? warningRedColor : colorScheme.textMuted,
+ color:
+ _errorMessage != null ? warningRedColor : colorScheme.textMuted,
),
),
const SizedBox(height: 20),
diff --git a/mobile/apps/photos/lib/ui/growth/change_referral_code_sheet.dart b/mobile/apps/photos/lib/ui/growth/change_referral_code_sheet.dart
index f04af954a6..f752c12dda 100644
--- a/mobile/apps/photos/lib/ui/growth/change_referral_code_sheet.dart
+++ b/mobile/apps/photos/lib/ui/growth/change_referral_code_sheet.dart
@@ -89,7 +89,8 @@ class _ChangeReferralCodeContentState
if (e is DioException) {
if (e.response?.statusCode == 400) {
setState(() {
- _errorMessage = AppLocalizations.of(context).unavailableReferralCode;
+ _errorMessage =
+ AppLocalizations.of(context).unavailableReferralCode;
});
} else if (e.response?.statusCode == 429) {
setState(() {
diff --git a/mobile/apps/photos/lib/ui/growth/referral_code_widget.dart b/mobile/apps/photos/lib/ui/growth/referral_code_widget.dart
index 510558de07..ed899759e8 100644
--- a/mobile/apps/photos/lib/ui/growth/referral_code_widget.dart
+++ b/mobile/apps/photos/lib/ui/growth/referral_code_widget.dart
@@ -80,8 +80,8 @@ class ReferralCodeWidget extends StatelessWidget {
showInfoDialog(
context,
title: AppLocalizations.of(context).error,
- body:
- AppLocalizations.of(context).onlyFamilyAdminCanChangeCode(
+ body: AppLocalizations.of(context)
+ .onlyFamilyAdminCanChangeCode(
familyAdminEmail: familyAdmin,
),
icon: Icons.error,
diff --git a/mobile/apps/photos/lib/ui/growth/referral_screen.dart b/mobile/apps/photos/lib/ui/growth/referral_screen.dart
index 6f09707ad7..93f5de214d 100644
--- a/mobile/apps/photos/lib/ui/growth/referral_screen.dart
+++ b/mobile/apps/photos/lib/ui/growth/referral_screen.dart
@@ -210,9 +210,10 @@ class ReferralWidget extends StatelessWidget {
),
const SizedBox(height: 12),
Text(
- AppLocalizations.of(context).referralsAreCurrentlyPaused,
- style:
- textTheme.small.copyWith(color: colorScheme.textFaint),
+ AppLocalizations.of(context)
+ .referralsAreCurrentlyPaused,
+ style: textTheme.small
+ .copyWith(color: colorScheme.textFaint),
),
],
),
diff --git a/mobile/apps/photos/lib/ui/growth/storage_details_screen.dart b/mobile/apps/photos/lib/ui/growth/storage_details_screen.dart
index 0dd9fd30d1..11b2b1b984 100644
--- a/mobile/apps/photos/lib/ui/growth/storage_details_screen.dart
+++ b/mobile/apps/photos/lib/ui/growth/storage_details_screen.dart
@@ -121,8 +121,8 @@ class _StorageDetailsScreenState extends State<StorageDetailsScreen> {
Expanded(
child: _StatCard(
value: data.refCount.toString(),
- label: AppLocalizations.of(context)
- .usedYourCode,
+ label:
+ AppLocalizations.of(context).usedYourCode,
cardColor: cardColor,
),
),
@@ -130,8 +130,7 @@ class _StorageDetailsScreenState extends State<StorageDetailsScreen> {
Expanded(
child: _StatCard(
value: data.refUpgradeCount.toString(),
- label:
- AppLocalizations.of(context).eligible,
+ label: AppLocalizations.of(context).eligible,
cardColor: cardColor,
),
),
@@ -145,8 +144,8 @@ class _StorageDetailsScreenState extends State<StorageDetailsScreen> {
Expanded(
child: _StatCard(
value: "1",
- label: AppLocalizations.of(context)
- .claimedByYou,
+ label:
+ AppLocalizations.of(context).claimedByYou,
cardColor: cardColor,
),
),
diff --git a/mobile/apps/photos/lib/ui/settings/debug/debug_settings_page.dart b/mobile/apps/photos/lib/ui/settings/debug/debug_settings_page.dart
index be7ca3e9e9..b7153552b2 100644
--- a/mobile/apps/photos/lib/ui/settings/debug/debug_settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/debug/debug_settings_page.dart
@@ -143,8 +143,7 @@ class _DebugSettingsPageState extends State<DebugSettingsPage> {
value: () =>
localSettings.isChristmasBannerEnabled,
onChanged: () async {
- await localSettings
- .setChristmasBannerEnabled(
+ await localSettings.setChristmasBannerEnabled(
!localSettings.isChristmasBannerEnabled,
);
Bus.instance.fire(ChristmasBannerEvent());
diff --git a/mobile/apps/photos/lib/ui/sharing/manage_links_widget.dart b/mobile/apps/photos/lib/ui/sharing/manage_links_widget.dart
index 0927d14111..d0595c6778 100644
--- a/mobile/apps/photos/lib/ui/sharing/manage_links_widget.dart
+++ b/mobile/apps/photos/lib/ui/sharing/manage_links_widget.dart
@@ -389,8 +389,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
leadingIcon: Icons.adaptive.share,
menuItemColor: getEnteColorScheme(context).fillFaint,
onTap: () async {
- // ignore: unawaited_futures
- await shareAlbumLinkWithPlaceholder(
+ await shareAlbumLink(
context,
widget.collection!,
urlValue,
diff --git a/mobile/apps/photos/lib/ui/sharing/public_link_enabled_actions_widget.dart b/mobile/apps/photos/lib/ui/sharing/public_link_enabled_actions_widget.dart
index 80fe1ce7ad..5ef979056f 100644
--- a/mobile/apps/photos/lib/ui/sharing/public_link_enabled_actions_widget.dart
+++ b/mobile/apps/photos/lib/ui/sharing/public_link_enabled_actions_widget.dart
@@ -81,7 +81,7 @@ class PublicLinkEnabledActionsWidget extends StatelessWidget {
leadingIcon: Icons.adaptive.share,
menuItemColor: enteColorScheme.fillFaint,
onTap: () async {
- await shareAlbumLinkWithPlaceholder(
+ await shareAlbumLink(
context,
collection,
url,
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dart b/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dart
index a9cdc64cf0..c8831d549b 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dart
@@ -1018,8 +1018,11 @@ class _FileSelectionActionsWidgetState
_cachedCollectionForSharedLink!,
);
unawaited(Clipboard.setData(ClipboardData(text: url)));
- await shareText(
+ const description =
+ 'Check out, comment and react on photos privately with Ente\'s end to end encryption';
+ await shareLinkWithDescription(
url,
+ description: description,
context: context,
key: sendLinkButtonKey,
);
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/collect_photos_bottom_buttons.dart b/mobile/apps/photos/lib/ui/viewer/gallery/collect_photos_bottom_buttons.dart
index fe18094e93..9c9c0f81d9 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/collect_photos_bottom_buttons.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/collect_photos_bottom_buttons.dart
@@ -45,7 +45,7 @@ class _EmptyAlbumStateNewState extends State<CollectPhotosBottomButtons> {
Future<void> _shareAlbumUrl() async {
final String url = CollectionsService.instance.getPublicUrl(widget.c);
- await shareAlbumLinkWithPlaceholder(
+ await shareAlbumLink(
context,
widget.c,
url,
diff --git a/mobile/apps/photos/lib/utils/share_util.dart b/mobile/apps/photos/lib/utils/share_util.dart
index f0692aa62c..d63efaad96 100644
--- a/mobile/apps/photos/lib/utils/share_util.dart
+++ b/mobile/apps/photos/lib/utils/share_util.dart
@@ -8,8 +8,6 @@ import 'package:path/path.dart';
import "package:photo_manager/photo_manager.dart";
import 'package:photos/core/configuration.dart';
import 'package:photos/core/constants.dart';
-import "package:photos/db/files_db.dart";
-import "package:photos/generated/l10n.dart";
import "package:photos/models/collection/collection.dart";
import 'package:photos/models/file/file.dart';
import 'package:photos/models/file/file_type.dart';
@@ -136,6 +134,17 @@ Future<ShareResult> shareText(
}
}
+/// Shares URL first with description below
+Future<ShareResult> shareLinkWithDescription(
+ String url, {
+ String? description,
+ BuildContext? context,
+ GlobalKey? key,
+}) async {
+ final text = description != null ? '$url\n$description' : url;
+ return shareText(text, context: context, key: key);
+}
+
Future<List<EnteFile>> convertIncomingSharedMediaToFile(
List<SharedMediaFile> sharedMedia,
int collectionID,
@@ -252,40 +261,21 @@ void shareSelected(
);
}
-Future<void> shareAlbumLinkWithPlaceholder(
+Future<void> shareAlbumLink(
BuildContext context,
Collection collection,
String url,
GlobalKey key,
) async {
- final List<EnteFile> filesInCollection =
- (await FilesDB.instance.getFilesInCollection(
- collection.id,
- galleryLoadStartTime,
- galleryLoadEndTime,
- ))
- .files;
+ final description =
+ 'Check out, comment and react on photos from ${collection.displayName} privately with Ente\'s end to end encryption';
- final dialog = createProgressDialog(
- context,
- AppLocalizations.of(context).creatingLink,
- isDismissible: true,
+ await shareLinkWithDescription(
+ url,
+ description: description,
+ context: context,
+ key: key,
);
- await dialog.show();
-
- if (filesInCollection.isEmpty) {
- await dialog.hide();
- await shareText(url);
- return;
- } else {
- await dialog.hide();
-
- await shareText(
- url,
- context: context,
- key: key,
- );
- }
}
/// required for ipad https://github.com/flutter/flutter/issues/47220#issuecomment-608453383