For #6470 Remove actions from notification, keep just close private tabs
Removed NotificationsIntentProcessor because notifications no longer open app Added new stringsmaster
parent
fdfd9ace4b
commit
373bd63c40
|
@ -47,7 +47,6 @@ import org.mozilla.fenix.ext.settings
|
|||
import org.mozilla.fenix.home.HomeFragmentDirections
|
||||
import org.mozilla.fenix.home.intent.CrashReporterIntentProcessor
|
||||
import org.mozilla.fenix.home.intent.DeepLinkIntentProcessor
|
||||
import org.mozilla.fenix.home.intent.NotificationsIntentProcessor
|
||||
import org.mozilla.fenix.home.intent.OpenBrowserIntentProcessor
|
||||
import org.mozilla.fenix.home.intent.SpeechProcessingIntentProcessor
|
||||
import org.mozilla.fenix.home.intent.StartSearchIntentProcessor
|
||||
|
@ -76,7 +75,6 @@ open class HomeActivity : AppCompatActivity() {
|
|||
|
||||
private val externalSourceIntentProcessors by lazy {
|
||||
listOf(
|
||||
NotificationsIntentProcessor(this),
|
||||
SpeechProcessingIntentProcessor(this),
|
||||
StartSearchIntentProcessor(components.analytics.metrics),
|
||||
DeepLinkIntentProcessor(this),
|
||||
|
|
|
@ -69,27 +69,13 @@ class SessionNotificationService : Service() {
|
|||
return NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
|
||||
.setOngoing(true)
|
||||
.setSmallIcon(R.drawable.ic_pbm_notification)
|
||||
.setContentTitle(getString(R.string.app_name_private_2))
|
||||
.setContentText(getString(R.string.notification_pbm_delete_text))
|
||||
.setContentTitle(getString(R.string.app_name_private_3))
|
||||
.setContentText(getString(R.string.notification_pbm_delete_text_2))
|
||||
.setContentIntent(createNotificationIntent())
|
||||
.setVisibility(NotificationCompat.VISIBILITY_SECRET)
|
||||
.setShowWhen(false)
|
||||
.setLocalOnly(true)
|
||||
.setColor(ContextCompat.getColor(this, R.color.pbm_notification_color))
|
||||
.addAction(
|
||||
NotificationCompat.Action(
|
||||
0,
|
||||
getString(R.string.notification_pbm_action_open),
|
||||
createOpenActionIntent()
|
||||
)
|
||||
)
|
||||
.addAction(
|
||||
NotificationCompat.Action(
|
||||
0,
|
||||
getString(R.string.notification_pbm_action_delete_and_open),
|
||||
createOpenAndEraseActionIntent()
|
||||
)
|
||||
)
|
||||
.build()
|
||||
}
|
||||
|
||||
|
@ -100,23 +86,6 @@ class SessionNotificationService : Service() {
|
|||
return PendingIntent.getService(this, 0, intent, PendingIntent.FLAG_ONE_SHOT)
|
||||
}
|
||||
|
||||
private fun createOpenActionIntent(): PendingIntent {
|
||||
val intent = Intent(this, HomeActivity::class.java)
|
||||
intent.putExtra(HomeActivity.EXTRA_OPENED_FROM_NOTIFICATION, true)
|
||||
intent.putExtra(HomeActivity.PRIVATE_BROWSING_MODE, true)
|
||||
|
||||
return PendingIntent.getActivity(this, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
}
|
||||
|
||||
private fun createOpenAndEraseActionIntent(): PendingIntent {
|
||||
val intent = Intent(this, HomeActivity::class.java)
|
||||
|
||||
intent.putExtra(HomeActivity.EXTRA_DELETE_PRIVATE_TABS, true)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||
|
||||
return PendingIntent.getActivity(this, 2, intent, PendingIntent.FLAG_CANCEL_CURRENT)
|
||||
}
|
||||
|
||||
private fun createNotificationChannelIfNeeded() {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
// Notification channels are only available on Android O or higher.
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
<resources>
|
||||
<!-- App name for private browsing mode, only the "Private" portion should be localized. -->
|
||||
<string name="app_name_private_2">Private Firefox Preview</string>
|
||||
|
||||
<!-- App name for private browsing mode, only the "Private" portion should be localized. -->
|
||||
<string name="app_name_private_3">Firefox Preview (Private)</string>
|
||||
<!-- Home Fragment -->
|
||||
<!-- Content description (not visible, for screen readers etc.): "Three dot" menu button. -->
|
||||
<string name="content_description_menu">More options</string>
|
||||
|
@ -649,6 +650,8 @@
|
|||
<string name="notification_pbm_channel_name">Private browsing session</string>
|
||||
<!-- 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">Delete private tabs</string>
|
||||
<!-- 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>
|
||||
<!-- Notification action to open Fenix and resume the current browsing session. -->
|
||||
<string name="notification_pbm_action_open">Open</string>
|
||||
<!-- Notification action to delete all current private browsing sessions AND switch to Fenix (bring it to the foreground) -->
|
||||
|
|
Loading…
Reference in New Issue