diff --git a/android/java/org/chromium/chrome/browser/app/BraveActivity.java b/android/java/org/chromium/chrome/browser/app/BraveActivity.java index 42ea80c586c5..047a73ab0aa0 100644 --- a/android/java/org/chromium/chrome/browser/app/BraveActivity.java +++ b/android/java/org/chromium/chrome/browser/app/BraveActivity.java @@ -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(); } diff --git a/android/java/org/chromium/chrome/browser/onboarding/OnboardingPrefManager.java b/android/java/org/chromium/chrome/browser/onboarding/OnboardingPrefManager.java index 04f2adf8b8e6..5099bd3f20c1 100644 --- a/android/java/org/chromium/chrome/browser/onboarding/OnboardingPrefManager.java +++ b/android/java/org/chromium/chrome/browser/onboarding/OnboardingPrefManager.java @@ -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; @@ -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(); + } }