Skip to content

Commit

Permalink
PWN-9042, PWN-9043, PWN-9057, PWN-9050, PWN-9046 - device share fixes (
Browse files Browse the repository at this point in the history
…#1875)

* PWN-9046 - fix intercom on restore flow

* PWN-9050 - backStack return fix

* PWN-9057 - errors handling fixed

* PWN-9043 - text for incorrect account updated

* PWN-9042 - set torusKeyTimestamp to 0 if torus key is null (on error cases)
  • Loading branch information
kabramovp2p authored Jun 26, 2023
1 parent 5bc570c commit 052f34a
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ class RestoreFlowDataLocalRepository(signUpDetailsStorage: UserSignUpDetailsStor
var torusKey: String? = null
set(value) {
field = value
torusKeyTimestamp = DateTimeUtils.getCurrentTimestampInSeconds()
torusKeyTimestamp = value?.let { DateTimeUtils.getCurrentTimestampInSeconds() } ?: 0

Timber.tag(TAG).i("torusKey is generated and set: ${torusKey?.length}")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import org.p2p.wallet.databinding.FragmentRestoreErrorScreenBinding
import org.p2p.wallet.intercom.IntercomService
import org.p2p.wallet.root.SystemIconsStyle
import org.p2p.wallet.utils.args
import org.p2p.wallet.utils.emptyString
import org.p2p.wallet.utils.popAndReplaceFragment
import org.p2p.wallet.utils.viewbinding.viewBinding
import org.p2p.wallet.utils.withArgs
Expand Down Expand Up @@ -65,6 +66,7 @@ class RestoreErrorScreenFragment :
binding.toolbar.inflateMenu(R.menu.menu_onboarding_help)
binding.toolbar.setOnMenuItemClickListener {
if (it.itemId == R.id.helpItem) {
IntercomService.signIn(userId = emptyString())
IntercomService.showMessenger()
}
return@setOnMenuItemClickListener true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class DevicesPresenter(
deviceNameTimestampSec = DateTimeUtils.getCurrentTimestampInSeconds()
)
refreshDeviceShare(newMetadata)
view?.showSuccessDeviceChange()
}

private suspend fun refreshDeviceShare(newMetadata: GatewayOnboardingMetadata) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ class UpdateDeviceSmsInputFragment : BaseSmsInputFragment() {
)
}

override fun navigateToGatewayErrorScreen(handledState: GatewayHandledState) = Unit
override fun navigateToGatewayErrorScreen(handledState: GatewayHandledState) {
showUiKitSnackBar(messageResId = R.string.error_general_message)
}

override fun navigateToRestoreErrorScreen(handledState: RestoreFailureState.TitleSubtitleError) = Unit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,9 @@ class UpdateDeviceSmsInputPresenter(
}

private fun handleGatewayError(error: PushServiceError) {
// TODO PWN-8827 fix error handling!
when (val gatewayHandledResult = gatewayServiceErrorHandler.handle(error)) {
is GatewayHandledState.CriticalError -> {
view?.navigateToGatewayErrorScreen(gatewayHandledResult)
view?.showUiKitSnackBar(gatewayHandledResult.errorCode.toString())
}
GatewayHandledState.IncorrectOtpCodeError -> {
view?.renderIncorrectSms()
Expand All @@ -81,10 +79,9 @@ class UpdateDeviceSmsInputPresenter(
}
is GatewayHandledState.TitleSubtitleError -> {
view?.navigateToGatewayErrorScreen(gatewayHandledResult)
view?.showUiKitSnackBar(gatewayHandledResult.title)
}
is GatewayHandledState.ToastError -> {
view?.showUiKitSnackBar(gatewayHandledResult.message)
view?.navigateToGatewayErrorScreen(gatewayHandledResult)
}
else -> {
Timber.i("GatewayService error is not handled")
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/settings_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@


<string name="devices_incorrect_account">Incorrect Google account</string>
<string name="devices_account_associated">This account is associated with %s. Please log in with the correct Google account.</string>
<string name="devices_account_associated">%s\nPlease log in with the correct Google account.</string>
<string name="devices_restore_another">Use another account</string>


Expand Down

0 comments on commit 052f34a

Please sign in to comment.