Improve detection of completion for Link new device flow
The SDK emits a Done progress once complete, but our listener might have been deallocated before receiving the done.
This commit is contained in:
parent
247147209b
commit
1abe7e7d3f
3 changed files with 5 additions and 4 deletions
|
|
@ -145,10 +145,7 @@ class LinkNewDeviceFlowNode(
|
||||||
LinkMobileStep.Starting -> {
|
LinkMobileStep.Starting -> {
|
||||||
// This step is not received at the moment, so do nothing
|
// This step is not received at the moment, so do nothing
|
||||||
}
|
}
|
||||||
LinkMobileStep.SyncingSecrets -> {
|
LinkMobileStep.SyncingSecrets -> Unit
|
||||||
// LinkMobileStep.Done is not received at the moment, so consider that the flow is done here
|
|
||||||
callback.onDone()
|
|
||||||
}
|
|
||||||
is LinkMobileStep.WaitingForAuth -> {
|
is LinkMobileStep.WaitingForAuth -> {
|
||||||
navigateToBrowser(linkMobileStep.verificationUri)
|
navigateToBrowser(linkMobileStep.verificationUri)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,8 @@ class RustLinkDesktopHandler(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
// We emit Done in case the progress listener was deallocated before scan() sent the Done
|
||||||
|
_linkDesktopStep.emit(LinkDesktopStep.Done)
|
||||||
} catch (e: QrCodeDecodeException) {
|
} catch (e: QrCodeDecodeException) {
|
||||||
Timber.tag(tag.value).w(e, "Invalid QR code scanned")
|
Timber.tag(tag.value).w(e, "Invalid QR code scanned")
|
||||||
_linkDesktopStep.emit(
|
_linkDesktopStep.emit(
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,8 @@ class RustLinkMobileHandler(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
// We emit Done in case the progress listener was deallocated before generate() sent the Done
|
||||||
|
_linkMobileStep.emit(LinkMobileStep.Done)
|
||||||
} catch (e: HumanQrGrantLoginException) {
|
} catch (e: HumanQrGrantLoginException) {
|
||||||
Timber.tag(tag.value).w(e, "Error during QR login grant")
|
Timber.tag(tag.value).w(e, "Error during QR login grant")
|
||||||
_linkMobileStep.emit(LinkMobileStep.Error(e.map()))
|
_linkMobileStep.emit(LinkMobileStep.Error(e.map()))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue