π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
update empty states
AmanRajSinghMourya20368416f89b
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arbindex 3a9ecb57a0..817ed35755 100644--- a/mobile/apps/photos/lib/l10n/intl_en.arb+++ b/mobile/apps/photos/lib/l10n/intl_en.arb@@ -1048,6 +1048,18 @@"grantFullAccessPrompt": "Please allow access to all photos in the Settings app","allowPermTitle": "Allow access to photos","allowPermBody": "Please allow access to your photos from Settings so Ente can display and backup your library.",+ "allowAccessToYourPhotos": "Allow access to your photos",+ "enteNeedsPermissionToSeeDeviceAlbums": "Ente needs permission to see your device albums",+ "allYourDeviceAlbumsInOnePlace": "All your device albums, in one place",+ "youPickWhatGetsBackedUp": "You pick what gets backed up",+ "privateAndEndToEndEncryptedAlways": "Private and end-to-end encrypted, always",+ "grantAccess": "Grant access",+ "albumsSharedWithYouShowUpHere": "Albums shared with you show up here",+ "inviteFamilyToSharePhotosPrivately": "Invite your family to share photos privately",+ "shareStorageWithUpToFiveFamilyMembers": "Share storage with up to 5 family members",+ "privateSpaceForEveryMember": "Private space for every member",+ "reactAndChatOnSharedMemories": "React and chat on shared memories",+ "addFamily": "Add family","openSettings": "Open settings","selectMorePhotos": "Select more photos","existingUser": "Existing user",@@ -3084,6 +3096,13 @@"offlineEnableBackupDesc": "Sign up to preserve your memories with Ente.","offlineEnableBackupTagLabel": "10 GB FREE!","offlineEnableBackupAction": "Start with 10 GB FREE",+ "organizeYourMemories": "Organize your memories",+ "groupPhotosTheWayYouThinkAboutThem": "Group your photos the way you think about them",+ "endToEndEncryptedOnlyYourPeopleCanSeeIt": "End-to-end encrypted, so only your people can see it",+ "backedUpSafelyAcrossDevices": "Backed up safely across your devices",+ "smartAlbumsOrganizePhotosForYou": "Smart albums organize photos for you",+ "createAlbum": "Create album",+ "createASmartAlbum": "Create a smart album","offlineSettingsBannerTitle": "We can't see your photos. Ever.","offlineSettingsBannerDesc": "Zero-knowledge encryption means your memories stay yours.","alreadyHaveAnAccount": "Already have an account?",diff --git a/mobile/apps/photos/lib/ui/components/models/button_type_v2.dart b/mobile/apps/photos/lib/ui/components/models/button_type_v2.dartindex 5288ba119a..fbc03b2a84 100644--- a/mobile/apps/photos/lib/ui/components/models/button_type_v2.dart+++ b/mobile/apps/photos/lib/ui/components/models/button_type_v2.dart@@ -51,11 +51,11 @@ ButtonTheme _criticalPalette(EnteColorScheme c) => ButtonTheme();ButtonTheme _secondaryPalette(EnteColorScheme c) => ButtonTheme(- defaultBg: c.fillDark,+ defaultBg: c.greenLight,hoverBg: c.fillDarker,pressedBg: c.fillDarkest,disabledBg: c.fillDark,- foreground: c.content,+ foreground: c.greenBase,disabledForeground: c.contentLighter,iconColor: c.content,disabledIconColor: c.contentLighter,diff --git a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/albums_empty_state_feature_row.dart b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/albums_empty_state_feature_row.dartnew file mode 100644index 0000000000..c26b94cb63--- /dev/null+++ b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/albums_empty_state_feature_row.dart@@ -0,0 +1,40 @@+import "package:flutter/widgets.dart";+import "package:hugeicons/hugeicons.dart";+import "package:photos/theme/ente_theme.dart";++class AlbumsEmptyStateFeatureRow extends StatelessWidget {+ const AlbumsEmptyStateFeatureRow({+ required this.icon,+ required this.label,+ super.key,+ });++ final List<List<dynamic>> icon;+ final String label;++ @override+ Widget build(BuildContext context) {+ final textTheme = getEnteTextTheme(context);++ return Row(+ crossAxisAlignment: CrossAxisAlignment.center,+ children: [+ Padding(+ padding: const EdgeInsetsGeometry.all(6),+ child: HugeIcon(+ icon: icon,+ size: 20,+ color: const Color.fromRGBO(222, 222, 222, 1),+ ),+ ),+ const SizedBox(width: 8),+ Expanded(+ child: Text(+ label,+ style: textTheme.small,+ ),+ ),+ ],+ );+ }+}diff --git a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_device_select_folders_empty_state.dart b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_device_select_folders_empty_state.dartnew file mode 100644index 0000000000..e4bb68d4cf--- /dev/null+++ b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_device_select_folders_empty_state.dart@@ -0,0 +1,107 @@+import "package:flutter/material.dart";+import "package:hugeicons/hugeicons.dart";+import "package:photo_manager/photo_manager.dart";+import "package:photos/core/event_bus.dart";+import "package:photos/events/permission_granted_event.dart";+import "package:photos/generated/l10n.dart";+import "package:photos/service_locator.dart";+import "package:photos/theme/ente_theme.dart";+import "package:photos/ui/common/backup_flow_helper.dart";+import "package:photos/ui/components/buttons/button_widget_v2.dart";+import "package:photos/ui/tabs/albums/empty_states/albums_empty_state_feature_row.dart";++class OnDeviceSelectFoldersEmptyState extends StatelessWidget {+ const OnDeviceSelectFoldersEmptyState({super.key});++ static Future<bool> shouldShow() async {+ if (backupPreferenceService.hasSkippedOnboardingPermission) {+ return true;+ }++ final state = await permissionService.getPermissionState();+ final hasAccess =+ state == PermissionState.authorized || state == PermissionState.limited;+ if (hasAccess && !permissionService.hasGrantedPermissions()) {+ await permissionService.onUpdatePermission(state);+ Bus.instance.fire(PermissionGrantedEvent());+ }+ return !hasAccess;+ }++ @override+ Widget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);+ final strings = AppLocalizations.of(context);+ final bottomPadding = 64 + MediaQuery.paddingOf(context).bottom + 32;++ return Align(+ alignment: Alignment.bottomCenter,+ child: Padding(+ padding: EdgeInsets.fromLTRB(16, 32, 16, bottomPadding),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 320),+ child: Column(+ children: [+ Text(+ strings.allowAccessToYourPhotos,+ textAlign: TextAlign.center,+ style: textTheme.largeBold.copyWith(+ fontFamily: "Nunito",+ fontWeight: FontWeight.w800,+ fontSize: 18,+ height: 28 / 18,+ color: colorScheme.content,+ ),+ ),+ const SizedBox(height: 4),+ Text(+ strings.enteNeedsPermissionToSeeDeviceAlbums,+ textAlign: TextAlign.center,+ style: textTheme.miniMuted,+ ),+ ],+ ),+ ),+ const SizedBox(height: 32),+ ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 320),+ child: Column(+ children: [+ AlbumsEmptyStateFeatureRow(+ icon: HugeIcons.strokeRoundedFolder02,+ label: strings.allYourDeviceAlbumsInOnePlace,+ ),+ const SizedBox(height: 24),+ AlbumsEmptyStateFeatureRow(+ icon: HugeIcons.strokeRoundedCloudSavingDone01,+ label: strings.youPickWhatGetsBackedUp,+ ),+ const SizedBox(height: 24),+ AlbumsEmptyStateFeatureRow(+ icon: HugeIcons.strokeRoundedLockSync01,+ label: strings.privateAndEndToEndEncryptedAlways,+ ),+ ],+ ),+ ),+ const SizedBox(height: 32),+ ButtonWidgetV2(+ buttonType: ButtonTypeV2.primary,+ labelText: strings.selectFolders,+ onTap: () => _selectFolders(context),+ shouldSurfaceExecutionStates: false,+ ),+ ],+ ),+ ),+ );+ }++ Future<void> _selectFolders(BuildContext context) async {+ await handleFolderSelectionBackupFlow(context);+ }+}diff --git a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_ente_empty_state.dart b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_ente_empty_state.dartnew file mode 100644index 0000000000..c5606981a1--- /dev/null+++ b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_ente_empty_state.dart@@ -0,0 +1,145 @@+import "package:ente_pure_utils/ente_pure_utils.dart";+import "package:flutter/material.dart";+import "package:hugeicons/hugeicons.dart";+import "package:photos/generated/l10n.dart";+import "package:photos/models/collection/collection.dart";+import "package:photos/models/collection/collection_items.dart";+import "package:photos/services/collections_service.dart";+import "package:photos/theme/ente_theme.dart";+import "package:photos/ui/collections/album/smart_album_people.dart";+import "package:photos/ui/components/buttons/button_widget_v2.dart";+import "package:photos/ui/tabs/albums/empty_states/albums_empty_state_feature_row.dart";+import "package:photos/ui/viewer/gallery/collection_page.dart";+import "package:photos/utils/dialog_util.dart";++class OnEnteEmptyState extends StatelessWidget {+ const OnEnteEmptyState({super.key});++ @override+ Widget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);+ final strings = AppLocalizations.of(context);+ final bottomPadding = 64 + MediaQuery.paddingOf(context).bottom + 32;++ return Align(+ alignment: Alignment.bottomCenter,+ child: Padding(+ padding: EdgeInsets.fromLTRB(16, 32, 16, bottomPadding),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 320),+ child: Column(+ children: [+ Text(+ strings.organizeYourMemories,+ textAlign: TextAlign.center,+ style: textTheme.largeBold.copyWith(+ fontFamily: "Nunito",+ fontWeight: FontWeight.w800,+ fontSize: 18,+ height: 28 / 18,+ color: colorScheme.content,+ ),+ ),+ const SizedBox(height: 4),+ Text(+ strings.groupPhotosTheWayYouThinkAboutThem,+ textAlign: TextAlign.center,+ style: textTheme.miniMuted,+ ),+ ],+ ),+ ),+ const SizedBox(height: 32),+ ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 320),+ child: Column(+ children: [+ AlbumsEmptyStateFeatureRow(+ icon: HugeIcons.strokeRoundedLockSync01,+ label: strings.endToEndEncryptedOnlyYourPeopleCanSeeIt,+ ),+ const SizedBox(height: 24),+ AlbumsEmptyStateFeatureRow(+ icon: HugeIcons.strokeRoundedCloudSavingDone01,+ label: strings.backedUpSafelyAcrossDevices,+ ),+ const SizedBox(height: 24),+ AlbumsEmptyStateFeatureRow(+ icon: HugeIcons.strokeRoundedSparkles,+ label: strings.smartAlbumsOrganizePhotosForYou,+ ),+ ],+ ),+ ),+ const SizedBox(height: 32),+ ButtonWidgetV2(+ buttonType: ButtonTypeV2.primary,+ labelText: strings.createAlbum,+ onTap: () => _createAlbum(context),+ shouldSurfaceExecutionStates: false,+ ),+ const SizedBox(height: 8),+ ButtonWidgetV2(+ buttonType: ButtonTypeV2.secondary,+ labelText: strings.createASmartAlbum,+ onTap: () => _createSmartAlbum(context),+ shouldSurfaceExecutionStates: false,+ ),+ ],+ ),+ ),+ );+ }++ Future<Collection?> _showCreateAlbumDialog(BuildContext context) async {+ Collection? collection;+ final result = await showTextInputDialog(+ context,+ title: AppLocalizations.of(context).newAlbum,+ submitButtonLabel: AppLocalizations.of(context).create,+ hintText: AppLocalizations.of(context).enterAlbumName,+ alwaysShowSuccessState: false,+ initialValue: "",+ textCapitalization: TextCapitalization.words,+ popnavAfterSubmission: true,+ onSubmit: (String text) async {+ final albumName = text.trim();+ if (albumName.isEmpty) {+ return;+ }+ collection = await CollectionsService.instance.createAlbum(albumName);+ },+ );++ if (result is Exception && context.mounted) {+ await showGenericErrorDialog(context: context, error: result);+ }+ return collection;+ }++ Future<void> _createAlbum(BuildContext context) async {+ final collection = await _showCreateAlbumDialog(context);+ if (collection == null || !context.mounted) {+ return;+ }+ await routeToPage(+ context,+ CollectionPage(CollectionWithThumbnail(collection, null)),+ );+ }++ Future<void> _createSmartAlbum(BuildContext context) async {+ final collection = await _showCreateAlbumDialog(context);+ if (collection == null || !context.mounted) {+ return;+ }+ await routeToPage(+ context,+ SmartAlbumPeople(collectionId: collection.id),+ );+ }+}diff --git a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/shared_empty_state.dart b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/shared_empty_state.dartnew file mode 100644index 0000000000..8015ee16d6--- /dev/null+++ b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/shared_empty_state.dart@@ -0,0 +1,105 @@+import "package:flutter/material.dart";+import "package:hugeicons/hugeicons.dart";+import "package:photos/generated/l10n.dart";+import "package:photos/service_locator.dart";+import "package:photos/services/account/user_service.dart";+import "package:photos/theme/ente_theme.dart";+import "package:photos/ui/components/buttons/button_widget_v2.dart";+import "package:photos/ui/tabs/albums/empty_states/albums_empty_state_feature_row.dart";+import "package:photos/utils/dialog_util.dart";++class SharedEmptyState extends StatelessWidget {+ const SharedEmptyState({super.key});++ @override+ Widget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);+ final strings = AppLocalizations.of(context);+ final bottomPadding = 64 + MediaQuery.paddingOf(context).bottom + 32;++ return Align(+ alignment: Alignment.bottomCenter,+ child: Padding(+ padding: EdgeInsets.fromLTRB(16, 32, 16, bottomPadding),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 320),+ child: Column(+ children: [+ Text(+ strings.albumsSharedWithYouShowUpHere,+ textAlign: TextAlign.center,+ style: textTheme.largeBold.copyWith(+ fontFamily: "Nunito",+ fontWeight: FontWeight.w800,+ fontSize: 18,+ height: 28 / 18,+ color: colorScheme.content,+ ),+ ),+ const SizedBox(height: 4),+ Text(+ strings.inviteFamilyToSharePhotosPrivately,+ textAlign: TextAlign.center,+ style: textTheme.miniMuted,+ ),+ ],+ ),+ ),+ const SizedBox(height: 32),+ ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 320),+ child: Column(+ children: [+ AlbumsEmptyStateFeatureRow(+ icon: HugeIcons.strokeRoundedUserMultiple,+ label: strings.shareStorageWithUpToFiveFamilyMembers,+ ),+ const SizedBox(height: 24),+ AlbumsEmptyStateFeatureRow(+ icon: HugeIcons.strokeRoundedLock,+ label: strings.privateSpaceForEveryMember,+ ),+ const SizedBox(height: 24),+ AlbumsEmptyStateFeatureRow(+ icon: HugeIcons.strokeRoundedFavourite,+ label: strings.reactAndChatOnSharedMemories,+ ),+ ],+ ),+ ),+ const SizedBox(height: 32),+ ButtonWidgetV2(+ buttonType: ButtonTypeV2.primary,+ labelText: strings.addFamily,+ onTap: () => _addFamily(context),+ shouldSurfaceExecutionStates: false,+ ),+ ],+ ),+ ),+ );+ }++ Future<void> _addFamily(BuildContext context) async {+ try {+ final userDetails =+ await UserService.instance.getUserDetailsV2(memoryCount: false);+ if (!context.mounted) {+ return;+ }+ await billingService.launchFamilyPortal(+ context,+ userDetails,+ refreshOnOpen: false,+ );+ } catch (e) {+ if (context.mounted) {+ await showGenericErrorDialog(context: context, error: e);+ }+ }+ }+}diff --git a/mobile/apps/photos/lib/ui/tabs/albums_tab.dart b/mobile/apps/photos/lib/ui/tabs/albums_tab.dartindex 4a6d5c8d5d..5903b66d58 100644--- a/mobile/apps/photos/lib/ui/tabs/albums_tab.dart+++ b/mobile/apps/photos/lib/ui/tabs/albums_tab.dart@@ -27,6 +27,9 @@ import "package:photos/ui/components/buttons/filter_pill_widget.dart";import "package:photos/ui/components/buttons/soft_icon_button.dart";import "package:photos/ui/components/text_input_widget_v2.dart";import "package:photos/ui/tabs/albums/albums_manage_sheet.dart";+import "package:photos/ui/tabs/albums/empty_states/on_device_select_folders_empty_state.dart";+import "package:photos/ui/tabs/albums/empty_states/on_ente_empty_state.dart";+import "package:photos/ui/tabs/albums/empty_states/shared_empty_state.dart";import "package:photos/ui/viewer/actions/album_selection_overlay_bar.dart";import "package:photos/utils/local_settings.dart";@@ -191,6 +194,50 @@ class _AlbumsTabState extends State<AlbumsTab>.toList();}+ Widget _buildCollectionContentSliver({+ required List<Collection> collections,+ required bool showCreateAlbum,+ required Widget emptyState,+ }) {+ if (collections.isEmpty && _searchQuery.trim().isEmpty) {+ return SliverFillRemaining(+ hasScrollBody: false,+ child: emptyState,+ );+ }++ return CollectionsFlexiGridViewWidget(+ _filterCollectionsByQuery(collections),+ albumViewType: _viewType.value,+ selectedAlbums: widget.selectedAlbums,+ shrinkWrap: true,+ shouldShowCreateAlbum: showCreateAlbum && _searchQuery.trim().isEmpty,+ enableSelectionMode: true,+ );+ }++ Widget _buildOnDeviceContentSliver() {+ return FutureBuilder<bool>(+ future: OnDeviceSelectFoldersEmptyState.shouldShow(),+ builder: (context, snapshot) {+ if (!snapshot.hasData) {+ return const SliverToBoxAdapter(child: SizedBox.shrink());+ }+ if (snapshot.data!) {+ return const SliverFillRemaining(+ hasScrollBody: false,+ child: OnDeviceSelectFoldersEmptyState(),+ );+ }++ return DeviceFolderVerticalGridSliver(+ searchQuery: _searchQuery,+ albumViewType: _viewType.value,+ );+ },+ );+ }+Future<void> _toggleViewMode() async {final next = _viewType.value == AlbumViewType.grid? AlbumViewType.list@@ -595,18 +642,18 @@ class _AlbumsTabState extends State<AlbumsTab>final filter = _filter.value;final List<Collection>? collections;final bool showCreateAlbum;+ final Widget emptyState;switch (filter) {case _AlbumsFilter.ente:collections = _enteCollections.value;showCreateAlbum = true;+ emptyState = const OnEnteEmptyState();case _AlbumsFilter.shared:collections = _sharedCollections.value;showCreateAlbum = false;+ emptyState = const SharedEmptyState();case _AlbumsFilter.onDevice:- return DeviceFolderVerticalGridSliver(- searchQuery: _searchQuery,- albumViewType: _viewType.value,- );+ return _buildOnDeviceContentSliver();}if (collections == null) {return const SliverToBoxAdapter(@@ -616,25 +663,13 @@ class _AlbumsTabState extends State<AlbumsTab>),);}- final filteredCollections = _filterCollectionsByQuery(- collections,- );- return CollectionsFlexiGridViewWidget(- filteredCollections,- albumViewType: _viewType.value,- selectedAlbums: widget.selectedAlbums,- shrinkWrap: true,- shouldShowCreateAlbum:- showCreateAlbum && _searchQuery.trim().isEmpty,- enableSelectionMode: true,+ return _buildCollectionContentSliver(+ collections: collections,+ showCreateAlbum: showCreateAlbum,+ emptyState: emptyState,);},),- SliverToBoxAdapter(- child: SizedBox(- height: 64 + MediaQuery.paddingOf(context).bottom,- ),- ),],),),