diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentTest.kt index 982637a9df449e0ff8eb24b91c2f48343b721ece..1c034bcaac76576108f9a3196cefb145e9ece069 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentTest.kt @@ -12,8 +12,6 @@ import dagger.android.ContributesAndroidInjector import de.rki.coronawarnapp.R import de.rki.coronawarnapp.appconfig.AppConfigProvider import de.rki.coronawarnapp.coronatest.CoronaTestRepository -import de.rki.coronawarnapp.coronatest.notification.ShareTestResultNotificationService -import de.rki.coronawarnapp.deadman.DeadmanNotificationScheduler import de.rki.coronawarnapp.main.CWASettings import de.rki.coronawarnapp.statistics.source.StatisticsProvider import de.rki.coronawarnapp.statistics.ui.homecards.StatisticsHomeCard @@ -65,12 +63,10 @@ class HomeFragmentTest : BaseUITest() { @MockK lateinit var tracingStateProviderFactory: TracingStateProvider.Factory @MockK lateinit var coronaTestRepository: CoronaTestRepository @MockK lateinit var tracingRepository: TracingRepository - @MockK lateinit var shareTestResultNotificationService: ShareTestResultNotificationService @MockK lateinit var submissionRepository: SubmissionRepository @MockK lateinit var cwaSettings: CWASettings @MockK lateinit var appConfigProvider: AppConfigProvider @MockK lateinit var statisticsProvider: StatisticsProvider - @MockK lateinit var deadmanNotificationScheduler: DeadmanNotificationScheduler @MockK lateinit var appShortcutsHelper: AppShortcutsHelper @MockK lateinit var tracingSettings: TracingSettings @MockK lateinit var traceLocationOrganizerSettings: TraceLocationOrganizerSettings @@ -273,7 +269,6 @@ class HomeFragmentTest : BaseUITest() { coronaTestRepository = coronaTestRepository, cwaSettings = cwaSettings, statisticsProvider = statisticsProvider, - deadmanNotificationScheduler = deadmanNotificationScheduler, appShortcutsHelper = appShortcutsHelper, tracingSettings = tracingSettings, traceLocationOrganizerSettings = traceLocationOrganizerSettings, diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/HomeFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/HomeFragment.kt index dfbad3ce5fc64c9f911afcb2b89421f40b7c8250..59df149b3f5656db3589f435411c1573866bdc83 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/HomeFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/HomeFragment.kt @@ -10,6 +10,7 @@ import androidx.navigation.fragment.findNavController import androidx.recyclerview.widget.DefaultItemAnimator import androidx.recyclerview.widget.LinearLayoutManager import de.rki.coronawarnapp.R +import de.rki.coronawarnapp.coronatest.type.CoronaTest import de.rki.coronawarnapp.databinding.HomeFragmentLayoutBinding import de.rki.coronawarnapp.tracing.ui.TracingExplanationDialog import de.rki.coronawarnapp.ui.main.home.popups.DeviceTimeIncorrectDialog @@ -97,7 +98,7 @@ class HomeFragment : Fragment(R.layout.home_fragment_layout), AutoInject { onPositive = { viewModel.errorResetDialogDismissed() } ) } - HomeFragmentEvents.ShowDeleteTestDialog -> showRemoveTestDialog() + is HomeFragmentEvents.ShowDeleteTestDialog -> showRemoveTestDialog(event.type) HomeFragmentEvents.GoToStatisticsExplanation -> doNavigate( HomeFragmentDirections.actionMainFragmentToStatisticsExplanationFragment() ) @@ -127,7 +128,7 @@ class HomeFragment : Fragment(R.layout.home_fragment_layout), AutoInject { binding.container.sendAccessibilityEvent(AccessibilityEvent.TYPE_ANNOUNCEMENT) } - private fun showRemoveTestDialog() { + private fun showRemoveTestDialog(type: CoronaTest.Type) { val removeTestDialog = DialogHelper.DialogInstance( requireActivity(), R.string.submission_test_result_dialog_remove_test_title, @@ -135,7 +136,7 @@ class HomeFragment : Fragment(R.layout.home_fragment_layout), AutoInject { R.string.submission_test_result_dialog_remove_test_button_positive, R.string.submission_test_result_dialog_remove_test_button_negative, positiveButtonFunction = { - viewModel.deregisterWarningAccepted() + viewModel.deregisterWarningAccepted(type) } ) DialogHelper.showDialog(removeTestDialog).apply { diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentEvents.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentEvents.kt index b219536e6ad616d1f0e99d5e9b10584a2336c35c..4573361022e31b8bc36f27279c2aff8ad07573f9 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentEvents.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentEvents.kt @@ -1,12 +1,14 @@ package de.rki.coronawarnapp.ui.main.home +import de.rki.coronawarnapp.coronatest.type.CoronaTest + sealed class HomeFragmentEvents { object ShowTracingExplanation : HomeFragmentEvents() object ShowErrorResetDialog : HomeFragmentEvents() - object ShowDeleteTestDialog : HomeFragmentEvents() + data class ShowDeleteTestDialog(val type: CoronaTest.Type) : HomeFragmentEvents() object GoToStatisticsExplanation : HomeFragmentEvents() } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentViewModel.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentViewModel.kt index 73fc1c4d40237b9bb81b043a5d6fc82cf0e100d1..488bfd1e58e55a168e99524693ff57781b5849e1 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentViewModel.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentViewModel.kt @@ -17,7 +17,6 @@ import de.rki.coronawarnapp.coronatest.type.pcr.toSubmissionState import de.rki.coronawarnapp.coronatest.type.rapidantigen.RACoronaTest import de.rki.coronawarnapp.coronatest.type.rapidantigen.SubmissionStateRAT import de.rki.coronawarnapp.coronatest.type.rapidantigen.toSubmissionState -import de.rki.coronawarnapp.deadman.DeadmanNotificationScheduler import de.rki.coronawarnapp.main.CWASettings import de.rki.coronawarnapp.statistics.source.StatisticsProvider import de.rki.coronawarnapp.statistics.ui.homecards.StatisticsHomeCard @@ -85,7 +84,6 @@ class HomeFragmentViewModel @AssistedInject constructor( private val cwaSettings: CWASettings, private val appConfigProvider: AppConfigProvider, statisticsProvider: StatisticsProvider, - private val deadmanNotificationScheduler: DeadmanNotificationScheduler, private val appShortcutsHelper: AppShortcutsHelper, private val tracingSettings: TracingSettings, private val traceLocationOrganizerSettings: TraceLocationOrganizerSettings, @@ -193,7 +191,7 @@ class HomeFragmentViewModel @AssistedInject constructor( ) } is SubmissionStatePCR.TestInvalid -> PcrTestInvalidCard.Item(state) { - popupEvents.postValue(HomeFragmentEvents.ShowDeleteTestDialog) + popupEvents.postValue(HomeFragmentEvents.ShowDeleteTestDialog(CoronaTest.Type.PCR)) } is SubmissionStatePCR.TestError -> PcrTestErrorCard.Item(state) { routeToScreen.postValue( @@ -239,7 +237,7 @@ class HomeFragmentViewModel @AssistedInject constructor( ) } is SubmissionStateRAT.TestInvalid -> RapidTestInvalidCard.Item(state) { - popupEvents.postValue(HomeFragmentEvents.ShowDeleteTestDialog) + popupEvents.postValue(HomeFragmentEvents.ShowDeleteTestDialog(CoronaTest.Type.RAPID_ANTIGEN)) } is SubmissionStateRAT.TestError -> RapidTestErrorCard.Item(state) { routeToScreen.postValue( @@ -368,8 +366,8 @@ class HomeFragmentViewModel @AssistedInject constructor( tracingRepository.refreshRiskResult() } - fun deregisterWarningAccepted() { - submissionRepository.removeTestFromDevice(type = CoronaTest.Type.PCR) + fun deregisterWarningAccepted(type: CoronaTest.Type) { + submissionRepository.removeTestFromDevice(type) } fun userHasAcknowledgedTheLoweredRiskLevel() { diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/main/home/HomeFragmentViewModelTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/main/home/HomeFragmentViewModelTest.kt index 5c027f688621adacfe73f360942ff6ae511c0823..0e3c9ee26bc72562208f3e02316c78b7a55258e9 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/main/home/HomeFragmentViewModelTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/main/home/HomeFragmentViewModelTest.kt @@ -3,7 +3,6 @@ package de.rki.coronawarnapp.main.home import android.content.Context import de.rki.coronawarnapp.appconfig.AppConfigProvider import de.rki.coronawarnapp.coronatest.CoronaTestRepository -import de.rki.coronawarnapp.deadman.DeadmanNotificationScheduler import de.rki.coronawarnapp.environment.BuildConfigWrap import de.rki.coronawarnapp.main.CWASettings import de.rki.coronawarnapp.statistics.source.StatisticsProvider @@ -57,7 +56,6 @@ class HomeFragmentViewModelTest : BaseTest() { @MockK lateinit var cwaSettings: CWASettings @MockK lateinit var appConfigProvider: AppConfigProvider @MockK lateinit var statisticsProvider: StatisticsProvider - @MockK lateinit var deadmanNotificationScheduler: DeadmanNotificationScheduler @MockK lateinit var appShortcutsHelper: AppShortcutsHelper @MockK lateinit var tracingSettings: TracingSettings @MockK lateinit var traceLocationOrganizerSettings: TraceLocationOrganizerSettings @@ -91,7 +89,6 @@ class HomeFragmentViewModelTest : BaseTest() { cwaSettings = cwaSettings, appConfigProvider = appConfigProvider, statisticsProvider = statisticsProvider, - deadmanNotificationScheduler = deadmanNotificationScheduler, appShortcutsHelper = appShortcutsHelper, tracingSettings = tracingSettings, traceLocationOrganizerSettings = traceLocationOrganizerSettings,