Fix Onedrive silent login, which was broken in 1.6.0-alpha1
This commit is contained in:
parent
ae053b34d0
commit
3db60452c9
@ -77,10 +77,45 @@ class UnlockVaultPresenter @Inject constructor(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val vault = intent.vaultModel().toVault()
|
||||||
getUnverifiedVaultConfigUseCase
|
getUnverifiedVaultConfigUseCase
|
||||||
.withVault(intent.vaultModel().toVault())
|
.withVault(vault)
|
||||||
.run(object : DefaultResultHandler<Optional<UnverifiedVaultConfig>>() {
|
.run(object : DefaultResultHandler<Optional<UnverifiedVaultConfig>>() {
|
||||||
override fun onSuccess(unverifiedVaultConfig: Optional<UnverifiedVaultConfig>) {
|
override fun onSuccess(unverifiedVaultConfig: Optional<UnverifiedVaultConfig>) {
|
||||||
|
onUnverifiedVaultConfigRetrieved(unverifiedVaultConfig)
|
||||||
|
}
|
||||||
|
override fun onError(e: Throwable) {
|
||||||
|
if (!authenticationExceptionHandler.handleAuthenticationException(this@UnlockVaultPresenter, e, ActivityResultCallbacks.authenticatedAfterGettingVaultConfig(vault))) {
|
||||||
|
super.onError(e)
|
||||||
|
finishWithResult(null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(dispatchResultOkOnly = false)
|
||||||
|
fun authenticatedAfterGettingVaultConfig(result: ActivityResult, vault: Vault) {
|
||||||
|
if (result.isResultOk) {
|
||||||
|
val cloud = result.getSingleResult(CloudModel::class.java).toCloud()
|
||||||
|
getUnverifiedVaultConfigUseCase
|
||||||
|
.withVault(Vault.aCopyOf(vault).withCloud(cloud).build())
|
||||||
|
.run(object : DefaultResultHandler<Optional<UnverifiedVaultConfig>>() {
|
||||||
|
override fun onSuccess(unverifiedVaultConfig: Optional<UnverifiedVaultConfig>) {
|
||||||
|
onUnverifiedVaultConfigRetrieved(unverifiedVaultConfig)
|
||||||
|
}
|
||||||
|
override fun onError(e: Throwable) {
|
||||||
|
super.onError(e)
|
||||||
|
finishWithResult(null)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
view?.closeDialog()
|
||||||
|
val error = result.getSingleResult(Throwable::class.java)
|
||||||
|
error?.let { showError(it) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun onUnverifiedVaultConfigRetrieved(unverifiedVaultConfig: Optional<UnverifiedVaultConfig>) {
|
||||||
if (unverifiedVaultConfig.isAbsent || unverifiedVaultConfig.get().keyId.scheme == CryptoConstants.MASTERKEY_SCHEME) {
|
if (unverifiedVaultConfig.isAbsent || unverifiedVaultConfig.get().keyId.scheme == CryptoConstants.MASTERKEY_SCHEME) {
|
||||||
when (intent.vaultAction()) {
|
when (intent.vaultAction()) {
|
||||||
UnlockVaultIntent.VaultAction.UNLOCK, UnlockVaultIntent.VaultAction.UNLOCK_FOR_BIOMETRIC_AUTH -> {
|
UnlockVaultIntent.VaultAction.UNLOCK, UnlockVaultIntent.VaultAction.UNLOCK_FOR_BIOMETRIC_AUTH -> {
|
||||||
@ -94,13 +129,6 @@ class UnlockVaultPresenter @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onError(e: Throwable) {
|
|
||||||
super.onError(e)
|
|
||||||
finishWithResult(null)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun unlockVault(vaultModel: VaultModel) {
|
private fun unlockVault(vaultModel: VaultModel) {
|
||||||
if (canUseBiometricOn(vaultModel)) {
|
if (canUseBiometricOn(vaultModel)) {
|
||||||
if (startedUsingPrepareUnlock) {
|
if (startedUsingPrepareUnlock) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user