Skip to content

armgit / ente

Public Imported from GitHub
0

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

Move down rituals banner

laurenspriem5613d9f59f7e
diff --git a/mobile/apps/photos/lib/models/search/search_types.dart b/mobile/apps/photos/lib/models/search/search_types.dart
index 8cb830a6e3..d78d2f440b 100644
--- a/mobile/apps/photos/lib/models/search/search_types.dart
+++ b/mobile/apps/photos/lib/models/search/search_types.dart
@@ -43,6 +43,7 @@ enum ResultType {
enum SectionType {
face,
magic,
+ ritual,
wrapped,
location,
album,
@@ -63,6 +64,8 @@ extension SectionTypeExtensions on SectionType {
return "Ente Rewind";
case SectionType.location:
return AppLocalizations.of(context).locations;
+ case SectionType.ritual:
+ return "Rituals";
case SectionType.contacts:
return AppLocalizations.of(context).contacts;
case SectionType.album:
@@ -82,6 +85,8 @@ extension SectionTypeExtensions on SectionType {
return "Check back soon for your 2025 highlights.";
case SectionType.location:
return AppLocalizations.of(context).searchLocationEmptySection;
+ case SectionType.ritual:
+ return "Build a ritual to keep your photo habit going.";
case SectionType.contacts:
return AppLocalizations.of(context).searchPeopleEmptySection;
case SectionType.album:
@@ -98,6 +103,7 @@ extension SectionTypeExtensions on SectionType {
case SectionType.face:
case SectionType.magic:
case SectionType.wrapped:
+ case SectionType.ritual:
case SectionType.fileTypesAndExtension:
return false;
case SectionType.location:
@@ -111,6 +117,7 @@ extension SectionTypeExtensions on SectionType {
this != SectionType.face &&
this != SectionType.magic &&
this != SectionType.wrapped &&
+ this != SectionType.ritual &&
this != SectionType.contacts;
bool get isEmptyCTAVisible {
@@ -118,6 +125,7 @@ extension SectionTypeExtensions on SectionType {
case SectionType.face:
case SectionType.magic:
case SectionType.wrapped:
+ case SectionType.ritual:
case SectionType.fileTypesAndExtension:
return false;
case SectionType.location:
@@ -139,6 +147,8 @@ extension SectionTypeExtensions on SectionType {
return "";
case SectionType.location:
return AppLocalizations.of(context).addNew;
+ case SectionType.ritual:
+ return "";
case SectionType.contacts:
return AppLocalizations.of(context).invite;
case SectionType.album:
@@ -158,6 +168,8 @@ extension SectionTypeExtensions on SectionType {
return null;
case SectionType.location:
return Icons.add_location_alt_outlined;
+ case SectionType.ritual:
+ return null;
case SectionType.contacts:
return Icons.adaptive.share;
case SectionType.album:
@@ -182,6 +194,8 @@ extension SectionTypeExtensions on SectionType {
showAddLocationSheet(context, centerPoint);
}
};
+ case SectionType.ritual:
+ return () async {};
case SectionType.album:
return () async {
final result = await showTextInputDialog(
@@ -247,6 +261,8 @@ extension SectionTypeExtensions on SectionType {
return Future.value(const <SearchResult>[]);
case SectionType.location:
return SearchService.instance.getAllLocationTags(limit);
+ case SectionType.ritual:
+ return Future.value(const <SearchResult>[]);
case SectionType.contacts:
return SearchService.instance.getAllContactsSearchResults(limit);
@@ -266,6 +282,8 @@ extension SectionTypeExtensions on SectionType {
return [Bus.instance.on<LocationTagUpdatedEvent>()];
case SectionType.wrapped:
return [];
+ case SectionType.ritual:
+ return [];
case SectionType.album:
return [Bus.instance.on<CollectionUpdatedEvent>()];
case SectionType.face:
@@ -285,6 +303,8 @@ extension SectionTypeExtensions on SectionType {
return [Bus.instance.on<MagicCacheUpdatedEvent>()];
case SectionType.wrapped:
return [];
+ case SectionType.ritual:
+ return [];
case SectionType.contacts:
return [Bus.instance.on<PeopleChangedEvent>()];
default:
diff --git a/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab.dart b/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab.dart
index c739f60a81..27eb6abac9 100644
--- a/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab.dart
@@ -12,6 +12,7 @@ import "package:photos/models/search/search_types.dart";
import "package:photos/service_locator.dart";
import "package:photos/services/wrapped/wrapped_service.dart";
import "package:photos/states/all_sections_examples_state.dart";
+import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/activity/activity_banner.dart";
import "package:photos/ui/common/loading_widget.dart";
import "package:photos/ui/viewer/search/result/no_result_widget.dart";
@@ -115,26 +116,25 @@ class _AllSearchSectionsState extends State<AllSearchSections> {
return ListView.builder(
padding: const EdgeInsets.only(bottom: 180),
physics: const BouncingScrollPhysics(),
- itemCount: searchTypes.length + 1,
+ itemCount: searchTypes.length,
itemBuilder: (context, index) {
- if (index == 0) {
- return const ActivityBanner();
- }
- final sectionIndex = index - 1;
- switch (searchTypes[sectionIndex]) {
+ final sectionType = searchTypes[index];
+ switch (sectionType) {
case SectionType.face:
if (!flagService.hasGrantedMLConsent) {
return const SizedBox.shrink();
}
return PeopleSection(
- examples: snapshot.data!.elementAt(sectionIndex)
+ examples: snapshot.data!.elementAt(index)
as List<GenericSearchResult>,
);
case SectionType.album:
return AlbumsSection(
- snapshot.data!.elementAt(sectionIndex)
+ snapshot.data!.elementAt(index)
as List<AlbumSearchResult>,
);
+ case SectionType.ritual:
+ return const _RitualsDiscoverySection();
case SectionType.wrapped:
return ValueListenableBuilder<WrappedEntryState>(
valueListenable: wrappedService.stateListenable,
@@ -151,19 +151,19 @@ class _AllSearchSectionsState extends State<AllSearchSections> {
);
case SectionType.location:
return LocationsSection(
- snapshot.data!.elementAt(sectionIndex)
+ snapshot.data!.elementAt(index)
as List<GenericSearchResult>,
);
case SectionType.contacts:
return const SizedBox.shrink();
case SectionType.fileTypesAndExtension:
return FileTypeSection(
- snapshot.data!.elementAt(sectionIndex)
+ snapshot.data!.elementAt(index)
as List<GenericSearchResult>,
);
case SectionType.magic:
return MagicSection(
- snapshot.data!.elementAt(sectionIndex)
+ snapshot.data!.elementAt(index)
as List<GenericSearchResult>,
);
}
@@ -225,3 +225,29 @@ class _AllSearchSectionsState extends State<AllSearchSections> {
);
}
}
+
+class _RitualsDiscoverySection extends StatelessWidget {
+ const _RitualsDiscoverySection();
+
+ @override
+ Widget build(BuildContext context) {
+ if (!flagService.ritualsFlag) {
+ return const SizedBox.shrink();
+ }
+ final textTheme = getEnteTextTheme(context);
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Padding(
+ padding: const EdgeInsets.fromLTRB(12, 8, 12, 0),
+ child: Text(
+ "Rituals",
+ style: textTheme.largeBold,
+ ),
+ ),
+ const SizedBox(height: 4),
+ const ActivityBanner(),
+ ],
+ );
+ }
+}