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

quo2 predictive keyboard component #15806

Merged
merged 1 commit into from
May 5, 2023

Conversation

ajayesivan
Copy link
Contributor

fixes #15802

Implemented predictive keyboard component

Test

Quo2 Preview -> Buttons -> Predictive Keyboard

status: ready

@status-im-auto
Copy link
Member

status-im-auto commented May 3, 2023

Jenkins Builds

Click to see older builds (11)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ a1d2990 #2 2023-05-03 23:41:30 ~5 min android 🤖apk 📲
✔️ a1d2990 #2 2023-05-03 23:41:55 ~6 min ios 📱ipa 📲
✔️ a1d2990 #2 2023-05-03 23:42:50 ~7 min android-e2e 🤖apk 📲
✔️ a1d2990 #2 2023-05-03 23:42:58 ~7 min tests 📄log
✔️ 165758a #5 2023-05-04 10:21:49 ~6 min ios 📱ipa 📲
✔️ 165758a #5 2023-05-04 10:22:13 ~6 min android-e2e 🤖apk 📲
✔️ 165758a #5 2023-05-04 10:23:26 ~7 min android 🤖apk 📲
✔️ 6442ce9 #6 2023-05-04 10:29:15 ~5 min android-e2e 🤖apk 📲
✔️ 6442ce9 #6 2023-05-04 10:29:57 ~6 min ios 📱ipa 📲
✔️ 6442ce9 #6 2023-05-04 10:30:27 ~6 min android 🤖apk 📲
✔️ 6442ce9 #6 2023-05-04 10:30:27 ~6 min tests 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 20f7d4f #7 2023-05-04 19:48:01 ~6 min android-e2e 🤖apk 📲
✔️ 20f7d4f #7 2023-05-04 19:48:31 ~6 min ios 📱ipa 📲
✔️ 20f7d4f #7 2023-05-04 19:48:52 ~6 min android 🤖apk 📲
✔️ 20f7d4f #7 2023-05-04 19:48:54 ~6 min tests 📄log
✔️ eab4850 #12 2023-05-05 14:47:54 ~11 min android-e2e 🤖apk 📲
✔️ eab4850 #12 2023-05-05 14:49:43 ~13 min android 🤖apk 📲
✔️ eab4850 #12 2023-05-05 14:54:21 ~17 min tests 📄log
✔️ eab4850 #12 2023-05-05 15:11:06 ~34 min ios 📱ipa 📲

[rn/flat-list
{:data words
:content-container-style style/word-list
:render-fn (fn [word] [render-word word
Copy link
Contributor

Choose a reason for hiding this comment

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

Just 2 things for this part:

  1. It looks like you can avoid the anonymous function if you pass blur? and on-press in the :render-data property of the rn/flat-list.
  2. Although we still have plenty of examples where the :render-fn component is named render-xyz, it's preferable to name render-word as a noun, since it should be treated as a normal hiccup component and not as a common function (which usually starts with a verb). In your example here, something like word-component should do it.

(gradients :blur)
(colors/theme-colors (gradients :light) (gradients :dark)))}

(condp = type
Copy link
Contributor

Choose a reason for hiding this comment

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

Worth sharing here: in Clojure it's a bit more idiomatic to use case when the clauses are compile-time values as is the case here, it's also slightly more performant than condp (not that it matters imo, not for our use cases). Just a reminder to also add the default clause, otherwise Clojure will throw an error if no match is found.

:type (if (= type :error) :error :default)}
(when blur?
{:text-color colors/white-opa-70
:icon-color colors/white-opa-70})) text]
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, align multiline args vertically, as is explained in the style guide https://guide.clojure.style/#vertically-align-fn-args. zprint won't do this for us. In this line in particular, it's quite difficult to grasp that text is the argument of info-message.

[info-message/info-message
{:icon :i/info
:size :default
:type :error} text]
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment about aligning args vertically https://guide.clojure.style/#vertically-align-fn-args

:padding-horizontal (if (= type :words) 0 20)})

(def word-list {:align-items :center :padding-horizontal 20})

Copy link
Contributor

Choose a reason for hiding this comment

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

The files in this PR have an extra empty line. In status-mobile it's recommended to configure our editors to remove trailing new lines at the end of files and to automatically add a line break at the end of files (if one doesn't exist yet). Just so you never have to worry about this again :)


(defn wrapper
[type]
{:width "100%"
Copy link
Contributor

Choose a reason for hiding this comment

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

For this case, can we use only flexbox properties and avoid "100%"?

(defn- render-word
[word {:keys [blur? on-press]}]
[button/button
(merge {:type :blur-bg :size 32 :on-press #(on-press word)} (when blur? {:override-theme :dark}))
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is kind of unreadable due to the lack of line breaks. Suggestion:

(merge {:type     :blur-bg
        :size     32
        :on-press #(on-press word)}
       (when blur? {:override-theme :dark}))

[quo2.foundations.colors :as colors]
[quo2.components.buttons.button :as button]))

(def gradients
Copy link
Contributor

Choose a reason for hiding this comment

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

Following the spirit of exposing only view, we can add ^:private to this var's metadata.


(defn- separator
[]
[rn/view {:width 8}])
Copy link
Contributor

Choose a reason for hiding this comment

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

Quick one: we should put the map in the :style prop.

@ajayesivan ajayesivan force-pushed the 15802-quo-predictive-keyboard-component branch 3 times, most recently from 165758a to 6442ce9 Compare May 4, 2023 10:23
@ajayesivan
Copy link
Contributor Author

@ilmotta Thanks for the detailed review :). I have updated the PR with suggested changes.

Copy link
Contributor

@ilmotta ilmotta left a comment

Choose a reason for hiding this comment

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

Nicely done. Thanks @ajayesivan

@status-im-auto
Copy link
Member

93% of end-end tests have passed

Total executed tests: 30
Failed tests: 2
Passed tests: 28
IDs of failed tests: 702851,702838 

Failed tests (2)

Click to expand
  • Rerun failed tests

  • Class TestCommunityMultipleDeviceMerged:

    1. test_community_message_send_check_timestamps_sender_username, id: 702838

    Device 2: Verifying that 'hello' is under today
    Device 2: Looking for a message by text: hello

    critical/test_public_chat_browsing.py:410: in test_community_message_send_check_timestamps_sender_username
        channel.verify_message_is_under_today_text(message, self.errors)
    ../views/chat_view.py:927: in verify_message_is_under_today_text
        message_element.wait_for_visibility_of_element()
    ../views/base_element.py:135: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: ChatElementByText by xpath:`//*[starts-with(@text,'hello')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']` is not found on the screen after wait_for_visibility_of_element 
    

    [[blocked by 14797]]

    Device sessions

    Class TestActivityCenterContactRequestMultipleDevicePR:

    1. test_activity_center_contact_request_accept_swipe_mark_all_as_read, id: 702851

    Device 1: Find ChatsTab by accessibility id: chats-stack-tab
    Device 1: Tap on found: ChatsTab

    medium/test_activity_center.py:82: in test_activity_center_contact_request_accept_swipe_mark_all_as_read
        self.home_1.notifications_unread_badge.wait_for_visibility_of_element(30)
    ../views/base_element.py:135: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 1: BaseElement by accessibility id:`activity-center-unread-count` is not found on the screen after wait_for_visibility_of_element
    



    Device sessions

    Passed tests (28)

    Click to expand

    Class TestActivityCenterContactRequestMultipleDevicePR:

    1. test_activity_center_contact_request_decline, id: 702850
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_text_message_delete_push_disappear, id: 702733
    Device sessions

    2. test_1_1_chat_edit_message, id: 702855
    Device sessions

    3. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    4. test_1_1_chat_message_reaction, id: 702730
    Device sessions

    5. test_1_1_chat_emoji_send_reply_and_open_link, id: 702782
    Device sessions

    6. test_1_1_chat_is_shown_message_sent_delivered_from_offline, id: 702783
    Device sessions

    7. test_1_1_chat_pin_messages, id: 702731
    Device sessions

    8. test_1_1_chat_push_emoji, id: 702813
    Device sessions

    9. test_1_1_chat_delete_via_long_press_relogin, id: 702784
    Device sessions

    Class TestActivityMultipleDevicePR:

    1. test_activity_center_reply_read_unread_delete_filter_swipe, id: 702947
    Device sessions

    2. test_activity_center_admin_notification_accept_swipe, id: 702958
    Device sessions

    3. test_navigation_jump_to, id: 702936
    Device sessions

    4. test_activity_center_mentions, id: 702957
    Device sessions

    Class TestCommunityOneDeviceMerged:

    1. test_community_navigate_to_channel_when_relaunch, id: 702846
    Device sessions

    2. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_pin_messages, id: 702732
    Device sessions

    2. test_group_chat_join_send_text_messages_push, id: 702807
    Device sessions

    3. test_group_chat_offline_pn, id: 702808
    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_emoji_send_copy_paste_reply, id: 702840
    Device sessions

    2. test_community_links_with_previews_github_youtube_twitter_gif_send_enable, id: 702844
    Device sessions

    3. test_community_mentions_push_notification, id: 702786
    Device sessions

    4. test_community_contact_block_unblock_offline, id: 702894
    Device sessions

    5. test_community_leave, id: 702845
    Device sessions

    6. test_community_unread_messages_badge, id: 702841
    Device sessions

    7. test_community_message_delete, id: 702839
    Device sessions

    8. test_community_mark_all_messages_as_read, id: 703086
    Device sessions

    9. test_community_message_edit, id: 702843
    Device sessions

    @pavloburykh pavloburykh self-assigned this May 4, 2023
    @pavloburykh
    Copy link
    Contributor

    @ajayesivan thanx for the PR. Please, have a look at a few minor issues

    ISSUE 1 Long info/error message is cut (Android)

    photo_2023-05-04 16 50 10

    ISSUE 2 Blur is applied for the area beyond the component (Android)

    telegram-cloud-document-2-5377743472037996816.mp4

    @pavloburykh
    Copy link
    Contributor

    @ajayesivan is it expected for this error to appear in Quo2 Preview while tapping the buttons?

    telegram-cloud-document-2-5377743472037996833.mp4

    @ajayesivan ajayesivan force-pushed the 15802-quo-predictive-keyboard-component branch from 6442ce9 to 20f7d4f Compare May 4, 2023 19:41
    @ajayesivan
    Copy link
    Contributor Author

    @pavloburykh Fixed all issues.

    (colors/theme-colors
    (gradients :light)
    (gradients :dark)))}

    Copy link
    Member

    Choose a reason for hiding this comment

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

    extra line

    :accessibility-label :predictive-keyboard
    :colors (if blur?
    (gradients :blur)
    (colors/theme-colors
    Copy link
    Member

    Choose a reason for hiding this comment

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

    its better to do not stretch too much code verticaly

    @status-im-auto
    Copy link
    Member

    81% of end-end tests have passed

    Total executed tests: 31
    Failed tests: 6
    Passed tests: 25
    
    IDs of failed tests: 703086,702958,702957,702894,702838,702850 
    

    Failed tests (6)

    Click to expand
  • Rerun failed tests

  • Class TestCommunityMultipleDeviceMerged:

    1. test_community_mark_all_messages_as_read, id: 703086

    Device 1: Find `Button` by `accessibility id`: `jump-to`

    critical/test_public_chat_browsing.py:679: in test_community_mark_all_messages_as_read
        self.channel_1.jump_to_communities_home()
    ../views/base_view.py:605: in jump_to_communities_home
        self.jump_to_button.click()
    ../views/base_element.py:91: in click
        self.find_element().click()
    ../views/base_element.py:80: in find_element
        raise NoSuchElementException(
     Device 1: Button by accessibility id: `jump-to` is not found on the screen
    



    Device sessions

    2. test_community_contact_block_unblock_offline, id: 702894

    Device 1: Tap on found: ProfileSendMessageButton
    Device 1: Sending message 'piy'

    critical/test_public_chat_browsing.py:668: in test_community_contact_block_unblock_offline
        self.chat_1.send_message("piy")
    ../views/chat_view.py:937: in send_message
        self.chat_message_input.wait_for_element(wait_chat_input_sec)
    ../views/base_element.py:117: in wait_for_element
        raise TimeoutException(
     Device `1`: `ChatMessageInput` by` accessibility id`: `chat-message-input` is not found on the screen after wait_for_element
    



    Device sessions

    3. test_community_message_send_check_timestamps_sender_username, id: 702838

    Device 2: Verifying that 'hello' is under today
    Device 2: Looking for a message by text: hello

    critical/test_public_chat_browsing.py:461: in test_community_message_send_check_timestamps_sender_username
        channel.verify_message_is_under_today_text(message, self.errors)
    ../views/chat_view.py:927: in verify_message_is_under_today_text
        message_element.wait_for_visibility_of_element()
    ../views/base_element.py:135: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: ChatElementByText by xpath:`//*[starts-with(@text,'hello')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']` is not found on the screen after wait_for_visibility_of_element 
    

    [[blocked by 14797]]

    Device sessions

    Class TestActivityCenterContactRequestMultipleDevicePR:

    1. test_activity_center_contact_request_decline, id: 702850

    Device 2: Find Button by accessibility id: close-activity-center
    Device 2: Tap on found: Button

    medium/test_activity_center.py:73: in test_activity_center_contact_request_decline
        self.errors.verify_no_errors()
    base_test_case.py:184: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     Username is not shown on 'Add contact' page after entering valid public key 
    

    [[Blocked by 15500]]

    Device sessions

    Class TestActivityMultipleDevicePR:

    1. test_activity_center_admin_notification_accept_swipe, id: 702958

    Device 2: Clearing history in chat 'user1' by long press
    Device 2: Looking for chat: 'user1'

    medium/test_activity_center.py:290: in test_activity_center_admin_notification_accept_swipe
        self.home_2.clear_chat_long_press(self.username_1)
    ../views/home_view.py:450: in clear_chat_long_press
        self.get_chat(username).long_press_element()
    ../views/base_element.py:292: in long_press_element
        element = self.find_element()
    ../views/home_view.py:65: in find_element
        self.wait_for_visibility_of_element(20)
    ../views/base_element.py:135: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: ChatElement by xpath:`//*[@content-desc='chat-name-text'][starts-with(@text,'user1')]/..` is not found on the screen after wait_for_visibility_of_element
    



    Device sessions

    2. test_activity_center_mentions, id: 702957

    Device 2: Type @ to ChatMessageInput
    Device 2: Find SendMessageButton by accessibility id: send-message-button

    medium/test_activity_center.py:259: in test_activity_center_mentions
        self.channel_2.send_message_button.click()
    ../views/base_element.py:91: in click
        self.find_element().click()
    ../views/base_element.py:80: in find_element
        raise NoSuchElementException(
     Device 2: SendMessageButton by accessibility id: `send-message-button` is not found on the screen
    



    Device sessions

    Passed tests (25)

    Click to expand

    Class TestActivityCenterContactRequestMultipleDevicePR:

    1. test_activity_center_contact_request_accept_swipe_mark_all_as_read, id: 702851
    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_mentions_push_notification, id: 702786
    Device sessions

    2. test_community_emoji_send_copy_paste_reply, id: 702840
    Device sessions

    3. test_community_leave, id: 702845
    Device sessions

    4. test_community_message_edit, id: 702843
    Device sessions

    5. test_community_links_with_previews_github_youtube_twitter_gif_send_enable, id: 702844
    Device sessions

    6. test_community_message_delete, id: 702839
    Device sessions

    7. test_community_unread_messages_badge, id: 702841
    Device sessions

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_pin_messages, id: 702732
    Device sessions

    2. test_group_chat_offline_pn, id: 702808
    Device sessions

    3. test_group_chat_join_send_text_messages_push, id: 702807
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_delete_via_long_press_relogin, id: 702784
    Device sessions

    2. test_1_1_chat_push_emoji, id: 702813
    Device sessions

    3. test_1_1_chat_pin_messages, id: 702731
    Device sessions

    4. test_1_1_chat_is_shown_message_sent_delivered_from_offline, id: 702783
    Device sessions

    5. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    6. test_1_1_chat_emoji_send_reply_and_open_link, id: 702782
    Device sessions

    7. test_1_1_chat_message_reaction, id: 702730
    Device sessions

    8. test_1_1_chat_text_message_delete_push_disappear, id: 702733
    Device sessions

    9. test_1_1_chat_edit_message, id: 702855
    Device sessions

    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 TestCommunityOneDeviceMerged:

    1. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133
    Device sessions

    2. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    3. test_community_navigate_to_channel_when_relaunch, id: 702846
    Device sessions

    @pavloburykh
    Copy link
    Contributor

    @ajayesivan thanx for the fixes. PR is ready to be merged.

    @@ -120,6 +121,9 @@
    ;;;; BANNER
    (def banner quo2.components.banners.banner.view/banner)

    ;;;; BUTTONS
    (def predictive-keyboard quo2.components.buttons.predictive-keyboard.view/view)
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Can you move other buttons in this file under this heading 🙏

    @ajayesivan ajayesivan force-pushed the 15802-quo-predictive-keyboard-component branch 3 times, most recently from eeaa6f8 to 5367528 Compare May 5, 2023 14:34
    @ajayesivan ajayesivan force-pushed the 15802-quo-predictive-keyboard-component branch from 5367528 to eab4850 Compare May 5, 2023 14:36
    @ajayesivan ajayesivan merged commit 5f362f3 into develop May 5, 2023
    @ajayesivan ajayesivan deleted the 15802-quo-predictive-keyboard-component branch May 5, 2023 15:11
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    No open projects
    Archived in project
    Development

    Successfully merging this pull request may close these issues.

    UI component - Buttons/Predictive keyboard
    6 participants