Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update RateThisApp.java #112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ratethisapp/src/main/java/com/kobakei/ratethisapp/RateThisApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ public void onCancel(DialogInterface dialog) {
}
clearSharedPreferences(context);
storeAskLaterDate(context);
storeAskLaterDate(context);
}
});
builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
Expand All @@ -311,6 +312,7 @@ private static void clearSharedPreferences(Context context) {
Editor editor = pref.edit();
editor.remove(KEY_INSTALL_DATE);
editor.remove(KEY_LAUNCH_TIMES);
editor.remove(KEY_OPT_OUT);
editor.apply();
}

Expand Down Expand Up @@ -360,6 +362,17 @@ private static void storeAskLaterDate(final Context context) {
editor.putLong(KEY_ASK_LATER_DATE, System.currentTimeMillis());
editor.apply();
}

/**
* Store the date the user asked for being asked again later.
* @param context
*/
private static void storeAskLaterTimes(final Context context) {
SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
Editor editor = pref.edit();
editor.putInt(KEY_LAUNCH_TIMES, 0);
editor.apply();
}

/**
* Print values in SharedPreferences (used for debug)
Expand Down