Skip to content
This repository has been archived by the owner on Sep 10, 2020. It is now read-only.

Commit

Permalink
call open later
Browse files Browse the repository at this point in the history
  • Loading branch information
uillianluiz committed Sep 5, 2020
1 parent dc2c57d commit ff94d12
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions mobile/lib/app/shared/rateapp/rateapp_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class _RateAppState extends State<RateApp> {
}));
}

void updateLikedState(LikeState newLikedState) {
void _updateLikedState(LikeState newLikedState) {
setState(() {
_likeState = newLikedState;
});
Expand Down Expand Up @@ -80,14 +80,14 @@ class _RateAppState extends State<RateApp> {
case LikeState.NEW:
await _changeOpacity();
Future.delayed(Duration(milliseconds: _animationDuration), () {
updateLikedState(
_updateLikedState(
positiveClick ? LikeState.LIKED : LikeState.DISLIKED);
});
break;
case LikeState.LIKED:
case LikeState.DISLIKED:
updateLikedState(LikeState.DONE);
RateAppService.setNeverOpen();
_updateLikedState(LikeState.DONE);
_handleNextOpenTime();
if (positiveClick) {
RateAppService.openPlayStore(context);
}
Expand All @@ -97,6 +97,16 @@ class _RateAppState extends State<RateApp> {
}
}

void _handleNextOpenTime() {
if (_likeState == LikeState.LIKED) {
// if user is liking the app, let's ask the same question in some time (default 2 weeks)
RateAppService.setOpenLater();
} else {
// if user is not liking the app, let's not ask ever again :)
RateAppService.setNeverOpen();
}
}

void _changeOpacity() async {
await setState(() {
_opacity = 0;
Expand Down

0 comments on commit ff94d12

Please sign in to comment.