Skip to content

Commit

Permalink
Bumped version and updated CHANGELOG.
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyost committed Sep 6, 2020
1 parent fa1cf79 commit 88d427f
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 49 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -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
Expand Down
29 changes: 20 additions & 9 deletions example/lib/content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,34 @@ class _ContentWidgetState extends State<ContentWidget> {
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();
},
),
),
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();
},
),
Expand All @@ -76,12 +82,14 @@ class _ContentWidgetState extends State<ContentWidget> {
/// Allows to refresh the widget state.
void refresh() {
setState(() {
debuggableConditions = widget.rateMyApp.conditions.whereType<DebuggableCondition>().toList();
debuggableConditions =
widget.rateMyApp.conditions.whereType<DebuggableCondition>().toList();
shouldOpenDialog = widget.rateMyApp.shouldOpenDialog;
});
}

List<Widget> starRateDialogActionsBuilder(BuildContext context, double stars) {
List<Widget> starRateDialogActionsBuilder(
BuildContext context, double stars) {
final Widget cancelButton = RateMyAppNoButton(
// We create a custom "Cancel" button using the RateMyAppNoButton class.
widget.rateMyApp,
Expand Down Expand Up @@ -121,7 +129,8 @@ class _ContentWidgetState extends State<ContentWidget> {

return [
FlatButton(
child: Text(MaterialLocalizations.of(context).okButtonLabel.toUpperCase()),
child:
Text(MaterialLocalizations.of(context).okButtonLabel.toUpperCase()),
onPressed: () async {
print(message);
Scaffold.of(context).showSnackBar(
Expand All @@ -132,8 +141,10 @@ class _ContentWidgetState extends State<ContentWidget> {
);

// 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<RateMyAppDialogButton>(context, RateMyAppDialogButton.rate);
await widget.rateMyApp
.callEvent(RateMyAppEventType.rateButtonPressed);
Navigator.pop<RateMyAppDialogButton>(
context, RateMyAppDialogButton.rate);
refresh();
},
),
Expand Down
30 changes: 22 additions & 8 deletions example/lib/custom_condition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> saveToPreferences(SharedPreferences preferences, String preferencesPrefix) async {
Future<void> 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
Expand Down Expand Up @@ -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;
}
}
57 changes: 30 additions & 27 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand All @@ -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()
);
}
static Widget buildProgressIndicator(BuildContext context) =>
const Center(child: CircularProgressIndicator());
}
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.7.0+1"
version: "0.7.1"
shared_preferences:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion ios/rate_my_app.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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...).
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit 88d427f

Please sign in to comment.