Bug 1874388 - Remove unused notification pre prompt

fenix/124.1.0
rahulsainani 5 months ago committed by mergify[bot]
parent 5d0b4517d6
commit ab56ebe21c

@ -1061,78 +1061,6 @@ onboarding:
metadata:
tags:
- Onboarding
notif_ppp_impression:
type: event
description: |
Notification pre permission prompt was shown to the user.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1810115
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/28529
- https://github.com/mozilla-mobile/firefox-android/pull/4039
data_sensitivity:
- interaction
notification_emails:
- android-probes@mozilla.com
expires: never
metadata:
tags:
- Notifications
- Onboarding
notif_ppp_close_click:
type: event
description: |
User clicked the close button on the notification pre permission prompt.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1810115
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/28529
- https://github.com/mozilla-mobile/firefox-android/pull/4039
data_sensitivity:
- interaction
notification_emails:
- android-probes@mozilla.com
expires: never
metadata:
tags:
- Notifications
- Onboarding
notif_ppp_positive_btn_click:
type: event
description: |
User clicked the positive button on notification pre permission prompt.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1810115
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/28529
- https://github.com/mozilla-mobile/firefox-android/pull/4039
data_sensitivity:
- interaction
notification_emails:
- android-probes@mozilla.com
expires: never
metadata:
tags:
- Notifications
- Onboarding
notif_ppp_negative_btn_click:
type: event
description: |
User clicked the negative button on notification pre permission prompt.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1810115
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/28529
- https://github.com/mozilla-mobile/firefox-android/pull/4039
data_sensitivity:
- interaction
notification_emails:
- android-probes@mozilla.com
expires: never
metadata:
tags:
- Notifications
- Onboarding
set_to_default_card:
type: event
description: |

@ -236,14 +236,6 @@ features:
type: Int
default: 0
pre-permission-notification-prompt:
description: A feature that shows the pre-permission notification prompt.
variables:
enabled:
description: if true, the pre-permission notification prompt is shown to the user.
type: Boolean
default: false
onboarding:
description: "A feature that configures the new user onboarding page.
Note that onboarding is a **first run** feature, and should only be modified by first run experiments."

@ -31,7 +31,6 @@ import androidx.annotation.RequiresApi
import androidx.annotation.VisibleForTesting
import androidx.appcompat.app.ActionBar
import androidx.appcompat.widget.Toolbar
import androidx.core.app.NotificationManagerCompat
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.lifecycle.lifecycleScope
import androidx.navigation.NavController
@ -63,7 +62,6 @@ import mozilla.components.feature.media.ext.findActiveMediaTab
import mozilla.components.feature.privatemode.notification.PrivateNotificationFeature
import mozilla.components.feature.search.BrowserStoreSearchAdapter
import mozilla.components.service.fxa.sync.SyncReason
import mozilla.components.support.base.ext.areNotificationsEnabledSafe
import mozilla.components.support.base.feature.ActivityResultHandler
import mozilla.components.support.base.feature.UserInteractionHandler
import mozilla.components.support.base.log.logger.Logger
@ -128,7 +126,6 @@ import org.mozilla.fenix.messaging.FenixNimbusMessagingController
import org.mozilla.fenix.messaging.MessageNotificationWorker
import org.mozilla.fenix.nimbus.FxNimbus
import org.mozilla.fenix.onboarding.ReEngagementNotificationWorker
import org.mozilla.fenix.onboarding.ensureMarketingChannelExists
import org.mozilla.fenix.perf.MarkersActivityLifecycleCallbacks
import org.mozilla.fenix.perf.MarkersFragmentLifecycleCallbacks
import org.mozilla.fenix.perf.Performance
@ -345,8 +342,6 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
if (settings().showHomeOnboardingDialog && components.fenixOnboarding.userHasBeenOnboarded()) {
navHost.navController.navigate(NavGraphDirections.actionGlobalHomeOnboardingDialog())
}
showNotificationPermissionPromptIfRequired()
}
Performance.processIntentIfPerformanceTest(intent, this)
@ -443,30 +438,6 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
StartupTimeline.onActivityCreateEndHome(this) // DO NOT MOVE ANYTHING BELOW HERE.
}
/**
* On Android 13 or above, prompt the user for notification permission at the start.
* Show the pre permission dialog to the user once if the notification are not enabled.
*/
private fun showNotificationPermissionPromptIfRequired() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
!NotificationManagerCompat.from(applicationContext).areNotificationsEnabledSafe() &&
settings().numberOfAppLaunches <= 1
) {
// Recording the exposure event here to capture all users who met all criteria to receive
// the pre permission notification prompt
FxNimbus.features.prePermissionNotificationPrompt.recordExposure()
if (settings().notificationPrePermissionPromptEnabled) {
if (!settings().isNotificationPrePermissionShown) {
navHost.navController.navigate(NavGraphDirections.actionGlobalHomeNotificationPermissionDialog())
}
} else {
// This will trigger the notification permission system dialog as app targets sdk 32.
ensureMarketingChannelExists(applicationContext)
}
}
}
private fun maybeShowSplashScreen() {
if (components.settings.isFirstSplashScreenShown) {
return

@ -1,64 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.fenix.onboarding
import android.annotation.SuppressLint
import android.content.pm.ActivityInfo
import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.RequiresApi
import androidx.compose.ui.platform.ComposeView
import androidx.fragment.app.DialogFragment
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.onboarding.view.NotificationPermissionDialogScreen
import org.mozilla.fenix.theme.FirefoxTheme
/**
* Dialog displaying notification pre-permission prompt.
*/
class HomeNotificationPermissionDialogFragment : DialogFragment() {
@SuppressLint("SourceLockedOrientationActivity")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(STYLE_NO_TITLE, R.style.HomeOnboardingDialogStyle)
activity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
}
override fun onDestroy() {
super.onDestroy()
activity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
}
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?,
): View = ComposeView(requireContext()).apply {
setContent {
FirefoxTheme {
NotificationPermissionDialogScreen(
onDismiss = ::onDismiss,
grantNotificationPermission = {
ensureMarketingChannelExists(context.applicationContext)
requireComponents.notificationsDelegate.requestNotificationPermission()
onDismiss()
},
)
}
}
}
private fun onDismiss() {
dismiss()
context?.settings()?.isNotificationPrePermissionShown = true
}
}

@ -1,75 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.fenix.onboarding.view
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import mozilla.components.service.glean.private.NoExtras
import org.mozilla.fenix.GleanMetrics.Onboarding
import org.mozilla.fenix.R
import org.mozilla.fenix.compose.annotation.LightDarkPreview
import org.mozilla.fenix.theme.FirefoxTheme
/**
* A screen for displaying notification pre permission prompt.
*
* @param onDismiss Invoked when the user clicks on the close or the negative button.
* @param grantNotificationPermission Invoked when the user clicks on the positive button.
*/
@Composable
fun NotificationPermissionDialogScreen(
onDismiss: () -> Unit,
grantNotificationPermission: () -> Unit,
) {
OnboardingPage(
pageState = OnboardingPageState(
imageRes = R.drawable.ic_notification_permission,
title = stringResource(
id = R.string.onboarding_home_enable_notifications_title,
formatArgs = arrayOf(stringResource(R.string.app_name)),
),
description = stringResource(
id = R.string.onboarding_home_enable_notifications_description,
formatArgs = arrayOf(stringResource(R.string.app_name)),
),
primaryButton = Action(
text = stringResource(id = R.string.onboarding_home_enable_notifications_positive_button),
onClick = {
grantNotificationPermission()
Onboarding.notifPppPositiveBtnClick.record(NoExtras())
},
),
secondaryButton = Action(
text = stringResource(id = R.string.onboarding_home_enable_notifications_negative_button),
onClick = {
onDismiss()
Onboarding.notifPppNegativeBtnClick.record(NoExtras())
},
),
onRecordImpressionEvent = { Onboarding.notifPppImpression.record(NoExtras()) },
),
onDismiss = {
onDismiss()
Onboarding.notifPppCloseClick.record(NoExtras())
},
modifier = Modifier
.statusBarsPadding()
.navigationBarsPadding(),
)
}
@LightDarkPreview
@Composable
private fun NotificationPermissionScreenPreview() {
FirefoxTheme {
NotificationPermissionDialogScreen(
grantNotificationPermission = {},
onDismiss = { },
)
}
}

@ -1682,23 +1682,6 @@ class Settings(private val appContext: Context) : PreferencesHolder {
default = setOf(),
)
/**
* Indicates if notification pre permission prompt feature is enabled.
*/
var notificationPrePermissionPromptEnabled by lazyFeatureFlagPreference(
key = appContext.getPreferenceKey(R.string.pref_key_notification_pre_permission_prompt_enabled),
default = { FxNimbus.features.prePermissionNotificationPrompt.value().enabled },
featureFlag = true,
)
/**
* Indicates if notification permission prompt has been shown to the user.
*/
var isNotificationPrePermissionShown by booleanPreference(
key = appContext.getPreferenceKey(R.string.pref_key_is_notification_pre_permission_prompt_shown),
default = false,
)
/**
* Returns whether onboarding should be shown to the user.
*

@ -43,10 +43,6 @@
android:id="@+id/action_global_home_onboarding_dialog"
app:destination="@id/homeOnboardingDialogFragment" />
<action
android:id="@+id/action_global_home_notification_permission_dialog"
app:destination="@id/homeNotificationPermissionDialogFragment" />
<action
android:id="@+id/action_global_wallpaper_onboarding_dialog"
app:destination="@id/wallpaperOnboardingDialogFragment"
@ -231,10 +227,6 @@
app:argType="string" />
</dialog>
<dialog
android:id="@+id/homeNotificationPermissionDialogFragment"
android:name="org.mozilla.fenix.onboarding.HomeNotificationPermissionDialogFragment" />
<dialog
android:id="@+id/wallpaperOnboardingDialogFragment"
android:name="org.mozilla.fenix.onboarding.WallpaperOnboardingDialogFragment" />

@ -377,10 +377,6 @@
<string name="pref_key_growth_resume_last_sent" translatable="false">pref_key_growth_last_resumed</string>
<string name="pref_key_growth_uri_load_last_sent" translatable="false">pref_key_growth_uri_load_last_sent</string>
<!-- Notification Pre Permission Prompt -->
<string name="pref_key_notification_pre_permission_prompt_enabled">pref_key_notification_pre_permission_prompt_enabled</string>
<string name="pref_key_is_notification_pre_permission_prompt_shown">pref_key_is_notification_pre_permission_prompt_shown</string>
<!--Shopping -->
<string name="pref_key_is_review_quality_check_enabled">pref_key_is_review_quality_check_enabled</string>
<string name="pref_key_is_review_quality_check_product_recommendations_enabled">pref_key_is_review_quality_check_product_recommendations_enabled</string>

@ -298,14 +298,14 @@
<!-- Notification pre-permission dialog -->
<!-- Enable notification pre permission dialog title
The first parameter is the name of the app defined in app_name (for example: Fenix) -->
<string name="onboarding_home_enable_notifications_title">Notifications help you do more with %s</string>
<string name="onboarding_home_enable_notifications_title" moz:removedIn="124" tools:ignore="UnusedResources">Notifications help you do more with %s</string>
<!-- Enable notification pre permission dialog description with rationale
The first parameter is the name of the app defined in app_name (for example: Fenix) -->
<string name="onboarding_home_enable_notifications_description">Sync your tabs between devices, manage downloads, get tips about making the most of %ss privacy protection, and more.</string>
<string name="onboarding_home_enable_notifications_description" moz:removedIn="124" tools:ignore="UnusedResources">Sync your tabs between devices, manage downloads, get tips about making the most of %ss privacy protection, and more.</string>
<!-- Text for the button to request notification permission on the device -->
<string name="onboarding_home_enable_notifications_positive_button">Continue</string>
<string name="onboarding_home_enable_notifications_positive_button" moz:removedIn="124" tools:ignore="UnusedResources">Continue</string>
<!-- Text for the button to not request notification permission on the device and dismiss the dialog -->
<string name="onboarding_home_enable_notifications_negative_button">Not now</string>
<string name="onboarding_home_enable_notifications_negative_button" moz:removedIn="124" tools:ignore="UnusedResources">Not now</string>
<!-- Juno first user onboarding flow experiment, strings are marked unused as they are only referenced by Nimbus experiments. -->
<!-- Description for learning more about our privacy notice. -->

Loading…
Cancel
Save