Skip to content

Commit

Permalink
Uplift of #16079 (squashed) to beta
Browse files Browse the repository at this point in the history
  • Loading branch information
brave-browser-releases committed Nov 25, 2022
1 parent 318d791 commit 0a7eeaf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1245,8 +1245,11 @@ public void onDismiss() {
};

private void checkAndshowNotificationWarningDialog() {
if (BraveNotificationWarningDialog.shouldShowNotificationWarningDialog(this)) {
if (BraveNotificationWarningDialog.shouldShowNotificationWarningDialog(this)
&& !OnboardingPrefManager.getInstance()
.isNotificationPermissionEnablingDialogShown()) {
showNotificationWarningDialog();
OnboardingPrefManager.getInstance().setNotificationPermissionEnablingDialogShown(true);
} else {
checkForNotificationData();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public class OnboardingPrefManager {
private static final String PREF_P3A_CRASH_REPORTING_MESSAGE_SHOWN =
"p3a_crash_reporting_message_shown";
private static final String PREF_URL_FOCUS_COUNT = "url_focus_count";
private static final String PREF_NOTIFICATION_PERMISSION_ENABLING_DIALOG =
"notification_permission_enabling_dialog";

private static OnboardingPrefManager sInstance;

Expand Down Expand Up @@ -341,4 +343,20 @@ private long setTimeInMillis(int timeInMinutes) {
Date date = calendar.getTime();
return date.getTime();
}

/**
* Returns the user preference for whether the Notification Permission Enabling dialog is shown.
*/
public boolean isNotificationPermissionEnablingDialogShown() {
return mSharedPreferences.getBoolean(PREF_NOTIFICATION_PERMISSION_ENABLING_DIALOG, false);
}

/**
* Sets the user preference for whether the Notification Permission Enabling dialog is shown.
*/
public void setNotificationPermissionEnablingDialogShown(boolean isShown) {
SharedPreferences.Editor sharedPreferencesEditor = mSharedPreferences.edit();
sharedPreferencesEditor.putBoolean(PREF_NOTIFICATION_PERMISSION_ENABLING_DIALOG, isShown);
sharedPreferencesEditor.apply();
}
}

0 comments on commit 0a7eeaf

Please sign in to comment.