Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(signing/views): allow discarding signing popup when tx in progress #10388

Closed
wants to merge 1 commit into from

Conversation

0x-r4bbit
Copy link
Member

Summary

As discussed in #9977, there's an issue that the signing view popup cannot
be cancelled/discarded when a transaction is in progress.
This is because the cancel-is-pressed event is only conditionally applied to
the cancel button, rendering it non-functional for the time-being.

This commit changes that behaviour to always attach the event handler to
the cancel button, so that the popup can be closed even when a transaction
has been sent.

Fixes #9977

Review notes

One thing to keep in mind:
Once the transaction has been signed and is in progress, there's no way to "cancel" it, so hitting the "Cancel" button in the UI really just "discards" it. One could consider changing the label to "Discard", but it probably won't work well because the UI is used in a context where cancelling makes sense.

Testing notes

Best way to test this is to turn off the signing/transaction-completed event so the app thinks the transaction is in progress forever.

Platforms

  • Android
  • iOS
  • macOS
  • Linux
  • Windows

@0x-r4bbit 0x-r4bbit requested a review from a team as a code owner April 21, 2020 13:29
@status-github-bot status-github-bot bot added this to REVIEW in Pipeline for QA Apr 21, 2020
@status-github-bot
Copy link

Pull Request Checklist

  • Docs: Updated the documentation, if affected
  • Docs: Added or updated inline comments explaining intention of the code
  • Tests: Ensured that all new UI elements have been assigned accessibility IDs
  • Tests: Signaled need for E2E tests with label, if applicable
  • Tests: Briefly described what was tested and what platforms were used
  • UI: In case of UI changes, ensured that UI matches Figma
  • UI: In case of UI changes, requested review from a Core UI designer
  • UI: In case of UI changes, included screenshots of implementation

[button/button {:type :secondary
:container-style {:padding-horizontal 24}
:label (i18n/label :t/cancel)
:on-press #(re-frame/dispatch [:signing.ui/cancel-is-pressed])}]])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice that transactions can't actually be cancelled, so hitting Cancel while the tx is in-flight really just discards the popup. Might be worth considering a different label depending on context.

@0x-r4bbit 0x-r4bbit changed the title fix(signing/views): allow discarding signing prop when tx in progress fix(signing/views): allow discarding signing popup when tx in progress Apr 21, 2020
As discussed in status-im#9977, there's an issue that the signing view popup cannot
be cancelled/discarded when a transaction is in progress.
This is because the `cancel-is-pressed` event is only conditionally applied to
the cancel button, rendering it non-functional for the time-being.

This commit changes that behaviour to always attach the event handler to
the cancel button, so that the popup can be closed even when a transaction
has been sent.

Fixes status-im#9977
@status-im-auto
Copy link
Member

status-im-auto commented Apr 21, 2020

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 77f2f66 #1 2020-04-21 13:42:24 ~9 min android 📦apk 📲
✔️ 77f2f66 #1 2020-04-21 13:45:14 ~10 min ios 📦ipa 📲
✔️ 77f2f66 #2 2020-04-21 13:49:17 ~14 min android-e2e 📦apk 📲

@flexsurfer
Copy link
Member

ping @hesterbruikman @errorists

@hesterbruikman
Copy link
Contributor

Let me preface with, I don't have a deep understanding of the issue.

It seems to me that indeed Cancel should be tappable when visible (fix 1). Cancel should then trigger a tx refresh (fix 2, if needed). Aside from these 2 fixes I do consider this a (nevertheless important) edge case and think these fixes are sufficient fine for now.

I expect two things will happen:

  • The user remains in the Stickermarket where there should be a pending state before the stickerpack can be installed (@errorists I believe this is the case, right?)
  • The user goes to wallet to check if the transaction happened. If they are still disconnected, they should see the loading state there, that will result in an Error on loading message. This should sufficiently inform the user that something is off in their last transaction and to check their history.

In the future I expect an aggregated tx history and inapp notifications (include a tx pending state @errorists) to make it easier to recover from this glitch.

wdyt @errorists ?

@errorists
Copy link
Contributor

oh I'm not familiar with the issue either, I've read the 9977 description and the steps taken to fix that and it all seems correct

The user remains in the Stickermarket where there should be a pending state before the stickerpack can be installed

I think so, yes

@flexsurfer
Copy link
Member

i don't think its correct, because you can't cancel tx when its in progress, so let's say user entered password and pressed send, now he is waiting and looking at the loading indicator, and he decides oh I want to cancel this tx, and make a new one instead, but its not possible to cancel tx because its already sent to the blockchain, so probably cancel should be replaced by close

@hesterbruikman
Copy link
Contributor

100% agree it's weird. I've had someone in a shop hit Cancel on my crypto payment asking me to pay again 😠, because it seemed Cancel was an option. Changing the copy on the button however doesn't seem right either. A button is not something that should change without user action.

An alternative would be to replace the loading state with an error state. Something like Error processing, please verify tx history; similar to the error state when the wallet can't load fiat values or history.

Again, though, feels like an edge case. And I'm happy with this as intermediary solution because the pending state is visible on the stickerpack and at least the user is no longer stuck having to close the app. I suggest creating another issue to describe desired behavior and put some more thought into that.

@0x-r4bbit
Copy link
Member Author

Thanks for all the feedback @flexsurfer @hesterbruikman and @errorists !

An alternative would be to replace the loading state with an error state. Something like Error processing, please verify tx history; similar to the error state when the wallet can't load fiat values or history.

So just to clarify, we're not necessarily even talking about an error state but rather a "pending". I think the issue can be broken down to:

When a transaction is signed, it's in-flight (can't be undone) and until it completes (which might take a while) the Cancel button doesn't work.

I wonder always renaming that Cancel label to Close is the way to go...

@hesterbruikman
Copy link
Contributor

So just to clarify, we're not necessarily even talking about an error state but rather a "pending".
Pending seems tricky because if connection is lost we wouldn't know when to change the state. The user might sit and wait for something to happen.

I wonder always renaming that Cancel label to Close is the way to go...
That makes a lot of sense 😅

@0x-r4bbit
Copy link
Member Author

@flexsurfer I can update the label from Cancel to Close. Are we sure this can be safely applied to all cases where Cancel is used right now? Given that the label is i18n'd, it's probably used in many places. Also, how do we handle translations in general?

I assume this PR should update labels for t/cancel in all languages?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Can't leave signing screen in case of losing internet connection
5 participants