Skip to content

Commit

Permalink
PWN-9092 - fix error handling on update share (#1895)
Browse files Browse the repository at this point in the history
  • Loading branch information
kabramovp2p authored Jun 29, 2023
1 parent b7a8762 commit d47f3f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ class DevicesPresenter(
val isTorusKeyValid = restoreFlowDataLocalRepository.isTorusKeyValid()
if (isTorusKeyValid) {
launch {
view?.setLoadingState(isScreenLoading = true)
updateDeviceShare()
view?.setLoadingState(isScreenLoading = false)
view?.showSuccessDeviceChange()
}
} else {
submitUserPhoneNumber()
Expand All @@ -58,12 +55,16 @@ class DevicesPresenter(
}

private suspend fun refreshDeviceShare(newMetadata: GatewayOnboardingMetadata) {
view?.setLoadingState(isScreenLoading = true)
try {
restoreWalletInteractor.refreshDeviceShare()
metadataInteractor.updateMetadata(newMetadata)
view?.showSuccessDeviceChange()
} catch (error: Throwable) {
view?.showFailDeviceChange()
Timber.e(error, "Error on refreshDeviceShare")
} finally {
view?.setLoadingState(isScreenLoading = false)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ class SettingsEmailConfirmPresenter(
deviceNameTimestampSec = DateTimeUtils.getCurrentTimestampInSeconds()
)
refreshDeviceShare(newMetadata)
view?.showSuccessDeviceChange()
}

private suspend fun refreshDeviceShare(newMetadata: GatewayOnboardingMetadata) {
try {
restoreWalletInteractor.refreshDeviceShare()
metadataInteractor.updateMetadata(newMetadata)
view?.showSuccessDeviceChange()
} catch (error: Throwable) {
view?.showFailDeviceChange()
Timber.e(error, "Error on refreshDeviceShare")
Expand Down

0 comments on commit d47f3f7

Please sign in to comment.