From bd18e966f5666168cb163dca17cc500572c5355d Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Fri, 11 Aug 2023 16:53:59 +0530 Subject: [PATCH 1/4] Add option to rate --- lib/l10n/arb/app_en.arb | 1 + lib/services/update_service.dart | 17 +++++++++++++++++ lib/ui/settings/social_section_widget.dart | 8 ++++++++ 3 files changed, 26 insertions(+) diff --git a/lib/l10n/arb/app_en.arb b/lib/l10n/arb/app_en.arb index 80dbf60e6..2b9eb3e8a 100644 --- a/lib/l10n/arb/app_en.arb +++ b/lib/l10n/arb/app_en.arb @@ -58,6 +58,7 @@ } }, "contactSupport": "Contact support", + "rateUsOnStore" : "Rate us on {storeName}", "verifyPassword": "Verify password", "pleaseWait": "Please wait...", "generatingEncryptionKeysTitle": "Generating encryption keys...", diff --git a/lib/services/update_service.dart b/lib/services/update_service.dart index 30cc9b769..c8fc18ffb 100644 --- a/lib/services/update_service.dart +++ b/lib/services/update_service.dart @@ -9,6 +9,7 @@ import 'package:flutter/foundation.dart'; import 'package:logging/logging.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:tuple/tuple.dart'; class UpdateService { UpdateService._privateConstructor(); @@ -87,6 +88,22 @@ class UpdateService { return LatestVersionInfo.fromMap(response.data["latestVersion"]); } + // getRateDetails returns details about the place + Tuple2 getRateDetails() { + // Note: in auth, currently we don't have a way to identify if the + // app was installed from play store, f-droid or github based on pkg name + if (Platform.isAndroid) { + return const Tuple2( + "AlternativeTo", + "https://alternativeto.net/software/ente-authenticator/about/", + ); + } + return const Tuple2( + "app store", + "https://apps.apple.com/in/app/ente-photos/id6444121398", + ); + } + bool isIndependent() { if (Platform.isIOS) { return false; diff --git a/lib/ui/settings/social_section_widget.dart b/lib/ui/settings/social_section_widget.dart index c7963e4da..36970f7bf 100644 --- a/lib/ui/settings/social_section_widget.dart +++ b/lib/ui/settings/social_section_widget.dart @@ -1,4 +1,5 @@ import 'package:ente_auth/l10n/l10n.dart'; +import 'package:ente_auth/services/update_service.dart'; import 'package:ente_auth/theme/ente_theme.dart'; import 'package:ente_auth/ui/components/captioned_text_widget.dart'; import 'package:ente_auth/ui/components/expandable_menu_item_widget.dart'; @@ -21,7 +22,14 @@ class SocialSectionWidget extends StatelessWidget { } Widget _getSectionOptions(BuildContext context) { + final l10n = context.l10n; + final result = UpdateService.instance.getRateDetails(); + final String ratePlace = result.item1; + final String rateUrl = result.item2; + final List options = [ + sectionOptionSpacing, + SocialsMenuItemWidget(l10n.rateUsOnStore(ratePlace), rateUrl), sectionOptionSpacing, const SocialsMenuItemWidget("Mastodon", "https://mstdn.social/@ente/"), sectionOptionSpacing, From 66ebcb6701a8e530c98624eb412db517a26f457a Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Fri, 11 Aug 2023 16:57:12 +0530 Subject: [PATCH 2/4] Add link to blog and shop --- lib/l10n/arb/app_en.arb | 2 ++ lib/ui/settings/social_section_widget.dart | 32 +++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/lib/l10n/arb/app_en.arb b/lib/l10n/arb/app_en.arb index 2b9eb3e8a..37a4e1015 100644 --- a/lib/l10n/arb/app_en.arb +++ b/lib/l10n/arb/app_en.arb @@ -59,6 +59,8 @@ }, "contactSupport": "Contact support", "rateUsOnStore" : "Rate us on {storeName}", + "blog": "Blog", + "merchandise": "Merchandise", "verifyPassword": "Verify password", "pleaseWait": "Please wait...", "generatingEncryptionKeysTitle": "Generating encryption keys...", diff --git a/lib/ui/settings/social_section_widget.dart b/lib/ui/settings/social_section_widget.dart index 36970f7bf..71016bf32 100644 --- a/lib/ui/settings/social_section_widget.dart +++ b/lib/ui/settings/social_section_widget.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:ente_auth/l10n/l10n.dart'; import 'package:ente_auth/services/update_service.dart'; import 'package:ente_auth/theme/ente_theme.dart'; @@ -31,6 +33,17 @@ class SocialSectionWidget extends StatelessWidget { sectionOptionSpacing, SocialsMenuItemWidget(l10n.rateUsOnStore(ratePlace), rateUrl), sectionOptionSpacing, + SocialsMenuItemWidget( + l10n.blog, + "https://ente.io/blog", + launchInExternalApp: !Platform.isAndroid, + ), + sectionOptionSpacing, + SocialsMenuItemWidget( + l10n.merchandise, + "https://shop.ente.io", + launchInExternalApp: !Platform.isAndroid, + ), const SocialsMenuItemWidget("Mastodon", "https://mstdn.social/@ente/"), sectionOptionSpacing, const SocialsMenuItemWidget("Twitter", "https://twitter.com/enteio"), @@ -48,9 +61,15 @@ class SocialSectionWidget extends StatelessWidget { class SocialsMenuItemWidget extends StatelessWidget { final String text; - final String urlSring; - const SocialsMenuItemWidget(this.text, this.urlSring, {Key? key}) - : super(key: key); + final String url; + final bool launchInExternalApp; + + const SocialsMenuItemWidget( + this.text, + this.url, { + Key? key, + this.launchInExternalApp = true, + }) : super(key: key); @override Widget build(BuildContext context) { @@ -62,7 +81,12 @@ class SocialsMenuItemWidget extends StatelessWidget { trailingIcon: Icons.chevron_right_outlined, trailingIconIsMuted: true, onTap: () async { - launchUrlString(urlSring); + launchUrlString( + url, + mode: launchInExternalApp + ? LaunchMode.externalApplication + : LaunchMode.platformDefault, + ); }, ); } From 3f0cd893b2a1a1cd46b4bce6a5046eda30dc476c Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Fri, 11 Aug 2023 16:57:36 +0530 Subject: [PATCH 3/4] Bump version to 1.0.52+52 --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 8efbcbde6..364117823 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: ente_auth description: ente two-factor authenticator -version: 1.0.51+51 +version: 1.0.52+52 publish_to: none environment: From ace37543702533cd51f4a8ed5fa6a7ccb05c7cbe Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Fri, 11 Aug 2023 17:01:06 +0530 Subject: [PATCH 4/4] Update case --- lib/services/update_service.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/services/update_service.dart b/lib/services/update_service.dart index c8fc18ffb..7d0fd3314 100644 --- a/lib/services/update_service.dart +++ b/lib/services/update_service.dart @@ -99,7 +99,7 @@ class UpdateService { ); } return const Tuple2( - "app store", + "App Store", "https://apps.apple.com/in/app/ente-photos/id6444121398", ); }