don't ask for 24h if user cancels dialog (eg clicking outside)
This commit is contained in:
@@ -284,7 +284,8 @@ public class KeyListFragment extends RecyclerFragment<FlexibleAdapter<FlexibleKe
|
||||
}
|
||||
|
||||
Preferences preferences = Preferences.getPreferences(context);
|
||||
if (!Constants.DEBUG && !preferences.isAnalyticsHasConsent() && preferences.isAnalyticsAskedPolitely()) {
|
||||
boolean askedBeforeAndWasRejected = preferences.isAnalyticsAskedPolitely() && !preferences.isAnalyticsHasConsent();
|
||||
if (!Constants.DEBUG && askedBeforeAndWasRejected) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -299,6 +300,14 @@ public class KeyListFragment extends RecyclerFragment<FlexibleAdapter<FlexibleKe
|
||||
return;
|
||||
}
|
||||
|
||||
long twentyFourHoursAgo = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(1);
|
||||
boolean askedLessThan24HoursAgo = preferences.getAnalyticsLastAsked() > twentyFourHoursAgo;
|
||||
if (askedLessThan24HoursAgo) {
|
||||
return;
|
||||
}
|
||||
|
||||
preferences.setAnalyticsLastAskedNow();
|
||||
|
||||
TrackingManager trackingManager = ((KeychainApplication) requireActivity().getApplication()).getTrackingManager();
|
||||
AlertDialog show = new Builder(context)
|
||||
.setMessage(R.string.dialog_analytics_text)
|
||||
|
||||
Reference in New Issue
Block a user