@@ -81,6 +81,7 @@ import com.duckduckgo.internal.features.api.InternalFeaturePlugin
81
81
import com.duckduckgo.mobile.android.app.tracking.ui.AppTrackingProtectionScreens.AppTrackerActivityWithEmptyParams
82
82
import com.duckduckgo.mobile.android.app.tracking.ui.AppTrackingProtectionScreens.AppTrackerOnboardingActivityWithEmptyParamsParams
83
83
import com.duckduckgo.navigation.api.GlobalActivityStarter
84
+ import com.duckduckgo.navigation.api.GlobalActivityStarter.ActivityParams
84
85
import com.duckduckgo.settings.api.DuckPlayerSettingsPlugin
85
86
import com.duckduckgo.settings.api.ProSettingsPlugin
86
87
import com.duckduckgo.subscriptions.api.PrivacyProFeedbackScreens.GeneralPrivacyProFeedbackScreenNoParams
@@ -305,29 +306,28 @@ class NewSettingsActivity : DuckDuckGoActivity() {
305
306
viewsPrivacy.cookiePopupProtectionSetting.setStatus(isOn = enabled)
306
307
}
307
308
308
- private fun processCommand (it : Command ? ) {
309
+ private fun processCommand (it : Command ) {
309
310
when (it) {
310
311
is LaunchDefaultBrowser -> launchDefaultAppScreen()
311
- is LaunchAutofillSettings -> launchAutofillSettings( )
312
- is LaunchAccessibilitySettings -> launchAccessibilitySettings( )
313
- is LaunchAppTPTrackersScreen -> launchAppTPTrackersScreen( )
314
- is LaunchAppTPOnboarding -> launchAppTPOnboardingScreen( )
315
- is LaunchEmailProtection -> launchEmailProtectionScreen( it.url)
316
- is LaunchEmailProtectionNotSupported -> launchEmailProtectionNotSupported( )
312
+ is LaunchAutofillSettings -> launchScreen( AutofillSettingsScreen (source = AutofillSettingsLaunchSource . SettingsActivity ) )
313
+ is LaunchAccessibilitySettings -> launchScreen( AccessibilityScreens . Default )
314
+ is LaunchAppTPTrackersScreen -> launchScreen( AppTrackerActivityWithEmptyParams )
315
+ is LaunchAppTPOnboarding -> launchScreen( AppTrackerOnboardingActivityWithEmptyParamsParams )
316
+ is LaunchEmailProtection -> launchActivityAndFinish( BrowserActivity .intent( this , it.url, interstitialScreen = true ) )
317
+ is LaunchEmailProtectionNotSupported -> launchScreen( EmailProtectionUnsupportedScreenNoParams )
317
318
is LaunchAddHomeScreenWidget -> launchAddHomeScreenWidget()
318
- is LaunchSyncSettings -> launchSyncSettings( )
319
- is LaunchPrivateSearchWebPage -> launchPrivateSearchScreen( )
320
- is LaunchWebTrackingProtectionScreen -> launchWebTrackingProtectionScreen( )
321
- is LaunchCookiePopupProtectionScreen -> launchCookiePopupProtectionScreen( )
322
- is LaunchFireButtonScreen -> launchFireButtonScreen( )
323
- is LaunchPermissionsScreen -> launchPermissionsScreen( )
324
- is LaunchAppearanceScreen -> launchAppearanceScreen( )
325
- is LaunchAboutScreen -> launchAboutScreen( )
326
- is LaunchGeneralSettingsScreen -> launchGeneralSettingsScreen( )
319
+ is LaunchSyncSettings -> launchScreen( SyncActivityWithEmptyParams )
320
+ is LaunchPrivateSearchWebPage -> launchScreen( PrivateSearchScreenNoParams )
321
+ is LaunchWebTrackingProtectionScreen -> launchScreen( WebTrackingProtectionScreenNoParams )
322
+ is LaunchCookiePopupProtectionScreen -> launchActivity( AutoconsentSettingsActivity .intent( this ) )
323
+ is LaunchFireButtonScreen -> launchScreen( FireButtonScreenNoParams )
324
+ is LaunchPermissionsScreen -> launchScreen( PermissionsScreenNoParams )
325
+ is LaunchAppearanceScreen -> launchScreen( AppearanceScreen . Default )
326
+ is LaunchAboutScreen -> launchScreen( AboutScreenNoParams )
327
+ is LaunchGeneralSettingsScreen -> launchScreen( GeneralSettingsScreenNoParams )
327
328
is LaunchFeedback -> launchFeedback()
328
- is LaunchPproUnifiedFeedback -> launchPproUnifiedFeedback()
329
- is LaunchOtherPlatforms -> launchOtherPlatforms()
330
- null -> TODO ()
329
+ is LaunchPproUnifiedFeedback -> launchScreen(GeneralPrivacyProFeedbackScreenNoParams )
330
+ is LaunchOtherPlatforms -> launchActivityAndFinish(BrowserActivity .intent(context = this , queryExtra = OTHER_PLATFORMS_URL ))
331
331
}
332
332
}
333
333
@@ -350,103 +350,28 @@ class NewSettingsActivity : DuckDuckGoActivity() {
350
350
launchDefaultAppActivity()
351
351
}
352
352
353
- private fun launchAutofillSettings () {
354
- val options = ActivityOptions .makeSceneTransitionAnimation(this ).toBundle()
355
- globalActivityStarter.start(this , AutofillSettingsScreen (source = AutofillSettingsLaunchSource .SettingsActivity ), options)
353
+ private fun launchScreen (activityParams : ActivityParams ) {
354
+ globalActivityStarter.start(this , activityParams)
356
355
}
357
356
358
- private fun launchAccessibilitySettings () {
359
- val options = ActivityOptions .makeSceneTransitionAnimation(this ).toBundle()
360
- globalActivityStarter.start(this , AccessibilityScreens .Default , options)
357
+ private fun launchActivity (intent : Intent ) {
358
+ startActivity(intent)
361
359
}
362
360
363
- private fun launchEmailProtectionScreen (url : String ) {
364
- val options = ActivityOptions .makeSceneTransitionAnimation(this ).toBundle()
365
- startActivity(BrowserActivity .intent(this , url, interstitialScreen = true ), options)
366
- this .finish()
367
- }
368
-
369
- private fun launchEmailProtectionNotSupported () {
370
- val options = ActivityOptions .makeSceneTransitionAnimation(this ).toBundle()
371
- globalActivityStarter.start(this , EmailProtectionUnsupportedScreenNoParams , options)
372
- }
373
-
374
- private fun launchSyncSettings () {
375
- val options = ActivityOptions .makeSceneTransitionAnimation(this ).toBundle()
376
- globalActivityStarter.start(this , SyncActivityWithEmptyParams , options)
377
- }
378
-
379
- private fun launchAppTPTrackersScreen () {
380
- val options = ActivityOptions .makeSceneTransitionAnimation(this ).toBundle()
381
- globalActivityStarter.start(this , AppTrackerActivityWithEmptyParams , options)
382
- }
383
-
384
- private fun launchAppTPOnboardingScreen () {
385
- val options = ActivityOptions .makeSceneTransitionAnimation(this ).toBundle()
386
- globalActivityStarter.start(this , AppTrackerOnboardingActivityWithEmptyParamsParams , options)
361
+ private fun launchActivityAndFinish (intent : Intent ) {
362
+ launchActivity(intent)
363
+ finish()
387
364
}
388
365
389
366
private fun launchAddHomeScreenWidget () {
390
367
pixel.fire(AppPixelName .SETTINGS_ADD_HOME_SCREEN_WIDGET_CLICKED )
391
368
addWidgetLauncher.launchAddWidget(this )
392
369
}
393
370
394
- private fun launchPrivateSearchScreen () {
395
- val options = ActivityOptions .makeSceneTransitionAnimation(this ).toBundle()
396
- globalActivityStarter.start(this , PrivateSearchScreenNoParams , options)
397
- }
398
-
399
- private fun launchWebTrackingProtectionScreen () {
400
- val options = ActivityOptions .makeSceneTransitionAnimation(this ).toBundle()
401
- globalActivityStarter.start(this , WebTrackingProtectionScreenNoParams , options)
402
- }
403
-
404
- private fun launchCookiePopupProtectionScreen () {
405
- val options = ActivityOptions .makeSceneTransitionAnimation(this ).toBundle()
406
- startActivity(AutoconsentSettingsActivity .intent(this ), options)
407
- }
408
-
409
- private fun launchFireButtonScreen () {
410
- val options = ActivityOptions .makeSceneTransitionAnimation(this ).toBundle()
411
- globalActivityStarter.start(this , FireButtonScreenNoParams , options)
412
- }
413
-
414
- private fun launchPermissionsScreen () {
415
- val options = ActivityOptions .makeSceneTransitionAnimation(this ).toBundle()
416
- globalActivityStarter.start(this , PermissionsScreenNoParams , options)
417
- }
418
-
419
- private fun launchAppearanceScreen () {
420
- val options = ActivityOptions .makeSceneTransitionAnimation(this ).toBundle()
421
- globalActivityStarter.start(this , AppearanceScreen .Default , options)
422
- }
423
-
424
- private fun launchAboutScreen () {
425
- val options = ActivityOptions .makeSceneTransitionAnimation(this ).toBundle()
426
- globalActivityStarter.start(this , AboutScreenNoParams , options)
427
- }
428
-
429
- private fun launchGeneralSettingsScreen () {
430
- val options = ActivityOptions .makeSceneTransitionAnimation(this ).toBundle()
431
- globalActivityStarter.start(this , GeneralSettingsScreenNoParams , options)
432
- }
433
-
434
371
private fun launchFeedback () {
435
372
feedbackFlow.launch(null )
436
373
}
437
374
438
- private fun launchPproUnifiedFeedback () {
439
- globalActivityStarter.start(
440
- this ,
441
- GeneralPrivacyProFeedbackScreenNoParams ,
442
- )
443
- }
444
-
445
- private fun launchOtherPlatforms () {
446
- startActivity(BrowserActivity .intent(context = this , queryExtra = OTHER_PLATFORMS_URL ))
447
- finish()
448
- }
449
-
450
375
companion object {
451
376
const val LAUNCH_FROM_NOTIFICATION_PIXEL_NAME = " LAUNCH_FROM_NOTIFICATION_PIXEL_NAME"
452
377
0 commit comments