1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-25 10:43:13 +02:00

fix(mobile): Prefer sharing local assets to remote (#7245)

Prefer sharing local assets to remote
This commit is contained in:
martyfuhry 2024-02-20 11:03:24 -05:00 committed by GitHub
parent b896d45ee7
commit e338e4def6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,7 +27,12 @@ class ShareService {
final downloadedXFiles = <XFile>[];
for (var asset in assets) {
if (asset.isRemote) {
if (asset.isLocal) {
// Prefer local assets to share
File? f = await asset.local!.file;
downloadedXFiles.add(XFile(f!.path));
} else if (asset.isRemote) {
// Download remote asset otherwise
final tempDir = await getTemporaryDirectory();
final fileName = asset.fileName;
final tempFile = await File('${tempDir.path}/$fileName').create();
@ -43,9 +48,6 @@ class ShareService {
tempFile.writeAsBytesSync(res.bodyBytes);
downloadedXFiles.add(XFile(tempFile.path));
} else {
File? f = await asset.local!.file;
downloadedXFiles.add(XFile(f!.path));
}
}