move profile tab (#15224)

* move profile tab

* e2e: new profile tab

* e2e: fix leftovers

* e2e: last

---------

Co-authored-by: Churikova Tetiana <tatiana@status.im>
This commit is contained in:
flexsurfer 2023-03-02 10:55:45 +01:00 committed by GitHub
parent 78682b823b
commit f731f75fca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 70 additions and 57 deletions

View File

@ -305,9 +305,10 @@
(rf/merge cofx
{:db (assoc db
:browser/options
{:browser-id (:browser-id browser)})}
(navigation/change-tab :browser-stack)
{:browser-id (:browser-id browser)}
:browser/screen-id :browser)}
(navigation/pop-to-root :shell-stack)
(navigation/change-tab :browser-stack)
(update-browser browser)
(resolve-url nil)))))
@ -319,11 +320,19 @@
(rf/merge cofx
{:db (assoc db
:browser/options
{:browser-id browser-id})}
{:browser-id browser-id}
:browser/screen-id :browser)}
(update-browser browser)
(navigation/set-stack-root :browser-stack :browser)
(navigation/change-tab :browser-stack)
(resolve-url nil))))
(rf/defn open-browser-tabs
{:events [:browser.ui/open-browser-tabs]}
[{:keys [db] :as cofx}]
(rf/merge cofx
{:db (assoc db :browser/screen-id :browser-tabs)}
(navigation/change-tab :browser-stack)))
(rf/defn web3-error-callback
{:events [:browser.dapp/transaction-on-error]}
[_ message-id message]
@ -573,9 +582,9 @@
(rf/defn open-empty-tab
{:events [:browser.ui/open-empty-tab]}
[cofx]
[{:keys [db]}]
(debounce/clear :browser/navigation-state-changed)
(navigation/set-stack-root cofx :browser-stack :empty-tab))
{:db (assoc db :browser/screen-id :empty-tab)})
(rf/defn url-input-pressed
{:events [:browser.ui/url-input-pressed]}

View File

@ -0,0 +1,14 @@
(ns status-im.ui.screens.browser.stack
(:require [utils.re-frame :as rf]
[status-im.ui.screens.browser.empty-tab.views :as empty-tab]
[status-im.ui.screens.browser.views :as browser]
[status-im.ui.screens.browser.tabs.views :as tabs]))
(defn browser-stack
[]
(let [screen-id (rf/sub [:browser/screen-id])]
(case screen-id
:empty-tab [empty-tab/empty-tab]
:browser [browser/browser]
:browser-tabs [tabs/tabs]
[empty-tab/empty-tab])))

View File

@ -6,13 +6,14 @@
(defn navbar
[]
{:background-color colors/white
:height 51
:height 100
:flex-direction :row
:align-items :center
:justify-content :space-between
:border-top-color colors/gray-lighter
:border-top-width 1
:padding-horizontal 24})
:padding-horizontal 24
:padding-bottom 50})
(def disabled-button
{:opacity 0.4})

View File

@ -55,7 +55,7 @@
(views/defview tabs
[]
(views/letsubs [browsers [:browser/browsers-vals]]
[react/view {:flex 1}
[react/view {:flex 1 :margin-bottom 50}
[topbar/topbar
{:modal? true
:border-bottom false

View File

@ -99,7 +99,7 @@
[chat-icon/custom-icon-view-list (:name dapps-account) (:color dapps-account) 32]]
[react/touchable-highlight
{:on-press #(re-frame/dispatch [:set-stack-root :browser-stack :browser-tabs])
{:on-press #(re-frame/dispatch [:browser.ui/open-browser-tabs])
:accessibility-label :browser-open-tabs}
[icons/icon :main-icons/tabs {:color colors/black}]]

View File

@ -204,6 +204,9 @@
{:right-accessories [{:accessibility-label :share-header-button
:icon :main-icons/share
:on-press on-share}]
:left-accessories [{:accessibility-label :close-header-button
:icon :main-icons/close
:on-press #(re-frame/dispatch [:navigate-back])}]
:use-insets true
:extended-header (profile-header/extended-header
{:on-press on-share

View File

@ -12,9 +12,6 @@
[status-im.ui.screens.bootnodes-settings.edit-bootnode.views :as edit-bootnode]
[status-im.ui.screens.bootnodes-settings.views :as bootnodes-settings]
[status-im.ui.screens.browser.bookmarks.views :as bookmarks]
[status-im.ui.screens.browser.empty-tab.views :as empty-tab]
[status-im.ui.screens.browser.tabs.views :as browser.tabs]
[status-im.ui.screens.browser.views :as browser]
[status-im.ui.screens.bug-report :as bug-report]
[status-im.ui.screens.communities.channel-details :as communities.channel-details]
[status-im.ui.screens.communities.community :as community]
@ -286,25 +283,6 @@
:options {:topBar {:title {:text (i18n/label :t/membership-title)}}}
:component membership/membership}
;;BROWSER
{:name :empty-tab
:insets {:top true}
:options {:topBar {:visible false}
:hardwareBackButton {:popStackOnPress false}}
:component empty-tab/empty-tab}
{:name :browser
:options {:topBar {:visible false}
:popGesture false
:hardwareBackButton {:dismissModalOnPress false
:popStackOnPress false}}
:component browser/browser}
{:name :browser-tabs
:insets {:top true}
:options {:topBar {:visible false}
:hardwareBackButton {:popStackOnPress false}}
:component browser.tabs/tabs}
;;WALLET
{:name :wallet

View File

@ -46,7 +46,7 @@
:style override-style
:avatar user-avatar}
"
[{:keys [type open-profile style avatar hide-search]}]
[{:keys [type style avatar hide-search]}]
(let [button-common-props (get-button-common-props type)
notif-count (rf/sub [:activity-center/unread-count])
new-notifications? (pos? notif-count)
@ -54,11 +54,12 @@
counter-label "0"]
[rn/view {:style (assoc style :height 56)}
;; Left Section
[rn/touchable-without-feedback {:on-press open-profile}
[rn/touchable-without-feedback {:on-press #(rf/dispatch [:navigate-to :my-profile])}
[rn/view
{:style {:position :absolute
:left 20
:top 12}}
{:accessibility-label :open-profile
:style {:position :absolute
:left 20
:top 12}}
[quo/user-avatar
(merge
{:status-indicator? true

View File

@ -2,13 +2,13 @@
(:require [react-native.core :as rn]
[react-native.reanimated :as reanimated]
[react-native.safe-area :as safe-area]
[status-im.ui.screens.profile.user.views :as profile.user]
[status-im.ui.screens.wallet.accounts.views :as wallet.accounts]
[status-im2.contexts.chat.home.view :as chat] ;; TODO move to status-im2
[status-im2.contexts.communities.home.view :as communities]
[status-im2.contexts.shell.animation :as animation]
[status-im2.contexts.shell.constants :as shell.constants]
[status-im2.contexts.shell.style :as styles]))
[status-im2.contexts.shell.style :as styles]
[status-im.ui.screens.browser.stack :as browser.stack]))
(defn load-stack?
[stack-id]
@ -39,7 +39,7 @@
:communities-stack [communities/home]
:chats-stack [chat/home]
:wallet-stack [wallet.accounts/accounts-overview]
:browser-stack [profile.user/my-profile])])]))
:browser-stack [browser.stack/browser-stack])])]))
(defn home-stack
[]

View File

@ -132,6 +132,7 @@
(reg-root-key-sub :browser/options :browser/options)
(reg-root-key-sub :dapps/permissions :dapps/permissions)
(reg-root-key-sub :bookmarks :bookmarks/bookmarks)
(reg-root-key-sub :browser/screen-id :browser/screen-id)
;;stickers
(reg-root-key-sub :stickers/selected-pack :stickers/selected-pack)

View File

@ -982,12 +982,12 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.profile_2.switch_push_notifications()
self.profile_1.just_fyi("Sending contact request via Profile > Contacts")
self.profile_1.click_system_back_button_until_element_is_shown(self.profile_1.chats_tab)
self.home_1.chats_tab.click()
for home in (self.home_1, self.home_2):
home.click_system_back_button_until_element_is_shown()
home.chats_tab.click()
self.home_1.send_contact_request_via_bottom_sheet(self.public_key_2)
self.home_2.just_fyi("Accepting contact request from activity centre")
self.home_2.chats_tab.click()
self.home_2.handle_contact_request(self.default_username_1)
self.profile_1.just_fyi("Sending message to contact via Messages > Recent")
@ -1161,8 +1161,9 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
@marks.testrail_id(702745)
def test_1_1_chat_non_latin_messages_stack_update_profile_photo(self):
self.home_1.click_system_back_button_until_element_is_shown()
self.home_1.browser_tab.click() # temp, until profile is on browser tab
self.home_1.profile_button.click()
self.profile_1.edit_profile_picture('sauce_logo.png')
self.profile_1.click_system_back_button_until_element_is_shown()
self.profile_1.chats_tab.click()
self.chat_2.just_fyi("Send messages with non-latin symbols")
@ -1204,7 +1205,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
[device.click_system_back_button_until_element_is_shown() for device in
(self.device_1, self.device_2)]
self.home_2.browser_tab.click() # temp, until profile is on browser tab
self.home_2.profile_button.click()
self.home_1.chats_tab.click()
self.device_2.just_fyi("Device 2 puts app on background being on Profile view to receive PN with text")
@ -1214,7 +1215,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
self.device_1.just_fyi("Device 1 puts app on background to receive emoji push notification")
self.device_1.click_system_back_button_until_element_is_shown()
self.device_1.browser_tab.click() # temp, until profile is on browser tab
self.device_1.profile_button.click()
self.device_1.click_system_home_button()
self.device_2.just_fyi("Check text push notification and tap it")

View File

@ -184,14 +184,13 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
for i in range(3):
self.public_keys[i], self.usernames[i] = users[i]
self.homes[0].chats_tab.click()
for i in range(1, 3):
self.homes[0].add_contact(self.public_keys[i])
for i in range(3):
self.homes[i].click_system_back_button_until_element_is_shown()
self.homes[i].chats_tab.click()
for i in range(1, 3):
self.homes[0].add_contact(self.public_keys[i])
self.homes[0].just_fyi('Members add admin to contacts to see PNs and put app in background')
self.loop.run_until_complete(
run_in_parallel(

View File

@ -361,6 +361,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.public_key_1, self.default_username_1 = self.home_1.get_public_key_and_username(return_username=True)
self.public_key_2, self.default_username_2 = self.home_2.get_public_key_and_username(return_username=True)
self.profile_1 = self.home_1.get_profile_view()
[home.click_system_back_button_until_element_is_shown() for home in (self.home_1, self.home_2)]
[home.chats_tab.click() for home in (self.home_1, self.home_2)]
self.home_1.add_contact(self.public_key_2)
self.home_2.handle_contact_request(self.default_username_1)

View File

@ -92,6 +92,8 @@ class TestActivityCenterMultipleDevicePR(MultipleSharedDeviceTestCase):
self.profile_1.just_fyi("Enabling PNs")
self.profile_1.switch_push_notifications()
[home.click_system_back_button_until_element_is_shown() for home in [self.home_1, self.home_2]]
@marks.testrail_id(702871)
def test_activity_center_cancel_outgoing_contact_request_no_pn(self):
@ -133,7 +135,6 @@ class TestActivityCenterMultipleDevicePR(MultipleSharedDeviceTestCase):
[home.chats_tab.click() for home in [self.home_1, self.home_2]]
self.home_2.just_fyi("Device2 sends pending contact request after cancelling")
# self.home_2.browser_tab.click() # temp
self.home_2.add_contact(self.public_key_1)
self.device_1.just_fyi('Device1 verifies pending contact request')

View File

@ -344,6 +344,7 @@ class TestDeeplinkOneDeviceNewUI(MultipleSharedDeviceTestCase):
self.sign_in = SignInView(self.drivers[0])
self.home = self.sign_in.create_user()
self.public_key, self.default_username = self.home.get_public_key_and_username(return_username=True)
self.home.click_system_back_button_until_element_is_shown()
self.home.chats_tab.click_until_presence_of_element(self.home.plus_button)
@marks.testrail_id(702774)
@ -364,7 +365,8 @@ class TestDeeplinkOneDeviceNewUI(MultipleSharedDeviceTestCase):
deep_link = 'status-im://u/%s' % self.public_key
self.sign_in.open_weblink_and_login(deep_link)
profile = self.home.get_profile_view()
self.home.browser_tab.click()
self.home.chats_tab.click()
self.home.profile_button.click()
if profile.default_username_text.text != self.default_username:
self.errors.append("Can't navigate to profile from deep link with own public key")
self.errors.verify_no_errors()

View File

@ -139,13 +139,15 @@ class WalletButton(TabButton):
class ProfileButton(TabButton):
def __init__(self, driver):
super().__init__(driver, xpath="//*[contains(@content-desc,'5 out of 5')]")
super().__init__(driver, accessibility_id="open-profile")
def navigate(self):
from views.profile_view import ProfileView
return ProfileView(self.driver)
def click(self, desired_element_text='privacy'):
if not self.is_element_displayed():
ChatsTab(self.driver).click()
from views.profile_view import ProfileView
if desired_element_text == 'privacy':
self.click_until_presence_of_element(ProfileView(self.driver).privacy_and_security_button)
@ -621,9 +623,9 @@ class BaseView(object):
def get_public_key_and_username(self, return_username=False):
self.driver.info("Get public key and username")
# profile_view = self.profile_button.click()
self.browser_tab.click() # temp, until profile is on browser tab
profile_view = self.get_profile_view()
profile_view = self.profile_button.click()
# self.browser_tab.click() # temp, until profile is on browser tab
#profile_view = self.get_profile_view()
default_username = profile_view.default_username_text.text
profile_view.share_my_profile_button.click()
profile_view.public_key_text.wait_for_visibility_of_element(20)