Skip to content

Commit

Permalink
fix: detekt
Browse files Browse the repository at this point in the history
  • Loading branch information
saleniuk committed May 23, 2024
1 parent d5e0163 commit 7ce2c0b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ fun LoginScreen(

navigator.navigate(NavigationCommand(destination, BackStackMode.CLEAR_WHOLE))
},
onRemoveDeviceNeeded = { navigator.navigate(NavigationCommand(RemoveDeviceScreenDestination, BackStackMode.CLEAR_WHOLE)) },
onRemoveDeviceNeeded = {
navigator.navigate(NavigationCommand(RemoveDeviceScreenDestination, BackStackMode.CLEAR_WHOLE))
},
loginEmailViewModel = loginEmailViewModel,
ssoLoginResult = loginNavArgs.ssoLoginResult
)
Expand All @@ -129,8 +131,11 @@ private fun LoginContent(
targetState = loginEmailViewModel.secondFactorVerificationCodeState.isCodeInputNecessary,
transitionSpec = { TransitionAnimationType.SLIDE.enterTransition.togetherWith(TransitionAnimationType.SLIDE.exitTransition) }
) { isCodeInputNecessary ->
if (isCodeInputNecessary) LoginEmailVerificationCodeScreen(loginEmailViewModel)
else MainLoginContent(onBackPressed, onSuccess, onRemoveDeviceNeeded, loginEmailViewModel, ssoLoginResult)
if (isCodeInputNecessary) {
LoginEmailVerificationCodeScreen(loginEmailViewModel)
} else {
MainLoginContent(onBackPressed, onSuccess, onRemoveDeviceNeeded, loginEmailViewModel, ssoLoginResult)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ sealed class LoginState {
data object PasswordNeededToRegisterClient : DialogError()
data class SSOResultError(val result: SSOFailureCodes) :
DialogError()
data object ServerVersionNotSupported: DialogError()
data object ClientUpdateRequired: DialogError()
data object ServerVersionNotSupported : DialogError()
data object ClientUpdateRequired : DialogError()
}
data object TooManyDevicesError : Error()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package com.wire.android.ui.authentication.login
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.wire.android.BuildConfig
Expand All @@ -46,7 +45,6 @@ import javax.inject.Inject
@HiltViewModel
@Suppress("TooManyFunctions")
open class LoginViewModel @Inject constructor(
savedStateHandle: SavedStateHandle,
private val clientScopeProviderFactory: ClientScopeProvider.Factory,
protected val authServerConfigProvider: AuthServerConfigProvider,
private val userDataStoreProvider: UserDataStoreProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class LoginEmailViewModel @Inject constructor(
@KaliumCoreLogic coreLogic: CoreLogic,
private val dispatchers: DispatcherProvider
) : LoginViewModel(
savedStateHandle,
clientScopeProviderFactory,
authServerConfigProvider,
userDataStoreProvider,
Expand All @@ -92,8 +91,11 @@ class LoginEmailViewModel @Inject constructor(

init {
userIdentifierTextState.setTextAndPlaceCursorAtEnd(
if (preFilledUserIdentifier is PreFilledUserIdentifierType.PreFilled) preFilledUserIdentifier.userIdentifier
else savedStateHandle[USER_IDENTIFIER_SAVED_STATE_KEY] ?: String.EMPTY
if (preFilledUserIdentifier is PreFilledUserIdentifierType.PreFilled) {
preFilledUserIdentifier.userIdentifier
} else {
savedStateHandle[USER_IDENTIFIER_SAVED_STATE_KEY] ?: String.EMPTY
}
)
viewModelScope.launch {
combine(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class LoginSSOViewModel @Inject constructor(
authServerConfigProvider: AuthServerConfigProvider,
userDataStoreProvider: UserDataStoreProvider
) : LoginViewModel(
savedStateHandle,
clientScopeProviderFactory,
authServerConfigProvider,
userDataStoreProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

package com.wire.android.ui.authentication

import androidx.lifecycle.SavedStateHandle
import com.wire.android.config.CoroutineTestExtension
import com.wire.android.datastore.UserDataStoreProvider
import com.wire.android.di.AuthServerConfigProvider
Expand All @@ -42,9 +41,6 @@ class LoginViewModelTest {
@MockK
private lateinit var clientScopeProviderFactory: ClientScopeProvider.Factory

@MockK
private lateinit var savedStateHandle: SavedStateHandle

@MockK
private lateinit var qualifiedIdMapper: QualifiedIdMapper

Expand All @@ -62,11 +58,9 @@ class LoginViewModelTest {
@BeforeEach
fun setup() {
MockKAnnotations.init(this)
every { savedStateHandle.get<String>(any()) } returns null
every { qualifiedIdMapper.fromStringToQualifiedID(any()) } returns QualifiedID("", "")
every { authServerConfigProvider.authServer.value } returns newServerConfig(1).links
loginViewModel = LoginViewModel(
savedStateHandle,
clientScopeProviderFactory,
authServerConfigProvider,
userDataStoreProvider,
Expand Down

0 comments on commit 7ce2c0b

Please sign in to comment.