albums: categorize samsung video captures folder

This commit is contained in:
Thibault Deckers 2021-11-11 18:06:06 +09:00
parent 8a9a4639ea
commit 3ef96826c8
2 changed files with 11 additions and 5 deletions

View file

@ -8,7 +8,8 @@ import 'package:flutter/widgets.dart';
final AndroidFileUtils androidFileUtils = AndroidFileUtils._private(); final AndroidFileUtils androidFileUtils = AndroidFileUtils._private();
class AndroidFileUtils { class AndroidFileUtils {
late final String separator, primaryStorage, dcimPath, downloadPath, moviesPath, picturesPath, videoCapturesPath; late final String separator, primaryStorage, dcimPath, downloadPath, moviesPath, picturesPath, avesVideoCapturesPath;
late final Set<String> videoCapturesPaths;
Set<StorageVolume> storageVolumes = {}; Set<StorageVolume> storageVolumes = {};
Set<Package> _packages = {}; Set<Package> _packages = {};
List<String> _potentialAppDirs = []; List<String> _potentialAppDirs = [];
@ -31,8 +32,13 @@ class AndroidFileUtils {
downloadPath = pContext.join(primaryStorage, 'Download'); downloadPath = pContext.join(primaryStorage, 'Download');
moviesPath = pContext.join(primaryStorage, 'Movies'); moviesPath = pContext.join(primaryStorage, 'Movies');
picturesPath = pContext.join(primaryStorage, 'Pictures'); picturesPath = pContext.join(primaryStorage, 'Pictures');
// from Aves avesVideoCapturesPath = pContext.join(dcimPath, 'Videocaptures');
videoCapturesPath = pContext.join(dcimPath, 'Video Captures'); videoCapturesPaths = {
// from Samsung
pContext.join(dcimPath, 'Video Captures'),
// from Aves
avesVideoCapturesPath,
};
_initialized = true; _initialized = true;
} }
@ -58,7 +64,7 @@ class AndroidFileUtils {
bool isScreenRecordingsPath(String path) => (path.startsWith(dcimPath) || path.startsWith(moviesPath)) && (path.endsWith('${separator}Screen recordings') || path.endsWith('${separator}ScreenRecords')); bool isScreenRecordingsPath(String path) => (path.startsWith(dcimPath) || path.startsWith(moviesPath)) && (path.endsWith('${separator}Screen recordings') || path.endsWith('${separator}ScreenRecords'));
bool isVideoCapturesPath(String path) => path == videoCapturesPath; bool isVideoCapturesPath(String path) => videoCapturesPaths.contains(path);
bool isDownloadPath(String path) => path == downloadPath; bool isDownloadPath(String path) => path == downloadPath;

View file

@ -72,7 +72,7 @@ class VideoActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix
final positionMillis = controller.currentPosition; final positionMillis = controller.currentPosition;
final bytes = await controller.captureFrame(); final bytes = await controller.captureFrame();
final destinationAlbum = androidFileUtils.videoCapturesPath; final destinationAlbum = androidFileUtils.avesVideoCapturesPath;
if (!await checkStoragePermissionForAlbums(context, {destinationAlbum})) return; if (!await checkStoragePermissionForAlbums(context, {destinationAlbum})) return;
if (!await checkFreeSpace(context, bytes.length, destinationAlbum)) return; if (!await checkFreeSpace(context, bytes.length, destinationAlbum)) return;