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

[#19410] wizard send collectibles #19515

Merged
merged 3 commits into from
May 14, 2024
Merged

Conversation

ulisesmac
Copy link
Contributor

@ulisesmac ulisesmac commented Apr 3, 2024

fixes #19410
fixes #16990

The bridge feature will be addressed in

Summary

This PR uses the wizard mechanism to unify the send token and send collectible flows, making able to skip some steps for the sending of collectibles.

Video containing the regular flow and the flow of first picking a collectible (skips select asset screen):

Screencast.from.2024-04-03.13-13-04.webm

Flow from home wallet screen (adds from step and skips sleect asset):

Screencast.from.2024-04-03.13-14-38.webm

Additionally, solves the following error when going back in the navigation:

Screencast.from.2024-04-03.13-02-27.webm

Testing notes

This PR focuses on the flow, there may be some other areas that still need to be polished/adjusted.

Platforms

  • Android
  • iOS

Steps to test

  • Open Status
  • Use/Recover an account owning some collectibles
  • Go to the account details
  • Move to Collectibles tab
  • Press any collectible
  • Press "Send" and complete the send flow.

status: ready

@ulisesmac ulisesmac self-assigned this Apr 3, 2024
@ulisesmac ulisesmac force-pushed the 19410-wizard-send-collectibles branch from 49ae5b5 to 1b71e41 Compare April 3, 2024 19:43
@ulisesmac ulisesmac changed the title 19410 wizard send collectibles [#19410] wizard send collectibles Apr 3, 2024
@status-im-auto
Copy link
Member

status-im-auto commented Apr 3, 2024

Jenkins Builds

Click to see older builds (24)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 1b71e41 #2 2024-04-03 19:49:39 ~5 min android-e2e 🤖apk 📲
✔️ 1b71e41 #2 2024-04-03 19:51:52 ~8 min android 🤖apk 📲
✔️ 1b71e41 #2 2024-04-03 20:00:25 ~16 min ios 📱ipa 📲
✔️ 1b71e41 #3 2024-04-03 21:16:23 ~1 min tests 📄log
be7c8c8 #4 2024-04-05 21:15:19 ~2 min tests 📄log
✔️ be7c8c8 #3 2024-04-05 21:18:23 ~5 min android-e2e 🤖apk 📲
✔️ be7c8c8 #3 2024-04-05 21:19:46 ~7 min android 🤖apk 📲
fe4a107 #5 2024-04-05 21:23:47 ~2 min tests 📄log
✔️ e313300 #6 2024-04-05 21:28:05 ~4 min tests 📄log
✔️ e313300 #5 2024-04-05 21:29:27 ~5 min android-e2e 🤖apk 📲
✔️ e313300 #5 2024-04-05 21:30:56 ~7 min android 🤖apk 📲
✔️ e313300 #5 2024-04-05 21:33:18 ~9 min ios 📱ipa 📲
✔️ 87ffb36 #7 2024-04-08 18:57:39 ~4 min tests 📄log
✔️ 87ffb36 #6 2024-04-08 19:00:03 ~6 min android-e2e 🤖apk 📲
✔️ 87ffb36 #6 2024-04-08 19:00:19 ~7 min android 🤖apk 📲
✔️ 87ffb36 #6 2024-04-08 19:01:49 ~8 min ios 📱ipa 📲
✔️ 3aa2593 #8 2024-04-11 23:45:26 ~4 min tests 📄log
✔️ 3aa2593 #7 2024-04-11 23:46:39 ~5 min android-e2e 🤖apk 📲
✔️ 3aa2593 #7 2024-04-11 23:47:54 ~6 min android 🤖apk 📲
✔️ 3aa2593 #7 2024-04-11 23:49:24 ~8 min ios 📱ipa 📲
3959259 #9 2024-04-26 08:22:14 ~4 min tests 📄log
✔️ 3959259 #8 2024-04-26 08:27:21 ~9 min ios 📱ipa 📲
✔️ 3959259 #8 2024-04-26 08:29:29 ~12 min android-e2e 🤖apk 📲
✔️ 3959259 #8 2024-04-26 08:29:35 ~12 min android 🤖apk 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 531a240 #10 2024-05-13 23:30:55 ~5 min tests 📄log
✔️ 531a240 #9 2024-05-13 23:31:04 ~5 min android-e2e 🤖apk 📲
✔️ 531a240 #9 2024-05-13 23:33:43 ~8 min ios 📱ipa 📲
✔️ 531a240 #9 2024-05-13 23:34:24 ~9 min android 🤖apk 📲
✔️ 4afe430 #11 2024-05-13 23:51:15 ~6 min tests 📄log
✔️ 4afe430 #10 2024-05-13 23:52:35 ~8 min ios 📱ipa 📲
✔️ 4afe430 #10 2024-05-13 23:56:30 ~12 min android-e2e 🤖apk 📲
✔️ 4afe430 #10 2024-05-13 23:56:41 ~12 min android 🤖apk 📲

Comment on lines 99 to 62
(defn f-view-internal
[{:keys [theme] :as _props}]
(defn view-internal
[_]
(let [selected-tab (reagent/atom :overview)
on-tab-change #(reset! selected-tab %)]
(fn []
(fn [{:keys [theme] :as _props}]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

An additional fix, we were receiving the theme in the wrong place, the component wouldn't re-render if it changed

Copy link
Contributor

Choose a reason for hiding this comment

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

can also use the hook directly, if you prefer 👍

Comment on lines 104 to 198
(rf/reg-event-fx :wallet/send-collectibles-amount
(fn [{:keys [db]} [{:keys [collectible stack-id amount]}]]
{:db (-> db
(update-in [:wallet :ui :send] dissoc :token)
(assoc-in [:wallet :ui :send :collectible] collectible)
(assoc-in [:wallet :ui :send :tx-type] :collectible)
(assoc-in [:wallet :ui :send :amount] amount))
:fx [[:dispatch [:wallet/get-suggested-routes {:amount amount}]]
[:navigate-to-within-stack [:screen/wallet.transaction-confirmation stack-id]]]}))
(rf/reg-event-fx
:wallet/set-collectible-to-send
(fn [{db :db} [{:keys [collectible current-screen]}]]
(let [one-collectible? (= (collectible.utils/collectible-balance collectible) 1)
collectible-tx (-> db
(update-in [:wallet :ui :send] dissoc :token)
(assoc-in [:wallet :ui :send :collectible] collectible)
(assoc-in [:wallet :ui :send :tx-type] :collectible))]
{:db (cond-> collectible-tx
one-collectible? (assoc-in [:wallet :ui :send :amount] 1))
:fx [(when one-collectible?
[:dispatch [:wallet/get-suggested-routes {:amount 1}]])
[:dispatch
[:wallet/wizard-navigate-forward
{:current-screen current-screen
:flow-id :wallet-flow}]]]})))

(rf/reg-event-fx :wallet/select-collectibles-amount
(fn [{:keys [db]} [{:keys [collectible stack-id]}]]
{:db (-> db
(update-in [:wallet :ui :send] dissoc :token)
(assoc-in [:wallet :ui :send :collectible] collectible)
(assoc-in [:wallet :ui :send :tx-type] :collectible))
:fx [[:navigate-to-within-stack [:screen/wallet.select-collectible-amount stack-id]]]}))
(rf/reg-event-fx
:wallet/set-collectible-amount-to-send
(fn [{db :db} [{:keys [stack-id amount]}]]
{:db (assoc-in db [:wallet :ui :send :amount] amount)
:fx [[:dispatch [:wallet/get-suggested-routes {:amount amount}]]
[:dispatch
[:wallet/wizard-navigate-forward
{:current-screen stack-id
:flow-id :wallet-flow}]]]}))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Redefined these events to handle the wizard flow, and changed their names.

send-collectibles-amount -> set-collectible-to-send
select-collectibles-amount -> set-collectible-amount-to-send

Given the functionality changed and the places where they are being used, the new names match better

Comment on lines -122 to +255
(rf/reg-event-fx :wallet/send-select-amount
(rf/reg-event-fx
:wallet/set-token-amount-to-send
Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to the previous mentioned renaming, and given that this even is specific for tokens and not collectibles, I performed this rename

Comment on lines 97 to 99
(defn- view-internal
[]
[:f> f-view-internal])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just removed this (now unnecessary) wrapper

Comment on lines -102 to +213
(when (= transaction-type :collecible) :tx-type))})))
(when (= transaction-type :collectible) :tx-type))})))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fix is not directly related, but noticed we had a typo here 👀

Comment on lines 105 to 245
(rf/reg-event-fx
:wallet/set-collectible-to-send
(fn [{db :db} [{:keys [collectible current-screen]}]]
(let [one-collectible? (= (collectible.utils/collectible-balance collectible) 1)
collectible-tx (-> db
(update-in [:wallet :ui :send] dissoc :token)
(assoc-in [:wallet :ui :send :collectible] collectible)
(assoc-in [:wallet :ui :send :tx-type] :collectible))]
{:db (cond-> collectible-tx
one-collectible? (assoc-in [:wallet :ui :send :amount] 1))
:fx [(when one-collectible?
[:dispatch [:wallet/get-suggested-routes {:amount 1}]])
[:dispatch
[:wallet/wizard-navigate-forward
{:current-screen current-screen
:flow-id :wallet-flow}]]]})))

(rf/reg-event-fx :wallet/select-collectibles-amount
(fn [{:keys [db]} [{:keys [collectible stack-id]}]]
{:db (-> db
(update-in [:wallet :ui :send] dissoc :token)
(assoc-in [:wallet :ui :send :collectible] collectible)
(assoc-in [:wallet :ui :send :tx-type] :collectible))
:fx [[:navigate-to-within-stack [:screen/wallet.select-collectible-amount stack-id]]]}))
(rf/reg-event-fx
:wallet/set-collectible-amount-to-send
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can have tests for these events

@J-Son89
Copy link
Contributor

J-Son89 commented Apr 4, 2024

@ulisesmac - I tested out this branch.
It works great for sending an asset.
One thought - there is also sending an asset from the home page by long press on a collectible.
@mmilad75 has added the "Select From" page for this flow already so it should be rather straightforward to include that.
Shall we add it here too? 🤔

@ulisesmac
Copy link
Contributor Author

@ulisesmac - I tested out this branch.
It works great for sending an asset.
One thought - there is also sending an asset from the home page by long press on a collectible.
@mmilad75 has added the "Select From" page for this flow already so it should be rather straightforward to include that.
Shall we add it here too? 🤔

Sure!, I'll add it :)

@ulisesmac ulisesmac force-pushed the 19410-wizard-send-collectibles branch from 1b71e41 to be7c8c8 Compare April 5, 2024 21:12
@ulisesmac
Copy link
Contributor Author

@ulisesmac - I tested out this branch.
It works great for sending an asset.
One thought - there is also sending an asset from the home page by long press on a collectible.
@mmilad75 has added the "Select From" page for this flow already so it should be rather straightforward to include that.
Shall we add it here too? 🤔

Sure!, I'll add it :)

I already added it, it wasn't as straightforward as I thought but it's not too complex, I added two comments in the code to make this more clear.

@ulisesmac
Copy link
Contributor Author

@OmarBasem @J-Son89
Can you please review again?
additionally, I think QA can be skipped, wdyt?

@ulisesmac ulisesmac force-pushed the 19410-wizard-send-collectibles branch from e313300 to 87ffb36 Compare April 8, 2024 18:52
@J-Son89
Copy link
Contributor

J-Son89 commented Apr 8, 2024

@OmarBasem @J-Son89 Can you please review again? additionally, I think QA can be skipped, wdyt?

I tend to disagree, I think this will benefit from QA. Send is quite an important area and we're making quite a number of changes which can break it, no?

@ulisesmac
Copy link
Contributor Author

@OmarBasem @J-Son89 Can you please review again? additionally, I think QA can be skipped, wdyt?

I tend to disagree, I think this will benefit from QA. Send is quite an important area and we're making quite a number of changes which can break it, no?

I thought this was kind of just connecting existing features, but I agree, let's ask for QA then 👍

@VolodLytvynenko
Copy link
Contributor

PR_ISSUE 5: The routes are not found when attempting to send a collectible using the 'send' button in the opened collectible

Steps:

  1. Restore the account with collectibles
  2. Long tap collectible
  3. Tap 'send'

Actual result:

The routes are not found

routes_collectible.mp4

Expected result:

The routes are found

Logs:

Status-debug-logs (8).zip

@ulisesmac
Copy link
Contributor Author

Hey @VolodLytvynenko
sorry for the late response.

Issue 1

This is due to the relogin issue, so I'd say it's out of scope of this one

Issue 2 and 3

This PR is not focused on fixing UI things, so they need to be addressed but preferably in a separate one.

Issue 4

This issue is also related to the recovery and relogin one, so I think we should address it separately.

Issue 5

We don't know the exact reason for routes not being found, but it's out of scope of this PR.

So, this PR is about connecting some flows, but they may still be buggy for various reasons, we'll address them separately.

@VolodLytvynenko
Copy link
Contributor

Hi @ulisesmac thank you for clarification. PR is ready to be merged

@VolodLytvynenko
Copy link
Contributor

@ulisesmac please let me know if any additional tests are needed after resolving the conflicts in this PR. I can quickly check everything

@ulisesmac ulisesmac force-pushed the 19410-wizard-send-collectibles branch from 531a240 to 4afe430 Compare May 13, 2024 23:44
@ulisesmac ulisesmac merged commit 88df609 into develop May 14, 2024
6 checks passed
@ulisesmac ulisesmac deleted the 19410-wizard-send-collectibles branch May 14, 2024 00:01
@ulisesmac
Copy link
Contributor Author

@VolodLytvynenko I solved the conflicts and merged the PR, I'll open issues for the points you pointed out and I'll be opening PRs to address them. Thank you!

@ulisesmac
Copy link
Contributor Author

PR_ISSUE 3: The select assets screen is shown when a watch-only token is going to be sent

Steps to reproduce:

1. Add watch only an account with some assets that are not available on the regular accounts (example: `0x8d2413447ff297d30bdc475f6d5cb00254685aae`)

2. Long tap on the asset that is available only within the current watch-only account

3. Select an address to 'send to'

4. Check next page

Actual result:

The 'Select assets' page is shown, even though the asset has already been selected in step 2.
select_as_page.mp4

Expected result:

Potential solutions:

* The 'Select assets' page should not be shown since the asset has already been selected.

* probably if the asset is related only to a watch-only account, the drawer should not be shown. Let's wait for the design team's response https://discord.com/channels/624634427930312714/852533718790570015/1228346181097230539

OS:

IOS, Android

Devices:

* Pixel 7a, Android 13

* iPhone 11 Pro Max, IOS 17

An update @VolodLytvynenko

This is being addressed by @mmilad75 in:

@ulisesmac
Copy link
Contributor Author

@VolodLytvynenko Another update on the issues, I've tested them on latest develop:

PR_ISSUE 1: The assets can't be sent on 'send to' page when an asset is selected on account overview page

No longer reproducible.

PR_ISSUE 2: 'Send' button is shown for watch-only collectibles and can navigate to the 'send' flow

No longer reproducible.

PR_ISSUE 3: The select assets screen is shown when a watch-only token is going to be sent

As said above @mmilad75 is solving it.

PR_ISSUE 4: The 'From' page is shown after sending the collectible from the account overview page

No longer reproducible.

PR_ISSUE 5: The routes are not found when attempting to send a collectible using the 'send' button in the opened collectible

No longer reproducible. Maybe it was happening because the collectible didn't support sending, you didn't have enough eth or it was a side issue and now it's solved.

So there's nothing else pending from this PR, thank you for taking the time to test!

@VolodLytvynenko
Copy link
Contributor

The select assets screen is shown when token is going to be sent which available on both watch-only and regular account #19745

Hi @ulisesmac thank you for the update. I confirm this. Issues you mentioned are fixed

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