From ceb0be123e239a2b88e25463d200e409fce20d52 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Wed, 9 Jul 2025 22:04:54 +0200 Subject: [PATCH] Implement native rating dialog --- lib/core/globals.dart | 8 ++++++++ lib/presentation/views/main_menu_view.dart | 8 ++++++++ pubspec.yaml | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/core/globals.dart b/lib/core/globals.dart index e11a118..6bfd077 100644 --- a/lib/core/globals.dart +++ b/lib/core/globals.dart @@ -1,3 +1,11 @@ +import 'package:rate_my_app/rate_my_app.dart'; + class Globals { static String appDevPhase = 'Beta'; + static RateMyApp rateMyApp = RateMyApp( + appStoreIdentifier: '6747105718', + minDays: 15, + remindDays: 45, + minLaunches: 15, + remindLaunches: 40); } diff --git a/lib/presentation/views/main_menu_view.dart b/lib/presentation/views/main_menu_view.dart index 425cf46..05665ce 100644 --- a/lib/presentation/views/main_menu_view.dart +++ b/lib/presentation/views/main_menu_view.dart @@ -1,4 +1,5 @@ import 'package:cabo_counter/core/custom_theme.dart'; +import 'package:cabo_counter/core/globals.dart'; import 'package:cabo_counter/data/game_manager.dart'; import 'package:cabo_counter/l10n/app_localizations.dart'; import 'package:cabo_counter/presentation/views/active_game_view.dart'; @@ -29,6 +30,13 @@ class _MainMenuViewState extends State { }); }); gameManager.addListener(_updateView); + + WidgetsBinding.instance.addPostFrameCallback((_) async { + await Globals.rateMyApp.init(); + if (mounted && Globals.rateMyApp.shouldOpenDialog) { + Globals.rateMyApp.showStarRateDialog(context); + } + }); } void _updateView() { diff --git a/pubspec.yaml b/pubspec.yaml index 175eebe..92ed456 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: cabo_counter description: "Mobile app for the card game Cabo" publish_to: 'none' -version: 0.4.0+382 +version: 0.4.0+411 environment: sdk: ^3.5.4