Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Fix send link not working on iPad

ashilkn5723654ee013
diff --git a/mobile/lib/ui/viewer/actions/file_selection_actions_widget.dart b/mobile/lib/ui/viewer/actions/file_selection_actions_widget.dart
index ed50b9b674..d9555f8aad 100644
--- a/mobile/lib/ui/viewer/actions/file_selection_actions_widget.dart
+++ b/mobile/lib/ui/viewer/actions/file_selection_actions_widget.dart
@@ -84,6 +84,7 @@ class _FileSelectionActionsWidgetState
// few files. This link is reset on any selection changed;
Collection? _cachedCollectionForSharedLink;
final GlobalKey shareButtonKey = GlobalKey();
+ final GlobalKey sendLinkButtonKey = GlobalKey();
@override
void initState() {
@@ -172,6 +173,7 @@ class _FileSelectionActionsWidgetState
labelText: S.of(context).sendLink,
onTap: anyUploadedFiles ? _onSendLinkTapped : null,
shouldShow: ownedFilesCount > 0,
+ key: sendLinkButtonKey,
),
);
}
@@ -414,6 +416,7 @@ class _FileSelectionActionsWidgetState
SelectionActionButton(
labelText: S.of(context).share,
icon: Icons.adaptive.share_outlined,
+ key: shareButtonKey,
onTap: () => shareSelected(
context,
shareButtonKey,
@@ -774,7 +777,7 @@ class _FileSelectionActionsWidgetState
final String url =
"${_cachedCollectionForSharedLink!.publicURLs?.first?.url}#$collectionKey";
unawaited(Clipboard.setData(ClipboardData(text: url)));
- await shareImageAndUrl(placeholderPath!, url);
+ await shareImageAndUrl(placeholderPath!, url, context, sendLinkButtonKey);
if (placeholderPath != null) {
final file = File(placeholderPath!);
try {
diff --git a/mobile/lib/utils/share_util.dart b/mobile/lib/utils/share_util.dart
index 91dc292fad..1012747799 100644
--- a/mobile/lib/utils/share_util.dart
+++ b/mobile/lib/utils/share_util.dart
@@ -217,9 +217,12 @@ void shareSelected(
Future<void> shareImageAndUrl(
String imagePath,
String url,
+ BuildContext context,
+ GlobalKey key,
) async {
await Share.shareXFiles(
[XFile(imagePath)],
text: url,
+ sharePositionOrigin: shareButtonRect(context, key),
);
}