Repository: corona-warn-app/cwa-app-android
File: Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentViewModel.kt (Kotlin)

Code before:
    fun showPopUps() = launch {
        if (errorResetTool.isResetNoticeToBeShown) events.postValue(ShowErrorResetDialog)
        if (!cwaSettings.wasTracingExplanationDialogShown) events.postValue(ShowTracingExplanation)
    }

    fun restoreAppShortcuts() {
        launch {
            appShortcutsHelper.restoreAppShortcut()
        }
    }

    fun userHasAcknowledgedTheLoweredRiskLevel() {
        isLoweredRiskLevelDialogBeingShown = false
        tracingSettings.isUserToBeNotifiedOfLoweredRiskLevel.update { false }
    }

    fun userHasAcknowledgedIncorrectDeviceTime() {
        cwaSettings.wasDeviceTimeIncorrectAcknowledged = true
    }

    fun tracingExplanationWasShown() {
        cwaSettings.wasTracingExplanationDialogShown = true
    }

    private fun isOlderThanThreshold(hours: Duration, testTimestamp: Instant): Boolean =
        Days.daysBetween(testTimestamp, Instant.now()).toStandardDuration().standardHours >= hours.standardHours

    private fun PCRCoronaTest?.toTestCardItem(testIdentifier: TestIdentifier) =
        when (val state = this.toSubmissionState()) {
            is SubmissionStatePCR.NoTest -> TestUnregisteredCard.Item(state) {
                events.postValue(HomeFragmentEvents.GoToSubmissionDispatcher)
            }
            is SubmissionStatePCR.FetchingResult -> TestFetchingCard.Item(state)
            is SubmissionStatePCR.TestResultReady -> PcrTestReadyCard.Item(state) {
                events.postValue(HomeFragmentEvents.GoToTestResultAvailableFragment(PCR, testIdentifier))
            }
            is SubmissionStatePCR.TestPositive -> PcrTestPositiveCard.Item(
                state = state,
                onClickAction = {
                    events.postValue(
                        HomeFragmentEvents.GoToTestResultPositiveFragment(
                            PCR,
                            testIdentifier
                        )
                    )
                },
                onRemoveAction = {
                    events.postValue(
                        HomeFragmentEvents.ShowDeleteTestDialog(
                            PCR,
                            false,

Review comment (suggestion):
btw , I think you can compare durations directly no need to get hours 
`toStandardDuration()>= hours`

Code after:
    fun userHasAcknowledgedTheLoweredRiskLevel() {
        isLoweredRiskLevelDialogBeingShown = false
        tracingSettings.isUserToBeNotifiedOfLoweredRiskLevel.update { false }
    }

    fun userHasAcknowledgedIncorrectDeviceTime() {
        cwaSettings.wasDeviceTimeIncorrectAcknowledged = true
    }

    fun tracingExplanationWasShown() {
        cwaSettings.wasTracingExplanationDialogShown = true
    }

    private fun PCRCoronaTest?.toTestCardItem(testIdentifier: TestIdentifier) =
        when (val state = this.toSubmissionState()) {
            is SubmissionStatePCR.NoTest -> TestUnregisteredCard.Item(state) {
                events.postValue(HomeFragmentEvents.GoToSubmissionDispatcher)
            }
            is SubmissionStatePCR.FetchingResult -> TestFetchingCard.Item(state)
            is SubmissionStatePCR.TestResultReady -> PcrTestReadyCard.Item(state) {
                events.postValue(HomeFragmentEvents.GoToTestResultAvailableFragment(PCR, testIdentifier))
            }
            is SubmissionStatePCR.TestPositive -> PcrTestPositiveCard.Item(
                state = state,
                onClickAction = {
                    events.postValue(
                        HomeFragmentEvents.GoToTestResultPositiveFragment(
                            PCR,
                            testIdentifier
                        )
                    )
                },
                onRemoveAction = {
                    events.postValue(
                        HomeFragmentEvents.ShowDeleteTestDialog(
                            PCR,
                            false,
                            identifier = testIdentifier
                        )
                    )
                }
            )
            is SubmissionStatePCR.TestNegative -> PcrTestNegativeCard.Item(state) {
                events.postValue(HomeFragmentEvents.GoToPcrTestResultNegativeFragment(PCR, testIdentifier))
            }
            is SubmissionStatePCR.TestInvalid -> PcrTestInvalidCard.Item(state) {
                events.postValue(HomeFragmentEvents.ShowDeleteTestDialog(PCR, identifier = testIdentifier))
            }
            is SubmissionStatePCR.TestError -> PcrTestErrorCard.Item(state) {
                events.postValue(HomeFragmentEvents.GoToTestResultPendingFragment(PCR, identifier = testIdentifier))
            }