mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-30 16:29:30 +01:00
fix: Sharing on iOS and iPad
This commit is contained in:
parent
a38da5cf69
commit
a3d41da047
@ -121,7 +121,12 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
|
||||
icon: const Icon(Icons.save_alt_outlined),
|
||||
label: Text(L10n.of(context)!.saveTheSecurityKeyNow),
|
||||
onPressed: () {
|
||||
Share.share(key!);
|
||||
final box = context.findRenderObject() as RenderBox;
|
||||
Share.share(
|
||||
key!,
|
||||
sharePositionOrigin:
|
||||
box.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
setState(() => _recoveryKeyCopied = true);
|
||||
},
|
||||
),
|
||||
|
@ -9,7 +9,11 @@ import 'package:fluffychat/utils/platform_infos.dart';
|
||||
abstract class FluffyShare {
|
||||
static Future<void> share(String text, BuildContext context) async {
|
||||
if (PlatformInfos.isMobile) {
|
||||
return Share.share(text);
|
||||
final box = context.findRenderObject() as RenderBox;
|
||||
return Share.share(
|
||||
text,
|
||||
sharePositionOrigin: box.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
}
|
||||
await Clipboard.setData(
|
||||
ClipboardData(text: text),
|
||||
|
@ -25,7 +25,11 @@ extension MatrixFileExtension on MatrixFile {
|
||||
final tmpDirectory = await getTemporaryDirectory();
|
||||
final path = '${tmpDirectory.path}$fileName';
|
||||
await File(path).writeAsBytes(bytes);
|
||||
await Share.shareFiles([path]);
|
||||
final box = context.findRenderObject() as RenderBox;
|
||||
await Share.shareFiles(
|
||||
[path],
|
||||
sharePositionOrigin: box.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1464,7 +1464,7 @@ packages:
|
||||
name: share_plus
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.6"
|
||||
version: "4.0.8"
|
||||
share_plus_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -75,7 +75,7 @@ dependencies:
|
||||
salomon_bottom_bar: ^3.2.0
|
||||
scroll_to_index: ^2.1.1
|
||||
sentry: ^6.3.0
|
||||
share_plus: ^4.0.6
|
||||
share_plus: ^4.0.8
|
||||
shared_preferences: ^2.0.13
|
||||
slugify: ^2.0.0
|
||||
snapping_sheet: ^3.1.0
|
||||
|
Loading…
Reference in New Issue
Block a user