Bug 1843057 - On Android 14, close private tabs when notification is dismissed.

fenix/123.0
mcarare 11 months ago committed by mergify[bot]
parent 349c6fba81
commit d6f1874bdf

@ -6,6 +6,7 @@ package org.mozilla.fenix.session
import android.annotation.SuppressLint
import android.content.Intent
import android.os.Build
import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat
import mozilla.components.browser.state.selector.selectedTab
@ -35,17 +36,22 @@ class PrivateNotificationService : AbstractPrivateNotificationService() {
override fun NotificationCompat.Builder.buildNotification() {
setSmallIcon(R.drawable.ic_private_browsing)
setContentTitle(
applicationContext.getString(
R.string.app_name_private_4,
getString(R.string.app_name),
),
)
setContentText(
applicationContext.getString(
R.string.notification_pbm_delete_text_2,
),
)
val contentTitle = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
applicationContext.getString(R.string.notification_erase_title_android_14)
} else {
applicationContext.getString(R.string.app_name_private_4, getString(R.string.app_name))
}
val contentText = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
getString(R.string.notification_erase_text_android_14)
} else {
getString(R.string.notification_pbm_delete_text_2)
}
setContentTitle(contentTitle)
setContentText(contentText)
color = ContextCompat.getColor(
this@PrivateNotificationService,
R.color.pbm_notification_color,

@ -1275,6 +1275,11 @@
<!-- Notifications -->
<!-- Text shown in the notification that pops up to remind the user that a private browsing session is active. -->
<string name="notification_pbm_delete_text_2">Close private tabs</string>
<!-- Text shown in the notification that pops up to remind the user that a private browsing session is active for Android 14+ -->
<string name="notification_erase_title_android_14">Close private tabs?</string>
<string name="notification_erase_text_android_14">Tap or swipe this notification to close private tabs.</string>
<!-- Name of the marketing notification channel. Displayed in the "App notifications" system settings for the app -->
<string name="notification_marketing_channel_name">Marketing</string>
<!-- Title shown in the notification that pops up to remind the user to set fenix as default browser.

Loading…
Cancel
Save