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

Add collectible menu #18185

Merged
merged 4 commits into from
Dec 15, 2023
Merged

Add collectible menu #18185

merged 4 commits into from
Dec 15, 2023

Conversation

vkjr
Copy link
Contributor

@vkjr vkjr commented Dec 14, 2023

fixes #17323

Summary

  • Collectible menu implemented without functionality
  • Collectible fetching fixed (was broken by PR that removes old wallet initialization)

Simulator Screenshot - iPhone 13 - 2023-12-14 at 13 50 13

status: ready

@vkjr vkjr self-assigned this Dec 14, 2023
@@ -269,7 +269,7 @@
:max-cache-age-seconds max-cache-age-seconds}
request-params [request-id
[(chain/chain-id db)]
(map :address (:profile/wallet-accounts db))
(keys (get-in db [:wallet :accounts]))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mmilad75, here is a fix that enables collectibles retrieving.
Old wallet initialization was failed and :profile/wallet-accounts key is not longer populated, so now we need to get account information in a new way

Copy link
Contributor

Choose a reason for hiding this comment

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

Great! Thanks man.

Copy link
Member

Choose a reason for hiding this comment

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

Apologies 🙏 for not spotting this yesterday when we removed it.

@status-im-auto
Copy link
Member

status-im-auto commented Dec 14, 2023

Jenkins Builds

Click to see older builds (8)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 95d9f09 #1 2023-12-14 13:56:49 ~4 min tests 📄log
✔️ 95d9f09 #1 2023-12-14 13:58:38 ~6 min ios 📱ipa 📲
✔️ 95d9f09 #1 2023-12-14 13:59:44 ~7 min android-e2e 🤖apk 📲
✔️ 95d9f09 #1 2023-12-14 13:59:51 ~7 min android 🤖apk 📲
✔️ 6d52a65 #2 2023-12-14 15:02:58 ~4 min tests 📄log
✔️ 6d52a65 #2 2023-12-14 15:05:51 ~7 min android 🤖apk 📲
✔️ 6d52a65 #2 2023-12-14 15:06:00 ~7 min android-e2e 🤖apk 📲
✔️ 6d52a65 #2 2023-12-14 15:12:04 ~13 min ios 📱ipa 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ c74874a #3 2023-12-14 20:14:23 ~5 min tests 📄log
✔️ c74874a #3 2023-12-14 20:15:12 ~5 min ios 📱ipa 📲
✔️ c74874a #3 2023-12-14 20:17:06 ~7 min android-e2e 🤖apk 📲
✔️ c74874a #3 2023-12-14 20:17:30 ~8 min android 🤖apk 📲
✔️ b11681b #5 2023-12-15 14:45:32 ~4 min tests 📄log
✔️ b11681b #5 2023-12-15 14:46:55 ~5 min ios 📱ipa 📲
✔️ b11681b #5 2023-12-15 14:49:20 ~7 min android-e2e 🤖apk 📲
✔️ b11681b #5 2023-12-15 14:49:20 ~7 min android 🤖apk 📲

(rf/dispatch [:wallet/request-collectibles
{:start-at-index 0
:new-request? true}]))
[(count accounts)])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@J-Son89, @ulisesmac, @briansztamfater, you may be interested:

Here I use use-effect because when user goes straight to wallet page, there is a moment when details about accounts aren't returned from status-go. And I've found kind of a problem: if you will try to use [accounts], or [@accoutns] - hook won't work properly and will call its function on every re-render. But with [(count accounts)] it works. So it looks like only simple values can be used as a conditional launch of use-effect hook.
I tried with atoms, reagent atom, clojure maps... all these kinds of values stated as condition trigger hook on every re-render(
If you know something about this behaviour - please share.

Copy link
Member

Choose a reason for hiding this comment

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

Here I use use-effect because when user goes straight to wallet page, there is a moment when details about accounts aren't returned from status-go.

@vkjr - Perhaps we can move this dispatch on the success of fetching the accounts (wallet/get-accounts-success a correct place too)? We currently dispatch wallet/get-wallet-token to fetch token prices which depend on the account addresses.

This will also help us resolve a bug (undiscovered until now :)) where a newly added account doesn't display collectables unless we log in again.

Copy link
Contributor

@ulisesmac ulisesmac Dec 14, 2023

Choose a reason for hiding this comment

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

@J-Son89, @ulisesmac, @briansztamfater, you may be interested:

Here I use use-effect because when user goes straight to wallet page, there is a moment when details about accounts aren't returned from status-go. And I've found kind of a problem: if you will try to use [accounts], or [@accoutns] - hook won't work properly and will call its function on every re-render. But with [(count accounts)] it works. So it looks like only simple values can be used as a conditional launch of use-effect hook.
I tried with atoms, reagent atom, clojure maps... all these kinds of values stated as condition trigger hook on every re-render(
If you know something about this behaviour - please share.

Hey @vkjr

I have faced this same issue in the past.
The problem is that the hook dependencies are being compared in the JS side to check if the hook should be re-executed.

It means that in JS, numbers can be compared without any problem, (e.g. 4 = 4 always is true), but JS objects are compared by reference, so two objects that look exactly the same are different

(E.g.

#js{"0x123" #js{"a" 100}}
=
#js{"0x123" #js{"a" 100}}

Always is false unless you store it in a let binding and compare the same var)

As far as I remember, the use-effect hook we are using transforms the dependencies vector from CLJS to JS, so it's creating new objects from clojure maps for each re-render.

Ok, enough of explanations. Let's give a solution.

We can rely on strings :) since they are compared by value.

So if we have a clojure map for accounts that looks like:

{"0x12..." {...}
 "0x01..." {...}
 "0xAB..." {...}}

I'd do:

(-> @accounts keys sort)

So that we get an ordered list of accounts that also works as hook dependency, if an account is added, the effect will detect a change and will re render, and I'm using sort because clojure hash maps aren't ordered (unless sorted-map is used), and we don't want to trigger renders just because of the order changed.

Note: maybe we'd need to add vec at the end of that -> if a vector must be passed to our use-effect dependency.

{:render-fn quo/token-value
:data temp/tokens
:key :assets-list
:content-container-style {:padding-horizontal 8}}]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say it's better to avoid inline styles, even if it's a single style

(rf/dispatch [:wallet/request-collectibles
{:start-at-index 0
:new-request? true}]))
[(count accounts)])
Copy link
Member

Choose a reason for hiding this comment

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

Here I use use-effect because when user goes straight to wallet page, there is a moment when details about accounts aren't returned from status-go.

@vkjr - Perhaps we can move this dispatch on the success of fetching the accounts (wallet/get-accounts-success a correct place too)? We currently dispatch wallet/get-wallet-token to fetch token prices which depend on the account addresses.

This will also help us resolve a bug (undiscovered until now :)) where a newly added account doesn't display collectables unless we log in again.

@@ -269,7 +269,7 @@
:max-cache-age-seconds max-cache-age-seconds}
request-params [request-id
[(chain/chain-id db)]
(map :address (:profile/wallet-accounts db))
(keys (get-in db [:wallet :accounts]))
Copy link
Member

Choose a reason for hiding this comment

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

Apologies 🙏 for not spotting this yesterday when we removed it.

Comment on lines 41 to 45
(def aval
(atom {:a 1
:b 2}))

(reset! aval {:a 4})
Copy link
Member

Choose a reason for hiding this comment

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

I guess this is intended for testing.

:on-press #(js/alert "pressed")}]
:on-press #(rf/dispatch
[:show-bottom-sheet
{:content (fn [] [collectible-actions-sheet])
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
{:content (fn [] [collectible-actions-sheet])
{:content collectible-actions-sheet

@vkjr
Copy link
Contributor Author

vkjr commented Dec 14, 2023

@smohamedjavid,

@vkjr - Perhaps we can move this dispatch on the success of fetching the accounts (wallet/get-accounts-success a correct place too)?

Yes, you are right, this is much better place)

{:keys [traits description]} collectible-data
chain-id (rf/sub [:wallet/last-collectible-chain-id])]
collection-data]} collectible
{:keys [traits name description]} collectible-data
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 name here can overshadow name keyword?

{:padding-horizontal 8})

(def home-container
{:margin-top (safe-area/get-top)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this safe area margin be applied in the navigation file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably yes, but I'd better make it the scope of other PR

:on-press #(rf/dispatch
[:show-bottom-sheet
{:content collectible-actions-sheet
:theme nil}])}]
Copy link
Contributor

Choose a reason for hiding this comment

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

why we passing theme as nil here btw? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, thanks for noticing!) That was temporary

@status-im-auto
Copy link
Member

75% of end-end tests have passed

Total executed tests: 48
Failed tests: 9
Expected to fail tests: 3
Passed tests: 36
IDs of failed tests: 703133,703495,703297,703202,702947,702843,702807,702808,703629 
IDs of expected to fail tests: 702732,703503,702731 

Failed tests (9)

Click to expand
  • Rerun failed tests

  • Class TestCommunityOneDeviceMerged:

    1. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133

    Device 1: Find `Button` by `accessibility id`: `show-profiles`
    Device 1: Tap on found: Button

    critical/chats/test_public_chat_browsing.py:274: in test_restore_multiaccount_with_waku_backup_remove_switch
        self.errors.verify_no_errors()
    base_test_case.py:191: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     zQ3...pJN5P was not restored as a contact from waku backup!
    



    Device sessions

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_mute_chat, id: 703495

    Test setup failed: critical/chats/test_group_chat.py:54: in prepare_devices
        self.loop.run_until_complete(
    /usr/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
        return future.result()
    __init__.py:44: in run_in_parallel
        returns.append(await k)
    /usr/lib/python3.10/concurrent/futures/thread.py:58: in run
        result = self.fn(*self.args, **self.kwargs)
    ../views/home_view.py:383: in handle_contact_request
        chat_element.accept_contact_request()
    ../views/home_view.py:150: in accept_contact_request
        self.handle_cr("accept-contact-request")
    ../views/home_view.py:147: in handle_cr
        ).wait_for_rendering_ended_and_click()
    ../views/base_element.py:155: in wait_for_rendering_ended_and_click
        self.wait_for_visibility_of_element(20)
    ../views/base_element.py:139: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 3: Button by xpath:`//*[contains(@text, 'user admin')]/ancestor::*[@content-desc='activity']/*[@content-desc="accept-contact-request"]` is not found on the screen after wait_for_visibility_of_element
    



    2. test_group_chat_send_image_save_and_share, id: 703297

    Test setup failed: critical/chats/test_group_chat.py:54: in prepare_devices
        self.loop.run_until_complete(
    /usr/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
        return future.result()
    __init__.py:44: in run_in_parallel
        returns.append(await k)
    /usr/lib/python3.10/concurrent/futures/thread.py:58: in run
        result = self.fn(*self.args, **self.kwargs)
    ../views/home_view.py:383: in handle_contact_request
        chat_element.accept_contact_request()
    ../views/home_view.py:150: in accept_contact_request
        self.handle_cr("accept-contact-request")
    ../views/home_view.py:147: in handle_cr
        ).wait_for_rendering_ended_and_click()
    ../views/base_element.py:155: in wait_for_rendering_ended_and_click
        self.wait_for_visibility_of_element(20)
    ../views/base_element.py:139: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 3: Button by xpath:`//*[contains(@text, 'user admin')]/ancestor::*[@content-desc='activity']/*[@content-desc="accept-contact-request"]` is not found on the screen after wait_for_visibility_of_element
    



    3. test_group_chat_reactions, id: 703202

    Test setup failed: critical/chats/test_group_chat.py:54: in prepare_devices
        self.loop.run_until_complete(
    /usr/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
        return future.result()
    __init__.py:44: in run_in_parallel
        returns.append(await k)
    /usr/lib/python3.10/concurrent/futures/thread.py:58: in run
        result = self.fn(*self.args, **self.kwargs)
    ../views/home_view.py:383: in handle_contact_request
        chat_element.accept_contact_request()
    ../views/home_view.py:150: in accept_contact_request
        self.handle_cr("accept-contact-request")
    ../views/home_view.py:147: in handle_cr
        ).wait_for_rendering_ended_and_click()
    ../views/base_element.py:155: in wait_for_rendering_ended_and_click
        self.wait_for_visibility_of_element(20)
    ../views/base_element.py:139: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 3: Button by xpath:`//*[contains(@text, 'user admin')]/ancestor::*[@content-desc='activity']/*[@content-desc="accept-contact-request"]` is not found on the screen after wait_for_visibility_of_element
    



    4. test_group_chat_join_send_text_messages_push, id: 702807

    Device 2: Tap on found: Button
    Device 2: Attempt 0 is successful clicking close-activity-center

    Test setup failed: critical/chats/test_group_chat.py:54: in prepare_devices
        self.loop.run_until_complete(
    /usr/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
        return future.result()
    __init__.py:44: in run_in_parallel
        returns.append(await k)
    /usr/lib/python3.10/concurrent/futures/thread.py:58: in run
        result = self.fn(*self.args, **self.kwargs)
    ../views/home_view.py:383: in handle_contact_request
        chat_element.accept_contact_request()
    ../views/home_view.py:150: in accept_contact_request
        self.handle_cr("accept-contact-request")
    ../views/home_view.py:147: in handle_cr
        ).wait_for_rendering_ended_and_click()
    ../views/base_element.py:155: in wait_for_rendering_ended_and_click
        self.wait_for_visibility_of_element(20)
    ../views/base_element.py:139: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 3: Button by xpath:`//*[contains(@text, 'user admin')]/ancestor::*[@content-desc='activity']/*[@content-desc="accept-contact-request"]` is not found on the screen after wait_for_visibility_of_element
    



    Device sessions

    5. test_group_chat_offline_pn, id: 702808

    Test setup failed: critical/chats/test_group_chat.py:54: in prepare_devices
        self.loop.run_until_complete(
    /usr/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
        return future.result()
    __init__.py:44: in run_in_parallel
        returns.append(await k)
    /usr/lib/python3.10/concurrent/futures/thread.py:58: in run
        result = self.fn(*self.args, **self.kwargs)
    ../views/home_view.py:383: in handle_contact_request
        chat_element.accept_contact_request()
    ../views/home_view.py:150: in accept_contact_request
        self.handle_cr("accept-contact-request")
    ../views/home_view.py:147: in handle_cr
        ).wait_for_rendering_ended_and_click()
    ../views/base_element.py:155: in wait_for_rendering_ended_and_click
        self.wait_for_visibility_of_element(20)
    ../views/base_element.py:139: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 3: Button by xpath:`//*[contains(@text, 'user admin')]/ancestor::*[@content-desc='activity']/*[@content-desc="accept-contact-request"]` is not found on the screen after wait_for_visibility_of_element 
    

    [[Data delivery issue]]

    Class TestCommunityMultipleDeviceMergedTwo:

    1. test_community_join_when_node_owner_offline, id: 703629

    Device 2: Tap on found: Button
    Device 2: Looking for community: 'open community'

    critical/chats/test_public_chat_browsing.py:1141: in test_community_join_when_node_owner_offline
        self.errors.verify_no_errors()
    base_test_case.py:191: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     Joined status is not displayed
    E    open community is not listed inside Joined communities tab
    



    Device sessions

    Class TestActivityMultipleDevicePR:

    1. test_activity_center_reply_read_unread_delete_filter_swipe, id: 702947

    Device 1: Tap on found: CommunitiesTab
    Device 2: Looking for a message by text: something to reply to

    activity_center/test_activity_center.py:282: in test_activity_center_reply_read_unread_delete_filter_swipe
        self.channel_2.chat_element_by_text(message_to_reply).wait_for_visibility_of_element(120)
    ../views/base_element.py:139: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: ChatElementByText by xpath:`//*[starts-with(@text,'something to reply to')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']` is not found on the screen after wait_for_visibility_of_element
    



    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_message_edit, id: 702843

    Device 2: Looking for a message by text: Message AFTER edit 2 (Edited)
    Device 2: Find ChatElementByText by xpath: //*[starts-with(@text,'Message AFTER edit 2 (Edited)')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']

    critical/chats/test_public_chat_browsing.py:351: in test_community_message_edit
        self.channel_2.set_reaction(message_text_after_edit)
    ../views/chat_view.py:1070: in set_reaction
        self.chat_element_by_text(message).long_press_until_element_is_shown(element)
    ../views/base_element.py:318: in long_press_until_element_is_shown
        element = self.find_element()
    ../views/chat_view.py:134: in find_element
        self.wait_for_visibility_of_element(20)
    ../views/base_element.py:139: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: ChatElementByText by xpath:`//*[starts-with(@text,'Message AFTER edit 2 (Edited)')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']` is not found on the screen after wait_for_visibility_of_element
    



    Device sessions

    Expected to fail tests (3)

    Click to expand

    Class TestCommunityOneDeviceMerged:

    1. test_community_discovery, id: 703503

    Test is not run, e2e blocker  
    

    [[reason: [NOTRUN] Curated communities not loading, https://github.com//issues/17852]]

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_pin_messages, id: 702731

    Test is not run, e2e blocker  
    

    [[reason: [NOTRUN] Pin feature is in development]]

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_pin_messages, id: 702732

    Test is not run, e2e blocker  
    

    [[reason: [NOTRUN] Pin feature is in development]]

    Passed tests (36)

    Click to expand

    Class TestCommunityOneDeviceMerged:

    1. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    2. test_community_undo_delete_message, id: 702869
    Device sessions

    3. test_community_navigate_to_channel_when_relaunch, id: 702846
    Device sessions

    4. test_community_mute_community_and_channel, id: 703382
    Device sessions

    Class TestActivityCenterContactRequestMultipleDevicePR:

    1. test_add_contact_field_validation, id: 702777
    Device sessions

    2. test_activity_center_contact_request_accept_swipe_mark_all_as_read, id: 702851
    Device sessions

    3. test_activity_center_contact_request_decline, id: 702850
    Device sessions

    Class TestDeepLinksOneDevice:

    1. test_links_open_universal_links_from_chat, id: 704613
    Device sessions

    2. test_links_deep_links, id: 702775
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_emoji_send_reply_and_open_link, id: 702782
    Device sessions

    2. test_1_1_chat_text_message_delete_push_disappear, id: 702733
    Device sessions

    3. test_1_1_chat_push_emoji, id: 702813
    Device sessions

    4. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    5. test_1_1_chat_edit_message, id: 702855
    Device sessions

    6. test_1_1_chat_send_image_save_and_share, id: 703391
    Device sessions

    7. test_1_1_chat_message_reaction, id: 702730
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUiTwo:

    1. test_1_1_chat_delete_via_long_press_relogin, id: 702784
    Device sessions

    2. test_1_1_chat_is_shown_message_sent_delivered_from_offline, id: 702783
    Device sessions

    3. test_1_1_chat_mute_chat, id: 703496
    Device sessions

    Class TestActivityMultipleDevicePRTwo:

    1. test_activity_center_mentions, id: 702957
    Device sessions

    2. test_activity_center_admin_notification_accept_swipe, id: 702958
    Device sessions

    Class TestCommunityMultipleDeviceMergedTwo:

    1. test_community_markdown_support, id: 702809
    Device sessions

    2. test_community_hashtag_links_to_community_channels, id: 702948
    Device sessions

    3. test_community_mentions_push_notification, id: 702786
    Device sessions

    4. test_community_leave, id: 702845
    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_several_images_send_reply, id: 703194
    Device sessions

    2. test_community_one_image_send_reply, id: 702859
    Device sessions

    3. test_community_emoji_send_copy_paste_reply, id: 702840
    Device sessions

    4. test_community_mark_all_messages_as_read, id: 703086
    Device sessions

    5. test_community_contact_block_unblock_offline, id: 702894
    Device sessions

    6. test_community_edit_delete_message_when_offline, id: 704615
    Device sessions

    7. test_community_message_delete, id: 702839
    Device sessions

    8. test_community_message_send_check_timestamps_sender_username, id: 702838
    Device sessions

    9. test_community_links_with_previews_github_youtube_twitter_gif_send_enable, id: 702844
    Device sessions

    10. test_community_unread_messages_badge, id: 702841
    Device sessions

    Class TestActivityMultipleDevicePR:

    1. test_navigation_jump_to, id: 702936
    Device sessions

    @pavloburykh
    Copy link
    Contributor

    @vkjr thank you for the PR. Failed e2e are not PR related. Ready for merge in case manual testing is not needed.

    @vkjr vkjr merged commit 2a5c102 into develop Dec 15, 2023
    6 checks passed
    @vkjr vkjr deleted the collectible-menu branch December 15, 2023 15:37
    ulisesmac pushed a commit that referenced this pull request Dec 15, 2023
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    Archived in project
    Archived in project
    Development

    Successfully merging this pull request may close these issues.

    Implement collectible menu
    8 participants