Cleanup remaining fakes

This commit is contained in:
Wolf-Martell Montwé 2024-04-24 18:37:13 +02:00
parent 0ac042e0d8
commit 8f417132b3
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72
3 changed files with 5 additions and 37 deletions

View file

@ -6,21 +6,7 @@ import app.k9mail.feature.account.oauth.ui.AccountOAuthContract.Event
import app.k9mail.feature.account.oauth.ui.AccountOAuthContract.State
import app.k9mail.feature.account.oauth.ui.AccountOAuthContract.ViewModel
class FakeAccountOAuthViewModel(
initialState: State = State(),
) : BaseViewModel<State, Event, Effect>(initialState), ViewModel {
val events = mutableListOf<Event>()
override fun initState(state: State) {
updateState { state }
}
override fun event(event: Event) {
events.add(event)
}
fun effect(effect: Effect) {
emitEffect(effect)
}
class FakeAccountOAuthViewModel : BaseViewModel<State, Event, Effect>(State()), ViewModel {
override fun initState(state: State) = Unit
override fun event(event: Event) = Unit
}

View file

@ -1,17 +0,0 @@
package app.k9mail.feature.account.oauth.ui.preview
import app.k9mail.core.ui.compose.common.mvi.BaseViewModel
import app.k9mail.feature.account.oauth.ui.AccountOAuthContract
/**
* Only for previewing the UI.
*/
class PreviewAccountOAuthViewModel :
BaseViewModel<AccountOAuthContract.State, AccountOAuthContract.Event, AccountOAuthContract.Effect>(
AccountOAuthContract.State(),
),
AccountOAuthContract.ViewModel {
override fun initState(state: AccountOAuthContract.State) = Unit
override fun event(event: AccountOAuthContract.Event) = Unit
}

View file

@ -4,7 +4,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.PreviewWithTheme
import app.k9mail.feature.account.common.domain.input.StringInputField
import app.k9mail.feature.account.oauth.ui.preview.PreviewAccountOAuthViewModel
import app.k9mail.feature.account.server.validation.ui.fake.FakeAccountOAuthViewModel
import app.k9mail.feature.account.setup.ui.autodiscovery.fake.fakeAutoDiscoveryResultSettings
@ -45,7 +44,7 @@ internal fun AccountAutoDiscoveryContentPasswordPreview() {
autoDiscoverySettings = fakeAutoDiscoveryResultSettings(isTrusted = true),
),
onEvent = {},
oAuthViewModel = PreviewAccountOAuthViewModel(),
oAuthViewModel = FakeAccountOAuthViewModel(),
)
}
}
@ -61,7 +60,7 @@ internal fun AccountAutoDiscoveryContentPasswordUntrustedSettingsPreview() {
autoDiscoverySettings = fakeAutoDiscoveryResultSettings(isTrusted = false),
),
onEvent = {},
oAuthViewModel = PreviewAccountOAuthViewModel(),
oAuthViewModel = FakeAccountOAuthViewModel(),
)
}
}