mirror of
https://github.com/immich-app/immich.git
synced 2024-11-24 08:52:28 +02:00
fix(mobile): Prefer sharing local assets to remote (#7245)
Prefer sharing local assets to remote
This commit is contained in:
parent
b896d45ee7
commit
e338e4def6
@ -27,7 +27,12 @@ class ShareService {
|
|||||||
final downloadedXFiles = <XFile>[];
|
final downloadedXFiles = <XFile>[];
|
||||||
|
|
||||||
for (var asset in assets) {
|
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 tempDir = await getTemporaryDirectory();
|
||||||
final fileName = asset.fileName;
|
final fileName = asset.fileName;
|
||||||
final tempFile = await File('${tempDir.path}/$fileName').create();
|
final tempFile = await File('${tempDir.path}/$fileName').create();
|
||||||
@ -43,9 +48,6 @@ class ShareService {
|
|||||||
|
|
||||||
tempFile.writeAsBytesSync(res.bodyBytes);
|
tempFile.writeAsBytesSync(res.bodyBytes);
|
||||||
downloadedXFiles.add(XFile(tempFile.path));
|
downloadedXFiles.add(XFile(tempFile.path));
|
||||||
} else {
|
|
||||||
File? f = await asset.local!.file;
|
|
||||||
downloadedXFiles.add(XFile(f!.path));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user