-
Notifications
You must be signed in to change notification settings - Fork 28
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
How do you configure "later" delay? #6
Comments
Thanks for your question! Right now, it cannot be configured, yet. But this could be improved, of course :) The current solution is implemented here. Doesn't the default behaviour work for you? |
I'm sorry, but I don't understand the implementation completely. The "later" button again reminds user depending on the first launch preference, but will remind only after 24 hours whatever be the preference, is it? Maybe this could be a Readme update? |
You're right, the current implementation doesn't make any sense! Thank you :) What about the following improvements? Alternative 1Replace ... private void buttonLaterClick(SharedPreferences.Editor editor, DialogInterface dialog, long firstLaunchTime) {
setFirstLaunchTime(editor, firstLaunchTime + DateUtils.DAY_IN_MILLIS);
closeDialog(dialog);
} ... with ... private void buttonLaterClick(SharedPreferences.Editor editor) {
long daysToWait = 1;
long manipulatedFirstLaunchTime = System.currentTimeMillis() - (mDaysBeforePrompt - daysToWait) * DateUtils.DAY_IN_MILLIS;
setFirstLaunchTime(editor, manipulatedFirstLaunchTime);
} Alternative 2Replace ... private void buttonLaterClick(SharedPreferences.Editor editor, DialogInterface dialog, long firstLaunchTime) {
setFirstLaunchTime(editor, firstLaunchTime + DateUtils.DAY_IN_MILLIS);
closeDialog(dialog);
}
...
if (System.currentTimeMillis() >= (firstLaunchTime + (mDaysBeforePrompt * DateUtils.DAY_IN_MILLIS))) { ... with ... private void buttonLaterClick(SharedPreferences.Editor editor) {
if (editor != null) {
long daysToWait = 1;
long oldDelay = prefs.getLong("delay", 0);
editor.putLong("delay", oldDelay + daysToWait * DateUtils.DAY_IN_MILLIS);
savePreferences(editor);
}
}
...
long dontShowBefore = firstLaunchTime + (mDaysBeforePrompt * DateUtils.DAY_IN_MILLIS) + prefs.getLong("delay", 0);
if (System.currentTimeMillis() >= dontShowBefore) { ... using a new The first approach is shorter but the second approach is cleaner because it does not manipulate the date of the first launch retrospectively. |
I would prefer 2nd approach as it is more self-explanatory from a code readability perspective and as you mention it is cleaner. I would also think a Readme update with a few lines explaining this would be good |
Is tit the same as when you initially fire the rating?
The text was updated successfully, but these errors were encountered: