From 74f340fc444cd703d862575a6ba6d7c88a43f684 Mon Sep 17 00:00:00 2001 From: Mohamed Metwalli Date: Sat, 1 Jan 2022 19:22:04 +0100 Subject: [PATCH] Remove `Activity.goBack()` --- .../de/rki/coronawarnapp/ui/onboarding/OnboardingActivity.kt | 4 ---- .../coronawarnapp/ui/onboarding/OnboardingPrivacyFragment.kt | 4 ++-- .../rki/coronawarnapp/ui/onboarding/OnboardingTestFragment.kt | 4 ++-- .../coronawarnapp/ui/onboarding/OnboardingTracingFragment.kt | 4 ++-- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingActivity.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingActivity.kt index 6723bf329c2..f9baa0012c4 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingActivity.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingActivity.kt @@ -76,8 +76,4 @@ class OnboardingActivity : AppCompatActivity(), LifecycleObserver, HasAndroidInj MainActivity.start(this, intent) finish() } - - fun goBack() { - onBackPressed() - } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingPrivacyFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingPrivacyFragment.kt index ed82a3750f6..e863e2d8a97 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingPrivacyFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingPrivacyFragment.kt @@ -9,6 +9,7 @@ import de.rki.coronawarnapp.databinding.FragmentOnboardingPrivacyBinding import de.rki.coronawarnapp.util.di.AutoInject import de.rki.coronawarnapp.util.ui.doNavigate import de.rki.coronawarnapp.util.ui.observe2 +import de.rki.coronawarnapp.util.ui.popBackStack import de.rki.coronawarnapp.util.ui.viewBinding import de.rki.coronawarnapp.util.viewmodel.CWAViewModelFactoryProvider import de.rki.coronawarnapp.util.viewmodel.cwaViewModels @@ -36,8 +37,7 @@ class OnboardingPrivacyFragment : Fragment(R.layout.fragment_onboarding_privacy) OnboardingPrivacyFragmentDirections .actionOnboardingPrivacyFragmentToOnboardingTracingFragment() ) - is OnboardingNavigationEvents.NavigateToOnboardingFragment -> - (activity as OnboardingActivity).goBack() + is OnboardingNavigationEvents.NavigateToOnboardingFragment -> popBackStack() } } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTestFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTestFragment.kt index a63ba07f1e9..ed72133ab74 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTestFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTestFragment.kt @@ -9,6 +9,7 @@ import de.rki.coronawarnapp.databinding.FragmentOnboardingTestBinding import de.rki.coronawarnapp.util.di.AutoInject import de.rki.coronawarnapp.util.ui.doNavigate import de.rki.coronawarnapp.util.ui.observe2 +import de.rki.coronawarnapp.util.ui.popBackStack import de.rki.coronawarnapp.util.ui.viewBinding import de.rki.coronawarnapp.util.viewmodel.CWAViewModelFactoryProvider import de.rki.coronawarnapp.util.viewmodel.cwaViewModels @@ -36,8 +37,7 @@ class OnboardingTestFragment : Fragment(R.layout.fragment_onboarding_test), Auto OnboardingTestFragmentDirections .actionOnboardingTestFragmentToOnboardingNotificationsFragment() ) - is OnboardingNavigationEvents.NavigateToOnboardingTracing -> - (activity as OnboardingActivity).goBack() + is OnboardingNavigationEvents.NavigateToOnboardingTracing -> popBackStack() } } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTracingFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTracingFragment.kt index 56dd5e6b18c..8a7d6a729dd 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTracingFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTracingFragment.kt @@ -13,6 +13,7 @@ import de.rki.coronawarnapp.ui.doNavigate import de.rki.coronawarnapp.util.DialogHelper import de.rki.coronawarnapp.util.di.AutoInject import de.rki.coronawarnapp.util.ui.observe2 +import de.rki.coronawarnapp.util.ui.popBackStack import de.rki.coronawarnapp.util.ui.viewBinding import de.rki.coronawarnapp.util.viewmodel.CWAViewModelFactoryProvider import de.rki.coronawarnapp.util.viewmodel.cwaViewModels @@ -56,8 +57,7 @@ class OnboardingTracingFragment : Fragment(R.layout.fragment_onboarding_tracing) } ) ) - is OnboardingNavigationEvents.NavigateToOnboardingPrivacy -> - (requireActivity() as OnboardingActivity).goBack() + is OnboardingNavigationEvents.NavigateToOnboardingPrivacy -> popBackStack() } } vm.permissionRequestEvent.observe2(this) { permissionRequest ->