mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
chore(mobile): Update share_file to latest version and migrate to using cross platform shareXFile (#1476)
* update share_plus and use sharexfile * rename variable
This commit is contained in:
parent
870a65fa6d
commit
f23979024a
3 changed files with 13 additions and 41 deletions
|
|
@ -22,7 +22,7 @@ class ShareService {
|
|||
}
|
||||
|
||||
Future<void> shareAssets(List<Asset> assets) async {
|
||||
final downloadedFilePaths = assets.map((asset) async {
|
||||
final downloadedXFiles = assets.map<Future<XFile>>((asset) async {
|
||||
if (asset.isRemote) {
|
||||
final tempDir = await getTemporaryDirectory();
|
||||
final fileName = basename(asset.remote!.originalPath);
|
||||
|
|
@ -33,16 +33,16 @@ class ShareService {
|
|||
isWeb: false,
|
||||
);
|
||||
tempFile.writeAsBytesSync(res.bodyBytes);
|
||||
return tempFile.path;
|
||||
return XFile(tempFile.path);
|
||||
} else {
|
||||
File? f = await asset.local!.file;
|
||||
return f!.path;
|
||||
return XFile(f!.path);
|
||||
}
|
||||
});
|
||||
|
||||
// ignore: deprecated_member_use
|
||||
Share.shareFiles(
|
||||
await Future.wait(downloadedFilePaths),
|
||||
Share.shareXFiles(
|
||||
await Future.wait(downloadedXFiles),
|
||||
sharePositionOrigin: Rect.zero,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue