You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-08-08 23:07:06 +02:00
fix(mobile): download asset to Camera folder on Android (#12355)
* fix(mobile): download asset to Camera folder on Android * remove unused import * better message * linting
This commit is contained in:
@ -19,7 +19,7 @@ class ImageViewerService {
|
||||
|
||||
ImageViewerService(this._apiService);
|
||||
|
||||
Future<bool> downloadAssetToDevice(Asset asset) async {
|
||||
Future<bool> downloadAsset(Asset asset) async {
|
||||
File? imageFile;
|
||||
File? videoFile;
|
||||
try {
|
||||
@ -82,18 +82,23 @@ class ImageViewerService {
|
||||
}
|
||||
|
||||
final AssetEntity? entity;
|
||||
final relativePath = Platform.isAndroid ? 'DCIM/Immich' : null;
|
||||
|
||||
if (asset.isImage) {
|
||||
entity = await PhotoManager.editor.saveImage(
|
||||
res.bodyBytes,
|
||||
title: asset.fileName,
|
||||
relativePath: relativePath,
|
||||
);
|
||||
} else {
|
||||
final tempDir = await getTemporaryDirectory();
|
||||
videoFile = await File('${tempDir.path}/${asset.fileName}').create();
|
||||
videoFile.writeAsBytesSync(res.bodyBytes);
|
||||
entity = await PhotoManager.editor
|
||||
.saveVideo(videoFile, title: asset.fileName);
|
||||
entity = await PhotoManager.editor.saveVideo(
|
||||
videoFile,
|
||||
title: asset.fileName,
|
||||
relativePath: relativePath,
|
||||
);
|
||||
}
|
||||
return entity != null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user