Skip to content

armgit / ente

Public Imported from GitHub
0

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

Share app engagement section across mobile apps

Neeraj Gupta5f8eb3c2f932
diff --git a/mobile/apps/auth/lib/services/review_service.dart b/mobile/apps/auth/lib/services/review_service.dart
new file mode 100644
index 0000000000..e74ea29cd7
--- /dev/null
+++ b/mobile/apps/auth/lib/services/review_service.dart
@@ -0,0 +1,15 @@
+import 'dart:io';
+
+import 'package:flutter/services.dart' show appFlavor;
+
+abstract final class ReviewService {
+ static String get url {
+ if (Platform.isIOS) {
+ return 'https://apps.apple.com/app/id6444121398';
+ }
+ if (Platform.isAndroid && appFlavor == 'playstore') {
+ return 'https://play.google.com/store/apps/details?id=io.ente.auth';
+ }
+ return 'https://alternativeto.net/software/ente-authenticator/about/';
+ }
+}
diff --git a/mobile/apps/auth/lib/services/update_service.dart b/mobile/apps/auth/lib/services/update_service.dart
index 2aedc5a40d..4e65642d87 100644
--- a/mobile/apps/auth/lib/services/update_service.dart
+++ b/mobile/apps/auth/lib/services/update_service.dart
@@ -9,8 +9,6 @@ import 'package:flutter/services.dart' show appFlavor;
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';
-import 'package:url_launcher/url_launcher_string.dart';
class UpdateService {
UpdateService._privateConstructor();
@@ -95,47 +93,6 @@ class UpdateService {
return LatestVersionInfo.fromMap(response.data["latestVersion"]);
}
- // getRateDetails returns details about the place
- Tuple2<String, String> getRateDetails() {
- if (Platform.isAndroid) {
- // 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 (appFlavor == "playstore") {
- return const Tuple2("Play Store", "market://details?id=io.ente.auth");
- }
- return const Tuple2(
- "AlternativeTo",
- "https://alternativeto.net/software/ente-authenticator/about/",
- );
- }
- if (Platform.isIOS) {
- return const Tuple2(
- "App Store",
- "https://apps.apple.com/in/app/ente-photos/id6444121398",
- );
- }
- return const Tuple2(
- "AlternativeTo",
- "https://alternativeto.net/software/ente-authenticator/about/",
- );
- }
-
- Future<void> launchReviewUrl() async {
- final String url = getRateDetails().item2;
- try {
- await launchUrlString(url, mode: LaunchMode.externalApplication);
- } catch (e) {
- _logger.severe("Failed top open launch url $url", e);
- // Fall back if we fail to open play-store market app on android
- if (Platform.isAndroid && url.startsWith("market://")) {
- launchUrlString(
- "https://play.google.com/store/apps/details?id=io.ente.auth",
- mode: LaunchMode.externalApplication,
- ).ignore();
- }
- }
- }
-
bool supportsInAppUpdates() {
return appFlavor == "independent" || PlatformDetector.isDesktop();
}
diff --git a/mobile/apps/auth/lib/ui/components/banner_widget.dart b/mobile/apps/auth/lib/ui/components/banner_widget.dart
index 29460b7301..32826c2ead 100644
--- a/mobile/apps/auth/lib/ui/components/banner_widget.dart
+++ b/mobile/apps/auth/lib/ui/components/banner_widget.dart
@@ -1,10 +1,10 @@
import 'package:dotted_border/dotted_border.dart';
-import 'package:ente_auth/services/update_service.dart';
+import 'package:ente_auth/services/review_service.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import 'package:flutter/material.dart';
import 'package:styled_text/tags/styled_text_tag.dart';
import 'package:styled_text/widgets/styled_text.dart';
-import 'package:url_launcher/url_launcher.dart';
+import 'package:url_launcher/url_launcher_string.dart';
enum BannerType { rateUs, starUs, freeStorage, discount }
@@ -31,13 +31,11 @@ class BannerWidget extends StatelessWidget {
Color dashColor;
List<BoxShadow>? boxShadow;
String imagePath;
- Uri? url;
- final result = UpdateService.instance.getRateDetails();
- final String rateUrl = result.item2;
+ String? url;
switch (type) {
case BannerType.rateUs:
- url = Uri.parse(rateUrl);
+ url = ReviewService.url;
imagePath = "assets/rate_us.png";
dashColor = const Color.fromRGBO(255, 191, 12, 1);
boxShadow = [
@@ -54,7 +52,7 @@ class BannerWidget extends StatelessWidget {
break;
case BannerType.starUs:
- url = Uri.parse("https://github.com/ente/ente");
+ url = "https://github.com/ente/ente";
imagePath = "assets/star_us.png";
dashColor = const Color.fromRGBO(233, 233, 233, 1);
boxShadow = [
@@ -108,9 +106,9 @@ class BannerWidget extends StatelessWidget {
break;
}
return GestureDetector(
- onTap: () {
- url != null ? launchUrl(url) : null;
- },
+ onTap: url == null
+ ? null
+ : () => launchUrlString(url!, mode: LaunchMode.externalApplication),
child: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(50)),
child: DottedBorder(
diff --git a/mobile/apps/auth/lib/ui/settings/about_settings_page.dart b/mobile/apps/auth/lib/ui/settings/about_settings_page.dart
index 1ff90f9f12..7221e98d55 100644
--- a/mobile/apps/auth/lib/ui/settings/about_settings_page.dart
+++ b/mobile/apps/auth/lib/ui/settings/about_settings_page.dart
@@ -33,13 +33,6 @@ class AboutSettingsPage extends StatelessWidget {
onTap: () => PlatformUtil.openUrlInBrowser('https://ente.com/blog'),
),
const SizedBox(height: Spacing.sm),
- SettingsItem(
- title: l10n.merchandise,
- icon: HugeIcons.strokeRoundedShoppingBag01,
- showOnlyLoadingState: true,
- onTap: () => PlatformUtil.openUrlInBrowser('https://shop.ente.com'),
- ),
- const SizedBox(height: Spacing.sm),
SettingsItem(
title: l10n.privacy,
icon: HugeIcons.strokeRoundedShield01,
diff --git a/mobile/apps/auth/lib/ui/settings/notification_banner_widget.dart b/mobile/apps/auth/lib/ui/settings/notification_banner_widget.dart
index 3b3a58db28..c13ffddff4 100644
--- a/mobile/apps/auth/lib/ui/settings/notification_banner_widget.dart
+++ b/mobile/apps/auth/lib/ui/settings/notification_banner_widget.dart
@@ -2,7 +2,6 @@ import 'package:ente_accounts/models/user_details.dart';
import 'package:ente_accounts/services/user_service.dart';
import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/services/preference_service.dart';
-import 'package:ente_auth/services/update_service.dart';
import 'package:ente_auth/ui/components/banner_widget.dart';
import 'package:ente_strings/ente_strings.dart';
import 'package:flutter/material.dart';
@@ -22,8 +21,7 @@ class NotificationBannerWidget extends StatelessWidget {
.difference(DateTime.fromMillisecondsSinceEpoch(appInstallTime))
.inDays;
final l10n = context.strings;
- final ratePlace = UpdateService.instance.getRateDetails().item1;
- final rateSubText = l10n.rateUsOnStore(storeName: ratePlace);
+ final rateSubText = l10n.rateUs;
if (Configuration.instance.hasConfiguredAccount()) {
return FutureBuilder<UserDetails>(
diff --git a/mobile/apps/auth/lib/ui/settings/social_icons_row.dart b/mobile/apps/auth/lib/ui/settings/social_icons_row.dart
index 4d38f8b416..bfcf15881d 100644
--- a/mobile/apps/auth/lib/ui/settings/social_icons_row.dart
+++ b/mobile/apps/auth/lib/ui/settings/social_icons_row.dart
@@ -1,9 +1,6 @@
import 'dart:io';
-import 'package:ente_auth/services/update_service.dart';
import 'package:ente_components/ente_components.dart';
-import 'package:ente_pure_utils/ente_pure_utils.dart';
-import 'package:ente_strings/ente_strings.dart';
import 'package:flutter/material.dart';
import 'package:hugeicons/hugeicons.dart';
import 'package:url_launcher/url_launcher_string.dart';
@@ -13,40 +10,32 @@ class SocialIconsRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final rateDetails = UpdateService.instance.getRateDetails();
- final links = <_SocialLink>[
- if (PlatformDetector.isMobile())
- _SocialLink(
- label: context.strings.rateUsOnStore(storeName: rateDetails.item1),
- identifier: 'auth_settings_rate',
- icon: HugeIcons.strokeRoundedStar,
- url: rateDetails.item2,
- ),
- const _SocialLink(
+ const links = <_SocialLink>[
+ _SocialLink(
label: 'Discord',
identifier: 'auth_settings_social_discord',
icon: HugeIcons.strokeRoundedDiscord,
url: 'https://ente.com/discord',
),
- const _SocialLink(
+ _SocialLink(
label: 'GitHub',
identifier: 'auth_settings_social_github',
icon: HugeIcons.strokeRoundedGithub,
url: 'https://github.com/ente/ente',
),
- const _SocialLink(
+ _SocialLink(
label: 'X',
identifier: 'auth_settings_social_x',
icon: HugeIcons.strokeRoundedNewTwitter,
url: 'https://twitter.com/enteio',
),
- const _SocialLink(
+ _SocialLink(
label: 'Mastodon',
identifier: 'auth_settings_social_mastodon',
icon: HugeIcons.strokeRoundedMastodon,
url: 'https://fosstodon.org/@ente',
),
- const _SocialLink(
+ _SocialLink(
label: 'Reddit',
identifier: 'auth_settings_social_reddit',
icon: HugeIcons.strokeRoundedReddit,
diff --git a/mobile/apps/auth/lib/ui/settings_page.dart b/mobile/apps/auth/lib/ui/settings_page.dart
index 8d2dfb979d..1f825eeafa 100644
--- a/mobile/apps/auth/lib/ui/settings_page.dart
+++ b/mobile/apps/auth/lib/ui/settings_page.dart
@@ -3,6 +3,7 @@ import 'dart:io';
import 'package:ente_accounts/services/user_service.dart';
import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/onboarding/view/onboarding_page.dart';
+import 'package:ente_auth/services/review_service.dart';
import 'package:ente_auth/store/code_store.dart';
import 'package:ente_auth/ui/components/buttons/button_widget.dart';
import 'package:ente_auth/ui/settings/about_settings_page.dart';
@@ -24,6 +25,7 @@ import 'package:ente_auth/utils/dialog_util.dart';
import 'package:ente_components/ente_components.dart';
import 'package:ente_lock_screen/local_authentication_service.dart';
import 'package:ente_strings/ente_strings.dart';
+import 'package:ente_ui/components/settings/app_engagement_section.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:hugeicons/hugeicons.dart';
@@ -128,6 +130,8 @@ class SettingsPage extends StatelessWidget {
onTap: () => pushAuthSettingsPage(context, const GeneralSettingsPage()),
),
const SizedBox(height: Spacing.sm),
+ AppEngagementSection(reviewUrl: ReviewService.url),
+ const SizedBox(height: Spacing.sm),
SettingsItem(
title: l10n.support,
icon: HugeIcons.strokeRoundedHelpCircle,
diff --git a/mobile/apps/auth/pubspec.yaml b/mobile/apps/auth/pubspec.yaml
index 3b28abc63b..4c4fb97304 100644
--- a/mobile/apps/auth/pubspec.yaml
+++ b/mobile/apps/auth/pubspec.yaml
@@ -131,7 +131,6 @@ dependencies:
step_progress_indicator: 1.0.2
styled_text: 8.1.0
tray_manager: 0.5.2
- tuple: 2.0.2
url_launcher: 6.3.2
url_launcher_ios: 6.4.1
uuid: 4.5.3
diff --git a/mobile/apps/locker/lib/services/review_service.dart b/mobile/apps/locker/lib/services/review_service.dart
new file mode 100644
index 0000000000..877dbd818f
--- /dev/null
+++ b/mobile/apps/locker/lib/services/review_service.dart
@@ -0,0 +1,15 @@
+import 'dart:io';
+
+import 'package:locker/services/update_service.dart';
+
+abstract final class ReviewService {
+ static String get url {
+ if (Platform.isIOS) {
+ return 'https://apps.apple.com/app/ente-locker/id6747611956';
+ }
+ if (UpdateService.instance.isPlayStoreFlavor()) {
+ return 'https://play.google.com/store/apps/details?id=io.ente.locker';
+ }
+ return 'https://alternativeto.net/software/ente-locker/about/';
+ }
+}
diff --git a/mobile/apps/locker/lib/ui/settings/settings_page.dart b/mobile/apps/locker/lib/ui/settings/settings_page.dart
index e8afff18ef..c27e3adda2 100644
--- a/mobile/apps/locker/lib/ui/settings/settings_page.dart
+++ b/mobile/apps/locker/lib/ui/settings/settings_page.dart
@@ -3,9 +3,11 @@ import "dart:io";
import "package:ente_accounts/services/user_service.dart";
import "package:ente_components/ente_components.dart";
import "package:ente_strings/ente_strings.dart";
+import "package:ente_ui/components/settings/app_engagement_section.dart";
import "package:flutter/foundation.dart";
import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
+import "package:locker/services/review_service.dart";
import "package:locker/ui/settings/pages/about_page.dart";
import "package:locker/ui/settings/pages/account_settings_page.dart";
import "package:locker/ui/settings/pages/general_settings_page.dart";
@@ -68,6 +70,9 @@ class SettingsWidget extends StatelessWidget {
);
contents.add(itemSpacing);
+ contents.add(AppEngagementSection(reviewUrl: ReviewService.url));
+ contents.add(itemSpacing);
+
contents.add(
SettingsItem(
icon: HugeIcons.strokeRoundedHelpCircle,
diff --git a/mobile/apps/photos/lib/services/review_service.dart b/mobile/apps/photos/lib/services/review_service.dart
new file mode 100644
index 0000000000..653edd8452
--- /dev/null
+++ b/mobile/apps/photos/lib/services/review_service.dart
@@ -0,0 +1,20 @@
+import 'dart:io';
+
+import 'package:photos/service_locator.dart';
+import 'package:url_launcher/url_launcher_string.dart';
+
+abstract final class ReviewService {
+ static String get url {
+ if (Platform.isIOS) {
+ return 'https://apps.apple.com/app/ente-photos/id1542026904';
+ }
+ if (updateService.isPlayStoreFlavor()) {
+ return 'https://play.google.com/store/apps/details?id=io.ente.photos';
+ }
+ return 'https://alternativeto.net/software/ente/about/';
+ }
+
+ static Future<void> launch() {
+ return launchUrlString(url, mode: LaunchMode.externalApplication);
+ }
+}
diff --git a/mobile/apps/photos/lib/services/update_service.dart b/mobile/apps/photos/lib/services/update_service.dart
index 1d3921d1d4..496e7b98c1 100644
--- a/mobile/apps/photos/lib/services/update_service.dart
+++ b/mobile/apps/photos/lib/services/update_service.dart
@@ -10,8 +10,6 @@ import "package:photos/services/language_service.dart";
import 'package:photos/services/notification_service.dart';
import 'package:photos/ui/notification/update/change_log_strings.dart';
import 'package:shared_preferences/shared_preferences.dart';
-import 'package:tuple/tuple.dart';
-import 'package:url_launcher/url_launcher_string.dart';
enum ChangeLogAction { skip, consumeWithoutShowing, show }
@@ -175,43 +173,6 @@ class UpdateService {
}
return !isIndependentFlavor() && !isFDroidFlavor();
}
-
- // getRateDetails returns details about the place
- Tuple2<String, String> getRateDetails() {
- if (isFDroidFlavor() || isIndependentFlavor()) {
- return const Tuple2(
- "AlternativeTo",
- "https://alternativeto.net/software/ente/about/",
- );
- }
- return Platform.isAndroid
- ? const Tuple2(
- "Google Play",
- "https://play.google.com/store/apps/details?id=io.ente.photos",
- )
- : const Tuple2(
- "App Store",
- "https://apps.apple.com/in/app/ente-photos/id1542026904",
- );
- }
-
- Future<void> launchReviewUrl() async {
- // TODO: Replace with https://pub.dev/packages/in_app_review
- final String url = getRateDetails().item2;
- try {
- await launchUrlString(url, mode: LaunchMode.externalApplication);
- } catch (e) {
- _logger.severe("Failed top open launch url $url", e);
- // Fall back if we fail to open play-store market app on android
- if (Platform.isAndroid && url.startsWith("market://")) {
- launchUrlString(
- "https://play.google.com/store/apps/details?id=io"
- ".ente.photos",
- mode: LaunchMode.externalApplication,
- ).ignore();
- }
- }
- }
}
class LatestVersionInfo {
diff --git a/mobile/apps/photos/lib/ui/notification/update/change_log_page.dart b/mobile/apps/photos/lib/ui/notification/update/change_log_page.dart
index 4000bbf0a0..40cb0c7f52 100644
--- a/mobile/apps/photos/lib/ui/notification/update/change_log_page.dart
+++ b/mobile/apps/photos/lib/ui/notification/update/change_log_page.dart
@@ -3,6 +3,7 @@ import "package:ente_strings/ente_strings.dart";
import 'package:flutter/material.dart';
import 'package:hugeicons/hugeicons.dart';
import "package:photos/service_locator.dart";
+import "package:photos/services/review_service.dart";
import 'package:photos/ui/notification/update/change_log_entry.dart';
import 'package:photos/ui/notification/update/change_log_strings.dart';
@@ -60,7 +61,7 @@ class _ChangeLogPageState extends State<ChangeLogPage> {
shouldSurfaceExecutionStates: false,
onTap: () async {
if (isLocalGallery) {
- await updateService.launchReviewUrl();
+ await ReviewService.launch();
} else if (Navigator.of(context).canPop()) {
Navigator.of(context).pop(ChangeLogPageAction.openReferrals);
}
diff --git a/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart b/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart
index 070a191684..4d813fb7d4 100644
--- a/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart
+++ b/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart
@@ -13,6 +13,7 @@ import "package:photos/service_locator.dart";
import "package:photos/services/collections_service.dart";
import "package:photos/services/deduplication_service.dart";
import "package:photos/services/files_service.dart";
+import "package:photos/services/review_service.dart";
import "package:photos/ui/components/models/button_type.dart";
import "package:photos/ui/notification/toast.dart";
import "package:photos/ui/tools/debug/app_storage_viewer.dart";
@@ -237,7 +238,7 @@ class _FreeUpSpaceOptionsScreenState extends State<FreeUpSpaceOptionsScreen> {
),
firstButtonLabel: context.strings.rateUs,
firstButtonOnTap: () async {
- await updateService.launchReviewUrl();
+ await ReviewService.launch();
},
firstButtonType: ButtonType.primary,
secondButtonLabel: context.strings.ok,
@@ -288,7 +289,7 @@ class _FreeUpSpaceOptionsScreenState extends State<FreeUpSpaceOptionsScreen> {
),
firstButtonLabel: context.strings.rateUs,
firstButtonOnTap: () async {
- await updateService.launchReviewUrl();
+ await ReviewService.launch();
},
firstButtonType: ButtonType.primary,
secondButtonLabel: context.strings.ok,
diff --git a/mobile/apps/photos/lib/ui/settings_page.dart b/mobile/apps/photos/lib/ui/settings_page.dart
index cc492c5c6d..973e376929 100644
--- a/mobile/apps/photos/lib/ui/settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings_page.dart
@@ -2,6 +2,7 @@ import "package:ente_components/ente_components.dart";
import "package:ente_lock_screen/local_authentication_service.dart";
import "package:ente_pure_utils/ente_pure_utils.dart";
import "package:ente_strings/ente_strings.dart";
+import "package:ente_ui/components/settings/app_engagement_section.dart";
import "package:flutter/foundation.dart";
import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
@@ -11,6 +12,7 @@ import "package:photos/emergency/emergency_page.dart";
import "package:photos/models/user_details.dart";
import "package:photos/service_locator.dart";
import "package:photos/services/account/user_service.dart";
+import "package:photos/services/review_service.dart";
import "package:photos/ui/account/email_entry_page.dart";
import "package:photos/ui/account/login_page.dart";
import "package:photos/ui/components/banners/offline_settings_banner.dart";
@@ -38,7 +40,6 @@ import "package:photos/ui/settings/support/help_support_page.dart";
import "package:photos/ui/settings/widget_settings_screen.dart";
import "package:photos/ui/sharing/verify_identity_dialog.dart";
import "package:photos/utils/dialog_util.dart";
-import "package:url_launcher/url_launcher_string.dart";
class SettingsPage extends StatelessWidget {
final ValueNotifier<String?> emailNotifier;
@@ -149,7 +150,7 @@ class _SettingsBody extends StatelessWidget {
const SizedBox(height: 8),
],
// Engagement section
- _buildEngagementCard(context),
+ AppEngagementSection(reviewUrl: ReviewService.url),
const SizedBox(height: 8),
// Support section
_buildMenuItem(
@@ -457,31 +458,6 @@ class _SettingsBody extends StatelessWidget {
);
}
- Widget _buildEngagementCard(BuildContext context) {
- return MenuGroupComponent(
- items: [
- _buildMenuItem(
- title: context.strings.merchandise,
- icon: HugeIcons.strokeRoundedTShirt,
- onTap: () async {
- await launchUrlString(
- "https://shop.ente.com",
- mode: LaunchMode.externalApplication,
- );
- },
- ),
- _buildMenuItem(
- title: context.strings.rateUs,
- icon: HugeIcons.strokeRoundedStar,
- onTap: () async {
- final rateUrl = updateService.getRateDetails().item2;
- await launchUrlString(rateUrl);
- },
- ),
- ],
- );
- }
-
Widget _buildLogoutCard(BuildContext context) {
return _buildMenuItem(
title: context.strings.logout,
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
index be792cb622..622764e46f 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
@@ -27,6 +27,7 @@ import 'package:photos/module/download/gallery.dart';
import 'package:photos/service_locator.dart';
import 'package:photos/services/collections_service.dart';
import "package:photos/services/files_service.dart";
+import "package:photos/services/review_service.dart";
import "package:photos/states/location_screen_state.dart";
import "package:photos/theme/ente_theme.dart";
import 'package:photos/ui/actions/collection/collection_sharing_actions.dart';
@@ -424,7 +425,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
),
firstButtonLabel: context.strings.rateUs,
firstButtonOnTap: () async {
- await updateService.launchReviewUrl();
+ await ReviewService.launch();
},
firstButtonType: ButtonType.primary,
secondButtonLabel: context.strings.ok,
diff --git a/mobile/packages/ui/lib/components/settings/app_engagement_section.dart b/mobile/packages/ui/lib/components/settings/app_engagement_section.dart
new file mode 100644
index 0000000000..9126d7505e
--- /dev/null
+++ b/mobile/packages/ui/lib/components/settings/app_engagement_section.dart
@@ -0,0 +1,41 @@
+import 'package:ente_components/ente_components.dart';
+import 'package:ente_strings/ente_strings.dart';
+import 'package:flutter/material.dart';
+import 'package:hugeicons/hugeicons.dart';
+import 'package:url_launcher/url_launcher_string.dart';
+
+class AppEngagementSection extends StatelessWidget {
+ const AppEngagementSection({super.key, required this.reviewUrl});
+
+ final String reviewUrl;
+
+ static Future<void> _launchMerchandise() {
+ return _openExternalUrl('https://shop.ente.com');
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final strings = context.strings;
+
+ return MenuGroupComponent(
+ items: [
+ SettingsItem(
+ title: strings.merchandise,
+ icon: HugeIcons.strokeRoundedTShirt,
+ showOnlyLoadingState: true,
+ onTap: _launchMerchandise,
+ ),
+ SettingsItem(
+ title: strings.rateUs,
+ icon: HugeIcons.strokeRoundedStar,
+ showOnlyLoadingState: true,
+ onTap: () => _openExternalUrl(reviewUrl),
+ ),
+ ],
+ );
+ }
+
+ static Future<void> _openExternalUrl(String url) {
+ return launchUrlString(url, mode: LaunchMode.externalApplication);
+ }
+}
diff --git a/mobile/packages/ui/pubspec.yaml b/mobile/packages/ui/pubspec.yaml
index 59ba5d0d3b..79e00487a0 100644
--- a/mobile/packages/ui/pubspec.yaml
+++ b/mobile/packages/ui/pubspec.yaml
@@ -26,6 +26,7 @@ dependencies:
fluttertoast: 8.2.14
hugeicons: 1.1.7
modal_bottom_sheet: 3.0.0
+ url_launcher: 6.3.2
dev_dependencies:
flutter_lints: 6.0.0