Loading feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/data/InMemoryAccountStateRepository.kt +6 −6 Original line number Diff line number Diff line Loading @@ -15,27 +15,27 @@ class InMemoryAccountStateRepository( return state } override fun save(accountState: AccountState) { override fun setState(accountState: AccountState) { state = accountState } override fun saveEmailAddress(emailAddress: String) { override fun setEmailAddress(emailAddress: String) { state = state.copy(emailAddress = emailAddress) } override fun saveIncomingServerSettings(serverSettings: ServerSettings) { override fun setIncomingServerSettings(serverSettings: ServerSettings) { state = state.copy(incomingServerSettings = serverSettings) } override fun saveOutgoingServerSettings(serverSettings: ServerSettings) { override fun setOutgoingServerSettings(serverSettings: ServerSettings) { state = state.copy(outgoingServerSettings = serverSettings) } override fun saveAuthorizationState(authorizationState: AuthorizationState) { override fun setAuthorizationState(authorizationState: AuthorizationState) { state = state.copy(authorizationState = authorizationState) } override fun saveOptions(options: AccountOptions) { override fun setOptions(options: AccountOptions) { state = state.copy(options = options) } Loading feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/domain/AccountDomainContract.kt +6 −6 Original line number Diff line number Diff line Loading @@ -10,17 +10,17 @@ interface AccountDomainContract { interface AccountStateRepository { fun getState(): AccountState fun save(accountState: AccountState) fun setState(accountState: AccountState) fun saveEmailAddress(emailAddress: String) fun setEmailAddress(emailAddress: String) fun saveIncomingServerSettings(serverSettings: ServerSettings) fun setIncomingServerSettings(serverSettings: ServerSettings) fun saveOutgoingServerSettings(serverSettings: ServerSettings) fun setOutgoingServerSettings(serverSettings: ServerSettings) fun saveAuthorizationState(authorizationState: AuthorizationState) fun setAuthorizationState(authorizationState: AuthorizationState) fun saveOptions(options: AccountOptions) fun setOptions(options: AccountOptions) fun clear() } Loading feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/ui/preview/PreviewAccountStateRepository.kt +7 −6 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ import com.fsck.k9.mail.AuthType import com.fsck.k9.mail.ServerSettings class PreviewAccountStateRepository : AccountDomainContract.AccountStateRepository { override fun getState(): AccountState = AccountState( emailAddress = "test@example.com", incomingServerSettings = ServerSettings( Loading @@ -33,17 +34,17 @@ class PreviewAccountStateRepository : AccountDomainContract.AccountStateReposito ), ) override fun save(accountState: AccountState) = Unit override fun setState(accountState: AccountState) = Unit override fun saveEmailAddress(emailAddress: String) = Unit override fun setEmailAddress(emailAddress: String) = Unit override fun saveIncomingServerSettings(serverSettings: ServerSettings) = Unit override fun setIncomingServerSettings(serverSettings: ServerSettings) = Unit override fun saveOutgoingServerSettings(serverSettings: ServerSettings) = Unit override fun setOutgoingServerSettings(serverSettings: ServerSettings) = Unit override fun saveAuthorizationState(authorizationState: AuthorizationState) = Unit override fun setAuthorizationState(authorizationState: AuthorizationState) = Unit override fun saveOptions(options: AccountOptions) = Unit override fun setOptions(options: AccountOptions) = Unit override fun clear() = Unit } feature/account/common/src/test/kotlin/app/k9mail/feature/account/common/data/InMemoryAccountStateRepositoryTest.kt +12 −12 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ class InMemoryAccountStateRepositoryTest { } @Test fun `should save state`() { fun `should set state`() { val testSubject = InMemoryAccountStateRepository( AccountState( uuid = "uuid", Loading @@ -58,56 +58,56 @@ class InMemoryAccountStateRepositoryTest { ), ) testSubject.save(newState) testSubject.setState(newState) assertThat(testSubject.getState()).isEqualTo(newState) } @Test fun `should save email address`() { fun `should set email address`() { val testSubject = InMemoryAccountStateRepository() testSubject.saveEmailAddress("emailAddress") testSubject.setEmailAddress("emailAddress") assertThat(testSubject.getState().emailAddress) .isEqualTo("emailAddress") } @Test fun `should save incoming server settings`() { fun `should set incoming server settings`() { val testSubject = InMemoryAccountStateRepository() testSubject.saveIncomingServerSettings(INCOMING_SERVER_SETTINGS) testSubject.setIncomingServerSettings(INCOMING_SERVER_SETTINGS) assertThat(testSubject.getState().incomingServerSettings) .isEqualTo(INCOMING_SERVER_SETTINGS) } @Test fun `should save outgoing server settings`() { fun `should set outgoing server settings`() { val testSubject = InMemoryAccountStateRepository() testSubject.saveOutgoingServerSettings(OUTGOING_SERVER_SETTINGS) testSubject.setOutgoingServerSettings(OUTGOING_SERVER_SETTINGS) assertThat(testSubject.getState().outgoingServerSettings) .isEqualTo(OUTGOING_SERVER_SETTINGS) } @Test fun `should save authorization state`() { fun `should set authorization state`() { val testSubject = InMemoryAccountStateRepository() testSubject.saveAuthorizationState(AuthorizationState("authorizationState")) testSubject.setAuthorizationState(AuthorizationState("authorizationState")) assertThat(testSubject.getState().authorizationState) .isEqualTo(AuthorizationState("authorizationState")) } @Test fun `should save options`() { fun `should set options`() { val testSubject = InMemoryAccountStateRepository() testSubject.saveOptions(OPTIONS) testSubject.setOptions(OPTIONS) assertThat(testSubject.getState().options) .isEqualTo(OPTIONS) Loading feature/account/server/settings/src/main/kotlin/app/k9mail/feature/account/server/settings/ui/incoming/IncomingServerSettingsViewModel.kt +1 −1 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ class IncomingServerSettingsViewModel( } if (!hasError) { accountStateRepository.saveIncomingServerSettings(state.value.toServerSettings()) accountStateRepository.setIncomingServerSettings(state.value.toServerSettings()) navigateNext() } } Loading Loading
feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/data/InMemoryAccountStateRepository.kt +6 −6 Original line number Diff line number Diff line Loading @@ -15,27 +15,27 @@ class InMemoryAccountStateRepository( return state } override fun save(accountState: AccountState) { override fun setState(accountState: AccountState) { state = accountState } override fun saveEmailAddress(emailAddress: String) { override fun setEmailAddress(emailAddress: String) { state = state.copy(emailAddress = emailAddress) } override fun saveIncomingServerSettings(serverSettings: ServerSettings) { override fun setIncomingServerSettings(serverSettings: ServerSettings) { state = state.copy(incomingServerSettings = serverSettings) } override fun saveOutgoingServerSettings(serverSettings: ServerSettings) { override fun setOutgoingServerSettings(serverSettings: ServerSettings) { state = state.copy(outgoingServerSettings = serverSettings) } override fun saveAuthorizationState(authorizationState: AuthorizationState) { override fun setAuthorizationState(authorizationState: AuthorizationState) { state = state.copy(authorizationState = authorizationState) } override fun saveOptions(options: AccountOptions) { override fun setOptions(options: AccountOptions) { state = state.copy(options = options) } Loading
feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/domain/AccountDomainContract.kt +6 −6 Original line number Diff line number Diff line Loading @@ -10,17 +10,17 @@ interface AccountDomainContract { interface AccountStateRepository { fun getState(): AccountState fun save(accountState: AccountState) fun setState(accountState: AccountState) fun saveEmailAddress(emailAddress: String) fun setEmailAddress(emailAddress: String) fun saveIncomingServerSettings(serverSettings: ServerSettings) fun setIncomingServerSettings(serverSettings: ServerSettings) fun saveOutgoingServerSettings(serverSettings: ServerSettings) fun setOutgoingServerSettings(serverSettings: ServerSettings) fun saveAuthorizationState(authorizationState: AuthorizationState) fun setAuthorizationState(authorizationState: AuthorizationState) fun saveOptions(options: AccountOptions) fun setOptions(options: AccountOptions) fun clear() } Loading
feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/ui/preview/PreviewAccountStateRepository.kt +7 −6 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ import com.fsck.k9.mail.AuthType import com.fsck.k9.mail.ServerSettings class PreviewAccountStateRepository : AccountDomainContract.AccountStateRepository { override fun getState(): AccountState = AccountState( emailAddress = "test@example.com", incomingServerSettings = ServerSettings( Loading @@ -33,17 +34,17 @@ class PreviewAccountStateRepository : AccountDomainContract.AccountStateReposito ), ) override fun save(accountState: AccountState) = Unit override fun setState(accountState: AccountState) = Unit override fun saveEmailAddress(emailAddress: String) = Unit override fun setEmailAddress(emailAddress: String) = Unit override fun saveIncomingServerSettings(serverSettings: ServerSettings) = Unit override fun setIncomingServerSettings(serverSettings: ServerSettings) = Unit override fun saveOutgoingServerSettings(serverSettings: ServerSettings) = Unit override fun setOutgoingServerSettings(serverSettings: ServerSettings) = Unit override fun saveAuthorizationState(authorizationState: AuthorizationState) = Unit override fun setAuthorizationState(authorizationState: AuthorizationState) = Unit override fun saveOptions(options: AccountOptions) = Unit override fun setOptions(options: AccountOptions) = Unit override fun clear() = Unit }
feature/account/common/src/test/kotlin/app/k9mail/feature/account/common/data/InMemoryAccountStateRepositoryTest.kt +12 −12 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ class InMemoryAccountStateRepositoryTest { } @Test fun `should save state`() { fun `should set state`() { val testSubject = InMemoryAccountStateRepository( AccountState( uuid = "uuid", Loading @@ -58,56 +58,56 @@ class InMemoryAccountStateRepositoryTest { ), ) testSubject.save(newState) testSubject.setState(newState) assertThat(testSubject.getState()).isEqualTo(newState) } @Test fun `should save email address`() { fun `should set email address`() { val testSubject = InMemoryAccountStateRepository() testSubject.saveEmailAddress("emailAddress") testSubject.setEmailAddress("emailAddress") assertThat(testSubject.getState().emailAddress) .isEqualTo("emailAddress") } @Test fun `should save incoming server settings`() { fun `should set incoming server settings`() { val testSubject = InMemoryAccountStateRepository() testSubject.saveIncomingServerSettings(INCOMING_SERVER_SETTINGS) testSubject.setIncomingServerSettings(INCOMING_SERVER_SETTINGS) assertThat(testSubject.getState().incomingServerSettings) .isEqualTo(INCOMING_SERVER_SETTINGS) } @Test fun `should save outgoing server settings`() { fun `should set outgoing server settings`() { val testSubject = InMemoryAccountStateRepository() testSubject.saveOutgoingServerSettings(OUTGOING_SERVER_SETTINGS) testSubject.setOutgoingServerSettings(OUTGOING_SERVER_SETTINGS) assertThat(testSubject.getState().outgoingServerSettings) .isEqualTo(OUTGOING_SERVER_SETTINGS) } @Test fun `should save authorization state`() { fun `should set authorization state`() { val testSubject = InMemoryAccountStateRepository() testSubject.saveAuthorizationState(AuthorizationState("authorizationState")) testSubject.setAuthorizationState(AuthorizationState("authorizationState")) assertThat(testSubject.getState().authorizationState) .isEqualTo(AuthorizationState("authorizationState")) } @Test fun `should save options`() { fun `should set options`() { val testSubject = InMemoryAccountStateRepository() testSubject.saveOptions(OPTIONS) testSubject.setOptions(OPTIONS) assertThat(testSubject.getState().options) .isEqualTo(OPTIONS) Loading
feature/account/server/settings/src/main/kotlin/app/k9mail/feature/account/server/settings/ui/incoming/IncomingServerSettingsViewModel.kt +1 −1 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ class IncomingServerSettingsViewModel( } if (!hasError) { accountStateRepository.saveIncomingServerSettings(state.value.toServerSettings()) accountStateRepository.setIncomingServerSettings(state.value.toServerSettings()) navigateNext() } } Loading