Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed May 15, 2024
1 parent 32f0bbc commit a3e4657
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class DeleteCustomListConfirmationViewModel(

fun deleteCustomList() {
viewModelScope.launch {
_error.tryEmit(null)
_error.emit(null)
customListActionUseCase
.performAction(CustomListAction.Delete(customListId))
.fold(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class DeviceListViewModel(
}
}
.onStart { fetchDevices() }
.stateIn(viewModelScope, SharingStarted.Lazily, DeviceListUiState.Loading)
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), DeviceListUiState.Loading)

fun fetchDevices() =
viewModelScope.launch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class SplashViewModel(
}

return if (accountData != null && accountData.expiryDate.isBeforeNow) {
SplashUiSideEffect.NavigateToOutOfTime
} else {
SplashUiSideEffect.NavigateToOutOfTime
} else {
SplashUiSideEffect.NavigateToConnect
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ import org.junit.jupiter.api.extension.ExtendWith
@ExtendWith(TestCoroutineRule::class)
class AccountViewModelTest {

private val mockAccountRepository: AccountRepository =
mockk(relaxUnitFun = true)
private val mockAccountRepository: AccountRepository = mockk(relaxUnitFun = true)
private val mockPaymentUseCase: PaymentUseCase = mockk(relaxed = true)

private val accountState: MutableStateFlow<DeviceState?> = MutableStateFlow(null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ package net.mullvad.mullvadvpn.viewmodel

import androidx.lifecycle.viewModelScope
import app.cash.turbine.test
import io.mockk.Runs
import io.mockk.coEvery
import io.mockk.coVerify
import io.mockk.every
import io.mockk.just
import io.mockk.mockk
import io.mockk.mockkStatic
import io.mockk.unmockkAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,20 +565,3 @@ sealed interface GrpcConnectivityState {

data object Shutdown : GrpcConnectivityState
}

sealed interface ServiceConnectionState {
data class Connected(val serviceState: ServiceState) : ServiceConnectionState

data class Connecting(val lastKnownState: ServiceState?) : ServiceConnectionState

data class Disconnected(val lastKnownState: ServiceState?, val error: ServiceConnectError?) :
ServiceConnectionState
}

data class ServiceState(val settings: ModelSettings, val accountState: ModelSettings)

sealed interface ServiceConnectError {
data object Timeout : ServiceConnectError

data class Connection(val message: String) : ServiceConnectError
}

0 comments on commit a3e4657

Please sign in to comment.