From 88d427fd64f4a1e280648e571b3c7efa98482a6c Mon Sep 17 00:00:00 2001 From: Skyost Date: Sun, 6 Sep 2020 21:10:09 +0200 Subject: [PATCH] Bumped version and updated CHANGELOG. --- CHANGELOG.md | 5 +++ android/build.gradle | 2 +- example/ios/Podfile.lock | 2 +- example/lib/content.dart | 29 +++++++++++----- example/lib/custom_condition.dart | 30 +++++++++++----- example/lib/main.dart | 57 ++++++++++++++++--------------- example/pubspec.lock | 2 +- ios/rate_my_app.podspec | 2 +- pubspec.yaml | 2 +- 9 files changed, 82 insertions(+), 49 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a3555d..f298df4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.7.1 + +* Disabled Android native review dialog by default. +* Various fixes on Android platforms (thanks [in_app_review](https://github.com/britannio/in_app_review)). + ## 0.7.0+1 * Added some extra debugging info on Android. diff --git a/android/build.gradle b/android/build.gradle index 908282b..29566c2 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ group 'fr.skyost.rate_my_app' -version '0.7.0' +version '0.7.1' buildscript { ext.kotlin_version = '1.3.50' diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 703d36e..f3aa410 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1,6 +1,6 @@ PODS: - Flutter (1.0.0) - - rate_my_app (0.7.0): + - rate_my_app (0.7.1): - Flutter - shared_preferences (0.0.1): - Flutter diff --git a/example/lib/content.dart b/example/lib/content.dart index e86c703..08a6362 100644 --- a/example/lib/content.dart +++ b/example/lib/content.dart @@ -38,13 +38,15 @@ class _ContentWidgetState extends State { children: [ for (DebuggableCondition condition in debuggableConditions) // textCenter(condition.valuesAsString), - textCenter('Are conditions met ? ' + (shouldOpenDialog ? 'Yes' : 'No')), + textCenter( + 'Are conditions met ? ' + (shouldOpenDialog ? 'Yes' : 'No')), Padding( padding: const EdgeInsets.only(top: 10), child: RaisedButton( child: const Text('Launch "Rate my app" dialog'), onPressed: () async { - await widget.rateMyApp.showRateDialog(context); // We launch the default Rate my app dialog. + await widget.rateMyApp.showRateDialog( + context); // We launch the default Rate my app dialog. refresh(); }, ), @@ -52,14 +54,18 @@ class _ContentWidgetState extends State { RaisedButton( child: const Text('Launch "Rate my app" star dialog'), onPressed: () async { - await widget.rateMyApp.showStarRateDialog(context, actionsBuilder: (_, stars) => starRateDialogActionsBuilder(context, stars)); // We launch the Rate my app dialog with stars. + await widget.rateMyApp.showStarRateDialog(context, + actionsBuilder: (_, stars) => starRateDialogActionsBuilder( + context, + stars)); // We launch the Rate my app dialog with stars. refresh(); }, ), RaisedButton( child: const Text('Reset'), onPressed: () async { - await widget.rateMyApp.reset(); // We reset all Rate my app conditions values. + await widget.rateMyApp + .reset(); // We reset all Rate my app conditions values. refresh(); }, ), @@ -76,12 +82,14 @@ class _ContentWidgetState extends State { /// Allows to refresh the widget state. void refresh() { setState(() { - debuggableConditions = widget.rateMyApp.conditions.whereType().toList(); + debuggableConditions = + widget.rateMyApp.conditions.whereType().toList(); shouldOpenDialog = widget.rateMyApp.shouldOpenDialog; }); } - List starRateDialogActionsBuilder(BuildContext context, double stars) { + List starRateDialogActionsBuilder( + BuildContext context, double stars) { final Widget cancelButton = RateMyAppNoButton( // We create a custom "Cancel" button using the RateMyAppNoButton class. widget.rateMyApp, @@ -121,7 +129,8 @@ class _ContentWidgetState extends State { return [ FlatButton( - child: Text(MaterialLocalizations.of(context).okButtonLabel.toUpperCase()), + child: + Text(MaterialLocalizations.of(context).okButtonLabel.toUpperCase()), onPressed: () async { print(message); Scaffold.of(context).showSnackBar( @@ -132,8 +141,10 @@ class _ContentWidgetState extends State { ); // This allow to mimic a click on the default "Rate" button and thus update the conditions based on it ("Do not open again" condition for example) : - await widget.rateMyApp.callEvent(RateMyAppEventType.rateButtonPressed); - Navigator.pop(context, RateMyAppDialogButton.rate); + await widget.rateMyApp + .callEvent(RateMyAppEventType.rateButtonPressed); + Navigator.pop( + context, RateMyAppDialogButton.rate); refresh(); }, ), diff --git a/example/lib/custom_condition.dart b/example/lib/custom_condition.dart index b69bff8..2a3137c 100644 --- a/example/lib/custom_condition.dart +++ b/example/lib/custom_condition.dart @@ -25,17 +25,23 @@ class MaxDialogOpeningCondition extends DebuggableCondition { assert(maxStarDialogOpeningCount != null); @override - void readFromPreferences(SharedPreferences preferences, String preferencesPrefix) { + void readFromPreferences( + SharedPreferences preferences, String preferencesPrefix) { // Here we can read the values (or we set their default values). - dialogOpeningCount = preferences.getInt(preferencesPrefix + 'dialogOpeningCount') ?? 0; - starDialogOpeningCount = preferences.getInt(preferencesPrefix + 'starDialogOpeningCount') ?? 0; + dialogOpeningCount = + preferences.getInt(preferencesPrefix + 'dialogOpeningCount') ?? 0; + starDialogOpeningCount = + preferences.getInt(preferencesPrefix + 'starDialogOpeningCount') ?? 0; } @override - Future saveToPreferences(SharedPreferences preferences, String preferencesPrefix) async { + Future saveToPreferences( + SharedPreferences preferences, String preferencesPrefix) async { // Here we save our current values. - await preferences.setInt(preferencesPrefix + 'dialogOpeningCount', dialogOpeningCount); - return preferences.setInt(preferencesPrefix + 'starDialogOpeningCount', starDialogOpeningCount); + await preferences.setInt( + preferencesPrefix + 'dialogOpeningCount', dialogOpeningCount); + return preferences.setInt( + preferencesPrefix + 'starDialogOpeningCount', starDialogOpeningCount); } @override @@ -65,12 +71,20 @@ class MaxDialogOpeningCondition extends DebuggableCondition { @override String get valuesAsString { // Allows to easily debug this condition. - return 'Dialog opening count : ' + dialogOpeningCount.toString() + '\nMax dialog opening count : ' + maxDialogOpeningCount.toString() + 'Star dialog opening count : ' + starDialogOpeningCount.toString() + '\nMax star dialog opening count : ' + maxStarDialogOpeningCount.toString(); + return 'Dialog opening count : ' + + dialogOpeningCount.toString() + + '\nMax dialog opening count : ' + + maxDialogOpeningCount.toString() + + 'Star dialog opening count : ' + + starDialogOpeningCount.toString() + + '\nMax star dialog opening count : ' + + maxStarDialogOpeningCount.toString(); } @override bool get isMet { // This allows to check whether this condition is met in its current state. - return dialogOpeningCount <= maxDialogOpeningCount && starDialogOpeningCount <= maxStarDialogOpeningCount; + return dialogOpeningCount <= maxDialogOpeningCount && + starDialogOpeningCount <= maxStarDialogOpeningCount; } } diff --git a/example/lib/main.dart b/example/lib/main.dart index 711d1f7..c940fc3 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -4,7 +4,8 @@ import 'package:rate_my_app_example/content.dart'; /// First plugin test method. void main() { - WidgetsFlutterBinding.ensureInitialized(); // This allows to use async methods in the main method without any problem. + WidgetsFlutterBinding + .ensureInitialized(); // This allows to use async methods in the main method without any problem. runApp(const _RateMyAppTestApp()); } @@ -21,35 +22,37 @@ class _RateMyAppTestApp extends StatefulWidget { class _RateMyAppTestAppState extends State<_RateMyAppTestApp> { /// The widget builder. WidgetBuilder builder = buildProgressIndicator; - + @override Widget build(BuildContext context) => MaterialApp( - home: Scaffold( - appBar: AppBar( - title: const Text('Rate my app !'), - ), - body: RateMyAppBuilder( - builder: builder, - onInitialized: (context, rateMyApp) { - setState(() => builder = (context) => ContentWidget(rateMyApp: rateMyApp)); - rateMyApp.conditions.forEach((condition) { - if (condition is DebuggableCondition) { - print(condition.valuesAsString); // We iterate through our list of conditions and we print all debuggable ones. - } - }); + home: Scaffold( + appBar: AppBar( + title: const Text('Rate my app !'), + ), + body: RateMyAppBuilder( + builder: builder, + onInitialized: (context, rateMyApp) { + setState(() => + builder = (context) => ContentWidget(rateMyApp: rateMyApp)); + rateMyApp.conditions.forEach((condition) { + if (condition is DebuggableCondition) { + print(condition + .valuesAsString); // We iterate through our list of conditions and we print all debuggable ones. + } + }); - print('Are all conditions met ? ' + (rateMyApp.shouldOpenDialog ? 'Yes' : 'No')); + print('Are all conditions met ? ' + + (rateMyApp.shouldOpenDialog ? 'Yes' : 'No')); - if (rateMyApp.shouldOpenDialog) { - rateMyApp.showRateDialog(context); - } - }, + if (rateMyApp.shouldOpenDialog) { + rateMyApp.showRateDialog(context); + } + }, + ), ), - ), - ); - + ); + /// Builds the progress indicator, allowing to wait for Rate my app to initialize. - static Widget buildProgressIndicator(BuildContext context) => const Center( - child: CircularProgressIndicator() - ); -} \ No newline at end of file + static Widget buildProgressIndicator(BuildContext context) => + const Center(child: CircularProgressIndicator()); +} diff --git a/example/pubspec.lock b/example/pubspec.lock index 2a16fe9..513b00b 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -155,7 +155,7 @@ packages: path: ".." relative: true source: path - version: "0.7.0+1" + version: "0.7.1" shared_preferences: dependency: transitive description: diff --git a/ios/rate_my_app.podspec b/ios/rate_my_app.podspec index 173d8c9..419720e 100644 --- a/ios/rate_my_app.podspec +++ b/ios/rate_my_app.podspec @@ -4,7 +4,7 @@ # Pod::Spec.new do |s| s.name = 'rate_my_app' - s.version = '0.7.0' + s.version = '0.7.1' s.summary = 'Allows to kindly ask users to rate your app if custom conditions are met (eg. install time, number of launches, etc...).' s.description = <<-DESC Allows to kindly ask users to rate your app if custom conditions are met (eg. install time, number of launches, etc...). diff --git a/pubspec.yaml b/pubspec.yaml index 4c9bebe..4092242 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: rate_my_app description: Allows to kindly ask users to rate your app if custom conditions are met (eg. install time, number of launches, etc...). -version: 0.7.0+1 # Remember to also change the version in "ios/bonsoir.podspec", "macos/bonsoir.podspec", and "android/build.gradle". +version: 0.7.1 # Remember to also change the version in "ios/bonsoir.podspec", "macos/bonsoir.podspec", and "android/build.gradle". homepage: https://github.com/Skyost/RateMyApp environment: