[#19247] feat: migrate to new contact profile (#19246)

Co-authored-by: Yevheniia Berdnyk <ie.berdnyk@gmail.com>
Co-authored-by: Sean Hagstrom <sean@seanhagstrom.com>
This commit is contained in:
Mohsen 2024-03-19 20:57:58 +03:00 committed by GitHub
parent 772efa90d4
commit 9e5b8b5f9c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 214 additions and 169 deletions

1
.env
View File

@ -34,4 +34,3 @@ STICKERS_TEST_ENABLED=1
LOCAL_PAIRING_ENABLED=1 LOCAL_PAIRING_ENABLED=1
TEST_STATEOFUS=1 TEST_STATEOFUS=1
FAST_CREATE_COMMUNITY_ENABLED=1 FAST_CREATE_COMMUNITY_ENABLED=1
FLAG_NEW_CONTACT_UI_ENABLED=0

View File

@ -58,7 +58,9 @@
(rf/defn block-contact (rf/defn block-contact
{:events [:contact.ui/block-contact-confirmed]} {:events [:contact.ui/block-contact-confirmed]}
[{:keys [db] :as cofx} public-key] [{:keys [db] :as cofx} public-key
{:keys [handle-navigation?]
:or {handle-navigation? true}}]
(let [contact (-> (contact.db/public-key->contact (let [contact (-> (contact.db/public-key->contact
(:contacts/contacts db) (:contacts/contacts db)
public-key) public-key)
@ -75,9 +77,10 @@
(re-frame/dispatch [:sanitize-messages-and-process-response block-contact]) (re-frame/dispatch [:sanitize-messages-and-process-response block-contact])
(re-frame/dispatch [:hide-popover]))) (re-frame/dispatch [:hide-popover])))
;; reset navigation to avoid going back to non existing one to one chat ;; reset navigation to avoid going back to non existing one to one chat
(when handle-navigation?
(if from-one-to-one-chat? (if from-one-to-one-chat?
(navigation/pop-to-root :shell-stack) (navigation/pop-to-root :shell-stack)
(navigation/navigate-back))))) (navigation/navigate-back))))))
(rf/defn contact-unblocked (rf/defn contact-unblocked
{:events [:contacts/unblocked]} {:events [:contacts/unblocked]}

View File

@ -115,12 +115,13 @@
emojis)) emojis))
(defn- view-internal (defn- view-internal
[{:keys [theme description input blur? input-props container-style] [{:keys [theme description title input blur? input-props container-style]
emojis :emoji-dash emojis :emoji-dash
:as props}] :as props}]
[rn/view {:style container-style} [rn/view {:style container-style}
[rn/view {:style style/top-container} [rn/view {:style style/top-container}
[header props] (when (or title input)
[header props])
(when description (when description
[description-container props]) [description-container props])
(when emojis (when emojis

View File

@ -7,11 +7,12 @@
[react-native.core :as rn])) [react-native.core :as rn]))
(defn- username-text (defn- username-text
[{:keys [theme name-type username blur?] [{:keys [theme name-type username accessibility-label blur?]
real-name :name}] real-name :name}]
[rn/view {:style style/username-text-container} [rn/view {:style style/username-text-container}
[text/text [text/text
{:size :heading-1 {:size :heading-1
:accessibility-label accessibility-label
:weight :semi-bold} :weight :semi-bold}
username] username]
(when (= name-type :nickname) (when (= name-type :nickname)
@ -24,6 +25,7 @@
[text/text [text/text
{:style (style/real-name-text theme blur?) {:style (style/real-name-text theme blur?)
:size :paragraph-1 :size :paragraph-1
:accessibility-label :real-name
:weight :medium} :weight :medium}
real-name]])]) real-name]])])

View File

@ -69,6 +69,7 @@
:center-opacity (reanimated/get-shared-value opacity-animation) :center-opacity (reanimated/get-shared-value opacity-animation)
:overlay-shown? overlay-shown?} :overlay-shown? overlay-shown?}
navigate-back? (assoc :icon-name :i/close navigate-back? (assoc :icon-name :i/close
:accessibility-label :back-button
:on-press #(rf/dispatch [:navigate-back])) :on-press #(rf/dispatch [:navigate-back]))
page-nav-props (merge page-nav-props))]) page-nav-props (merge page-nav-props))])
(when title-colum (when title-colum

View File

@ -73,6 +73,7 @@
(def ^:const contact-request-message-state-pending 1) (def ^:const contact-request-message-state-pending 1)
(def ^:const contact-request-message-state-accepted 2) (def ^:const contact-request-message-state-accepted 2)
(def ^:const contact-request-message-state-declined 3) (def ^:const contact-request-message-state-declined 3)
(def ^:const contact-request-message-max-length 280)
(def request-to-join-pending-state 1) (def request-to-join-pending-state 1)

View File

@ -14,7 +14,6 @@
[status-im.contexts.chat.messenger.messages.delete-message-for-me.events :as delete-for-me] [status-im.contexts.chat.messenger.messages.delete-message-for-me.events :as delete-for-me]
[status-im.contexts.chat.messenger.messages.delete-message.events :as delete-message] [status-im.contexts.chat.messenger.messages.delete-message.events :as delete-message]
[status-im.contexts.chat.messenger.messages.list.state :as chat.state] [status-im.contexts.chat.messenger.messages.list.state :as chat.state]
[status-im.feature-flags :as ff]
[status-im.navigation.events :as navigation] [status-im.navigation.events :as navigation]
[taoensso.timbre :as log] [taoensso.timbre :as log]
[utils.datetime :as datetime] [utils.datetime :as datetime]
@ -444,8 +443,5 @@
{:pubkey public-key {:pubkey public-key
:ens ens-name :ens ens-name
:success-fn (fn [_] :success-fn (fn [_]
{:dispatch [:open-modal {:dispatch [:open-modal :contact-profile]})}]}
(if (ff/enabled? ::ff/profile.new-contact-ui) {:dispatch [:open-modal :settings]}))))
:contact-profile
:profile)]})}]}
{:dispatch [:navigate-to :my-profile]}))))

View File

@ -68,8 +68,9 @@
(i18n/label :t/edit-nickname) (i18n/label :t/edit-nickname)
(i18n/label :t/add-nickname-title)) (i18n/label :t/add-nickname-title))
:on-press on-add-nickname :on-press on-add-nickname
:accessibility-label (if nickname :edit-nickname :add-nickname)} :accessibility-label (if nickname :edit-nickname :add-nickname)}]
{:icon :i/qr-code (when-not blocked?
[{:icon :i/qr-code
:label (i18n/label :t/show-qr) :label (i18n/label :t/show-qr)
:on-press on-show-qr :on-press on-show-qr
:accessibility-label :show-qr-code} :accessibility-label :show-qr-code}
@ -83,9 +84,8 @@
:on-press on-remove-nickname :on-press on-remove-nickname
:add-divider? true :add-divider? true
:accessibility-label :remove-nickname :accessibility-label :remove-nickname
:danger? true})] :danger? true})
(when-not blocked? {:icon :i/untrustworthy
[{:icon :i/untrustworthy
:label (i18n/label :t/mark-untrustworthy) :label (i18n/label :t/mark-untrustworthy)
:on-press not-implemented/alert :on-press not-implemented/alert
:accessibility-label :mark-untrustworthy :accessibility-label :mark-untrustworthy

View File

@ -20,6 +20,8 @@
profile-picture (profile.utils/photo profile) profile-picture (profile.utils/photo profile)
[unsaved-nickname set-unsaved-nickname] (rn/use-state nickname) [unsaved-nickname set-unsaved-nickname] (rn/use-state nickname)
[error-msg set-error-msg] (rn/use-state nil) [error-msg set-error-msg] (rn/use-state nil)
has-nickname? (rn/use-memo (fn [] (not (string/blank? nickname)))
[nickname])
validate-nickname (rn/use-callback validate-nickname (rn/use-callback
(debounce/debounce (debounce/debounce
(fn [name] (fn [name]
@ -72,9 +74,10 @@
(i18n/label :t/nickname-visible-to-you))]] (i18n/label :t/nickname-visible-to-you))]]
[quo/bottom-actions [quo/bottom-actions
{:actions :two-actions {:actions :two-actions
:button-one-label (i18n/label :t/add-nickname-title) :button-one-label (i18n/label (if has-nickname? :t/update-nickname-title :t/add-nickname-title))
:button-one-props {:disabled? (or (string/blank? unsaved-nickname) :button-one-props {:disabled? (or (string/blank? unsaved-nickname)
(not (string/blank? error-msg))) (not (string/blank? error-msg)))
:customization-color customization-color
:on-press on-nickname-submit} :on-press on-nickname-submit}
:button-two-label (i18n/label :t/cancel) :button-two-label (i18n/label :t/cancel)
:button-two-props {:type :grey :button-two-props {:type :grey

View File

@ -17,8 +17,6 @@
customization-color (or customization-color constants/profile-default-color) customization-color (or customization-color constants/profile-default-color)
full-name (profile.utils/displayed-name contact) full-name (profile.utils/displayed-name contact)
profile-picture (profile.utils/photo contact) profile-picture (profile.utils/photo contact)
[remove-contact? set-remove-contact?] (rn/use-state false)
on-remove-toggle (rn/use-callback #(set-remove-contact? not) [])
on-block-press (rn/use-callback on-block-press (rn/use-callback
(fn [] (fn []
(rf/dispatch [:toasts/upsert (rf/dispatch [:toasts/upsert
@ -28,12 +26,12 @@
{:username {:username
full-name})}]) full-name})}])
(rf/dispatch [:contact.ui/block-contact-confirmed (rf/dispatch [:contact.ui/block-contact-confirmed
public-key]) public-key
(when remove-contact? {:handle-navigation? false}])
(rf/dispatch [:contact.ui/remove-contact-pressed (rf/dispatch [:contact.ui/remove-contact-pressed
{:public-key public-key}])) {:public-key public-key}])
(on-close)) (on-close))
[remove-contact? public-key full-name])] [public-key full-name])]
[:<> [:<>
[quo/drawer-top [quo/drawer-top
{:type :context-tag {:type :context-tag
@ -52,19 +50,21 @@
:type :default} :type :default}
(i18n/label :t/blocking-a-user-message {:username full-name})] (i18n/label :t/blocking-a-user-message {:username full-name})]
(when (= constants/contact-request-state-mutual contact-request-state) (when (= constants/contact-request-state-mutual contact-request-state)
[rn/pressable [rn/view
{:style style/checkbox-wrapper {:style style/checkbox-wrapper}
:on-press on-remove-toggle}
[quo/selectors [quo/selectors
{:type :checkbox {:type :checkbox
:checked? remove-contact? :customization-color customization-color
:on-change on-remove-toggle}] :checked? true
:disabled? true}]
[quo/text (i18n/label :t/remove-contact)]])] [quo/text (i18n/label :t/remove-contact)]])]
[quo/bottom-actions [quo/bottom-actions
{:actions :two-actions {:actions :two-actions
:button-one-label (i18n/label :t/block) :button-one-label (i18n/label :t/block)
:button-one-props {:type :danger :button-one-props {:type :danger
:accessibility-label :block-contact
:on-press on-block-press} :on-press on-block-press}
:button-two-label (i18n/label :t/cancel) :button-two-label (i18n/label :t/cancel)
:button-two-props {:type :grey :button-two-props {:type :grey
:accessibility-label :cancel
:on-press on-close}}]])) :on-press on-close}}]]))

View File

@ -36,18 +36,24 @@
:full-name full-name :full-name full-name
:profile-picture profile-picture :profile-picture profile-picture
:customization-color customization-color}] :customization-color customization-color}]
[rn/text {:style style/message-prompt-wrapper} [quo/text {:style style/message-prompt-wrapper}
(i18n/label :t/contact-request-message-prompt)] (i18n/label :t/contact-request-message-prompt)]
[rn/view {:style style/message-input-wrapper} [rn/view {:style style/message-input-wrapper}
[quo/input [quo/input
{:type :text {:type :text
:multiline? true :multiline? true
:char-limit 280 :char-limit constants/contact-request-message-max-length
:max-length constants/contact-request-message-max-length
:placeholder (i18n/label :t/type-something)
:auto-focus true
:accessibility-label :contact-request-message
:label (i18n/label :t/message) :label (i18n/label :t/message)
:on-change-text on-message-change}]] :on-change-text on-message-change}]]
[quo/bottom-actions [quo/bottom-actions
{:actions :one-action {:actions :one-action
:button-one-props {:disabled? (string/blank? message) :button-one-props {:disabled? (string/blank? message)
:accessibility-label :send-contact-request
:customization-color customization-color
:on-press on-message-submit} :on-press on-message-submit}
:button-one-label (i18n/label :t/send-contact-request)}]])) :button-one-label (i18n/label :t/send-contact-request)}]]))

View File

@ -12,6 +12,10 @@
:margin-bottom 16 :margin-bottom 16
:padding-horizontal 20}) :padding-horizontal 20})
(def username-wrapper
{:margin-top 12
:padding-horizontal 20})
(defn header-container (defn header-container
[border-radius theme margin-top] [border-radius theme margin-top]
(reanimated/apply-animations-to-style (reanimated/apply-animations-to-style

View File

@ -1,5 +1,6 @@
(ns status-im.contexts.profile.contact.header.view (ns status-im.contexts.profile.contact.header.view
(:require [quo.core :as quo] (:require [clojure.string :as string]
[quo.core :as quo]
[quo.foundations.colors :as colors] [quo.foundations.colors :as colors]
[quo.theme] [quo.theme]
[react-native.core :as rn] [react-native.core :as rn]
@ -25,7 +26,7 @@
(defn view (defn view
[{:keys [scroll-y]}] [{:keys [scroll-y]}]
(let [{:keys [public-key customization-color ens-name (let [{:keys [public-key customization-color ens-name nickname secondary-name
emoji-hash bio blocked? contact-request-state] emoji-hash bio blocked? contact-request-state]
:as contact} (rf/sub [:contacts/current-contact]) :as contact} (rf/sub [:contacts/current-contact])
;; TODO(@mohsen): remove default color, https://github.com/status-im/status-mobile/issues/18733 ;; TODO(@mohsen): remove default color, https://github.com/status-im/status-mobile/issues/18733
@ -34,6 +35,13 @@
profile-picture (profile.utils/photo contact) profile-picture (profile.utils/photo contact)
online? (rf/sub [:visibility-status-updates/online? public-key]) online? (rf/sub [:visibility-status-updates/online? public-key])
theme (quo.theme/use-theme-value) theme (quo.theme/use-theme-value)
contact-status (rn/use-memo (fn []
(cond
(= contact-request-state
constants/contact-request-state-mutual) :contact
blocked? :blocked
:else nil))
[blocked? contact-request-state])
on-start-chat (rn/use-callback #(rf/dispatch [:chat.ui/start-chat on-start-chat (rn/use-callback #(rf/dispatch [:chat.ui/start-chat
public-key public-key
ens-name]) ens-name])
@ -64,16 +72,23 @@
{:label (i18n/label :t/contact-profile-request-pending) {:label (i18n/label :t/contact-profile-request-pending)
:status {:type :pending} :status {:type :pending}
:size :large}]])] :size :large}]])]
[rn/view {:style style/username-wrapper}
[quo/username
{:name-type (if-not (string/blank? nickname) :nickname :default)
:accessibility-label :contact-name
:username full-name
:status contact-status
:name secondary-name}]]
[quo/page-top [quo/page-top
{:title full-name {:description :text
:description :text :description-text (when-not blocked? bio)
:description-text bio
:emoji-dash emoji-hash}] :emoji-dash emoji-hash}]
(when blocked? (when blocked?
[quo/button [quo/button
{:container-style style/button-wrapper {:container-style style/button-wrapper
:on-press on-unblock-press :on-press on-unblock-press
:customization-color customization-color
:icon-left :i/block} :icon-left :i/block}
(i18n/label :t/unblock)]) (i18n/label :t/unblock)])
@ -87,6 +102,7 @@
[quo/button [quo/button
{:container-style style/button-wrapper {:container-style style/button-wrapper
:on-press on-contact-request :on-press on-contact-request
:customization-color customization-color
:icon-left :i/add-user} :icon-left :i/add-user}
(i18n/label :t/send-contact-request)] (i18n/label :t/send-contact-request)]
@ -94,6 +110,7 @@
[quo/button [quo/button
{:container-style style/button-wrapper {:container-style style/button-wrapper
:on-press on-contact-review :on-press on-contact-review
:customization-color customization-color
:icon-left :i/add-user} :icon-left :i/add-user}
(i18n/label :t/contact-request-review)] (i18n/label :t/contact-request-review)]
@ -101,6 +118,7 @@
[quo/button [quo/button
{:container-style style/button-wrapper {:container-style style/button-wrapper
:on-press on-start-chat :on-press on-start-chat
:customization-color customization-color
:icon-left :i/messages} :icon-left :i/messages}
(i18n/label :t/send-message)] (i18n/label :t/send-message)]

View File

@ -1,30 +1,50 @@
(ns status-im.contexts.profile.contact.view (ns status-im.contexts.profile.contact.view
(:require [quo.foundations.colors :as colors] (:require [quo.core :as quo]
[quo.foundations.colors :as colors]
[quo.theme] [quo.theme]
[react-native.core :as rn]
[react-native.reanimated :as reanimated] [react-native.reanimated :as reanimated]
[status-im.common.scroll-page.view :as scroll-page] [status-im.common.scroll-page.view :as scroll-page]
[status-im.constants :as constants] [status-im.constants :as constants]
[status-im.contexts.profile.contact.actions.view :as actions] [status-im.contexts.profile.contact.actions.view :as actions]
[status-im.contexts.profile.contact.header.view :as contact-header] [status-im.contexts.profile.contact.header.view :as contact-header]
[status-im.contexts.shell.jump-to.constants :as jump-to.constants]
[utils.debounce :as debounce]
[utils.i18n :as i18n]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
(defn on-show-actions
[]
(rf/dispatch [:show-bottom-sheet
{:content (fn [] [actions/view])}]))
(defn on-jump-to
[]
(rf/dispatch [:navigate-back])
(debounce/throttle-and-dispatch [:shell/navigate-to-jump-to] 500))
(defn view (defn view
[] []
(let [{:keys [customization-color]} (rf/sub [:contacts/current-contact]) (let [{:keys [customization-color]} (rf/sub [:contacts/current-contact])
scroll-y (reanimated/use-shared-value 0) scroll-y (reanimated/use-shared-value 0)
theme (quo.theme/use-theme-value) theme (quo.theme/use-theme-value)]
on-action-press (rn/use-callback (fn [] [:<>
(rf/dispatch [:show-bottom-sheet
{:content (fn []
[actions/view])}])))]
[scroll-page/scroll-page [scroll-page/scroll-page
{:navigate-back? true {:navigate-back? true
:height 148 :height 148
:on-scroll #(reanimated/set-shared-value scroll-y %) :on-scroll #(reanimated/set-shared-value scroll-y %)
;; TODO(@mohsen): remove default color, https://github.com/status-im/status-mobile/issues/18733 ;; TODO(@mohsen): remove default color, https://github.com/status-im/status-mobile/issues/18733
:cover-color (or customization-color constants/profile-default-color) :cover-color (colors/resolve-color (or customization-color constants/profile-default-color)
theme
20)
:background-color (colors/theme-colors colors/white colors/neutral-95 theme) :background-color (colors/theme-colors colors/white colors/neutral-95 theme)
:page-nav-props {:right-side [{:icon-name :i/options :page-nav-props {:right-side [{:icon-name :i/options
:on-press on-action-press}]}} :on-press on-show-actions
[contact-header/view {:scroll-y scroll-y}]])) :accessibility-label :contact-actions}]}}
[contact-header/view {:scroll-y scroll-y}]]
[quo/floating-shell-button
{:jump-to
{:on-press on-jump-to
:customization-color customization-color
:label (i18n/label :t/jump-to)}}
{:position :absolute
:bottom jump-to.constants/floating-shell-button-height}]]))

View File

@ -15,7 +15,6 @@
::wallet.edit-derivation-path (enabled-in-env? :FLAG_EDIT_DERIVATION_PATH) ::wallet.edit-derivation-path (enabled-in-env? :FLAG_EDIT_DERIVATION_PATH)
::wallet.remove-account (enabled-in-env? :FLAG_REMOVE_ACCOUNT_ENABLED) ::wallet.remove-account (enabled-in-env? :FLAG_REMOVE_ACCOUNT_ENABLED)
::wallet.network-filter (enabled-in-env? :FLAG_NETWORK_FILTER_ENABLED) ::wallet.network-filter (enabled-in-env? :FLAG_NETWORK_FILTER_ENABLED)
::profile.new-contact-ui (enabled-in-env? :FLAG_NEW_CONTACT_UI_ENABLED)
::community.edit-account-selection (enabled-in-env? :FLAG_EDIT_ACCOUNT_SELECTION_ENABLED)})) ::community.edit-account-selection (enabled-in-env? :FLAG_EDIT_ACCOUNT_SELECTION_ENABLED)}))
(defn feature-flags [] @feature-flags-config) (defn feature-flags [] @feature-flags-config)

View File

@ -49,8 +49,11 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
self.errors.append("User is not found on 'Add contact' page after entering valid public key") self.errors.append("User is not found on 'Add contact' page after entering valid public key")
chat = self.home_2.get_chat_view() chat = self.home_2.get_chat_view()
chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_block_contact_button) chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_send_contact_request_button)
chat.profile_add_to_contacts_button.click() chat.profile_send_contact_request_button.click()
chat.contact_request_message_input.send_keys("hi")
chat.confirm_send_contact_request_button.click()
chat.close_button.click_until_absense_of_element(chat.close_button)
self.home_2.navigate_back_to_home_view() self.home_2.navigate_back_to_home_view()
self.device_1.just_fyi("Device 1: check there is no PN when receiving new message to activity centre") self.device_1.just_fyi("Device 1: check there is no PN when receiving new message to activity centre")
@ -83,7 +86,7 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
self.home_2.open_activity_center_button.click() self.home_2.open_activity_center_button.click()
self.home_2.activity_unread_filter_button.click() self.home_2.activity_unread_filter_button.click()
if not self.home_2.element_by_text_part( if not self.home_2.element_by_text_part(
self.home_2.get_translation_by_key("add-me-to-your-contacts")).is_element_displayed(30): self.home_2.get_translation_by_key("contact-request-outgoing")).is_element_displayed(30):
self.errors.append( self.errors.append(
"Pending contact request is not shown on unread notification element on Activity center!") "Pending contact request is not shown on unread notification element on Activity center!")
self.home_2.close_activity_centre.click() self.home_2.close_activity_centre.click()
@ -105,8 +108,11 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
self.home_2.element_by_translation_id("paste").click() self.home_2.element_by_translation_id("paste").click()
self.home_2.element_by_translation_id("user-found").wait_for_visibility_of_element(10) self.home_2.element_by_translation_id("user-found").wait_for_visibility_of_element(10)
chat = self.home_2.get_chat_view() chat = self.home_2.get_chat_view()
chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_block_contact_button) chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_send_contact_request_button)
chat.profile_add_to_contacts_button.click() chat.profile_send_contact_request_button.click()
chat.contact_request_message_input.send_keys("hi")
chat.confirm_send_contact_request_button.click()
chat.close_button.click_until_absense_of_element(chat.close_button)
self.device_1.just_fyi('Device1 accepts pending contact request by swiping') self.device_1.just_fyi('Device1 accepts pending contact request by swiping')
self.home_1.chats_tab.click() self.home_1.chats_tab.click()
@ -184,8 +190,12 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
else: else:
self.errors.append("User is not found on 'Add contact' page after entering valid public key") self.errors.append("User is not found on 'Add contact' page after entering valid public key")
chat_1 = self.home_1.get_chat_view() chat_1 = self.home_1.get_chat_view()
chat_1.view_profile_new_contact_button.click_until_presence_of_element(chat_1.profile_block_contact_button) chat_1.view_profile_new_contact_button.click_until_presence_of_element(
chat_1.profile_add_to_contacts_button.click() chat_1.profile_send_contact_request_button)
chat_1.profile_send_contact_request_button.click()
chat_1.contact_request_message_input.send_keys("hi")
chat_1.confirm_send_contact_request_button.click()
chat_1.close_button.click_until_absense_of_element(chat_1.close_button)
self.home_2.just_fyi("Device 2 accepts contact request") self.home_2.just_fyi("Device 2 accepts contact request")
self.home_2.handle_contact_request(new_username_1) self.home_2.handle_contact_request(new_username_1)

View File

@ -34,7 +34,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
for home in (self.home_1, self.home_2): for home in (self.home_1, self.home_2):
home.navigate_back_to_home_view() home.navigate_back_to_home_view()
home.chats_tab.click() home.chats_tab.click()
self.home_1.send_contact_request_via_bottom_sheet(self.public_key_2) self.home_1.add_contact(self.public_key_2)
self.home_2.just_fyi("Accepting contact request from activity centre") self.home_2.just_fyi("Accepting contact request from activity centre")
self.home_2.handle_contact_request(self.username_1) self.home_2.handle_contact_request(self.username_1)
@ -538,7 +538,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUiTwo(MultipleSharedDeviceTestCase
for home in (self.home_1, self.home_2): for home in (self.home_1, self.home_2):
home.navigate_back_to_home_view() home.navigate_back_to_home_view()
home.chats_tab.click() home.chats_tab.click()
self.home_1.send_contact_request_via_bottom_sheet(self.public_key_2) self.home_1.add_contact(self.public_key_2)
self.home_2.just_fyi("Accepting contact request from activity centre") self.home_2.just_fyi("Accepting contact request from activity centre")
self.home_2.handle_contact_request(self.username_1) self.home_2.handle_contact_request(self.username_1)

View File

@ -143,7 +143,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
self.chats[0].just_fyi("Admin opens member_2 profile") self.chats[0].just_fyi("Admin opens member_2 profile")
self.chats[0].user_list_element_by_name(self.usernames[2]).click() self.chats[0].user_list_element_by_name(self.usernames[2]).click()
try: try:
username_shown = self.chats[0].get_profile_view().default_username_text.text username_shown = self.chats[0].get_profile_view().contact_name_text.text
if username_shown != self.usernames[2]: if username_shown != self.usernames[2]:
self.errors.append( self.errors.append(
"Incorrect profile is opened from the list of reactions, username is %s but expected to be %s" % ( "Incorrect profile is opened from the list of reactions, username is %s but expected to be %s" % (

View File

@ -709,7 +709,9 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
chat_element = self.channel_1.chat_element_by_text(message_unblocked) chat_element = self.channel_1.chat_element_by_text(message_unblocked)
chat_element.find_element() chat_element.find_element()
chat_element.member_photo.click() chat_element.member_photo.click()
self.channel_1.profile_add_to_contacts_button.click() self.channel_1.profile_send_contact_request_button.click()
self.channel_1.contact_request_message_input.send_keys("hi")
self.channel_1.confirm_send_contact_request_button.click()
self.home_2.just_fyi("Accept contact request after being unblocked") self.home_2.just_fyi("Accept contact request after being unblocked")
self.home_2.navigate_back_to_home_view() self.home_2.navigate_back_to_home_view()
self.home_2.handle_contact_request(self.username_1) self.home_2.handle_contact_request(self.username_1)

View File

@ -38,13 +38,14 @@ class TestDeepLinksOneDevice(MultipleSharedDeviceTestCase):
self.channel.chat_message_input.clear() self.channel.chat_message_input.clear()
self.channel.send_message(url) self.channel.send_message(url)
self.channel.chat_element_by_text(url).click_on_link_inside_message_body() self.channel.chat_element_by_text(url).click_on_link_inside_message_body()
if self.channel.profile_add_to_contacts_button.is_element_displayed(10): if self.channel.profile_send_contact_request_button.is_element_displayed(10):
username_text = self.profile_view.default_username_text.text # username_text = self.profile_view.default_username_text.text
username_text = self.profile_view.contact_name_text.text
if not (username_text.endswith(url[-6:]) or username_text == text): if not (username_text.endswith(url[-6:]) or username_text == text):
self.errors.append("Incorrect username is shown for profile url %s" % url) self.errors.append("Incorrect username is shown for profile url %s" % url)
else: else:
self.errors.append("Profile was not opened by the profile url %s" % url) self.errors.append("Profile was not opened by the profile url %s" % url)
self.home.navigate_back_to_chat_view() self.profile_view.close_button.click()
closed_community_urls = { closed_community_urls = {
"https://status.app/c/G8EAAMR_fz8tsCQ-aR2QrCS5sVAvvzc_N3mAA-En_Zxy4JA3j7Dl1A50Pd4DbooQOMbWf7E1_4wipgDyGe8XZEappDn-Qomf9l_xyXhSYBuSQic8InCEUBSRGR0oixSTh3iw5ZCxzkGSI95Iyu1EBpcIlFOEMPHpKUBIdkkoKBJglMDKko8O8dBvBtIYncOA8mwztwLpx3C0rK_u59PldFuXe4cx#zQ3shwQnEfMtcXpHXF4qJPyCGgw2F18N3nbGzYbzsVHnMq4yK": "https://status.app/c/G8EAAMR_fz8tsCQ-aR2QrCS5sVAvvzc_N3mAA-En_Zxy4JA3j7Dl1A50Pd4DbooQOMbWf7E1_4wipgDyGe8XZEappDn-Qomf9l_xyXhSYBuSQic8InCEUBSRGR0oixSTh3iw5ZCxzkGSI95Iyu1EBpcIlFOEMPHpKUBIdkkoKBJglMDKko8O8dBvBtIYncOA8mwztwLpx3C0rK_u59PldFuXe4cx#zQ3shwQnEfMtcXpHXF4qJPyCGgw2F18N3nbGzYbzsVHnMq4yK":
@ -81,12 +82,13 @@ class TestDeepLinksOneDevice(MultipleSharedDeviceTestCase):
for link, text in profile_links.items(): for link, text in profile_links.items():
self.channel.just_fyi("Opening profile link %s" % link) self.channel.just_fyi("Opening profile link %s" % link)
self.browser_view.open_url(link) self.browser_view.open_url(link)
shown_name_text = self.profile_view.default_username_text.text # shown_name_text = self.profile_view.default_username_text.text
shown_name_text = self.profile_view.contact_name_text.text
if text: if text:
name_is_shown = shown_name_text == text or shown_name_text.endswith(link[-6:]) name_is_shown = shown_name_text == text or shown_name_text.endswith(link[-6:])
else: else:
name_is_shown = shown_name_text.endswith(link[-6:]) name_is_shown = shown_name_text.endswith(link[-6:])
if not self.channel.profile_add_to_contacts_button.is_element_displayed(10) or not name_is_shown: if not self.channel.profile_send_contact_request_button.is_element_displayed(10) or not name_is_shown:
self.errors.append("Profile was not opened by the profile deep link %s" % link) self.errors.append("Profile was not opened by the profile deep link %s" % link)
self.browser_view.click_system_back_button() self.browser_view.click_system_back_button()

View File

@ -62,15 +62,6 @@ class GroupInfoButton(Button):
return self.navigate() return self.navigate()
class UnblockContactButton(Button):
def __init__(self, driver):
super().__init__(driver, accessibility_id="Unblock-item-button")
def click(self):
self.scroll_to_element()
self.wait_for_element().click()
class OpenInStatusButton(Button): class OpenInStatusButton(Button):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, translation_id="browsing-open-in-status") super().__init__(driver, translation_id="browsing-open-in-status")
@ -101,21 +92,12 @@ class ChatOptionsButton(Button):
class ProfileSendMessageButton(Button): class ProfileSendMessageButton(Button):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, accessibility_id="Chat-item-button") super().__init__(driver, accessibility_id="icon, Send message")
def navigate(self): def navigate(self):
return ChatView(self.driver) return ChatView(self.driver)
class ProfileBlockContactButton(Button):
def __init__(self, driver):
super(ProfileBlockContactButton, self).__init__(driver, accessibility_id="Block-item-button")
def click(self):
self.scroll_to_element()
self.wait_for_element().click()
class ChatElementByText(Text): class ChatElementByText(Text):
def __init__(self, driver, text): def __init__(self, driver, text):
self.message_text = text self.message_text = text
@ -868,11 +850,15 @@ class ChatView(BaseView):
# Contact's profile # Contact's profile
self.contact_profile_picture = ProfilePictureElement(self.driver) self.contact_profile_picture = ProfilePictureElement(self.driver)
self.profile_send_message_button = ProfileSendMessageButton(self.driver) self.profile_send_message_button = ProfileSendMessageButton(self.driver)
self.profile_block_contact_button = ProfileBlockContactButton(self.driver) self.profile_options_button = Button(self.driver, accessibility_id="contact-actions")
self.confirm_block_contact_button = Button(self.driver, accessibility_id="block-contact-confirm") self.profile_block_contact_button = Button(self.driver, accessibility_id="block-user")
self.unblock_contact_button = UnblockContactButton(self.driver) self.confirm_block_contact_button = Button(self.driver, accessibility_id="block-contact")
self.unblock_contact_button = Button(self.driver, accessibility_id="icon, Unblock")
self.profile_mute_contact = Button(self.driver, accessibility_id="Mute-item-button") self.profile_mute_contact = Button(self.driver, accessibility_id="Mute-item-button")
self.profile_unmute_contact = Button(self.driver, accessibility_id="Unmute-item-button") self.profile_unmute_contact = Button(self.driver, accessibility_id="Unmute-item-button")
self.profile_send_contact_request_button = Button(self.driver, accessibility_id="icon, Send contact request")
self.contact_request_message_input = EditBox(self.driver, accessibility_id="contact-request-message")
self.confirm_send_contact_request_button = EditBox(self.driver, accessibility_id="send-contact-request")
self.profile_add_to_contacts_button = Button(self.driver, accessibility_id="Add to contacts-item-button") self.profile_add_to_contacts_button = Button(self.driver, accessibility_id="Add to contacts-item-button")
self.profile_remove_from_contacts = Button(self.driver, accessibility_id="Remove from contacts-item-button") self.profile_remove_from_contacts = Button(self.driver, accessibility_id="Remove from contacts-item-button")
self.profile_details = Button(self.driver, accessibility_id="share-button") self.profile_details = Button(self.driver, accessibility_id="share-button")
@ -1172,6 +1158,7 @@ class ChatView(BaseView):
def block_contact(self): def block_contact(self):
self.driver.info("Block contact from other user profile") self.driver.info("Block contact from other user profile")
self.profile_options_button.click()
self.profile_block_contact_button.click() self.profile_block_contact_button.click()
self.confirm_block_contact_button.click() self.confirm_block_contact_button.click()

View File

@ -412,10 +412,12 @@ class HomeView(BaseView):
chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_block_contact_button) chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_block_contact_button)
if remove_from_contacts and chat.profile_remove_from_contacts.is_element_displayed(): if remove_from_contacts and chat.profile_remove_from_contacts.is_element_displayed():
chat.profile_remove_from_contacts.click() chat.profile_remove_from_contacts.click()
chat.profile_add_to_contacts_button.click() chat.profile_send_contact_request_button.click()
chat.contact_request_message_input.send_keys("hi")
chat.confirm_send_contact_request_button.click()
if nickname: if nickname:
chat.set_nickname(nickname) chat.set_nickname(nickname)
self.navigate_back_to_home_view() chat.close_button.click_until_absense_of_element(chat.close_button)
def create_group_chat(self, user_names_to_add: list, group_chat_name: str = 'new_group_chat'): def create_group_chat(self, user_names_to_add: list, group_chat_name: str = 'new_group_chat'):
self.driver.info("## Creating group chat '%s'" % group_chat_name, device=False) self.driver.info("## Creating group chat '%s'" % group_chat_name, device=False)
@ -434,19 +436,6 @@ class HomeView(BaseView):
self.driver.info("## Group chat %s is created successfully!" % group_chat_name, device=False) self.driver.info("## Group chat %s is created successfully!" % group_chat_name, device=False)
return chat return chat
def send_contact_request_via_bottom_sheet(self, key: str):
chat = self.get_chat_view()
self.new_chat_button.click()
self.add_a_contact_chat_bottom_sheet_button.click()
chat.public_key_edit_box.click()
chat.public_key_edit_box.send_keys(key)
chat.element_by_translation_id("user-found").wait_for_visibility_of_element()
if not chat.view_profile_new_contact_button.is_element_displayed():
chat.click_system_back_button()
chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_add_to_contacts_button)
chat.profile_add_to_contacts_button.click()
self.navigate_back_to_home_view()
def create_community_e2e(self, name: str, description="some_description", set_image=False, def create_community_e2e(self, name: str, description="some_description", set_image=False,
file_name='sauce_logo.png', file_name='sauce_logo.png',
require_approval=True): require_approval=True):

View File

@ -194,6 +194,7 @@ class ProfileView(BaseView):
# Header # Header
self.public_key_text = Text(self.driver, accessibility_id="chat-key") self.public_key_text = Text(self.driver, accessibility_id="chat-key")
self.default_username_text = Text(self.driver, accessibility_id="default-username") self.default_username_text = Text(self.driver, accessibility_id="default-username")
self.contact_name_text = Text(self.driver, accessibility_id="contact-name")
self.share_my_profile_button = Button(self.driver, accessibility_id="share-header-button") self.share_my_profile_button = Button(self.driver, accessibility_id="share-header-button")
self.profile_picture = ProfilePictureElement(self.driver) self.profile_picture = ProfilePictureElement(self.driver)
self.online_indicator = Button(self.driver, accessibility_id="online-profile-photo-dot") self.online_indicator = Button(self.driver, accessibility_id="online-profile-photo-dot")

View File

@ -1662,6 +1662,7 @@
"add-nickname": "Add a nickname (optional)", "add-nickname": "Add a nickname (optional)",
"edit-nickname": "Edit nickname", "edit-nickname": "Edit nickname",
"add-nickname-title": "Add nickname", "add-nickname-title": "Add nickname",
"update-nickname-title": "Update nickname",
"nickname-visible-to-you": "Nickname will only be visible to you", "nickname-visible-to-you": "Nickname will only be visible to you",
"type-nickname": "Type nickname", "type-nickname": "Type nickname",
"remove-nickname": "Remove nickname", "remove-nickname": "Remove nickname",