High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix: handle back gesture in multi selection mode (#20356)
shenlong34974b036c5b
diff --git a/mobile/lib/infrastructure/repositories/db.repository.dart b/mobile/lib/infrastructure/repositories/db.repository.dartindex 7f6374ed24..6e574afa8c 100644--- a/mobile/lib/infrastructure/repositories/db.repository.dart+++ b/mobile/lib/infrastructure/repositories/db.repository.dart@@ -109,6 +109,7 @@ class Drift extends $Drift implements IDatabaseRepository {await customStatement('PRAGMA foreign_keys = ON');await customStatement('PRAGMA synchronous = NORMAL');await customStatement('PRAGMA journal_mode = WAL');+ await customStatement('PRAGMA busy_timeout = 500');},);}diff --git a/mobile/lib/presentation/widgets/timeline/timeline.widget.dart b/mobile/lib/presentation/widgets/timeline/timeline.widget.dartindex 26799580a2..d946872781 100644--- a/mobile/lib/presentation/widgets/timeline/timeline.widget.dart+++ b/mobile/lib/presentation/widgets/timeline/timeline.widget.dart@@ -155,79 +155,69 @@ class _SliverTimelineState extends ConsumerState<_SliverTimeline> {final asyncSegments = ref.watch(timelineSegmentProvider);final maxHeight = ref.watch(timelineArgsProvider.select((args) => args.maxHeight));final isSelectionMode = ref.watch(multiSelectProvider.select((s) => s.forceEnable));+ final isMultiSelectEnabled = ref.watch(multiSelectProvider.select((s) => s.isEnabled));- return asyncSegments.widgetWhen(- onData: (segments) {- final childCount = (segments.lastOrNull?.lastIndex ?? -1) + 1;- final double appBarExpandedHeight = widget.appBar != null && widget.appBar is MesmerizingSliverAppBar ? 200 : 0;- final topPadding = context.padding.top + (widget.appBar == null ? 0 : kToolbarHeight) + 10;-- const scrubberBottomPadding = 100.0;- final bottomPadding = context.padding.bottom + (widget.appBar == null ? 0 : scrubberBottomPadding);-- return PrimaryScrollController(- controller: _scrollController,- child: Stack(- children: [- Scrubber(- layoutSegments: segments,- timelineHeight: maxHeight,- topPadding: topPadding,- bottomPadding: bottomPadding,- monthSegmentSnappingOffset: widget.topSliverWidgetHeight ?? 0 + appBarExpandedHeight,- child: CustomScrollView(- primary: true,- cacheExtent: maxHeight * 2,- slivers: [- if (isSelectionMode) const SelectionSliverAppBar() else if (widget.appBar != null) widget.appBar!,- if (widget.topSliverWidget != null) widget.topSliverWidget!,- _SliverSegmentedList(- segments: segments,- delegate: SliverChildBuilderDelegate(- (ctx, index) {- if (index >= childCount) return null;- final segment = segments.findByIndex(index);- return segment?.builder(ctx, index) ?? const SizedBox.shrink();- },- childCount: childCount,- addAutomaticKeepAlives: false,- // We add repaint boundary around tiles, so skip the auto boundaries- addRepaintBoundaries: false,+ return PopScope(+ canPop: !isMultiSelectEnabled,+ onPopInvokedWithResult: (_, __) {+ if (isMultiSelectEnabled) {+ ref.read(multiSelectProvider.notifier).reset();+ }+ },+ child: asyncSegments.widgetWhen(+ onData: (segments) {+ final childCount = (segments.lastOrNull?.lastIndex ?? -1) + 1;+ final double appBarExpandedHeight = widget.appBar != null && widget.appBar is MesmerizingSliverAppBar+ ? 200+ : 0;+ final topPadding = context.padding.top + (widget.appBar == null ? 0 : kToolbarHeight) + 10;++ const scrubberBottomPadding = 100.0;+ final bottomPadding = context.padding.bottom + (widget.appBar == null ? 0 : scrubberBottomPadding);++ return PrimaryScrollController(+ controller: _scrollController,+ child: Stack(+ children: [+ Scrubber(+ layoutSegments: segments,+ timelineHeight: maxHeight,+ topPadding: topPadding,+ bottomPadding: bottomPadding,+ monthSegmentSnappingOffset: widget.topSliverWidgetHeight ?? 0 + appBarExpandedHeight,+ child: CustomScrollView(+ primary: true,+ cacheExtent: maxHeight * 2,+ slivers: [+ if (isSelectionMode) const SelectionSliverAppBar() else if (widget.appBar != null) widget.appBar!,+ if (widget.topSliverWidget != null) widget.topSliverWidget!,+ _SliverSegmentedList(+ segments: segments,+ delegate: SliverChildBuilderDelegate(+ (ctx, index) {+ if (index >= childCount) return null;+ final segment = segments.findByIndex(index);+ return segment?.builder(ctx, index) ?? const SizedBox.shrink();+ },+ childCount: childCount,+ addAutomaticKeepAlives: false,+ // We add repaint boundary around tiles, so skip the auto boundaries+ addRepaintBoundaries: false,+ ),),- ),- const SliverPadding(padding: EdgeInsets.only(bottom: scrubberBottomPadding)),- ],- ),- ),- if (!isSelectionMode) ...[- Consumer(- builder: (_, consumerRef, child) {- final isMultiSelectEnabled = consumerRef.watch(multiSelectProvider.select((s) => s.isEnabled));-- if (isMultiSelectEnabled) {- return child!;- }- return const SizedBox.shrink();- },- child: const Positioned(top: 60, left: 25, child: _MultiSelectStatusButton()),- ),- if (widget.bottomSheet != null)- Consumer(- builder: (_, consumerRef, child) {- final isMultiSelectEnabled = consumerRef.watch(multiSelectProvider.select((s) => s.isEnabled));-- if (isMultiSelectEnabled) {- return child!;- }- return const SizedBox.shrink();- },- child: widget.bottomSheet,+ const SliverPadding(padding: EdgeInsets.only(bottom: scrubberBottomPadding)),+ ],),+ ),+ if (!isSelectionMode && isMultiSelectEnabled) ...[+ const Positioned(top: 60, left: 25, child: _MultiSelectStatusButton()),+ if (widget.bottomSheet != null) widget.bottomSheet!,+ ],],- ],- ),- );- },+ ),+ );+ },+ ),);}}