Add in-app review prompt

This commit is contained in:
Tommy Chow 2023-05-03 22:19:24 -04:00
parent c8d3974b5f
commit b98dd967cb
4 changed files with 57 additions and 2 deletions

View file

@ -1,4 +1,6 @@
PODS:
- advanced_in_app_review (0.0.1):
- Flutter
- device_info_plus (0.0.1):
- Flutter
- Firebase/Analytics (10.7.0):
@ -146,6 +148,8 @@ PODS:
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (7.11.1):
- GoogleUtilities/Logger
- in_app_review (0.2.0):
- Flutter
- nanopb (2.30909.0):
- nanopb/decode (= 2.30909.0)
- nanopb/encode (= 2.30909.0)
@ -173,6 +177,7 @@ PODS:
- Flutter
DEPENDENCIES:
- advanced_in_app_review (from `.symlinks/plugins/advanced_in_app_review/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
@ -181,6 +186,7 @@ DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- in_app_review (from `.symlinks/plugins/in_app_review/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
@ -211,6 +217,8 @@ SPEC REPOS:
- PromisesSwift
EXTERNAL SOURCES:
advanced_in_app_review:
:path: ".symlinks/plugins/advanced_in_app_review/ios"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
firebase_analytics:
@ -227,6 +235,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_native_splash/ios"
flutter_secure_storage:
:path: ".symlinks/plugins/flutter_secure_storage/ios"
in_app_review:
:path: ".symlinks/plugins/in_app_review/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_foundation:
@ -243,6 +253,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"
SPEC CHECKSUMS:
advanced_in_app_review: fe8fd50b8670cb3dbe67e4c26ca643f7aea8dbb8
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
Firebase: 0219acf760880eeec8ce479895bd7767466d9f81
firebase_analytics: e8e294333de66e5429d4aac365966281b4dbfb7d
@ -266,6 +277,7 @@ SPEC CHECKSUMS:
GoogleAppMeasurement: fe17c92a32207dd5cdd4e8d742767f2da74857f6
GoogleDataTransport: 8378d1fa8ac49753ea6ce70d65a7cb70ce5f66e6
GoogleUtilities: 9aa0ad5a7bc171f8bae016300bfcfa3fb8425749
in_app_review: 318597b3a06c22bb46dc454d56828c85f444f99d
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852

View file

@ -1,6 +1,7 @@
import 'dart:convert';
import 'dart:io';
import 'package:advanced_in_app_review/advanced_in_app_review.dart';
import 'package:device_preview/device_preview.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
@ -214,7 +215,7 @@ final oledTheme = ThemeData(
snackBarTheme: snackBarTheme,
);
class MyApp extends StatelessWidget {
class MyApp extends StatefulWidget {
final bool firstRun;
const MyApp({
@ -222,6 +223,23 @@ class MyApp extends StatelessWidget {
this.firstRun = false,
}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
AdvancedInAppReview()
.setMinDaysBeforeRemind(7)
.setMinDaysAfterInstall(1)
.setMinLaunchTimes(5)
.setMinSecondsBeforeShowDialog(3)
.monitor();
}
@override
Widget build(BuildContext context) {
return Observer(
@ -242,7 +260,7 @@ class MyApp extends StatelessWidget {
: settingsStore.themeType == ThemeType.light
? ThemeMode.light
: ThemeMode.dark,
home: firstRun ? const OnboardingIntro() : const Home(),
home: widget.firstRun ? const OnboardingIntro() : const Home(),
navigatorKey: navigatorKey,
);
},

View file

@ -17,6 +17,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.1"
advanced_in_app_review:
dependency: "direct main"
description:
name: advanced_in_app_review
sha256: "7b544b1224d4c5b6fe0b204fdc06d47e573580c43746718b04c2be89f97e3897"
url: "https://pub.dev"
source: hosted
version: "1.1.3"
analyzer:
dependency: transitive
description:
@ -581,6 +589,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.3.0"
in_app_review:
dependency: transitive
description:
name: in_app_review
sha256: "16328b8202d36522322b95804ae5d975577aa9f584d634985849ba1099645850"
url: "https://pub.dev"
source: hosted
version: "2.0.6"
in_app_review_platform_interface:
dependency: transitive
description:
name: in_app_review_platform_interface
sha256: b12ec9aaf6b34d3a72aa95895eb252b381896246bdad4ef378d444affe8410ef
url: "https://pub.dev"
source: hosted
version: "2.0.4"
intl:
dependency: "direct main"
description:

View file

@ -62,6 +62,7 @@ dependencies:
firebase_crashlytics: ^3.1.2
firebase_performance: ^0.9.1+1
firebase_analytics: ^10.2.1
advanced_in_app_review: ^1.1.3
dev_dependencies:
flutter_test: