Skip to content

Commit 513f611

Browse files
committed
fix navigation transition to sub-screens
We don't need to use makeSceneTransitionAnimation as we're not doing SharedElementTransitions This looks like it became a c/p for all the screens, resulting in some weird cross-fading
1 parent a3f3b00 commit 513f611

File tree

1 file changed

+26
-101
lines changed

1 file changed

+26
-101
lines changed

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

Lines changed: 26 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ import com.duckduckgo.internal.features.api.InternalFeaturePlugin
8181
import com.duckduckgo.mobile.android.app.tracking.ui.AppTrackingProtectionScreens.AppTrackerActivityWithEmptyParams
8282
import com.duckduckgo.mobile.android.app.tracking.ui.AppTrackingProtectionScreens.AppTrackerOnboardingActivityWithEmptyParamsParams
8383
import com.duckduckgo.navigation.api.GlobalActivityStarter
84+
import com.duckduckgo.navigation.api.GlobalActivityStarter.ActivityParams
8485
import com.duckduckgo.settings.api.DuckPlayerSettingsPlugin
8586
import com.duckduckgo.settings.api.ProSettingsPlugin
8687
import com.duckduckgo.subscriptions.api.PrivacyProFeedbackScreens.GeneralPrivacyProFeedbackScreenNoParams
@@ -305,29 +306,28 @@ class NewSettingsActivity : DuckDuckGoActivity() {
305306
viewsPrivacy.cookiePopupProtectionSetting.setStatus(isOn = enabled)
306307
}
307308

308-
private fun processCommand(it: Command?) {
309+
private fun processCommand(it: Command) {
309310
when (it) {
310311
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)
317318
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)
327328
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))
331331
}
332332
}
333333

@@ -350,103 +350,28 @@ class NewSettingsActivity : DuckDuckGoActivity() {
350350
launchDefaultAppActivity()
351351
}
352352

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)
356355
}
357356

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)
361359
}
362360

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()
387364
}
388365

389366
private fun launchAddHomeScreenWidget() {
390367
pixel.fire(AppPixelName.SETTINGS_ADD_HOME_SCREEN_WIDGET_CLICKED)
391368
addWidgetLauncher.launchAddWidget(this)
392369
}
393370

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-
434371
private fun launchFeedback() {
435372
feedbackFlow.launch(null)
436373
}
437374

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-
450375
companion object {
451376
const val LAUNCH_FROM_NOTIFICATION_PIXEL_NAME = "LAUNCH_FROM_NOTIFICATION_PIXEL_NAME"
452377

0 commit comments

Comments
 (0)