From 3f5147ddcef841caa40c56cd092916020bb06f21 Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Thu, 1 Dec 2022 16:47:10 +0100 Subject: [PATCH] Fixing the toggle notifications use case for current session --- ...eCase.kt => ToggleNotificationsUseCase.kt} | 2 +- .../v2/overview/SessionOverviewViewModel.kt | 6 +- ...leNotificationsForCurrentSessionUseCase.kt | 9 +-- ...leNotificationsForCurrentSessionUseCase.kt | 10 +--- ...leNotificationsForCurrentSessionUseCase.kt | 57 +++++++++++++++++++ ...SettingsNotificationPreferenceViewModel.kt | 6 +- ...t.kt => ToggleNotificationsUseCaseTest.kt} | 10 ++-- ...tificationsForCurrentSessionUseCaseTest.kt | 14 ++--- ...tificationsForCurrentSessionUseCaseTest.kt | 8 +-- .../fakes/FakeToggleNotificationUseCase.kt | 4 +- 10 files changed, 92 insertions(+), 34 deletions(-) rename vector/src/main/java/im/vector/app/features/settings/devices/v2/notification/{ToggleNotificationUseCase.kt => ToggleNotificationsUseCase.kt} (97%) create mode 100644 vector/src/main/java/im/vector/app/features/settings/notifications/ToggleNotificationsForCurrentSessionUseCase.kt rename vector/src/test/java/im/vector/app/features/settings/devices/v2/notification/{ToggleNotificationUseCaseTest.kt => ToggleNotificationsUseCaseTest.kt} (93%) diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/v2/notification/ToggleNotificationUseCase.kt b/vector/src/main/java/im/vector/app/features/settings/devices/v2/notification/ToggleNotificationsUseCase.kt similarity index 97% rename from vector/src/main/java/im/vector/app/features/settings/devices/v2/notification/ToggleNotificationUseCase.kt rename to vector/src/main/java/im/vector/app/features/settings/devices/v2/notification/ToggleNotificationsUseCase.kt index 73a81a6de1..77195ea950 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/v2/notification/ToggleNotificationUseCase.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/v2/notification/ToggleNotificationsUseCase.kt @@ -20,7 +20,7 @@ import im.vector.app.core.di.ActiveSessionHolder import org.matrix.android.sdk.api.account.LocalNotificationSettingsContent import javax.inject.Inject -class ToggleNotificationUseCase @Inject constructor( +class ToggleNotificationsUseCase @Inject constructor( private val activeSessionHolder: ActiveSessionHolder, private val checkIfCanToggleNotificationsViaPusherUseCase: CheckIfCanToggleNotificationsViaPusherUseCase, private val checkIfCanToggleNotificationsViaAccountDataUseCase: CheckIfCanToggleNotificationsViaAccountDataUseCase, diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/v2/overview/SessionOverviewViewModel.kt b/vector/src/main/java/im/vector/app/features/settings/devices/v2/overview/SessionOverviewViewModel.kt index f598c397de..55866cb8c4 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/v2/overview/SessionOverviewViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/v2/overview/SessionOverviewViewModel.kt @@ -31,7 +31,7 @@ import im.vector.app.features.settings.devices.v2.RefreshDevicesUseCase import im.vector.app.features.settings.devices.v2.ToggleIpAddressVisibilityUseCase import im.vector.app.features.settings.devices.v2.VectorSessionsListViewModel import im.vector.app.features.settings.devices.v2.notification.GetNotificationsStatusUseCase -import im.vector.app.features.settings.devices.v2.notification.ToggleNotificationUseCase +import im.vector.app.features.settings.devices.v2.notification.ToggleNotificationsUseCase import im.vector.app.features.settings.devices.v2.signout.SignoutSessionsReAuthNeeded import im.vector.app.features.settings.devices.v2.signout.SignoutSessionsUseCase import im.vector.app.features.settings.devices.v2.verification.CheckIfCurrentSessionCanBeVerifiedUseCase @@ -52,7 +52,7 @@ class SessionOverviewViewModel @AssistedInject constructor( private val signoutSessionsUseCase: SignoutSessionsUseCase, private val pendingAuthHandler: PendingAuthHandler, private val activeSessionHolder: ActiveSessionHolder, - private val toggleNotificationUseCase: ToggleNotificationUseCase, + private val toggleNotificationsUseCase: ToggleNotificationsUseCase, private val getNotificationsStatusUseCase: GetNotificationsStatusUseCase, refreshDevicesUseCase: RefreshDevicesUseCase, private val vectorPreferences: VectorPreferences, @@ -226,7 +226,7 @@ class SessionOverviewViewModel @AssistedInject constructor( private fun handleTogglePusherAction(action: SessionOverviewAction.TogglePushNotifications) { viewModelScope.launch { - toggleNotificationUseCase.execute(action.deviceId, action.enabled) + toggleNotificationsUseCase.execute(action.deviceId, action.enabled) } } } diff --git a/vector/src/main/java/im/vector/app/features/settings/notifications/DisableNotificationsForCurrentSessionUseCase.kt b/vector/src/main/java/im/vector/app/features/settings/notifications/DisableNotificationsForCurrentSessionUseCase.kt index 380c3b5e4e..9173107018 100644 --- a/vector/src/main/java/im/vector/app/features/settings/notifications/DisableNotificationsForCurrentSessionUseCase.kt +++ b/vector/src/main/java/im/vector/app/features/settings/notifications/DisableNotificationsForCurrentSessionUseCase.kt @@ -20,21 +20,22 @@ import im.vector.app.core.di.ActiveSessionHolder import im.vector.app.core.pushers.PushersManager import im.vector.app.core.pushers.UnregisterUnifiedPushUseCase import im.vector.app.features.settings.devices.v2.notification.CheckIfCanToggleNotificationsViaPusherUseCase -import im.vector.app.features.settings.devices.v2.notification.ToggleNotificationUseCase import javax.inject.Inject class DisableNotificationsForCurrentSessionUseCase @Inject constructor( private val activeSessionHolder: ActiveSessionHolder, private val pushersManager: PushersManager, private val checkIfCanToggleNotificationsViaPusherUseCase: CheckIfCanToggleNotificationsViaPusherUseCase, - private val toggleNotificationUseCase: ToggleNotificationUseCase, + private val toggleNotificationsForCurrentSessionUseCase: ToggleNotificationsForCurrentSessionUseCase, private val unregisterUnifiedPushUseCase: UnregisterUnifiedPushUseCase, ) { + // TODO update unit tests suspend fun execute() { val session = activeSessionHolder.getSafeActiveSession() ?: return - val deviceId = session.sessionParams.deviceId ?: return - toggleNotificationUseCase.execute(deviceId, enabled = false) + toggleNotificationsForCurrentSessionUseCase.execute(enabled = false) + + // handle case when server does not support toggle of pusher if (!checkIfCanToggleNotificationsViaPusherUseCase.execute(session)) { unregisterUnifiedPushUseCase.execute(pushersManager) } diff --git a/vector/src/main/java/im/vector/app/features/settings/notifications/EnableNotificationsForCurrentSessionUseCase.kt b/vector/src/main/java/im/vector/app/features/settings/notifications/EnableNotificationsForCurrentSessionUseCase.kt index 89633a10c2..663c5004e8 100644 --- a/vector/src/main/java/im/vector/app/features/settings/notifications/EnableNotificationsForCurrentSessionUseCase.kt +++ b/vector/src/main/java/im/vector/app/features/settings/notifications/EnableNotificationsForCurrentSessionUseCase.kt @@ -16,17 +16,14 @@ package im.vector.app.features.settings.notifications -import im.vector.app.core.di.ActiveSessionHolder import im.vector.app.core.pushers.EnsureFcmTokenIsRetrievedUseCase import im.vector.app.core.pushers.PushersManager import im.vector.app.core.pushers.RegisterUnifiedPushUseCase -import im.vector.app.features.settings.devices.v2.notification.ToggleNotificationUseCase import javax.inject.Inject class EnableNotificationsForCurrentSessionUseCase @Inject constructor( - private val activeSessionHolder: ActiveSessionHolder, private val pushersManager: PushersManager, - private val toggleNotificationUseCase: ToggleNotificationUseCase, + private val toggleNotificationsForCurrentSessionUseCase: ToggleNotificationsForCurrentSessionUseCase, private val registerUnifiedPushUseCase: RegisterUnifiedPushUseCase, private val ensureFcmTokenIsRetrievedUseCase: EnsureFcmTokenIsRetrievedUseCase, ) { @@ -37,6 +34,7 @@ class EnableNotificationsForCurrentSessionUseCase @Inject constructor( object NeedToAskUserForDistributor : EnableNotificationsResult } + // TODO update unit tests suspend fun execute(distributor: String = ""): EnableNotificationsResult { val pusherForCurrentSession = pushersManager.getPusherForCurrentSession() if (pusherForCurrentSession == null) { @@ -50,9 +48,7 @@ class EnableNotificationsForCurrentSessionUseCase @Inject constructor( } } - val session = activeSessionHolder.getSafeActiveSession() ?: return EnableNotificationsResult.Failure - val deviceId = session.sessionParams.deviceId ?: return EnableNotificationsResult.Failure - toggleNotificationUseCase.execute(deviceId, enabled = true) + toggleNotificationsForCurrentSessionUseCase.execute(enabled = true) return EnableNotificationsResult.Success } diff --git a/vector/src/main/java/im/vector/app/features/settings/notifications/ToggleNotificationsForCurrentSessionUseCase.kt b/vector/src/main/java/im/vector/app/features/settings/notifications/ToggleNotificationsForCurrentSessionUseCase.kt new file mode 100644 index 0000000000..64b4b1bb89 --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/settings/notifications/ToggleNotificationsForCurrentSessionUseCase.kt @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2022 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.app.features.settings.notifications + +import im.vector.app.core.di.ActiveSessionHolder +import im.vector.app.core.pushers.UnifiedPushHelper +import im.vector.app.features.settings.devices.v2.notification.CheckIfCanToggleNotificationsViaPusherUseCase +import im.vector.app.features.settings.devices.v2.notification.DeleteNotificationSettingsAccountDataUseCase +import im.vector.app.features.settings.devices.v2.notification.SetNotificationSettingsAccountDataUseCase +import org.matrix.android.sdk.api.account.LocalNotificationSettingsContent +import timber.log.Timber +import javax.inject.Inject + +class ToggleNotificationsForCurrentSessionUseCase @Inject constructor( + private val activeSessionHolder: ActiveSessionHolder, + private val unifiedPushHelper: UnifiedPushHelper, + private val checkIfCanToggleNotificationsViaPusherUseCase: CheckIfCanToggleNotificationsViaPusherUseCase, + private val setNotificationSettingsAccountDataUseCase: SetNotificationSettingsAccountDataUseCase, + private val deleteNotificationSettingsAccountDataUseCase: DeleteNotificationSettingsAccountDataUseCase, +) { + + // TODO add unit tests + suspend fun execute(enabled: Boolean) { + val session = activeSessionHolder.getSafeActiveSession() ?: return + val deviceId = session.sessionParams.deviceId ?: return + + if (unifiedPushHelper.isBackgroundSync()) { + Timber.d("background sync is enabled, setting account data event") + val newNotificationSettingsContent = LocalNotificationSettingsContent(isSilenced = !enabled) + setNotificationSettingsAccountDataUseCase.execute(session, deviceId, newNotificationSettingsContent) + } else { + Timber.d("push notif is enabled, deleting any account data and updating pusher") + deleteNotificationSettingsAccountDataUseCase.execute(session) + + if (checkIfCanToggleNotificationsViaPusherUseCase.execute(session)) { + val devicePusher = session.pushersService().getPushers().firstOrNull { it.deviceId == deviceId } + devicePusher?.let { pusher -> + session.pushersService().togglePusher(pusher, enabled) + } + } + } + } +} diff --git a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationPreferenceViewModel.kt b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationPreferenceViewModel.kt index d6a9c621f2..357f6458f2 100644 --- a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationPreferenceViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationPreferenceViewModel.kt @@ -40,6 +40,7 @@ class VectorSettingsNotificationPreferenceViewModel @AssistedInject constructor( private val unregisterUnifiedPushUseCase: UnregisterUnifiedPushUseCase, private val registerUnifiedPushUseCase: RegisterUnifiedPushUseCase, private val ensureFcmTokenIsRetrievedUseCase: EnsureFcmTokenIsRetrievedUseCase, + private val toggleNotificationsForCurrentSessionUseCase: ToggleNotificationsForCurrentSessionUseCase, ) : VectorViewModel(initialState) { @AssistedFactory @@ -80,6 +81,7 @@ class VectorSettingsNotificationPreferenceViewModel @AssistedInject constructor( } } + // TODO update unit tests private fun handleRegisterPushDistributor(distributor: String) { viewModelScope.launch { unregisterUnifiedPushUseCase.execute(pushersManager) @@ -88,7 +90,9 @@ class VectorSettingsNotificationPreferenceViewModel @AssistedInject constructor( _viewEvents.post(VectorSettingsNotificationPreferenceViewEvent.AskUserForPushDistributor) } RegisterUnifiedPushUseCase.RegisterUnifiedPushResult.Success -> { - ensureFcmTokenIsRetrievedUseCase.execute(pushersManager, registerPusher = vectorPreferences.areNotificationEnabledForDevice()) + val areNotificationsEnabled = vectorPreferences.areNotificationEnabledForDevice() + ensureFcmTokenIsRetrievedUseCase.execute(pushersManager, registerPusher = areNotificationsEnabled) + toggleNotificationsForCurrentSessionUseCase.execute(enabled = areNotificationsEnabled) _viewEvents.post(VectorSettingsNotificationPreferenceViewEvent.NotificationMethodChanged) } } diff --git a/vector/src/test/java/im/vector/app/features/settings/devices/v2/notification/ToggleNotificationUseCaseTest.kt b/vector/src/test/java/im/vector/app/features/settings/devices/v2/notification/ToggleNotificationsUseCaseTest.kt similarity index 93% rename from vector/src/test/java/im/vector/app/features/settings/devices/v2/notification/ToggleNotificationUseCaseTest.kt rename to vector/src/test/java/im/vector/app/features/settings/devices/v2/notification/ToggleNotificationsUseCaseTest.kt index 1e3517c776..90afbe9045 100644 --- a/vector/src/test/java/im/vector/app/features/settings/devices/v2/notification/ToggleNotificationUseCaseTest.kt +++ b/vector/src/test/java/im/vector/app/features/settings/devices/v2/notification/ToggleNotificationsUseCaseTest.kt @@ -26,7 +26,7 @@ import kotlinx.coroutines.test.runTest import org.junit.Test import org.matrix.android.sdk.api.account.LocalNotificationSettingsContent -class ToggleNotificationUseCaseTest { +class ToggleNotificationsUseCaseTest { private val activeSessionHolder = FakeActiveSessionHolder() private val fakeCheckIfCanToggleNotificationsViaPusherUseCase = @@ -36,8 +36,8 @@ class ToggleNotificationUseCaseTest { private val fakeSetNotificationSettingsAccountDataUseCase = mockk() - private val toggleNotificationUseCase = - ToggleNotificationUseCase( + private val toggleNotificationsUseCase = + ToggleNotificationsUseCase( activeSessionHolder = activeSessionHolder.instance, checkIfCanToggleNotificationsViaPusherUseCase = fakeCheckIfCanToggleNotificationsViaPusherUseCase, checkIfCanToggleNotificationsViaAccountDataUseCase = fakeCheckIfCanToggleNotificationsViaAccountDataUseCase, @@ -59,7 +59,7 @@ class ToggleNotificationUseCaseTest { every { fakeCheckIfCanToggleNotificationsViaAccountDataUseCase.execute(fakeSession, sessionId) } returns false // When - toggleNotificationUseCase.execute(sessionId, true) + toggleNotificationsUseCase.execute(sessionId, true) // Then activeSessionHolder.fakeSession.pushersService().verifyTogglePusherCalled(pushers.first(), true) @@ -78,7 +78,7 @@ class ToggleNotificationUseCaseTest { ) // When - toggleNotificationUseCase.execute(sessionId, true) + toggleNotificationsUseCase.execute(sessionId, true) // Then coVerify { diff --git a/vector/src/test/java/im/vector/app/features/settings/notifications/DisableNotificationsForCurrentSessionUseCaseTest.kt b/vector/src/test/java/im/vector/app/features/settings/notifications/DisableNotificationsForCurrentSessionUseCaseTest.kt index e53874858a..7e2a118e0e 100644 --- a/vector/src/test/java/im/vector/app/features/settings/notifications/DisableNotificationsForCurrentSessionUseCaseTest.kt +++ b/vector/src/test/java/im/vector/app/features/settings/notifications/DisableNotificationsForCurrentSessionUseCaseTest.kt @@ -18,7 +18,7 @@ package im.vector.app.features.settings.notifications import im.vector.app.core.pushers.UnregisterUnifiedPushUseCase import im.vector.app.features.settings.devices.v2.notification.CheckIfCanToggleNotificationsViaPusherUseCase -import im.vector.app.features.settings.devices.v2.notification.ToggleNotificationUseCase +import im.vector.app.features.settings.devices.v2.notification.ToggleNotificationsUseCase import im.vector.app.test.fakes.FakeActiveSessionHolder import im.vector.app.test.fakes.FakePushersManager import io.mockk.coJustRun @@ -35,14 +35,14 @@ class DisableNotificationsForCurrentSessionUseCaseTest { private val fakeActiveSessionHolder = FakeActiveSessionHolder() private val fakePushersManager = FakePushersManager() private val fakeCheckIfCanToggleNotificationsViaPusherUseCase = mockk() - private val fakeToggleNotificationUseCase = mockk() + private val fakeToggleNotificationsUseCase = mockk() private val fakeUnregisterUnifiedPushUseCase = mockk() private val disableNotificationsForCurrentSessionUseCase = DisableNotificationsForCurrentSessionUseCase( activeSessionHolder = fakeActiveSessionHolder.instance, pushersManager = fakePushersManager.instance, checkIfCanToggleNotificationsViaPusherUseCase = fakeCheckIfCanToggleNotificationsViaPusherUseCase, - toggleNotificationUseCase = fakeToggleNotificationUseCase, + toggleNotificationUseCase = fakeToggleNotificationsUseCase, unregisterUnifiedPushUseCase = fakeUnregisterUnifiedPushUseCase, ) @@ -52,13 +52,13 @@ class DisableNotificationsForCurrentSessionUseCaseTest { val fakeSession = fakeActiveSessionHolder.fakeSession fakeSession.givenSessionId(A_SESSION_ID) every { fakeCheckIfCanToggleNotificationsViaPusherUseCase.execute(fakeSession) } returns true - coJustRun { fakeToggleNotificationUseCase.execute(A_SESSION_ID, any()) } + coJustRun { fakeToggleNotificationsUseCase.execute(A_SESSION_ID, any()) } // When disableNotificationsForCurrentSessionUseCase.execute() // Then - coVerify { fakeToggleNotificationUseCase.execute(A_SESSION_ID, false) } + coVerify { fakeToggleNotificationsUseCase.execute(A_SESSION_ID, false) } } @Test @@ -67,7 +67,7 @@ class DisableNotificationsForCurrentSessionUseCaseTest { val fakeSession = fakeActiveSessionHolder.fakeSession fakeSession.givenSessionId(A_SESSION_ID) every { fakeCheckIfCanToggleNotificationsViaPusherUseCase.execute(fakeSession) } returns false - coJustRun { fakeToggleNotificationUseCase.execute(A_SESSION_ID, any()) } + coJustRun { fakeToggleNotificationsUseCase.execute(A_SESSION_ID, any()) } coJustRun { fakeUnregisterUnifiedPushUseCase.execute(any()) } // When @@ -75,7 +75,7 @@ class DisableNotificationsForCurrentSessionUseCaseTest { // Then coVerify { - fakeToggleNotificationUseCase.execute(A_SESSION_ID, false) + fakeToggleNotificationsUseCase.execute(A_SESSION_ID, false) fakeUnregisterUnifiedPushUseCase.execute(fakePushersManager.instance) } } diff --git a/vector/src/test/java/im/vector/app/features/settings/notifications/EnableNotificationsForCurrentSessionUseCaseTest.kt b/vector/src/test/java/im/vector/app/features/settings/notifications/EnableNotificationsForCurrentSessionUseCaseTest.kt index f10b0777cb..7beab170f2 100644 --- a/vector/src/test/java/im/vector/app/features/settings/notifications/EnableNotificationsForCurrentSessionUseCaseTest.kt +++ b/vector/src/test/java/im/vector/app/features/settings/notifications/EnableNotificationsForCurrentSessionUseCaseTest.kt @@ -18,7 +18,7 @@ package im.vector.app.features.settings.notifications import im.vector.app.core.pushers.EnsureFcmTokenIsRetrievedUseCase import im.vector.app.core.pushers.RegisterUnifiedPushUseCase -import im.vector.app.features.settings.devices.v2.notification.ToggleNotificationUseCase +import im.vector.app.features.settings.devices.v2.notification.ToggleNotificationsUseCase import im.vector.app.test.fakes.FakeActiveSessionHolder import im.vector.app.test.fakes.FakePushersManager import io.mockk.coJustRun @@ -36,14 +36,14 @@ class EnableNotificationsForCurrentSessionUseCaseTest { private val fakeActiveSessionHolder = FakeActiveSessionHolder() private val fakePushersManager = FakePushersManager() - private val fakeToggleNotificationUseCase = mockk() + private val fakeToggleNotificationsUseCase = mockk() private val fakeRegisterUnifiedPushUseCase = mockk() private val fakeEnsureFcmTokenIsRetrievedUseCase = mockk() private val enableNotificationsForCurrentSessionUseCase = EnableNotificationsForCurrentSessionUseCase( activeSessionHolder = fakeActiveSessionHolder.instance, pushersManager = fakePushersManager.instance, - toggleNotificationUseCase = fakeToggleNotificationUseCase, + toggleNotificationUseCase = fakeToggleNotificationsUseCase, registerUnifiedPushUseCase = fakeRegisterUnifiedPushUseCase, ensureFcmTokenIsRetrievedUseCase = fakeEnsureFcmTokenIsRetrievedUseCase, ) @@ -57,7 +57,7 @@ class EnableNotificationsForCurrentSessionUseCaseTest { fakePushersManager.givenGetPusherForCurrentSessionReturns(null) every { fakeRegisterUnifiedPushUseCase.execute(any()) } returns RegisterUnifiedPushUseCase.RegisterUnifiedPushResult.Success justRun { fakeEnsureFcmTokenIsRetrievedUseCase.execute(any(), any()) } - coJustRun { fakeToggleNotificationUseCase.execute(A_SESSION_ID, any()) } + coJustRun { fakeToggleNotificationsUseCase.execute(A_SESSION_ID, any()) } // When val result = enableNotificationsForCurrentSessionUseCase.execute(aDistributor) diff --git a/vector/src/test/java/im/vector/app/test/fakes/FakeToggleNotificationUseCase.kt b/vector/src/test/java/im/vector/app/test/fakes/FakeToggleNotificationUseCase.kt index 527625144e..3d2179bc2d 100644 --- a/vector/src/test/java/im/vector/app/test/fakes/FakeToggleNotificationUseCase.kt +++ b/vector/src/test/java/im/vector/app/test/fakes/FakeToggleNotificationUseCase.kt @@ -16,14 +16,14 @@ package im.vector.app.test.fakes -import im.vector.app.features.settings.devices.v2.notification.ToggleNotificationUseCase +import im.vector.app.features.settings.devices.v2.notification.ToggleNotificationsUseCase import io.mockk.coJustRun import io.mockk.coVerify import io.mockk.mockk class FakeToggleNotificationUseCase { - val instance = mockk { + val instance = mockk { coJustRun { execute(any(), any()) } }