Skip to content

Commit e00c63d

Browse files
authored
Update destination screen for clear data notification (#6423)
Task/Issue URL: https://app.asana.com/1/137249556945/project/1202552961248957/task/1210122720065734 ### Description Updated the navigation from "Data clearing notification" to open the "Data Clearing" screen and not the "Settings" screen. ### Steps to test this PR _Notification navigation_ - [x] Start with fresh install if you've previously already seen this notification - [x] Change "Automatically Clear Data" option to "None" - [x] Leave the app - [x] Wait for the notification to display and click on it ### UI changes | Before | After | | ------ | ----- | | <video src="https://github.com/user-attachments/assets/81d5f3a8-21da-4b95-a578-b77dc80b2f4e" /> | <video src="https://github.com/user-attachments/assets/e8c6c294-55d5-440d-a6bf-cf186adae63e" />|
1 parent 83e4b9f commit e00c63d

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

app/src/main/java/com/duckduckgo/app/firebutton/FireButtonActivity.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
package com.duckduckgo.app.firebutton
1818

1919
import android.app.ActivityOptions
20+
import android.content.Context
21+
import android.content.Intent
2022
import android.os.Bundle
2123
import androidx.annotation.StringRes
2224
import androidx.lifecycle.Lifecycle
@@ -70,6 +72,10 @@ class FireButtonActivity : DuckDuckGoActivity() {
7072

7173
configureUiEventHandlers()
7274
observeViewModel()
75+
76+
intent?.getStringExtra(LAUNCH_FROM_NOTIFICATION_PIXEL_NAME)?.let {
77+
viewModel.onLaunchedFromNotification(it)
78+
}
7379
}
7480

7581
private fun configureUiEventHandlers() {
@@ -238,4 +244,12 @@ class FireButtonActivity : DuckDuckGoActivity() {
238244
)
239245
.show()
240246
}
247+
248+
companion object {
249+
const val LAUNCH_FROM_NOTIFICATION_PIXEL_NAME = "LAUNCH_FROM_NOTIFICATION_PIXEL_NAME"
250+
251+
fun intent(context: Context): Intent {
252+
return Intent(context, FireButtonActivity::class.java)
253+
}
254+
}
241255
}

app/src/main/java/com/duckduckgo/app/firebutton/FireButtonViewModel.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ class FireButtonViewModel @Inject constructor(
172172
pixel.fire(AppPixelName.FIRE_ANIMATION_NEW_SELECTED, mapOf(Pixel.PixelParameter.FIRE_ANIMATION to selectedFireAnimation.getPixelValue()))
173173
}
174174

175+
fun onLaunchedFromNotification(pixelName: String) {
176+
pixel.fire(pixelName)
177+
}
178+
175179
private fun ClearWhatOption.pixelEvent(): Pixel.PixelName {
176180
return when (this) {
177181
ClearWhatOption.CLEAR_NONE -> AppPixelName.AUTOMATIC_CLEAR_DATA_WHAT_OPTION_NONE

app/src/main/java/com/duckduckgo/app/notification/model/ClearDataNotification.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import android.content.Context
2121
import android.os.Bundle
2222
import com.duckduckgo.app.browser.R
2323
import com.duckduckgo.app.di.AppCoroutineScope
24+
import com.duckduckgo.app.firebutton.FireButtonActivity
2425
import com.duckduckgo.app.notification.NotificationRegistrar
2526
import com.duckduckgo.app.notification.TaskStackBuilderFactory
2627
import com.duckduckgo.app.notification.db.NotificationDao
2728
import com.duckduckgo.app.pixels.AppPixelName
28-
import com.duckduckgo.app.settings.SettingsActivity
2929
import com.duckduckgo.app.settings.clear.ClearWhatOption
3030
import com.duckduckgo.app.settings.db.SettingsDataStore
3131
import com.duckduckgo.app.statistics.pixels.Pixel
@@ -114,8 +114,8 @@ class ClearDataNotificationPlugin @Inject constructor(
114114
}
115115

116116
override fun getLaunchIntent(): PendingIntent? {
117-
val intent = SettingsActivity.intent(context).apply {
118-
putExtra(SettingsActivity.LAUNCH_FROM_NOTIFICATION_PIXEL_NAME, pixelName(AppPixelName.NOTIFICATION_LAUNCHED.pixelName))
117+
val intent = FireButtonActivity.intent(context).apply {
118+
putExtra(FireButtonActivity.LAUNCH_FROM_NOTIFICATION_PIXEL_NAME, pixelName(AppPixelName.NOTIFICATION_LAUNCHED.pixelName))
119119
}
120120
val pendingIntent: PendingIntent? = taskStackBuilderFactory.createTaskBuilder().run {
121121
addNextIntentWithParentStack(intent)

app/src/main/java/com/duckduckgo/app/settings/SettingsActivity.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,6 @@ class SettingsActivity : DuckDuckGoActivity() {
182182
configureSettings()
183183
lifecycle.addObserver(viewModel)
184184
observeViewModel()
185-
186-
intent?.getStringExtra(BrowserActivity.LAUNCH_FROM_NOTIFICATION_PIXEL_NAME)?.let {
187-
viewModel.onLaunchedFromNotification(it)
188-
}
189185
}
190186

191187
override fun onResume() {
@@ -435,8 +431,6 @@ class SettingsActivity : DuckDuckGoActivity() {
435431
}
436432

437433
companion object {
438-
const val LAUNCH_FROM_NOTIFICATION_PIXEL_NAME = "LAUNCH_FROM_NOTIFICATION_PIXEL_NAME"
439-
440434
fun intent(context: Context): Intent {
441435
return Intent(context, SettingsActivity::class.java)
442436
}

app/src/main/java/com/duckduckgo/app/settings/SettingsViewModel.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,6 @@ class SettingsViewModel @Inject constructor(
398398
pixel.fire(SETTINGS_ABOUT_DDG_SHARE_FEEDBACK_PRESSED)
399399
}
400400

401-
fun onLaunchedFromNotification(pixelName: String) {
402-
pixel.fire(pixelName)
403-
}
404-
405401
fun onDdgOnOtherPlatformsClicked() {
406402
viewModelScope.launch { command.send(LaunchOtherPlatforms) }
407403
}

0 commit comments

Comments
 (0)