Fix bug accepting identity server terms from the Setting Discovery section.

This commit is contained in:
Doug
2021-10-20 09:58:30 +01:00
parent 53de9aef28
commit 892179b030
3 changed files with 68 additions and 65 deletions
@@ -54,11 +54,11 @@ import Foundation
func process(viewAction: SettingsDiscoveryViewAction) {
switch viewAction {
case .load:
self.checkTerms()
checkTerms()
case .acceptTerms:
self.acceptTerms()
coordinatorDelegate?.settingsDiscoveryViewModelDidTapAcceptIdentityServerTerms(self)
case .select(threePid: let threePid):
self.coordinatorDelegate?.settingsDiscoveryViewModel(self, didSelectThreePidWith: threePid.medium.identifier, and: threePid.address)
coordinatorDelegate?.settingsDiscoveryViewModel(self, didSelectThreePidWith: threePid.medium.identifier, and: threePid.address)
}
}
@@ -114,28 +114,6 @@ import Foundation
})
}
private func acceptTerms() {
guard let identityService = self.identityService else {
self.update(viewState: .loaded(displayMode: .noIdentityServer))
return
}
// Launch an identity server request to trigger terms modal apparition
identityService.account { (response) in
switch response {
case .success:
// Display three pids if presents
self.updateViewStateFromCurrentThreePids()
case .failure(let error):
if MXError(nsError: error)?.errcode == kMXErrCodeStringTermsNotSigned {
// Identity terms modal should appear
} else {
self.update(viewState: .error(error))
}
}
}
}
private func canCheckTerms() -> Bool {
guard let viewState = self.viewState else {
return true