view: fixed source setup when trashing items

This commit is contained in:
Thibault Deckers 2022-02-24 19:25:21 +09:00
parent 2fd9ccb6d3
commit 3be7d90233
4 changed files with 7 additions and 11 deletions

View file

@ -152,7 +152,7 @@ dependencies {
implementation 'com.github.deckerst:Android-TiffBitmapFactory:876e53870a' implementation 'com.github.deckerst:Android-TiffBitmapFactory:876e53870a'
// forked, built by JitPack, cf https://jitpack.io/p/deckerst/pixymeta-android // forked, built by JitPack, cf https://jitpack.io/p/deckerst/pixymeta-android
implementation 'com.github.deckerst:pixymeta-android:706bd73d6e' implementation 'com.github.deckerst:pixymeta-android:706bd73d6e'
implementation 'com.github.bumptech.glide:glide:4.13.0' implementation 'com.github.bumptech.glide:glide:4.13.1'
kapt 'androidx.annotation:annotation:1.3.0' kapt 'androidx.annotation:annotation:1.3.0'
kapt 'com.github.bumptech.glide:compiler:4.13.0' kapt 'com.github.bumptech.glide:compiler:4.13.0'

View file

@ -50,12 +50,6 @@ mixin EntryStorageMixin on FeedbackMixin, PermissionAwareMixin, SizeAwareMixin {
))) return; ))) return;
} }
final source = context.read<CollectionSource>();
if (source.initState != SourceInitializationState.full) {
// source may be uninitialized in viewer mode
await source.init();
}
final entriesByDestination = <String, Set<AvesEntry>>{}; final entriesByDestination = <String, Set<AvesEntry>>{};
switch (moveType) { switch (moveType) {
case MoveType.copy: case MoveType.copy:
@ -116,6 +110,7 @@ mixin EntryStorageMixin on FeedbackMixin, PermissionAwareMixin, SizeAwareMixin {
} }
} }
final source = context.read<CollectionSource>();
source.pauseMonitoring(); source.pauseMonitoring();
final opId = mediaFileService.newOpId; final opId = mediaFileService.newOpId;
await showOpReport<MoveOpEvent>( await showOpReport<MoveOpEvent>(

View file

@ -31,6 +31,10 @@ Future<String?> pickAlbum({
required MoveType? moveType, required MoveType? moveType,
}) async { }) async {
final source = context.read<CollectionSource>(); final source = context.read<CollectionSource>();
if (source.initState != SourceInitializationState.full) {
// source may not be fully initialized in view mode
await source.init();
}
final filter = await Navigator.push( final filter = await Navigator.push(
context, context,
MaterialPageRoute<AlbumFilter>( MaterialPageRoute<AlbumFilter>(

View file

@ -202,10 +202,6 @@ class EntryActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix
); );
if (options == null) return; if (options == null) return;
final source = context.read<CollectionSource>();
if (source.initState != SourceInitializationState.full) {
await source.init();
}
final destinationAlbum = await pickAlbum(context: context, moveType: MoveType.export); final destinationAlbum = await pickAlbum(context: context, moveType: MoveType.export);
if (destinationAlbum == null) return; if (destinationAlbum == null) return;
if (!await checkStoragePermissionForAlbums(context, {destinationAlbum})) return; if (!await checkStoragePermissionForAlbums(context, {destinationAlbum})) return;
@ -228,6 +224,7 @@ class EntryActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix
} }
final selectionCount = selection.length; final selectionCount = selection.length;
final source = context.read<CollectionSource>();
source.pauseMonitoring(); source.pauseMonitoring();
await showOpReport<ExportOpEvent>( await showOpReport<ExportOpEvent>(
context: context, context: context,