File tree Expand file tree Collapse file tree 5 files changed +21
-13
lines changed
app/src/main/java/com/duckduckgo/app Expand file tree Collapse file tree 5 files changed +21
-13
lines changed Original file line number Diff line number Diff line change 17
17
package com.duckduckgo.app.firebutton
18
18
19
19
import android.app.ActivityOptions
20
+ import android.content.Context
21
+ import android.content.Intent
20
22
import android.os.Bundle
21
23
import androidx.annotation.StringRes
22
24
import androidx.lifecycle.Lifecycle
@@ -70,6 +72,10 @@ class FireButtonActivity : DuckDuckGoActivity() {
70
72
71
73
configureUiEventHandlers()
72
74
observeViewModel()
75
+
76
+ intent?.getStringExtra(LAUNCH_FROM_NOTIFICATION_PIXEL_NAME )?.let {
77
+ viewModel.onLaunchedFromNotification(it)
78
+ }
73
79
}
74
80
75
81
private fun configureUiEventHandlers () {
@@ -238,4 +244,12 @@ class FireButtonActivity : DuckDuckGoActivity() {
238
244
)
239
245
.show()
240
246
}
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
+ }
241
255
}
Original file line number Diff line number Diff line change @@ -172,6 +172,10 @@ class FireButtonViewModel @Inject constructor(
172
172
pixel.fire(AppPixelName .FIRE_ANIMATION_NEW_SELECTED , mapOf (Pixel .PixelParameter .FIRE_ANIMATION to selectedFireAnimation.getPixelValue()))
173
173
}
174
174
175
+ fun onLaunchedFromNotification (pixelName : String ) {
176
+ pixel.fire(pixelName)
177
+ }
178
+
175
179
private fun ClearWhatOption.pixelEvent (): Pixel .PixelName {
176
180
return when (this ) {
177
181
ClearWhatOption .CLEAR_NONE -> AppPixelName .AUTOMATIC_CLEAR_DATA_WHAT_OPTION_NONE
Original file line number Diff line number Diff line change @@ -21,11 +21,11 @@ import android.content.Context
21
21
import android.os.Bundle
22
22
import com.duckduckgo.app.browser.R
23
23
import com.duckduckgo.app.di.AppCoroutineScope
24
+ import com.duckduckgo.app.firebutton.FireButtonActivity
24
25
import com.duckduckgo.app.notification.NotificationRegistrar
25
26
import com.duckduckgo.app.notification.TaskStackBuilderFactory
26
27
import com.duckduckgo.app.notification.db.NotificationDao
27
28
import com.duckduckgo.app.pixels.AppPixelName
28
- import com.duckduckgo.app.settings.SettingsActivity
29
29
import com.duckduckgo.app.settings.clear.ClearWhatOption
30
30
import com.duckduckgo.app.settings.db.SettingsDataStore
31
31
import com.duckduckgo.app.statistics.pixels.Pixel
@@ -114,8 +114,8 @@ class ClearDataNotificationPlugin @Inject constructor(
114
114
}
115
115
116
116
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))
119
119
}
120
120
val pendingIntent: PendingIntent ? = taskStackBuilderFactory.createTaskBuilder().run {
121
121
addNextIntentWithParentStack(intent)
Original file line number Diff line number Diff line change @@ -182,10 +182,6 @@ class SettingsActivity : DuckDuckGoActivity() {
182
182
configureSettings()
183
183
lifecycle.addObserver(viewModel)
184
184
observeViewModel()
185
-
186
- intent?.getStringExtra(BrowserActivity .LAUNCH_FROM_NOTIFICATION_PIXEL_NAME )?.let {
187
- viewModel.onLaunchedFromNotification(it)
188
- }
189
185
}
190
186
191
187
override fun onResume () {
@@ -435,8 +431,6 @@ class SettingsActivity : DuckDuckGoActivity() {
435
431
}
436
432
437
433
companion object {
438
- const val LAUNCH_FROM_NOTIFICATION_PIXEL_NAME = " LAUNCH_FROM_NOTIFICATION_PIXEL_NAME"
439
-
440
434
fun intent (context : Context ): Intent {
441
435
return Intent (context, SettingsActivity ::class .java)
442
436
}
Original file line number Diff line number Diff line change @@ -398,10 +398,6 @@ class SettingsViewModel @Inject constructor(
398
398
pixel.fire(SETTINGS_ABOUT_DDG_SHARE_FEEDBACK_PRESSED )
399
399
}
400
400
401
- fun onLaunchedFromNotification (pixelName : String ) {
402
- pixel.fire(pixelName)
403
- }
404
-
405
401
fun onDdgOnOtherPlatformsClicked () {
406
402
viewModelScope.launch { command.send(LaunchOtherPlatforms ) }
407
403
}
You can’t perform that action at this time.
0 commit comments