Rename AuthorizationState
property to value
This commit is contained in:
parent
63d834d18c
commit
c50314ffbe
8 changed files with 12 additions and 12 deletions
|
@ -39,12 +39,12 @@ class InMemoryAccountStore(
|
|||
accountMap[account.uuid] = if (isIncoming) {
|
||||
account.copy(
|
||||
incomingServerSettings = serverSettings,
|
||||
authorizationState = authorizationState?.state,
|
||||
authorizationState = authorizationState?.value,
|
||||
)
|
||||
} else {
|
||||
account.copy(
|
||||
outgoingServerSettings = serverSettings,
|
||||
authorizationState = authorizationState?.state,
|
||||
authorizationState = authorizationState?.value,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ class AccountServerSettingsUpdater(
|
|||
account.outgoingServerSettings = serverSettings
|
||||
}
|
||||
|
||||
account.oAuthState = authorizationState?.state
|
||||
account.oAuthState = authorizationState?.value
|
||||
|
||||
accountManager.saveAccount(account)
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class AccountServerSettingsUpdaterTest {
|
|||
assertThat(k9Account).isNotNull().all {
|
||||
prop(K9Account::incomingServerSettings).isEqualTo(updatedIncomingServerSettings)
|
||||
prop(K9Account::outgoingServerSettings).isEqualTo(OUTGOING_SERVER_SETTINGS)
|
||||
prop(K9Account::oAuthState).isEqualTo(updatedAuthorizationState.state)
|
||||
prop(K9Account::oAuthState).isEqualTo(updatedAuthorizationState.value)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ class AccountServerSettingsUpdaterTest {
|
|||
assertThat(k9Account).isNotNull().all {
|
||||
prop(K9Account::incomingServerSettings).isEqualTo(INCOMING_SERVER_SETTINGS)
|
||||
prop(K9Account::outgoingServerSettings).isEqualTo(updatedOutgoingServerSettings)
|
||||
prop(K9Account::oAuthState).isEqualTo(updatedAuthorizationState.state)
|
||||
prop(K9Account::oAuthState).isEqualTo(updatedAuthorizationState.value)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ class AccountServerSettingsUpdaterTest {
|
|||
).apply {
|
||||
incomingServerSettings = INCOMING_SERVER_SETTINGS
|
||||
outgoingServerSettings = OUTGOING_SERVER_SETTINGS
|
||||
oAuthState = AUTHORIZATION_STATE.state
|
||||
oAuthState = AUTHORIZATION_STATE.value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ class InMemoryAccountStateRepository(
|
|||
}
|
||||
|
||||
override fun getAuthorizationState(): String? {
|
||||
return state.authorizationState?.state
|
||||
return state.authorizationState?.value
|
||||
}
|
||||
|
||||
override fun updateAuthorizationState(authorizationState: String?) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package app.k9mail.feature.account.common.domain.entity
|
||||
|
||||
data class AuthorizationState(
|
||||
val state: String? = null,
|
||||
val value: String? = null,
|
||||
)
|
||||
|
|
|
@ -10,6 +10,6 @@ class AuthorizationStateTest {
|
|||
fun `should default to null state`() {
|
||||
val authorizationState = AuthorizationState()
|
||||
|
||||
assertThat(authorizationState.state).isNull()
|
||||
assertThat(authorizationState.value).isNull()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import timber.log.Timber
|
|||
|
||||
fun AuthState.toAuthorizationState(): AuthorizationState {
|
||||
return try {
|
||||
AuthorizationState(state = jsonSerializeString())
|
||||
AuthorizationState(value = jsonSerializeString())
|
||||
} catch (e: JSONException) {
|
||||
Timber.e(e, "Error serializing AuthorizationState")
|
||||
AuthorizationState()
|
||||
|
@ -16,7 +16,7 @@ fun AuthState.toAuthorizationState(): AuthorizationState {
|
|||
|
||||
fun AuthorizationState.toAuthState(): AuthState {
|
||||
return try {
|
||||
state?.let { AuthState.jsonDeserialize(it) } ?: AuthState()
|
||||
value?.let { AuthState.jsonDeserialize(it) } ?: AuthState()
|
||||
} catch (e: JSONException) {
|
||||
Timber.e(e, "Error deserializing AuthorizationState")
|
||||
AuthState()
|
||||
|
|
|
@ -169,7 +169,7 @@ class AccountOAuthViewModelTest {
|
|||
@Test
|
||||
fun `should finish OAuth sign in when onOAuthResult received with success`() = runTest {
|
||||
val initialState = defaultState
|
||||
val authorizationState = AuthorizationState(state = "state")
|
||||
val authorizationState = AuthorizationState(value = "state")
|
||||
val testSubject = createTestSubject(
|
||||
authorizationResult = AuthorizationResult.Success(authorizationState),
|
||||
initialState = initialState,
|
||||
|
|
Loading…
Reference in a new issue