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

Gesture section list #15727

Merged
merged 8 commits into from
Apr 25, 2023
Merged

Gesture section list #15727

merged 8 commits into from
Apr 25, 2023

Conversation

OmarBasem
Copy link
Contributor

fixes: #15726

This PR implements a gesture section list to be used in bottom-sheet-screen

@status-im-auto
Copy link
Member

status-im-auto commented Apr 24, 2023

Jenkins Builds

Click to see older builds (8)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ f2928b6 #2 2023-04-24 12:55:27 ~6 min android 🤖apk 📲
✔️ f2928b6 #2 2023-04-24 12:55:31 ~6 min tests 📄log
✔️ f2928b6 #2 2023-04-24 12:56:08 ~7 min android-e2e 🤖apk 📲
✔️ f2928b6 #2 2023-04-24 12:59:45 ~10 min ios 📱ipa 📲
✔️ dc015b6 #4 2023-04-24 14:00:37 ~5 min android-e2e 🤖apk 📲
✔️ dc015b6 #4 2023-04-24 14:01:43 ~6 min ios 📱ipa 📲
✔️ dc015b6 #4 2023-04-24 14:01:52 ~6 min tests 📄log
✔️ dc015b6 #4 2023-04-24 14:02:07 ~6 min android 🤖apk 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ f01a9b2 #5 2023-04-25 05:05:23 ~5 min android-e2e 🤖apk 📲
✔️ f01a9b2 #5 2023-04-25 05:06:03 ~6 min ios 📱ipa 📲
✔️ f01a9b2 #5 2023-04-25 05:06:34 ~6 min android 🤖apk 📲
✔️ f01a9b2 #5 2023-04-25 05:06:43 ~6 min tests 📄log
✔️ fc5fa4a #7 2023-04-25 11:00:54 ~5 min android 🤖apk 📲
✔️ fc5fa4a #7 2023-04-25 11:02:02 ~7 min tests 📄log
✔️ fc5fa4a #7 2023-04-25 11:02:09 ~7 min ios 📱ipa 📲
✔️ fc5fa4a #7 2023-04-25 11:02:17 ~7 min android-e2e 🤖apk 📲

@@ -76,3 +76,25 @@
[gesture-flat-list (rn-flat-list/base-list-props props)])

(def scroll-view (reagent/adapt-react-class ScrollView))

;;; Custom gesture section-list
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's a good idea to add a newline between section comments and the functions, otherwise it looks like the comment is correlated specifically with the function implementation.

[{:keys [sections render-section-header-fn render-fn] :as props}]
(let [data (flatten-sections sections)]
[flat-list
(conj props
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's a bit more idiomatic to use merge to merge maps instead of conj'ing them.

@@ -76,3 +76,25 @@
[gesture-flat-list (rn-flat-list/base-list-props props)])

(def scroll-view (reagent/adapt-react-class ScrollView))

;;; Custom gesture section-list
(defn flatten-sections
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: make this function private, so that this function won't be suggested when autocompleting from other files.

;;; Custom gesture section-list
(defn flatten-sections
[input-vector]
(reduce
Copy link
Contributor

Choose a reason for hiding this comment

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

In terms of implementation, since we're flattening just one level, I tried to cook a solution with mapcat. As far as I checked, the implementation is equivalent, but should perform better since it's considerably simpler. Also select-keys is avoided, since that scans the entire map when we only need the title.

(defn flatten-sections
  [sections]
  (mapcat (fn [{:keys [title data]}]
            (into [{:title title :header? true}] data))
          sections))

Here's the test, the equality below shows they're equivalent. The only difference is that the final result of mapcat is a lazy sequence, whereas the reduce you used returns a vector. But since the result of flatten-sections is passed down to flat-list, it doesn't matter if it's a vector or not.

(let [sections
      [{:title "Section A",
        :data
        [{:primary-name "Alice"
          :public-key   "0x1"}
         {:primary-name "Bob"
          :public-key   "0x2"}]}
       {:title "Section B",
        :data
        [{:primary-name "Carol"
          :public-key   "0x3"}
         {:primary-name "Daniel"
          :public-key   "0x4"}]}]]
  (= (flatten-sections-old sections)
     (flatten-sections-new sections)))

;; Result

;; => ({:title "Section A", :header? true}
;;     {:primary-name "Alice", :public-key "0x1"}
;;     {:primary-name "Bob", :public-key "0x2"}
;;     {:title "Section B", :header? true}
;;     {:primary-name "Carol", :public-key "0x3"}
;;     {:primary-name "Daniel", :public-key "0x4"})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @ilmotta ! This one definitely looks simpler

Copy link
Contributor

Choose a reason for hiding this comment

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

You're welcome :) Nice work in creating this component @OmarBasem

@status-im-auto
Copy link
Member

48% of end-end tests have passed

Total executed tests: 25
Failed tests: 13
Passed tests: 12
Not executed tests: 4
IDs of not executed tests: 702846,702742,702850,702851 
IDs of failed tests: 702947,702840,702958,702844,702786,702894,702845,702841,702936,702957,702839,702838,702843 

Not executed tests (4)

Click to expand
  • Rerun not executed tests
  • Failed tests (13)

    Click to expand
  • Rerun failed tests

  • Class TestCommunityMultipleDeviceMerged:

    1. test_community_emoji_send_copy_paste_reply, id: 702840
    Test setup failed: critical/test_public_chat_browsing.py:397: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:372: in join_community
        self.checkbox_button.scroll_and_click()
    ../views/base_element.py:182: in scroll_and_click
        self.scroll_to_element(direction=direction)
    ../views/base_element.py:177: in scroll_to_element
        raise NoSuchElementException(
     Device 2: CheckBox by accessibility id: `checkbox-off` is not found on the screen
    



    2. test_community_links_with_previews_github_youtube_twitter_gif_send_enable, id: 702844

    Test setup failed: critical/test_public_chat_browsing.py:397: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:372: in join_community
        self.checkbox_button.scroll_and_click()
    ../views/base_element.py:182: in scroll_and_click
        self.scroll_to_element(direction=direction)
    ../views/base_element.py:177: in scroll_to_element
        raise NoSuchElementException(
     Device 2: CheckBox by accessibility id: `checkbox-off` is not found on the screen
    



    3. test_community_mentions_push_notification, id: 702786

    Test setup failed: critical/test_public_chat_browsing.py:397: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:372: in join_community
        self.checkbox_button.scroll_and_click()
    ../views/base_element.py:182: in scroll_and_click
        self.scroll_to_element(direction=direction)
    ../views/base_element.py:177: in scroll_to_element
        raise NoSuchElementException(
     Device 2: CheckBox by accessibility id: `checkbox-off` is not found on the screen
    



    4. test_community_contact_block_unblock_offline, id: 702894

    Test setup failed: critical/test_public_chat_browsing.py:397: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:372: in join_community
        self.checkbox_button.scroll_and_click()
    ../views/base_element.py:182: in scroll_and_click
        self.scroll_to_element(direction=direction)
    ../views/base_element.py:177: in scroll_to_element
        raise NoSuchElementException(
     Device 2: CheckBox by accessibility id: `checkbox-off` is not found on the screen
    



    5. test_community_leave, id: 702845

    Test setup failed: critical/test_public_chat_browsing.py:397: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:372: in join_community
        self.checkbox_button.scroll_and_click()
    ../views/base_element.py:182: in scroll_and_click
        self.scroll_to_element(direction=direction)
    ../views/base_element.py:177: in scroll_to_element
        raise NoSuchElementException(
     Device 2: CheckBox by accessibility id: `checkbox-off` is not found on the screen
    



    6. test_community_unread_messages_badge, id: 702841

    Test setup failed: critical/test_public_chat_browsing.py:397: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:372: in join_community
        self.checkbox_button.scroll_and_click()
    ../views/base_element.py:182: in scroll_and_click
        self.scroll_to_element(direction=direction)
    ../views/base_element.py:177: in scroll_to_element
        raise NoSuchElementException(
     Device 2: CheckBox by accessibility id: `checkbox-off` is not found on the screen
    



    7. test_community_message_delete, id: 702839

    Test setup failed: critical/test_public_chat_browsing.py:397: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:372: in join_community
        self.checkbox_button.scroll_and_click()
    ../views/base_element.py:182: in scroll_and_click
        self.scroll_to_element(direction=direction)
    ../views/base_element.py:177: in scroll_to_element
        raise NoSuchElementException(
     Device 2: CheckBox by accessibility id: `checkbox-off` is not found on the screen
    



    8. test_community_message_send_check_timestamps_sender_username, id: 702838

    Device 2: Find CheckBox by accessibility id: checkbox-off
    Device 2: Find CheckBox by accessibility id: checkbox-off

    Test setup failed: critical/test_public_chat_browsing.py:397: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:372: in join_community
        self.checkbox_button.scroll_and_click()
    ../views/base_element.py:182: in scroll_and_click
        self.scroll_to_element(direction=direction)
    ../views/base_element.py:177: in scroll_to_element
        raise NoSuchElementException(
     Device 2: CheckBox by accessibility id: `checkbox-off` is not found on the screen 
    

    [[blocked by 14797]]

    Device sessions

    9. test_community_message_edit, id: 702843

    Test setup failed: critical/test_public_chat_browsing.py:397: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:372: in join_community
        self.checkbox_button.scroll_and_click()
    ../views/base_element.py:182: in scroll_and_click
        self.scroll_to_element(direction=direction)
    ../views/base_element.py:177: in scroll_to_element
        raise NoSuchElementException(
     Device 2: CheckBox by accessibility id: `checkbox-off` is not found on the screen
    



    Class TestActivityMultipleDevicePR:

    1. test_activity_center_reply_read_unread_delete_filter_swipe, id: 702947

    Test setup failed: medium/test_activity_center.py:228: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:372: in join_community
        self.checkbox_button.scroll_and_click()
    ../views/base_element.py:182: in scroll_and_click
        self.scroll_to_element(direction=direction)
    ../views/base_element.py:177: in scroll_to_element
        raise NoSuchElementException(
     Device 2: CheckBox by accessibility id: `checkbox-off` is not found on the screen
    



    2. test_activity_center_admin_notification_accept_swipe, id: 702958

    Test setup failed: medium/test_activity_center.py:228: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:372: in join_community
        self.checkbox_button.scroll_and_click()
    ../views/base_element.py:182: in scroll_and_click
        self.scroll_to_element(direction=direction)
    ../views/base_element.py:177: in scroll_to_element
        raise NoSuchElementException(
     Device 2: CheckBox by accessibility id: `checkbox-off` is not found on the screen 
    

    [[Blocked by 15500]]

    3. test_navigation_jump_to, id: 702936

    Device 2: Find CheckBox by accessibility id: checkbox-off
    Device 2: Find CheckBox by accessibility id: checkbox-off

    Test setup failed: medium/test_activity_center.py:228: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:372: in join_community
        self.checkbox_button.scroll_and_click()
    ../views/base_element.py:182: in scroll_and_click
        self.scroll_to_element(direction=direction)
    ../views/base_element.py:177: in scroll_to_element
        raise NoSuchElementException(
     Device 2: CheckBox by accessibility id: `checkbox-off` is not found on the screen
    



    Device sessions

    4. test_activity_center_mentions, id: 702957

    Test setup failed: medium/test_activity_center.py:228: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:372: in join_community
        self.checkbox_button.scroll_and_click()
    ../views/base_element.py:182: in scroll_and_click
        self.scroll_to_element(direction=direction)
    ../views/base_element.py:177: in scroll_to_element
        raise NoSuchElementException(
     Device 2: CheckBox by accessibility id: `checkbox-off` is not found on the screen 
    

    [[Blocked by 15500]]

    Passed tests (12)

    Click to expand

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

    @OmarBasem OmarBasem merged commit 2fe4956 into develop Apr 25, 2023
    @OmarBasem OmarBasem deleted the gesture-section-list-2 branch April 25, 2023 11:20
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    No open projects
    Archived in project
    Development

    Successfully merging this pull request may close these issues.

    Gesture Section List
    3 participants