Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
Fix certificates info screen not showing up after onboarding. (#5760)
Browse files Browse the repository at this point in the history
Co-authored-by: Nikolaus Schauersberger <[email protected]>
Co-authored-by: Mohamed <[email protected]>
  • Loading branch information
3 people authored Dec 15, 2022
1 parent 4cd43c0 commit 4e3bcf9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class CovidCertificateOnboardingFragment : Fragment(R.layout.covid_certificate_o
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
viewModel.checkOnboardingStatus()

with(binding) {
if (!args.showBottomNav) {
toolbar.apply {
Expand All @@ -73,6 +75,7 @@ class CovidCertificateOnboardingFragment : Fragment(R.layout.covid_certificate_o
findNavController().navigate(
R.id.action_covidCertificateOnboardingFragment_to_privacyFragment
)

CovidCertificateOnboardingViewModel.Event.NavigateToPersonOverview ->
findNavController().navigate(
R.id.action_covidCertificateOnboardingFragment_to_personOverviewFragment
Expand All @@ -82,8 +85,10 @@ class CovidCertificateOnboardingFragment : Fragment(R.layout.covid_certificate_o
val uri = when (event.containerId) {
is VaccinationCertificateContainerId ->
VaccinationDetailsFragment.uri(event.containerId.qrCodeHash)

is TestCertificateContainerId ->
TestCertificateDetailsFragment.uri(event.containerId.qrCodeHash)

is RecoveryCertificateContainerId ->
RecoveryCertificateDetailsFragment.uri(event.containerId.qrCodeHash)
}
Expand All @@ -92,8 +97,16 @@ class CovidCertificateOnboardingFragment : Fragment(R.layout.covid_certificate_o
.build()
findNavController().navigate(uri, navOption)
}

is CovidCertificateOnboardingViewModel.Event.Error ->
showCovidCertificateOnboardingErrorDialog(event.throwable)

is CovidCertificateOnboardingViewModel.Event.SkipOnboarding ->
if (args.showBottomNav) {
findNavController().navigate(
R.id.action_covidCertificateOnboardingFragment_to_personOverviewFragment
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import de.rki.coronawarnapp.util.coroutine.DispatcherProvider
import de.rki.coronawarnapp.util.ui.SingleLiveEvent
import de.rki.coronawarnapp.util.viewmodel.CWAViewModel
import de.rki.coronawarnapp.util.viewmodel.CWAViewModelFactory
import kotlinx.coroutines.flow.first
import timber.log.Timber

class CovidCertificateOnboardingViewModel @AssistedInject constructor(
Expand Down Expand Up @@ -38,6 +39,12 @@ class CovidCertificateOnboardingViewModel @AssistedInject constructor(
events.postValue(event)
}

fun checkOnboardingStatus() = launch {
if (covidCertificateSettings.isOnboarded.first()) {
events.postValue(Event.SkipOnboarding)
}
}

fun onDataPrivacyClick() = events.postValue(Event.NavigateToDataPrivacy)

@AssistedFactory
Expand All @@ -50,6 +57,8 @@ class CovidCertificateOnboardingViewModel @AssistedInject constructor(
sealed class Event {
object NavigateToDataPrivacy : Event()
object NavigateToPersonOverview : Event()

object SkipOnboarding : Event()
data class NavigateToDccDetailsScreen(val containerId: CertificateContainerId) : Event()
data class Error(val throwable: Throwable) : Event()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/covid_certificates_graph"
app:startDestination="@id/personOverviewFragment">
app:startDestination="@id/covidCertificateOnboardingFragment">
<fragment
android:id="@+id/personOverviewFragment"
android:name="de.rki.coronawarnapp.covidcertificate.person.ui.overview.PersonOverviewFragment"
Expand Down

0 comments on commit 4e3bcf9

Please sign in to comment.