mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-30 16:29:30 +01:00
refactor: Migrate to share_plus
This commit is contained in:
parent
06a18b2e4e
commit
822b45d885
@ -7,7 +7,7 @@ import 'package:future_loading_dialog/future_loading_dialog.dart';
|
|||||||
import 'package:matrix/encryption.dart';
|
import 'package:matrix/encryption.dart';
|
||||||
import 'package:matrix/encryption/utils/bootstrap.dart';
|
import 'package:matrix/encryption/utils/bootstrap.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
import 'package:share/share.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/config/themes.dart';
|
import 'package:fluffychat/config/themes.dart';
|
||||||
import 'package:fluffychat/utils/platform_infos.dart';
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:share/share.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/utils/platform_infos.dart';
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
|
|
||||||
|
@ -3,10 +3,9 @@ import 'dart:io';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:file_picker_cross/file_picker_cross.dart';
|
import 'package:file_picker_cross/file_picker_cross.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:share/share.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/utils/platform_infos.dart';
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
|
|
||||||
@ -23,17 +22,10 @@ extension MatrixFileExtension on MatrixFile {
|
|||||||
|
|
||||||
void share(BuildContext context) async {
|
void share(BuildContext context) async {
|
||||||
final fileName = name.split('/').last;
|
final fileName = name.split('/').last;
|
||||||
final tmpDirectory = PlatformInfos.isAndroid
|
final tmpDirectory = await getTemporaryDirectory();
|
||||||
? (await getExternalStorageDirectories(
|
|
||||||
type: StorageDirectory.downloads))!
|
|
||||||
.first
|
|
||||||
: await getTemporaryDirectory();
|
|
||||||
final path = '${tmpDirectory.path}$fileName';
|
final path = '${tmpDirectory.path}$fileName';
|
||||||
await File(path).writeAsBytes(bytes);
|
await File(path).writeAsBytes(bytes);
|
||||||
await Share.shareFiles([path]);
|
await Share.shareFiles([path]);
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(content: Text(L10n.of(context)!.savedFileAs(path))),
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1449,15 +1449,8 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.4.0"
|
version: "6.4.0"
|
||||||
share:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: share
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "2.0.4"
|
|
||||||
share_plus:
|
share_plus:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: share_plus
|
name: share_plus
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
|
@ -75,7 +75,7 @@ dependencies:
|
|||||||
salomon_bottom_bar: ^3.2.0
|
salomon_bottom_bar: ^3.2.0
|
||||||
scroll_to_index: ^2.1.1
|
scroll_to_index: ^2.1.1
|
||||||
sentry: ^6.3.0
|
sentry: ^6.3.0
|
||||||
share: ^2.0.4
|
share_plus: ^4.0.4
|
||||||
shared_preferences: ^2.0.13
|
shared_preferences: ^2.0.13
|
||||||
slugify: ^2.0.0
|
slugify: ^2.0.0
|
||||||
snapping_sheet: ^3.1.0
|
snapping_sheet: ^3.1.0
|
||||||
|
Loading…
Reference in New Issue
Block a user