From 661e347a99f3c61fff940ab5cf5c287b23cbe04b Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Wed, 7 Dec 2022 10:51:47 +0530 Subject: [PATCH 1/9] Move general section below security --- lib/ui/settings_page.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ui/settings_page.dart b/lib/ui/settings_page.dart index 6a397c9b1..a508bae21 100644 --- a/lib/ui/settings_page.dart +++ b/lib/ui/settings_page.dart @@ -77,6 +77,8 @@ class SettingsPage extends StatelessWidget { contents.addAll([ const SecuritySectionWidget(), sectionSpacing, + const GeneralSectionWidget(), + sectionSpacing, ]); if (Platform.isAndroid || kDebugMode) { @@ -91,8 +93,6 @@ class SettingsPage extends StatelessWidget { sectionSpacing, const SocialSectionWidget(), sectionSpacing, - const GeneralSectionWidget(), - sectionSpacing, const AboutSectionWidget(), ]); From cee6e1287761fd34fb2d59a7e050256f397dd49d Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Wed, 7 Dec 2022 11:08:02 +0530 Subject: [PATCH 2/9] Copy changes --- lib/ui/settings/backup_section_widget.dart | 4 ++-- lib/ui/settings/security_section_widget.dart | 2 +- lib/ui/settings/support_section_widget.dart | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/ui/settings/backup_section_widget.dart b/lib/ui/settings/backup_section_widget.dart index 61fdb4f83..42cf203c9 100644 --- a/lib/ui/settings/backup_section_widget.dart +++ b/lib/ui/settings/backup_section_widget.dart @@ -81,7 +81,7 @@ class BackupSectionWidgetState extends State { [ MenuItemWidget( captionedTextWidget: const CaptionedTextWidget( - title: "Free up space", + title: "Free up device space", ), pressedColor: getEnteColorScheme(context).fillFaint, trailingIcon: Icons.chevron_right_outlined, @@ -117,7 +117,7 @@ class BackupSectionWidgetState extends State { sectionOptionSpacing, MenuItemWidget( captionedTextWidget: const CaptionedTextWidget( - title: "Deduplicate files", + title: "Remove duplicates", ), pressedColor: getEnteColorScheme(context).fillFaint, trailingIcon: Icons.chevron_right_outlined, diff --git a/lib/ui/settings/security_section_widget.dart b/lib/ui/settings/security_section_widget.dart index 3b1e7ef81..ea964247e 100644 --- a/lib/ui/settings/security_section_widget.dart +++ b/lib/ui/settings/security_section_widget.dart @@ -135,7 +135,7 @@ class _SecuritySectionWidgetState extends State { children.addAll([ MenuItemWidget( captionedTextWidget: const CaptionedTextWidget( - title: "Active sessions", + title: "View active sessions", ), pressedColor: getEnteColorScheme(context).fillFaint, trailingIcon: Icons.chevron_right_outlined, diff --git a/lib/ui/settings/support_section_widget.dart b/lib/ui/settings/support_section_widget.dart index 7f20dca5e..1535b1831 100644 --- a/lib/ui/settings/support_section_widget.dart +++ b/lib/ui/settings/support_section_widget.dart @@ -33,7 +33,7 @@ class SupportSectionWidget extends StatelessWidget { sectionOptionSpacing, MenuItemWidget( captionedTextWidget: const CaptionedTextWidget( - title: "Email", + title: "Contact support", ), pressedColor: getEnteColorScheme(context).fillFaint, trailingIcon: Icons.chevron_right_outlined, @@ -45,7 +45,7 @@ class SupportSectionWidget extends StatelessWidget { sectionOptionSpacing, MenuItemWidget( captionedTextWidget: const CaptionedTextWidget( - title: "Roadmap", + title: "Suggest features", ), pressedColor: getEnteColorScheme(context).fillFaint, trailingIcon: Icons.chevron_right_outlined, @@ -59,7 +59,7 @@ class SupportSectionWidget extends StatelessWidget { final url = Configuration.instance.isLoggedIn() ? endpoint + "?token=" + Configuration.instance.getToken() : roadmapURL; - return WebPage("Roadmap", url); + return WebPage("Suggest features", url); }, ), ); From 1df3d5080ee6c5af9eeaacece8d9637392a6efad Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Wed, 7 Dec 2022 11:14:15 +0530 Subject: [PATCH 3/9] Copy changes for settings --- lib/ui/settings/about_section_widget.dart | 27 +++++++++------------ lib/ui/settings/support_section_widget.dart | 6 +++++ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/lib/ui/settings/about_section_widget.dart b/lib/ui/settings/about_section_widget.dart index 5a14e692a..4952b9204 100644 --- a/lib/ui/settings/about_section_widget.dart +++ b/lib/ui/settings/about_section_widget.dart @@ -28,25 +28,10 @@ class AboutSectionWidget extends StatelessWidget { Widget _getSectionOptions(BuildContext context) { return Column( children: [ - sectionOptionSpacing, - const AboutMenuItemWidget( - title: "FAQ", - url: "https://ente.io/faq", - ), - sectionOptionSpacing, - const AboutMenuItemWidget( - title: "Terms", - url: "https://ente.io/terms", - ), - sectionOptionSpacing, - const AboutMenuItemWidget( - title: "Privacy", - url: "https://ente.io/privacy", - ), sectionOptionSpacing, MenuItemWidget( captionedTextWidget: const CaptionedTextWidget( - title: "Source code", + title: "We are open source!", ), pressedColor: getEnteColorScheme(context).fillFaint, trailingIcon: Icons.chevron_right_outlined, @@ -56,6 +41,16 @@ class AboutSectionWidget extends StatelessWidget { }, ), sectionOptionSpacing, + const AboutMenuItemWidget( + title: "Privacy", + url: "https://ente.io/privacy", + ), + sectionOptionSpacing, + const AboutMenuItemWidget( + title: "Terms", + url: "https://ente.io/terms", + ), + sectionOptionSpacing, UpdateService.instance.isIndependent() ? Column( children: [ diff --git a/lib/ui/settings/support_section_widget.dart b/lib/ui/settings/support_section_widget.dart index 1535b1831..2407885aa 100644 --- a/lib/ui/settings/support_section_widget.dart +++ b/lib/ui/settings/support_section_widget.dart @@ -10,6 +10,7 @@ import 'package:photos/ui/common/web_page.dart'; import 'package:photos/ui/components/captioned_text_widget.dart'; import 'package:photos/ui/components/expandable_menu_item_widget.dart'; import 'package:photos/ui/components/menu_item_widget.dart'; +import 'package:photos/ui/settings/about_section_widget.dart'; import 'package:photos/ui/settings/common_settings.dart'; import 'package:photos/utils/email_util.dart'; @@ -43,6 +44,11 @@ class SupportSectionWidget extends StatelessWidget { }, ), sectionOptionSpacing, + const AboutMenuItemWidget( + title: "Frequently asked questions", + url: "https://ente.io/faq", + ), + sectionOptionSpacing, MenuItemWidget( captionedTextWidget: const CaptionedTextWidget( title: "Suggest features", From a0b22cd3a1dbd7d4d7abef5f66537b37a9cba689 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Wed, 7 Dec 2022 11:49:41 +0530 Subject: [PATCH 4/9] Refactor: Pass photoGridSize from gallery to inner widgets --- .../huge_listview/lazy_loading_gallery.dart | 26 ++++++++++--------- lib/ui/viewer/gallery/gallery.dart | 4 +++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/lib/ui/huge_listview/lazy_loading_gallery.dart b/lib/ui/huge_listview/lazy_loading_gallery.dart index 60b2ac12d..085ebafa6 100644 --- a/lib/ui/huge_listview/lazy_loading_gallery.dart +++ b/lib/ui/huge_listview/lazy_loading_gallery.dart @@ -19,7 +19,6 @@ import 'package:photos/ui/viewer/file/detail_page.dart'; import 'package:photos/ui/viewer/file/thumbnail_widget.dart'; import 'package:photos/ui/viewer/gallery/gallery.dart'; import 'package:photos/utils/date_time_util.dart'; -import 'package:photos/utils/local_settings.dart'; import 'package:photos/utils/navigation_util.dart'; import 'package:visibility_detector/visibility_detector.dart'; @@ -33,6 +32,7 @@ class LazyLoadingGallery extends StatefulWidget { final String tag; final String logTag; final Stream currentIndexStream; + final int photoGirdSize; LazyLoadingGallery( this.files, @@ -44,6 +44,7 @@ class LazyLoadingGallery extends StatefulWidget { this.tag, this.currentIndexStream, { this.logTag = "", + this.photoGirdSize = photoGridSizeDefault, Key key, }) : super(key: key ?? UniqueKey()); @@ -236,7 +237,7 @@ class _LazyLoadingGalleryState extends State { ? _getGallery() : PlaceHolderWidget( _files.length, - LocalSettings.instance.getPhotoGridSize(), + widget.photoGirdSize, ), ], ); @@ -258,6 +259,7 @@ class _LazyLoadingGalleryState extends State { _files.length > kRecycleLimit, _toggleSelectAllFromDay, _areAllFromDaySelected, + widget.photoGirdSize, ), ); } @@ -285,6 +287,7 @@ class LazyLoadingGridView extends StatefulWidget { final bool shouldRecycle; final ValueNotifier toggleSelectAllFromDay; final ValueNotifier areAllFilesSelected; + final int photoGridSize; LazyLoadingGridView( this.tag, @@ -294,7 +297,8 @@ class LazyLoadingGridView extends StatefulWidget { this.shouldRender, this.shouldRecycle, this.toggleSelectAllFromDay, - this.areAllFilesSelected, { + this.areAllFilesSelected, + this.photoGridSize, { Key key, }) : super(key: key ?? UniqueKey()); @@ -304,7 +308,6 @@ class LazyLoadingGridView extends StatefulWidget { class _LazyLoadingGridViewState extends State { bool _shouldRender; - int _photoGridSize; StreamSubscription _clearSelectionsEvent; @override @@ -340,7 +343,6 @@ class _LazyLoadingGridViewState extends State { @override Widget build(BuildContext context) { - _photoGridSize = LocalSettings.instance.getPhotoGridSize(); if (widget.shouldRecycle) { return _getRecyclableView(); } else { @@ -361,7 +363,7 @@ class _LazyLoadingGridViewState extends State { }, child: _shouldRender ? _getGridView() - : PlaceHolderWidget(widget.filesInDay.length, _photoGridSize), + : PlaceHolderWidget(widget.filesInDay.length, widget.photoGridSize), ); } @@ -376,7 +378,8 @@ class _LazyLoadingGridViewState extends State { }); } }, - child: PlaceHolderWidget(widget.filesInDay.length, _photoGridSize), + child: + PlaceHolderWidget(widget.filesInDay.length, widget.photoGridSize), ); } else { return _getGridView(); @@ -386,8 +389,8 @@ class _LazyLoadingGridViewState extends State { Widget _getGridView() { return GridView.builder( shrinkWrap: true, - physics: - const NeverScrollableScrollPhysics(), // to disable GridView's scrolling + physics: const NeverScrollableScrollPhysics(), + // to disable GridView's scrolling itemBuilder: (context, index) { return _buildFile(context, widget.filesInDay[index]); }, @@ -395,7 +398,7 @@ class _LazyLoadingGridViewState extends State { gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisSpacing: 2, mainAxisSpacing: 2, - crossAxisCount: _photoGridSize, + crossAxisCount: widget.photoGridSize, ), padding: const EdgeInsets.all(0), ); @@ -433,8 +436,7 @@ class _LazyLoadingGridViewState extends State { serverLoadDeferDuration: thumbnailServerLoadDeferDuration, shouldShowLivePhotoOverlay: true, key: Key(widget.tag + file.tag), - thumbnailSize: LocalSettings.instance.getPhotoGridSize() < - photoGridSizeDefault + thumbnailSize: widget.photoGridSize < photoGridSizeDefault ? thumbnailLargeSize : thumbnailSmallSize, ), diff --git a/lib/ui/viewer/gallery/gallery.dart b/lib/ui/viewer/gallery/gallery.dart index c7f2c1739..0b6736890 100644 --- a/lib/ui/viewer/gallery/gallery.dart +++ b/lib/ui/viewer/gallery/gallery.dart @@ -19,6 +19,7 @@ import 'package:photos/ui/huge_listview/huge_listview.dart'; import 'package:photos/ui/huge_listview/lazy_loading_gallery.dart'; import 'package:photos/ui/viewer/gallery/empty_state.dart'; import 'package:photos/utils/date_time_util.dart'; +import 'package:photos/utils/local_settings.dart'; import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; typedef GalleryLoader = Future Function( @@ -77,6 +78,7 @@ class _GalleryState extends State { StreamSubscription _tabDoubleTapEvent; final _forceReloadEventSubscriptions = >[]; String _logTag; + int _photoGridSize; @override void initState() { @@ -200,6 +202,7 @@ class _GalleryState extends State { if (!_hasLoadedFiles) { return const EnteLoadingWidget(); } + _photoGridSize = LocalSettings.instance.getPhotoGridSize(); return _getListView(); } @@ -246,6 +249,7 @@ class _GalleryState extends State { .where((event) => event.tag == widget.tagPrefix) .map((event) => event.index), logTag: _logTag, + photoGirdSize: _photoGridSize, ); if (widget.header != null && index == 0) { gallery = Column(children: [widget.header, gallery]); From 379db6701adcc732b15f2d74b3e10ba25cee75f2 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Wed, 7 Dec 2022 11:52:48 +0530 Subject: [PATCH 5/9] Use small font when photoGridSize > 5 --- lib/ui/huge_listview/lazy_loading_gallery.dart | 1 + lib/utils/date_time_util.dart | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ui/huge_listview/lazy_loading_gallery.dart b/lib/ui/huge_listview/lazy_loading_gallery.dart index 085ebafa6..38062e28b 100644 --- a/lib/ui/huge_listview/lazy_loading_gallery.dart +++ b/lib/ui/huge_listview/lazy_loading_gallery.dart @@ -193,6 +193,7 @@ class _LazyLoadingGalleryState extends State { child: getDayWidget( context, _files[0].creationTime, + widget.photoGirdSize, ), ), ValueListenableBuilder( diff --git a/lib/utils/date_time_util.dart b/lib/utils/date_time_util.dart index a06d31bd0..621f2976e 100644 --- a/lib/utils/date_time_util.dart +++ b/lib/utils/date_time_util.dart @@ -195,16 +195,18 @@ bool isLeapYear(DateTime dateTime) { Widget getDayWidget( BuildContext context, int timestamp, + int photoGridSize, ) { final colorScheme = getEnteColorScheme(context); final textTheme = getEnteTextTheme(context); + final textStyle = photoGridSize < 6 ? textTheme.body : textTheme.small; return Container( alignment: Alignment.centerLeft, child: Text( getDayTitle(timestamp), style: (getDayTitle(timestamp) == "Today") - ? textTheme.body - : textTheme.body.copyWith(color: colorScheme.textMuted), + ? textStyle + : textStyle.copyWith(color: colorScheme.textMuted), ), ); } From 817dfc3afac17cc6a7b2671c79cde6f8d8e25641 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Wed, 7 Dec 2022 11:55:18 +0530 Subject: [PATCH 6/9] Change gridTitle padding based on gridSize --- lib/ui/huge_listview/lazy_loading_gallery.dart | 11 ++++------- lib/utils/date_time_util.dart | 18 +++++++++++------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/ui/huge_listview/lazy_loading_gallery.dart b/lib/ui/huge_listview/lazy_loading_gallery.dart index 38062e28b..7c546cd73 100644 --- a/lib/ui/huge_listview/lazy_loading_gallery.dart +++ b/lib/ui/huge_listview/lazy_loading_gallery.dart @@ -188,13 +188,10 @@ class _LazyLoadingGalleryState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Padding( - padding: const EdgeInsets.all(12), - child: getDayWidget( - context, - _files[0].creationTime, - widget.photoGirdSize, - ), + getDayWidget( + context, + _files[0].creationTime, + widget.photoGirdSize, ), ValueListenableBuilder( valueListenable: _showSelectAllButton, diff --git a/lib/utils/date_time_util.dart b/lib/utils/date_time_util.dart index 621f2976e..61dd75d63 100644 --- a/lib/utils/date_time_util.dart +++ b/lib/utils/date_time_util.dart @@ -200,13 +200,17 @@ Widget getDayWidget( final colorScheme = getEnteColorScheme(context); final textTheme = getEnteTextTheme(context); final textStyle = photoGridSize < 6 ? textTheme.body : textTheme.small; - return Container( - alignment: Alignment.centerLeft, - child: Text( - getDayTitle(timestamp), - style: (getDayTitle(timestamp) == "Today") - ? textStyle - : textStyle.copyWith(color: colorScheme.textMuted), + final double paddingValue = photoGridSize < 6 ? 12.0 : 8.0; + return Padding( + padding: EdgeInsets.all(paddingValue), + child: Container( + alignment: Alignment.centerLeft, + child: Text( + getDayTitle(timestamp), + style: (getDayTitle(timestamp) == "Today") + ? textStyle + : textStyle.copyWith(color: colorScheme.textMuted), + ), ), ); } From 50e23815a5f4b2d1309ef4f6b33d6ce69edde5b8 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Wed, 7 Dec 2022 12:50:25 +0530 Subject: [PATCH 7/9] Add link to Mastodon, Blog, & Matrix --- lib/ui/settings/social_section_widget.dart | 31 +++++++++++++++------- lib/utils/date_time_util.dart | 6 +++-- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/lib/ui/settings/social_section_widget.dart b/lib/ui/settings/social_section_widget.dart index 7aa86fd8d..21b69c2b5 100644 --- a/lib/ui/settings/social_section_widget.dart +++ b/lib/ui/settings/social_section_widget.dart @@ -24,15 +24,7 @@ class SocialSectionWidget extends StatelessWidget { } Widget _getSectionOptions(BuildContext context) { - final List options = [ - sectionOptionSpacing, - const SocialsMenuItemWidget("Twitter", "https://twitter.com/enteio"), - sectionOptionSpacing, - const SocialsMenuItemWidget("Discord", "https://ente.io/discord"), - sectionOptionSpacing, - const SocialsMenuItemWidget("Reddit", "https://reddit.com/r/enteio"), - sectionOptionSpacing, - ]; + final List options = []; if (!UpdateService.instance.isIndependent()) { options.addAll( [ @@ -46,6 +38,27 @@ class SocialSectionWidget extends StatelessWidget { ], ); } + options.addAll( + [ + sectionOptionSpacing, + const SocialsMenuItemWidget("Blog", "https://ente.io/blog"), + sectionOptionSpacing, + const SocialsMenuItemWidget("Twitter", "https://twitter.com/enteio"), + sectionOptionSpacing, + const SocialsMenuItemWidget("Mastodon", "https://mstdn.social/@ente"), + sectionOptionSpacing, + const SocialsMenuItemWidget( + "Matrix", + "https://matrix.to/#/#ente:matrix.org", + ), + sectionOptionSpacing, + const SocialsMenuItemWidget("Discord", "https://ente.io/discord"), + sectionOptionSpacing, + const SocialsMenuItemWidget("Reddit", "https://reddit.com/r/enteio"), + sectionOptionSpacing, + ], + ); + return Column(children: options); } } diff --git a/lib/utils/date_time_util.dart b/lib/utils/date_time_util.dart index 61dd75d63..6a8ed50bb 100644 --- a/lib/utils/date_time_util.dart +++ b/lib/utils/date_time_util.dart @@ -1,6 +1,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; +import 'package:photos/core/constants.dart'; import 'package:photos/theme/ente_theme.dart'; const Set monthWith31Days = {1, 3, 5, 7, 8, 10, 12}; @@ -199,8 +200,9 @@ Widget getDayWidget( ) { final colorScheme = getEnteColorScheme(context); final textTheme = getEnteTextTheme(context); - final textStyle = photoGridSize < 6 ? textTheme.body : textTheme.small; - final double paddingValue = photoGridSize < 6 ? 12.0 : 8.0; + final textStyle = + photoGridSize < photoGridSizeMax ? textTheme.body : textTheme.small; + final double paddingValue = photoGridSize < photoGridSizeMax ? 12.0 : 8.0; return Padding( padding: EdgeInsets.all(paddingValue), child: Container( From 4e4807ac5ae74152163d56ff0f864dfff7d6a80c Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Wed, 7 Dec 2022 14:08:57 +0530 Subject: [PATCH 8/9] Show rate us on AlternativeTo --- lib/services/update_service.dart | 27 ++++++++++++++++++++++ lib/ui/settings/social_section_widget.dart | 12 ++++------ 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/lib/services/update_service.dart b/lib/services/update_service.dart index ae7e8eed0..c05645657 100644 --- a/lib/services/update_service.dart +++ b/lib/services/update_service.dart @@ -9,6 +9,7 @@ import 'package:photos/core/constants.dart'; import 'package:photos/core/network.dart'; import 'package:photos/services/notification_service.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:tuple/tuple.dart'; class UpdateService { UpdateService._privateConstructor(); @@ -121,6 +122,32 @@ class UpdateService { } return _packageInfo.packageName.startsWith("io.ente.photos.independent"); } + + bool isFdroidFlavor() { + if (Platform.isIOS) { + return false; + } + return _packageInfo.packageName.startsWith("io.ente.photos.fdroid"); + } + + // getRateDetails returns details about the place + Tuple2 getRateDetails() { + if (isFdroidFlavor() || isIndependentFlavor()) { + return const Tuple2( + "AlternativeTo", + "https://alternativeto.net/software/ente/about/", + ); + } + return Platform.isAndroid + ? const Tuple2( + "play store", + "https://play.google.com/store/apps/details?id=io.ente.photos", + ) + : const Tuple2( + "app store", + "https://apps.apple.com/in/app/ente-photos/id1542026904", + ); + } } class LatestVersionInfo { diff --git a/lib/ui/settings/social_section_widget.dart b/lib/ui/settings/social_section_widget.dart index 21b69c2b5..5e6bc4781 100644 --- a/lib/ui/settings/social_section_widget.dart +++ b/lib/ui/settings/social_section_widget.dart @@ -1,7 +1,5 @@ // @dart=2.9 -import 'dart:io'; - import 'package:flutter/material.dart'; import 'package:photos/services/update_service.dart'; import 'package:photos/theme/ente_theme.dart'; @@ -25,15 +23,13 @@ class SocialSectionWidget extends StatelessWidget { Widget _getSectionOptions(BuildContext context) { final List options = []; + final result = UpdateService.instance.getRateDetails(); + final String ratePlace = result.item1; + final String rateUrl = result.item2; if (!UpdateService.instance.isIndependent()) { options.addAll( [ - SocialsMenuItemWidget( - "Rate us! ✨", - Platform.isAndroid - ? "https://play.google.com/store/apps/details?id=io.ente.photos" - : "https://apps.apple.com/in/app/ente-photos/id1542026904", - ), + SocialsMenuItemWidget("Rate us on $ratePlace", rateUrl), sectionOptionSpacing, ], ); From a8a009318d354b140959e098855e87aa9e3025da Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Wed, 7 Dec 2022 14:11:52 +0530 Subject: [PATCH 9/9] Fix: RateUs -> use alternativeTo for f-droid and github apk --- lib/ui/settings/backup_section_widget.dart | 24 ++++--------------- .../gallery/gallery_app_bar_widget.dart | 12 +++------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/lib/ui/settings/backup_section_widget.dart b/lib/ui/settings/backup_section_widget.dart index 42cf203c9..da031558e 100644 --- a/lib/ui/settings/backup_section_widget.dart +++ b/lib/ui/settings/backup_section_widget.dart @@ -8,6 +8,7 @@ import 'package:photos/models/backup_status.dart'; import 'package:photos/models/duplicate_files.dart'; import 'package:photos/services/deduplication_service.dart'; import 'package:photos/services/sync_service.dart'; +import 'package:photos/services/update_service.dart'; import 'package:photos/theme/ente_theme.dart'; import 'package:photos/ui/backup_folder_selection_page.dart'; import 'package:photos/ui/backup_settings_screen.dart'; @@ -175,16 +176,8 @@ class BackupSectionWidgetState extends State { ), onPressed: () { Navigator.of(context, rootNavigator: true).pop('dialog'); - // TODO: Replace with https://pub.dev/packages/in_app_review - if (Platform.isAndroid) { - launchUrlString( - "https://play.google.com/store/apps/details?id=io.ente.photos", - ); - } else { - launchUrlString( - "https://apps.apple.com/in/app/ente-photos/id1542026904", - ); - } + final url = UpdateService.instance.getRateDetails().item2; + launchUrlString(url); }, ), TextButton( @@ -238,15 +231,8 @@ class BackupSectionWidgetState extends State { onPressed: () { Navigator.of(context, rootNavigator: true).pop('dialog'); // TODO: Replace with https://pub.dev/packages/in_app_review - if (Platform.isAndroid) { - launchUrlString( - "https://play.google.com/store/apps/details?id=io.ente.photos", - ); - } else { - launchUrlString( - "https://apps.apple.com/in/app/ente-photos/id1542026904", - ); - } + final url = UpdateService.instance.getRateDetails().item2; + launchUrlString(url); }, ), TextButton( diff --git a/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/lib/ui/viewer/gallery/gallery_app_bar_widget.dart index 4fe1c6cc4..e8c445196 100644 --- a/lib/ui/viewer/gallery/gallery_app_bar_widget.dart +++ b/lib/ui/viewer/gallery/gallery_app_bar_widget.dart @@ -18,6 +18,7 @@ import 'package:photos/models/magic_metadata.dart'; import 'package:photos/models/selected_files.dart'; import 'package:photos/services/collections_service.dart'; import 'package:photos/services/sync_service.dart'; +import 'package:photos/services/update_service.dart'; import 'package:photos/ui/common/dialogs.dart'; import 'package:photos/ui/common/rename_dialog.dart'; import 'package:photos/ui/sharing/share_collection_widget.dart'; @@ -213,15 +214,8 @@ class _GalleryAppBarWidgetState extends State { onPressed: () { Navigator.of(context, rootNavigator: true).pop('dialog'); // TODO: Replace with https://pub.dev/packages/in_app_review - if (Platform.isAndroid) { - launchUrlString( - "https://play.google.com/store/apps/details?id=io.ente.photos", - ); - } else { - launchUrlString( - "https://apps.apple.com/in/app/ente-photos/id1542026904", - ); - } + final url = UpdateService.instance.getRateDetails().item2; + launchUrlString(url); }, ), TextButton(