Current launches have négative value
nitneuq33 opened this issue · comments
I have a problem, when user clic on laterbutton I reset current launches to force 0. But When I reopen the app I have randomly -3 or -5 or -7 with current launches. It appear only when I use Navigator.of(context).pop();
If I reset without Navigator.of(context).pop(); the dialog need a manual close but the reset is affected. If I force the dialog close with Navigator.of(context).pop(); I have negative current launches
here is a part of my code
void ratemyapp(){
rateMyApp.init().then((_) {
rateMyApp.conditions.forEach((condition){
if(condition is DebuggableCondition){
print(condition.valuesAsString);
}
});
if (rateMyApp.shouldOpenDialog) {
rateMyApp.showRateDialog(
context,
title: "", // The dialog title.
rateButton: 'Noter', // The dialog "rate" button text.
noButton: 'Jamais !', // The dialog "no" button text.
laterButton: 'Plus tard', // The dialog "later" button text.
dialogStyle: DialogStyle(
dialogShape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0), // Définir le bord arrondi
),
),
listener: (button) { // The button click listener (useful if you want to cancel the click event).
switch(button) {
case RateMyAppDialogButton.rate:
print('Clicked on "Rate".');
break;
case RateMyAppDialogButton.later:
print('Clicked on "Later".');
break;
case RateMyAppDialogButton.no:
print('Clicked on "No".');
break;
}
return true; // Return false if you want to cancel the click event.
},
ignoreNativeDialog: true, // Set to false if you want to show the Apple's native app rating dialog on iOS or Google's native app rating dialog (depends on the current Platform).
// ignoreNativeDialog: Platform.isIOS, // Set to false if you want to show the Apple's native app rating dialog on iOS or Google's native app rating dialog (depends on the current Platform).
actionsBuilder: (context) => [
Container(
width: MediaQuery.of(context).size.width / 1.1,
height: MediaQuery.of(context).size.height / 15,
margin: EdgeInsets.only(bottom:15,right:10,left:10),
decoration: BoxDecoration(
color: Color(0xFFDBCEA4),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
bottomLeft: Radius.circular(20),
bottomRight: Radius.circular(20),
),
boxShadow: [
BoxShadow(
offset: Offset(0, 0),
color: Colors.grey.shade300,
spreadRadius:3.0,
blurRadius: 10.0,
),
],
),
child:
Row(
mainAxisAlignment: MainAxisAlignment.start, // Change to 'start' or 'center'
children: [
Flexible(
flex: 1,
child: GestureDetector(
onTapUp: (_) async{
final event = RateMyAppEventType.rateButtonPressed;
await rateMyApp.callEvent(event);
rateMyApp.launchStore();
setState(() {
// audioCache.play("pop_sound.mp3");
_player?.dispose();
final player = _player = AudioPlayer();
if(isSoundEnabled==true){
player.setVolume(0.03);
}else{
player.setVolume(0);
}
player.play(AssetSource('pop_sound.mp3'));
Vibration.vibrate(
pattern: [100, 1,],
intensities: [intensity, 0, ],
);
});
},
child: Transform.scale(
scale: 1,
child: AnimatedContainer(
duration: Duration(milliseconds: 200),
height: MediaQuery.of(context).size.height / 12,
decoration: BoxDecoration(
color: Color(0xFFE7BE35),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
bottomLeft: Radius.circular(20),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Noter".i18n, textAlign: TextAlign.center, style: TextStyle( fontSize: getFontSize_min(context),color:Colors.white, fontFamily: '$font_text',fontWeight: FontWeight.w800,),),
],
),
),
),
),
),
VerticalDivider(
thickness: 2,
width: 2, // <-- Add this line
color: Color(0xFFC8A52F),
),
Flexible(
flex: 1,
child: GestureDetector(
onTapUp: (_) async{
setState(() {
final event = RateMyAppEventType.laterButtonPressed;
rateMyApp.callEvent(event);
// audioCache.play("pop_sound.mp3");
_player?.dispose();
final player = _player = AudioPlayer();
if(isSoundEnabled==true){
player.setVolume(0.03);
}else{
player.setVolume(0);
}
player.play(AssetSource('pop_sound.mp3'));
Vibration.vibrate(
pattern: [100, 1,],
intensities: [intensity, 0, ],
);
rateMyApp.reset(); // Réinitialise le compteur Current launches à zéro
Navigator.of(context).pop();
}
);
},
child: Transform.scale(
scale: 1,
child: AnimatedContainer(
duration: Duration(milliseconds: 200),
height: MediaQuery.of(context).size.height / 12,
decoration: BoxDecoration(
color: Color(0xFFE7BE35),
borderRadius: BorderRadius.only(
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Plus tard".i18n, textAlign: TextAlign.center, style: TextStyle( fontSize: getFontSize_min(context),color:Colors.white, fontFamily: '$font_text',fontWeight: FontWeight.w800,),),
],
),
),
),
),
),
There is a methode to force Current launches to zero ?
rateMyApp.reset();
resets everything. Just call rateMyApp.callEvent(RateMyAppEventType.laterButtonPressed)
.