Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Resolve merge conflict and merge main

ashilknf0c7e184e5b4
diff --cc mobile/apps/photos/lib/ui/viewer/gallery/component/gallery_file_widget.dart
index e870601ffe,f2ac3188df..85c131e555
--- a/mobile/apps/photos/lib/ui/viewer/gallery/component/gallery_file_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/component/gallery_file_widget.dart
@@@ -4,17 -4,14 +4,18 @@@ import "package:media_extension/media_e
import "package:media_extension/media_extension_action_types.dart";
import "package:photos/core/constants.dart";
import 'package:photos/models/file/file.dart';
+ import "package:photos/models/gallery_type.dart";
import "package:photos/models/selected_files.dart";
+import "package:photos/service_locator.dart";
import "package:photos/services/app_lifecycle_service.dart";
import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/common/touch_cross_detector.dart";
import "package:photos/ui/viewer/file/detail_page.dart";
import "package:photos/ui/viewer/file/thumbnail_widget.dart";
+import "package:photos/ui/viewer/gallery/component/swipe_selectable_file_widget.dart";
import "package:photos/ui/viewer/gallery/state/gallery_context_state.dart";
import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";
+import "package:photos/ui/viewer/gallery/state/gallery_swipe_helper.dart";
import "package:photos/utils/file_util.dart";
import "package:photos/utils/navigation_util.dart";
diff --cc mobile/apps/photos/lib/ui/viewer/gallery/device_folder_page.dart
index e50c08b16a,79c98dddbb..d6416c6e40
--- a/mobile/apps/photos/lib/ui/viewer/gallery/device_folder_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/device_folder_page.dart
@@@ -57,32 -57,32 +58,34 @@@ class DeviceFolderPage extends Stateles
header: Configuration.instance.hasConfiguredAccount()
? BackupHeaderWidget(deviceCollection)
: const SizedBox.shrink(),
- initialFiles: [deviceCollection.thumbnail!],
+ initialFiles: deviceCollection.thumbnail != null
+ ? [deviceCollection.thumbnail!]
+ : const <EnteFile>[],
);
- return GalleryFilesState(
- child: Scaffold(
- appBar: PreferredSize(
- preferredSize: const Size.fromHeight(50.0),
- child: GalleryAppBarWidget(
- GalleryType.localFolder,
- deviceCollection.name,
- _selectedFiles,
- deviceCollection: deviceCollection,
+ return GalleryBoundariesProvider(
+ child: GalleryFilesState(
+ child: Scaffold(
+ appBar: PreferredSize(
+ preferredSize: const Size.fromHeight(50.0),
+ child: GalleryAppBarWidget(
+ GalleryType.localFolder,
+ deviceCollection.name,
+ _selectedFiles,
+ deviceCollection: deviceCollection,
+ ),
),
- ),
- body: SelectionState(
- selectedFiles: _selectedFiles,
- child: Stack(
- alignment: Alignment.bottomCenter,
- children: [
- gallery,
- FileSelectionOverlayBar(
- GalleryType.localFolder,
- _selectedFiles,
- ),
- ],
+ body: SelectionState(
+ selectedFiles: _selectedFiles,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: [
+ gallery,
+ FileSelectionOverlayBar(
+ GalleryType.localFolder,
+ _selectedFiles,
+ ),
+ ],
+ ),
),
),
),
diff --cc mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart
index ad08b9e57f,e48aad0a6e..0820cc84b7
--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart
@@@ -610,106 -556,90 +610,107 @@@ class GalleryState extends State<Galler
if (!_hasLoadedFiles) {
return widget.loadingWidget;
}
- return GalleryContextState(
- sortOrderAsc: _sortOrderAsc,
- inSelectionMode: widget.inSelectionMode,
- type: _groupType,
- galleryType: widget.galleryType,
- child: _allGalleryFiles.isEmpty
- ? Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- if (widget.addHeaderOrFooterEmptyState)
- widget.header ?? const SizedBox.shrink(),
- Expanded(child: widget.emptyState),
- if (widget.addHeaderOrFooterEmptyState)
- widget.footer ?? const SizedBox.shrink(),
- ],
- )
- : CustomScrollBar(
- scrollController: _scrollController,
- galleryGroups: galleryGroups,
- inUseNotifier: scrollBarInUseNotifier,
- heighOfViewport: MediaQuery.sizeOf(context).height,
- topPadding: widget.disableVerticalPaddingForScrollbar
- ? 0.0
- : groupHeaderExtent!,
- bottomPadding: widget.disableVerticalPaddingForScrollbar
- ? ValueNotifier(0.0)
- : scrollbarBottomPaddingNotifier,
- child: NotificationListener<SizeChangedLayoutNotification>(
- onNotification: (notification) {
- final renderBox = _headerKey.currentContext
- ?.findRenderObject() as RenderBox?;
- if (renderBox != null) {
- _headerHeightNotifier.value = renderBox.size.height;
- } else {
- _logger.info(
- "Header render box is null, cannot get height",
- );
- }
-
- return true;
- },
- child: Stack(
- clipBehavior: Clip.none,
- children: [
- CustomScrollView(
- physics: widget.disableScroll
- ? const NeverScrollableScrollPhysics()
- : const ExponentialBouncingScrollPhysics(),
- controller: _scrollController,
- slivers: [
- SliverToBoxAdapter(
- child: SizeChangedLayoutNotifier(
- child: SizedBox(
- key: _headerKey,
- child: widget.header ?? const SizedBox.shrink(),
- ),
- ),
- ),
- SectionedListSliver(
- sectionLayouts: galleryGroups.groupLayouts,
- ),
- SliverToBoxAdapter(
- child: widget.footer,
- ),
- ],
- ),
- galleryGroups.groupType.showGroupHeader() &&
- !widget.disablePinnedGroupHeader
- ? PinnedGroupHeader(
- scrollController: _scrollController,
- galleryGroups: galleryGroups,
- headerHeightNotifier: _headerHeightNotifier,
- selectedFiles: widget.selectedFiles,
- showSelectAll: widget.showSelectAll &&
- !widget.limitSelectionToOne,
- scrollbarInUseNotifier: scrollBarInUseNotifier,
- showGallerySettingsCTA:
- widget.showGallerySettingsCTA,
- )
- : const SizedBox.shrink(),
- ],
+
+ final shouldEnableSwipeSelection =
+ flagService.internalUser && widget.limitSelectionToOne == false;
+
+ return SwipeSelectionWrapper(
+ isEnabled: shouldEnableSwipeSelection,
+ swipeHelper: _swipeHelper,
+ selectedFiles: widget.selectedFiles,
+ swipeActiveNotifier: _swipeActiveNotifier,
+ scrollController: _scrollController,
+ child: GalleryContextState(
+ sortOrderAsc: _sortOrderAsc,
+ inSelectionMode: widget.inSelectionMode,
+ type: _groupType,
++ galleryType: widget.galleryType,
+ child: _allGalleryFiles.isEmpty
+ ? Column(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ if (widget.addHeaderOrFooterEmptyState)
+ widget.header ?? const SizedBox.shrink(),
+ Expanded(child: widget.emptyState),
+ if (widget.addHeaderOrFooterEmptyState)
+ widget.footer ?? const SizedBox.shrink(),
+ ],
+ )
+ : CustomScrollBar(
+ scrollController: _scrollController,
+ galleryGroups: galleryGroups,
+ inUseNotifier: scrollBarInUseNotifier,
+ heighOfViewport: MediaQuery.sizeOf(context).height,
+ topPadding: widget.disableVerticalPaddingForScrollbar
+ ? 0.0
+ : groupHeaderExtent!,
+ bottomPadding: widget.disableVerticalPaddingForScrollbar
+ ? ValueNotifier(0.0)
+ : scrollbarBottomPaddingNotifier,
+ child: NotificationListener<SizeChangedLayoutNotification>(
+ onNotification: (notification) {
+ final renderBox = _headerKey.currentContext
+ ?.findRenderObject() as RenderBox?;
+ if (renderBox != null) {
+ _headerHeightNotifier.value = renderBox.size.height;
+ } else {
+ _logger.info(
+ "Header render box is null, cannot get height",
+ );
+ }
+
+ return true;
+ },
+ child: Stack(
+ clipBehavior: Clip.none,
+ children: [
+ ValueListenableBuilder<bool>(
+ valueListenable: _swipeActiveNotifier,
+ builder: (context, isSwipeActive, child) {
+ return CustomScrollView(
+ physics: widget.disableScroll || isSwipeActive
+ ? const NeverScrollableScrollPhysics()
+ : const ExponentialBouncingScrollPhysics(),
+ controller: _scrollController,
+ slivers: [
+ SliverToBoxAdapter(
+ child: SizeChangedLayoutNotifier(
+ child: SizedBox(
+ key: _headerKey,
+ child: widget.header ??
+ const SizedBox.shrink(),
+ ),
+ ),
+ ),
+ SectionedListSliver(
+ sectionLayouts: galleryGroups.groupLayouts,
+ ),
+ SliverToBoxAdapter(
+ child: widget.footer,
+ ),
+ ],
+ );
+ },
+ ),
+ galleryGroups.groupType.showGroupHeader() &&
+ !widget.disablePinnedGroupHeader
+ ? PinnedGroupHeader(
+ scrollController: _scrollController,
+ galleryGroups: galleryGroups,
+ headerHeightNotifier: _headerHeightNotifier,
+ selectedFiles: widget.selectedFiles,
+ showSelectAll: widget.showSelectAll &&
+ !widget.limitSelectionToOne,
+ scrollbarInUseNotifier: scrollBarInUseNotifier,
+ showGallerySettingsCTA:
+ widget.showGallerySettingsCTA,
+ )
+ : const SizedBox.shrink(),
+ ],
+ ),
),
),
- ),
+ ),
);
}
}
diff --cc mobile/apps/photos/lib/ui/viewer/search/result/magic_result_screen.dart
index fae5ed5032,b5b6042cce..c715e2b1d3
--- a/mobile/apps/photos/lib/ui/viewer/search/result/magic_result_screen.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/magic_result_screen.dart
@@@ -167,62 -165,52 +167,62 @@@ class _MagicResultScreenState extends S
tagPrefix: widget.heroTag,
selectedFiles: _selectedFiles,
enableFileGrouping: _enableGrouping,
- initialFiles: [files.first],
+ initialFiles: files.isNotEmpty ? [files.first] : const [],
);
- return GalleryFilesState(
- child: InheritedSearchFilterDataWrapper(
- searchFilterDataProvider: _searchFilterDataProvider,
- child: Scaffold(
- appBar: PreferredSize(
- preferredSize: const Size.fromHeight(90.0),
- child: GalleryAppBarWidget(
- MagicResultScreen.appBarType,
- widget.name,
- _selectedFiles,
+ return GalleryBoundariesProvider(
+ child: GalleryFilesState(
+ child: InheritedSearchFilterDataWrapper(
+ searchFilterDataProvider: _searchFilterDataProvider,
+ child: Scaffold(
+ appBar: PreferredSize(
+ preferredSize: const Size.fromHeight(90.0),
+ child: _enableGrouping
+ ? GalleryAppBarWidget(
+ MagicResultScreen.appBarType,
+ widget.name,
+ _selectedFiles,
+ )
+ : _AppBarWithBoundary(
+ child: GalleryAppBarWidget(
+ MagicResultScreen.appBarType,
+ widget.name,
+ _selectedFiles,
+ ),
+ ),
),
- ),
- body: SelectionState(
- selectedFiles: _selectedFiles,
- child: Stack(
- alignment: Alignment.bottomCenter,
- children: [
- Builder(
- builder: (context) {
- return ValueListenableBuilder(
- valueListenable: InheritedSearchFilterData.of(context)
- .searchFilterDataProvider!
- .isSearchingNotifier,
- builder: (context, value, _) {
- return value
- ? HierarchicalSearchGallery(
- tagPrefix: widget.heroTag,
- selectedFiles: _selectedFiles,
- )
- : AnimatedSwitcher(
- duration: const Duration(milliseconds: 250),
- switchInCurve: Curves.easeInOutQuad,
- switchOutCurve: Curves.easeInOutQuad,
- child: gallery,
- );
- },
- );
- },
- ),
- FileSelectionOverlayBar(
- MagicResultScreen.overlayType,
- _selectedFiles,
- ),
- ],
+ body: SelectionState(
+ selectedFiles: _selectedFiles,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: [
+ Builder(
+ builder: (context) {
+ return ValueListenableBuilder(
+ valueListenable: InheritedSearchFilterData.of(context)
+ .searchFilterDataProvider!
+ .isSearchingNotifier,
+ builder: (context, value, _) {
+ return value
+ ? HierarchicalSearchGallery(
+ tagPrefix: widget.heroTag,
+ selectedFiles: _selectedFiles,
+ )
+ : AnimatedSwitcher(
+ duration: const Duration(milliseconds: 250),
+ switchInCurve: Curves.easeInOutQuad,
+ switchOutCurve: Curves.easeInOutQuad,
+ child: gallery,
+ );
+ },
+ );
+ },
+ ),
+ FileSelectionOverlayBar(
+ MagicResultScreen.overlayType,
+ _selectedFiles,
+ ),
+ ],
+ ),
),
),
),