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

Implement Wallet - Account Switcher #18003

Merged
merged 6 commits into from
Dec 4, 2023
Merged

Conversation

smohamedjavid
Copy link
Member

@smohamedjavid smohamedjavid commented Nov 27, 2023

fixes #17368

Summary

This PR:

  • Implements the Wallet Account Switcher for easy switching between wallet accounts
  • Updates the about tab in the accounts screen to display the correct account address and derivation path along with the profile.
  • Updates the account-item component to pass the state from the parent and refactors the depreciated color functions
  • Moves the handle-bar in the bottom sheet to a standalone component Figma Link
Account.Switcher.mp4

Review notes

The handle-bar used in the bottom sheet is actually a separate component and it's moved to its respective ns. This helps us to create the gradient effect along with account options and a handlebar to be sticky on top of the sheet when the user scrolls through the accounts list. We have to make the sticky area to be positioned absolute to receive the sheet gesture.

Platforms

  • Android
  • iOS

Steps to test

User having only one account

  • Open Status
  • Navigate to the new wallet
  • Open any account by tapping on any of the cards in the home
  • Tap on the Account Avatar (Switcher) in the top right corner to open the account options + switcher sheet
  • The accounts list should NOT be displayed

User having more than one account

  • Open Status
  • Navigate to the new wallet
  • Open any account by tapping on any of the cards in the home
  • Tap on the Account Avatar (Switcher) in the top right corner to open the account options + switcher sheet
  • Tap on any account to switch to that account
  • Verify the details in the account screen reflect the selected account

status: ready

@status-im-auto
Copy link
Member

status-im-auto commented Nov 27, 2023

Jenkins Builds

Click to see older builds (23)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 5f45859 #1 2023-11-27 11:41:02 ~6 min android 🤖apk 📲
✔️ 5f45859 #1 2023-11-27 11:41:17 ~6 min ios 📱ipa 📲
✔️ 5f45859 #1 2023-11-27 11:41:55 ~7 min android-e2e 🤖apk 📲
5f45859 #1 2023-11-27 11:53:08 ~18 min tests 📄log
b4ec617 #2 2023-11-27 20:25:13 ~3 min tests 📄log
✔️ b4ec617 #2 2023-11-27 20:28:54 ~6 min ios 📱ipa 📲
✔️ b4ec617 #2 2023-11-27 20:29:23 ~7 min android-e2e 🤖apk 📲
✔️ b4ec617 #2 2023-11-27 20:30:32 ~8 min android 🤖apk 📲
✔️ 7977bcb #3 2023-11-28 09:33:03 ~7 min android 🤖apk 📲
✔️ 7977bcb #3 2023-11-28 09:33:09 ~7 min android-e2e 🤖apk 📲
7977bcb #3 2023-11-28 09:33:41 ~7 min ios 📄log
✔️ ad9ce1e #4 2023-11-28 11:14:48 ~7 min ios 📱ipa 📲
ad9ce1e #4 2023-11-28 11:19:22 ~11 min tests 📄log
✔️ ad9ce1e #4 2023-11-28 11:21:21 ~13 min android 🤖apk 📲
✔️ ad9ce1e #4 2023-11-28 11:22:20 ~14 min android-e2e 🤖apk 📲
✔️ ac9a6bb #5 2023-11-29 09:50:58 ~5 min android 🤖apk 📲
✔️ ac9a6bb #5 2023-11-29 09:51:56 ~6 min android-e2e 🤖apk 📲
✔️ ac9a6bb #5 2023-11-29 09:52:04 ~7 min ios 📱ipa 📲
✔️ ac9a6bb #5 2023-11-29 09:55:08 ~10 min tests 📄log
✔️ c0b627c #6 2023-11-30 10:23:07 ~6 min ios 📱ipa 📲
✔️ c0b627c #6 2023-11-30 10:26:33 ~10 min android-e2e 🤖apk 📲
✔️ c0b627c #6 2023-11-30 10:26:46 ~10 min android 🤖apk 📲
✔️ c0b627c #6 2023-11-30 10:28:17 ~11 min tests 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 5025a50 #7 2023-12-01 13:29:13 ~7 min ios 📱ipa 📲
✔️ 5025a50 #7 2023-12-01 13:32:20 ~10 min android-e2e 🤖apk 📲
✔️ 5025a50 #7 2023-12-01 13:32:35 ~10 min android 🤖apk 📲
✔️ 5025a50 #7 2023-12-01 13:33:57 ~11 min tests 📄log
✔️ 503b250 #8 2023-12-04 13:07:42 ~6 min android 🤖apk 📲
✔️ 503b250 #8 2023-12-04 13:08:57 ~7 min android-e2e 🤖apk 📲
✔️ 503b250 #8 2023-12-04 13:13:35 ~12 min tests 📄log
✔️ 503b250 #8 2023-12-04 13:14:45 ~13 min ios 📱ipa 📲

@J-Son89
Copy link
Contributor

J-Son89 commented Nov 27, 2023

just a heads up this pr will be merged shortly- not sure if it affects this pr but it moved the account switcher to a centralised location 👍 - #17946

@smohamedjavid smohamedjavid force-pushed the feature/account-switcher branch from 5f45859 to b4ec617 Compare November 27, 2023 20:21
@ulisesmac
Copy link
Contributor

@smohamedjavid it's still marked as darft. is that by accident? if not, please let us know when it's ready to review 👍

@smohamedjavid smohamedjavid force-pushed the feature/account-switcher branch 2 times, most recently from 7977bcb to ad9ce1e Compare November 28, 2023 11:07
@smohamedjavid smohamedjavid marked this pull request as ready for review November 28, 2023 11:07
@smohamedjavid
Copy link
Member Author

@smohamedjavid it's still marked as darft. is that by accident? if not, please let us know when it's ready to review 👍

@ulisesmac - I was adding tests and fixing bugs yesterday. So, marked it as a draft.
It's ready for review now. Thanks!

src/quo/core.cljs Outdated Show resolved Hide resolved
Copy link
Contributor

@OmarBasem OmarBasem left a comment

Choose a reason for hiding this comment

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

Looks good ⭐

@status-im-auto
Copy link
Member

82% of end-end tests have passed

Total executed tests: 45
Failed tests: 4
Expected to fail tests: 4
Passed tests: 37
IDs of failed tests: 702777,703133,702948,703629 
IDs of expected to fail tests: 702732,703503,702731,702808 

Failed tests (4)

Click to expand
  • Rerun failed tests

  • Class TestActivityCenterContactRequestMultipleDevicePR:

    1. test_add_contact_field_validation, id: 702777

    ## Creating new multiaccount (password:'qwerty1234', keycard:'False', enable_notification: 'False')
    Device 2: Find `Button` by `accessibility id`: `show-new-account-options`

    activity_center/test_activity_center.py:145: in test_add_contact_field_validation
        self.device_2.create_user(username=new_username_2, first_user=False)
    ../views/sign_in_view.py:232: in create_user
        self.plus_profiles_button.click()
    ../views/base_element.py:90: in click
        self.find_element().click()
    ../views/base_element.py:79: in find_element
        raise NoSuchElementException(
     Device 2: Button by accessibility id: `show-new-account-options` is not found on the screen; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
    



    Device sessions

    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:273: 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))]))
     Incorrect contacts number restored: 0 instead of 2
    E    admin_open was not restored from waku-backup!!
    E    member_open was not restored from waku-backup!!
    E    admin_closed was not restored from waku-backup!!
    E    member_closed was not restored from waku-backup!!
    



    Device sessions

    Class TestCommunityMultipleDeviceMergedTwo:

    1. test_community_hashtag_links_to_community_channels, id: 702948

    Device 1: Looking for activity center element: 'user_2'
    Device 1: Swiping right on element ActivityCenterElement

    critical/chats/test_public_chat_browsing.py:995: in test_community_hashtag_links_to_community_channels
        reply_element.swipe_right_on_element()
    ../views/base_element.py:299: in swipe_right_on_element
        location, size = self.get_element_coordinates()
    ../views/base_element.py:285: in get_element_coordinates
        element = self.find_element()
    ../views/base_element.py:434: in find_element
        raise NoSuchElementException(
     Device 1: `ActivityCenterElement` by `xpath`:`//*[contains(@text, 'user_2')]/ancestor::*[@content-desc='activity']` not found on the screen; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
    



    Device sessions

    2. test_community_join_when_node_owner_offline, id: 703629

    Device 1: ## Creating open community
    Device 1: Find Button by accessibility id: new-communities-button

    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/connectionpool.py:703: in urlopen
        httplib_response = self._make_request(
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/connectionpool.py:449: in _make_request
        six.raise_from(e, None)
    <string>:3: in raise_from
        ???
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/connectionpool.py:444: in _make_request
        httplib_response = conn.getresponse()
    /usr/lib/python3.10/http/client.py:1375: in getresponse
        response.begin()
    /usr/lib/python3.10/http/client.py:318: in begin
        version, status, reason = self._read_status()
    /usr/lib/python3.10/http/client.py:287: in _read_status
        raise RemoteDisconnected("Remote end closed connection without"
    E   http.client.RemoteDisconnected: Remote end closed connection without response
    
    During handling of the above exception, another exception occurred:
    critical/chats/test_public_chat_browsing.py:1057: in test_community_join_when_node_owner_offline
        self.home_1.create_community(community_type="open")
    ../views/home_view.py:476: in create_community
        self.plus_community_button.click()
    ../views/base_element.py:90: in click
        self.find_element().click()
    /home/jenkins/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webelement.py:94: in click
        self._execute(Command.CLICK_ELEMENT)
    /home/jenkins/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webelement.py:395: in _execute
        return self._parent.execute(command, params)
    /home/jenkins/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:343: in execute
        response = self.command_executor.execute(driver_command, params)
    /home/jenkins/.local/lib/python3.10/site-packages/selenium/webdriver/remote/remote_connection.py:291: in execute
        return self._request(command_info[0], url, body=data)
    /home/jenkins/.local/lib/python3.10/site-packages/selenium/webdriver/remote/remote_connection.py:312: in _request
        response = self._conn.request(method, url, body=body, headers=headers)
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/request.py:78: in request
        return self.request_encode_body(
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/request.py:170: in request_encode_body
        return self.urlopen(method, url, **extra_kw)
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/poolmanager.py:376: in urlopen
        response = conn.urlopen(method, u.request_uri, **kw)
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/connectionpool.py:787: in urlopen
        retries = retries.increment(
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/util/retry.py:550: in increment
        raise six.reraise(type(error), error, _stacktrace)
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/packages/six.py:769: in reraise
        raise value.with_traceback(tb)
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/connectionpool.py:703: in urlopen
        httplib_response = self._make_request(
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/connectionpool.py:449: in _make_request
        six.raise_from(e, None)
    <string>:3: in raise_from
        ???
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/connectionpool.py:444: in _make_request
        httplib_response = conn.getresponse()
    /usr/lib/python3.10/http/client.py:1375: in getresponse
        response.begin()
    /usr/lib/python3.10/http/client.py:318: in begin
        version, status, reason = self._read_status()
    /usr/lib/python3.10/http/client.py:287: in _read_status
        raise RemoteDisconnected("Remote end closed connection without"
     ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
    



    Device sessions

    Expected to fail tests (4)

    Click to expand

    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]]

    2. test_group_chat_offline_pn, id: 702808

    Device 3: Looking for a message by text: message from old member
    Device 3: Looking for a message by text: message from new member

    critical/chats/test_group_chat.py:323: in test_group_chat_offline_pn
        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))]))
     Messages PN was not fetched from offline 
    

    [[Data delivery issue]]

    Device sessions

    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]]

    Passed tests (37)

    Click to expand

    Class TestActivityMultipleDevicePR:

    1. test_navigation_jump_to, id: 702936
    Device sessions

    2. test_activity_center_reply_read_unread_delete_filter_swipe, id: 702947
    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 TestCommunityMultipleDeviceMergedTwo:

    1. test_community_markdown_support, id: 702809
    Device sessions

    2. test_community_mentions_push_notification, id: 702786
    Device sessions

    3. test_community_leave, id: 702845
    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 TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_mute_chat, id: 703495
    Device sessions

    2. test_group_chat_send_image_save_and_share, id: 703297
    Device sessions

    3. test_group_chat_reactions, id: 703202
    Device sessions

    4. test_group_chat_join_send_text_messages_push, id: 702807
    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_message_delete, id: 702839
    Device sessions

    7. test_community_message_send_check_timestamps_sender_username, id: 702838
    Device sessions

    8. test_community_links_with_previews_github_youtube_twitter_gif_send_enable, id: 702844
    Device sessions

    9. test_community_message_edit, id: 702843
    Device sessions

    10. test_community_unread_messages_badge, id: 702841
    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 TestActivityCenterContactRequestMultipleDevicePR:

    1. test_activity_center_contact_request_accept_swipe_mark_all_as_read, id: 702851
    Device sessions

    2. test_activity_center_contact_request_decline, id: 702850
    Device sessions

    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

    src/quo/components/list_items/account/view.cljs Outdated Show resolved Hide resolved
    src/quo/components/list_items/account/view.cljs Outdated Show resolved Hide resolved
    src/status_im2/contexts/wallet/events.cljs Show resolved Hide resolved
    src/status_im2/subs/wallet/wallet.cljs Outdated Show resolved Hide resolved
    src/status_im2/subs/wallet/wallet_test.cljs Show resolved Hide resolved
    @smohamedjavid smohamedjavid force-pushed the feature/account-switcher branch from ac9a6bb to c0b627c Compare November 30, 2023 10:16
    @qoqobolo qoqobolo self-assigned this Nov 30, 2023
    @qoqobolo
    Copy link
    Contributor

    qoqobolo commented Dec 1, 2023

    @smohamedjavid amazing work, thank you!
    Looks good to me so far, but could you please resolve the conflicts so I can briefly recheck your changes for compatibility with the recently merged wallet PRs, please?

    @smohamedjavid smohamedjavid force-pushed the feature/account-switcher branch from c0b627c to 5025a50 Compare December 1, 2023 13:21
    @smohamedjavid
    Copy link
    Member Author

    @smohamedjavid amazing work, thank you! Looks good to me so far, but could you please resolve the conflicts so I can briefly recheck your changes for compatibility with the recently merged wallet PRs, please?

    @qoqobolo - Thank you for testing this PR.
    I have resolved the conflicts and it's ready for testing.

    @qoqobolo
    Copy link
    Contributor

    qoqobolo commented Dec 1, 2023

    Thanks @smohamedjavid! One question:

    On Android, when the height of the bottom sheet is max, the top margin differs from iOS and design, is this expected?

    video_2023-12-01_16-47-53.mp4

    Designs/iOS

    Screenshot 2023-12-01 at 16 49 50

    @smohamedjavid
    Copy link
    Member Author

    On Android, when the height of the bottom sheet is max, the top margin differs from iOS and design, is this expected?

    @qoqobolo - This is odd, as I could not see this issue on my end.

    Pixel 3 Pixel 7
    Screenshot_1701457894 Screenshot_1701458947

    We didn't have any full-height bottom sheets before this PR. So, it's hard to test with other bottom sheets. Can you help with the device model you are using to test? We will try to debug.

    @qoqobolo
    Copy link
    Contributor

    qoqobolo commented Dec 4, 2023

    Can you help with the device model you are using to test? We will try to debug.

    Sure, it's reproducible on Google Pixel 7a

    @smohamedjavid
    Copy link
    Member Author

    Can you help with the device model you are using to test? We will try to debug.

    Sure, it's reproducible on Google Pixel 7a

    @qoqobolo - Thank you for sending the device modal.

    I tried it on Google Pixel 7a, and it's reproducible.

    I checked the existing max height calculation (window height less (-) OS's top (bar) safe area). It works as expected on iOS devices and for Android devices that don't have a punch-hole selfie camera.

    The sheet's max height behaves differently on devices with a punch-hole selfie camera than the devices without it.

    Please help me create a separate issue, as adjusting the bottom sheet max-height calculation should not affect existing sheets in the app.

    @qoqobolo
    Copy link
    Contributor

    qoqobolo commented Dec 4, 2023

    Please help me create a separate issue, as adjusting the bottom sheet max-height calculation should not affect existing sheets in the app.

    Will do!👌

    No more questions from my side, PR can be merged.

    Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
    Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
    Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
    Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
    Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
    Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
    @smohamedjavid smohamedjavid force-pushed the feature/account-switcher branch from 5025a50 to 503b250 Compare December 4, 2023 13:01
    @smohamedjavid smohamedjavid merged commit 56d135f into develop Dec 4, 2023
    6 checks passed
    @smohamedjavid smohamedjavid deleted the feature/account-switcher branch December 4, 2023 13:17
    yevh-berdnyk pushed a commit that referenced this pull request Dec 8, 2023
    This commit:
    
    - Implements the Wallet Account Switcher for easy switching between wallet accounts
    - Updates the About tab in the accounts screen to display the correct account address and derivation path along with the profile.
    - Updates the account-item component to pass the state from the parent and refactors the depreciated color functions
    - Moves the handle-bar in the bottom sheet to a standalone component 
    - Adds customization-color in account-origin component
    
    ---------
    
    Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
    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
    Development

    Successfully merging this pull request may close these issues.

    Implement Account Switcher
    6 participants