π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
use functionality of 'preserve more' for 'add photos' icon on top right of home tab and remove 'preserve more' footer
ashilkna1717ee31da5
diff --git a/lib/ui/components/home_header_widget.dart b/lib/ui/components/home_header_widget.dartindex 38adf5ebb0..aea0aca525 100644--- a/lib/ui/components/home_header_widget.dart+++ b/lib/ui/components/home_header_widget.dart@@ -1,6 +1,15 @@+import "dart:async";+import "dart:io";+import 'package:flutter/material.dart';-import "package:photos/ui/collections/new_album_icon.dart";+import "package:logging/logging.dart";+import "package:photo_manager/photo_manager.dart";+import "package:photos/generated/l10n.dart";+import "package:photos/services/local_sync_service.dart";import 'package:photos/ui/components/buttons/icon_button_widget.dart';+import "package:photos/ui/settings/backup/backup_folder_selection_page.dart";+import "package:photos/utils/dialog_util.dart";+import "package:photos/utils/navigation_util.dart";class HomeHeaderWidget extends StatefulWidget {final Widget centerWidget;@@ -33,9 +42,55 @@ class _HomeHeaderWidgetState extends State<HomeHeaderWidget> {duration: const Duration(milliseconds: 250),child: widget.centerWidget,),- const NewAlbumIcon(+ IconButtonWidget(icon: Icons.add_photo_alternate_outlined,iconButtonType: IconButtonType.primary,+ onTap: () async {+ try {+ final PermissionState state =+ await PhotoManager.requestPermissionExtend();+ await LocalSyncService.instance.onUpdatePermission(state);+ } on Exception catch (e) {+ Logger("HomeHeaderWidget").severe(+ "Failed to request permission: ${e.toString()}",+ e,+ );+ }+ if (!LocalSyncService.instance.hasGrantedFullPermission()) {+ if (Platform.isAndroid) {+ await PhotoManager.openSetting();+ } else {+ final bool hasGrantedLimit =+ LocalSyncService.instance.hasGrantedLimitedPermissions();+ showChoiceActionSheet(+ context,+ title: S.of(context).preserveMore,+ body: S.of(context).grantFullAccessPrompt,+ firstButtonLabel: S.of(context).openSettings,+ firstButtonOnTap: () async {+ await PhotoManager.openSetting();+ },+ secondButtonLabel: hasGrantedLimit+ ? S.of(context).selectMorePhotos+ : S.of(context).cancel,+ secondButtonOnTap: () async {+ if (hasGrantedLimit) {+ await PhotoManager.presentLimited();+ }+ },+ );+ }+ } else {+ unawaited(+ routeToPage(+ context,+ BackupFolderSelectionPage(+ buttonText: S.of(context).backup,+ ),+ ),+ );+ }+ },),],);diff --git a/lib/ui/home/preserve_footer_widget.dart b/lib/ui/home/preserve_footer_widget.dartdeleted file mode 100644index a9a3019c8a..0000000000--- a/lib/ui/home/preserve_footer_widget.dart+++ /dev/null@@ -1,73 +0,0 @@-import 'dart:async';-import "dart:io";--import 'package:flutter/material.dart';-import "package:logging/logging.dart";-import 'package:photo_manager/photo_manager.dart';-import "package:photos/generated/l10n.dart";-import 'package:photos/services/local_sync_service.dart';-import 'package:photos/ui/common/gradient_button.dart';-import 'package:photos/ui/settings/backup/backup_folder_selection_page.dart';-import "package:photos/utils/dialog_util.dart";-import 'package:photos/utils/navigation_util.dart';--class PreserveFooterWidget extends StatelessWidget {- const PreserveFooterWidget({Key? key}) : super(key: key);-- @override- Widget build(BuildContext context) {- return Padding(- padding: const EdgeInsets.fromLTRB(20, 24, 20, 100),- child: GradientButton(- onTap: () async {- try {- final PermissionState state =- await PhotoManager.requestPermissionExtend();- await LocalSyncService.instance.onUpdatePermission(state);- } on Exception catch (e) {- Logger("PreserveFooterWidget").severe(- "Failed to request permission: ${e.toString()}",- e,- );- }- if (!LocalSyncService.instance.hasGrantedFullPermission()) {- if (Platform.isAndroid) {- await PhotoManager.openSetting();- } else {- final bool hasGrantedLimit =- LocalSyncService.instance.hasGrantedLimitedPermissions();- showChoiceActionSheet(- context,- title: S.of(context).preserveMore,- body: S.of(context).grantFullAccessPrompt,- firstButtonLabel: S.of(context).openSettings,- firstButtonOnTap: () async {- await PhotoManager.openSetting();- },- secondButtonLabel: hasGrantedLimit- ? S.of(context).selectMorePhotos- : S.of(context).cancel,- secondButtonOnTap: () async {- if (hasGrantedLimit) {- await PhotoManager.presentLimited();- }- },- );- }- } else {- unawaited(- routeToPage(- context,- BackupFolderSelectionPage(- buttonText: S.of(context).backup,- ),- ),- );- }- },- text: S.of(context).preserveMore,- iconData: Icons.cloud_upload_outlined,- ),- );- }-}diff --git a/lib/ui/tabs/home_widget.dart b/lib/ui/tabs/home_widget.dartindex 086f7a8978..bd202d4b53 100644--- a/lib/ui/tabs/home_widget.dart+++ b/lib/ui/tabs/home_widget.dart@@ -46,7 +46,6 @@ import 'package:photos/ui/home/home_bottom_nav_bar.dart';import 'package:photos/ui/home/home_gallery_widget.dart';import 'package:photos/ui/home/landing_page_widget.dart';import "package:photos/ui/home/loading_photos_widget.dart";-import 'package:photos/ui/home/preserve_footer_widget.dart';import 'package:photos/ui/home/start_backup_hook_widget.dart';import 'package:photos/ui/notification/update/change_log_page.dart';import "package:photos/ui/search_tab.dart";@@ -415,7 +414,9 @@ class _HomeWidgetState extends State<HomeWidget> {? const StartBackupHookWidget(headerWidget: _headerWidget): HomeGalleryWidget(header: _headerWidget,- footer: const PreserveFooterWidget(),+ footer: const SizedBox(+ height: 160,+ ),selectedFiles: _selectedFiles,),_userCollectionsTab,