Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove 100ms delay when opening image #15422

Merged
merged 3 commits into from
Mar 21, 2023
Merged

Remove 100ms delay when opening image #15422

merged 3 commits into from
Mar 21, 2023

Conversation

OmarBasem
Copy link
Contributor

@OmarBasem OmarBasem commented Mar 21, 2023

fixes: #15358

QA notes:

What needs to be tested is that when pressing on an image, the opening animation executes. Currently, this works only on iOS. For Android there is an open issue: #15421
Also note that there is some open issues for images (#15395, #15391)

@OmarBasem OmarBasem self-assigned this Mar 21, 2023
@status-im-auto
Copy link
Member

status-im-auto commented Mar 21, 2023

Jenkins Builds

Click to see older builds (12)
Commit #️⃣ Finished (UTC) Duration Platform Result
c94508e #1 2023-03-21 05:10:31 ~2 min tests 📄log
✔️ c94508e #1 2023-03-21 05:15:56 ~8 min ios 📱ipa 📲
✔️ c94508e #1 2023-03-21 05:16:22 ~8 min android-e2e 🤖apk 📲
✔️ c94508e #1 2023-03-21 05:16:36 ~9 min android 🤖apk 📲
✔️ ecba5ad #2 2023-03-21 07:00:16 ~4 min tests 📄log
✔️ ecba5ad #2 2023-03-21 07:04:15 ~8 min android-e2e 🤖apk 📲
✔️ ecba5ad #2 2023-03-21 07:04:39 ~8 min ios 📱ipa 📲
✔️ ecba5ad #2 2023-03-21 07:04:44 ~8 min android 🤖apk 📲
✔️ c17b0ce #3 2023-03-21 09:11:05 ~5 min tests 📄log
✔️ c17b0ce #3 2023-03-21 09:13:23 ~7 min ios 📱ipa 📲
✔️ c17b0ce #3 2023-03-21 09:13:36 ~7 min android-e2e 🤖apk 📲
✔️ c17b0ce #3 2023-03-21 09:15:08 ~9 min android 🤖apk 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 1e6c4e1 #4 2023-03-21 10:01:56 ~4 min tests 📄log
✔️ 1e6c4e1 #4 2023-03-21 10:05:20 ~8 min android-e2e 🤖apk 📲
✔️ 1e6c4e1 #4 2023-03-21 10:05:41 ~8 min android 🤖apk 📲
✔️ 1e6c4e1 #4 2023-03-21 10:05:58 ~8 min ios 📱ipa 📲
✔️ 614b18a #5 2023-03-21 13:56:11 ~6 min tests 📄log
✔️ 614b18a #5 2023-03-21 13:57:10 ~7 min android-e2e 🤖apk 📲
✔️ 614b18a #5 2023-03-21 13:58:37 ~8 min android 🤖apk 📲
614b18a #5 2023-03-21 13:58:43 ~9 min ios 📄log

@OmarBasem OmarBasem force-pushed the remove-image-delay branch from ecba5ad to c17b0ce Compare March 21, 2023 09:05
@OmarBasem OmarBasem marked this pull request as ready for review March 21, 2023 09:05
@OmarBasem OmarBasem requested review from ilmotta and ibrkhalil March 21, 2023 09:05
{:events [:chat.ui/navigate-to-lightbox]}
[{:keys [db]} shared-element-id screen-params]
(let [updated-db (assoc db :shared-element-id shared-element-id)]
(reagent/next-tick #(rf/dispatch [:navigate-to :lightbox screen-params]))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it safe to use reagent/next-tick inside a re-frame event?
And if we need it to happen immediately .. Why no use dispatch-sync?
Should we go with re-frame.interop/next-tick
CC: @flexsurfer, @ilmotta

Copy link
Contributor Author

@OmarBasem OmarBasem Mar 21, 2023

Choose a reason for hiding this comment

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

And if we need it to happen immediately .. Why no use dispatch-sync?

@ibrkhalil we do not want the navigate-to to happen immediately. (shared-element-id should dispatch first)

Should we go with day8/re-frame#480 (comment)

I just tried this one and it did not work. It navigated without executing the shared element transition. (same for dispatch-later)

Copy link
Contributor

Choose a reason for hiding this comment

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

So I guess a normal :dispatch key in the returned map didn't work too .. Cool cool
Thanks Omar

Copy link
Member

Choose a reason for hiding this comment

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

shared-element-id should dispatch first

could you elaborate what does it mean?

Copy link
Contributor Author

@OmarBasem OmarBasem Mar 21, 2023

Choose a reason for hiding this comment

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

shared-element-id is used to execute the shared element transition animation. When pressing on an image, we need to update the shared-element-id with that image's id before navigating in order for the animation to execute.

Note that the shared-element-transition for the opening animation currently does not work on Android.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ibrkhalil, I don't know the answer to your question. I've never done this workaround with next-tick inside the event handler. It's dirty, but if it's the only thing @OmarBasem found to work for now.

Something tells me if we used :db and :fx keywords like re-frame suggests, we would be able to correctly order the effects to happen after the :db. Unfortunately we can't, unless we change/improve the rf/defn macro.

Just for reference:

In fact, with v1.1.0 best practice changed to event handlers should only return two effects :db and :fx, in which case :db was always done first and then :fx, and within :fx the ordering is sequential. This new approach is more about making it easier to compose event handlers from many smaller functions, but more specificity around ordering was a consequence.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ilmotta I am curious to know what is the difference between what we are currently doing and what you are suggesting here

Copy link
Contributor

Choose a reason for hiding this comment

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

The way we dispatch effects in re-frame is kind of deprecated. But in order to use :db and :fx we need to change the rf/defn macro. I'm curious too @OmarBasem, because I'm not sure if it would solve your problem. You can totally try this if you want, you'll just need to use re-frame.core/reg-event-fx instead of rf/defn, just don't expect the code to be approved since we currently have a guideline to always use rf/defn.

(rf/defn navigate-to-lightbox
{:events [:chat.ui/navigate-to-lightbox]}
[{:keys [db]} shared-element-id screen-params]
(let [updated-db (assoc db :shared-element-id shared-element-id)]
Copy link
Member

@flexsurfer flexsurfer Mar 21, 2023

Choose a reason for hiding this comment

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

why updated-db is needed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed it

@OmarBasem OmarBasem force-pushed the remove-image-delay branch from c17b0ce to 1e6c4e1 Compare March 21, 2023 09:57
@status-im-auto
Copy link
Member

94% of end-end tests have passed

Total executed tests: 33
Failed tests: 2
Passed tests: 31
IDs of failed tests: 702775,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:411: in test_community_message_send_check_timestamps_sender_username
        channel.verify_message_is_under_today_text(message, self.errors)
    ../views/chat_view.py:912: 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 TestDeeplinkOneDeviceNewUI:

    1. test_deep_link_open_user_profile, id: 702775

    Device 1: Tap on found: SignInButton
    ## Signed in successfully!

    medium/test_deeplink_chat_share_profile.py:394: in test_deep_link_open_user_profile
        chat.wait_for_element_starts_with_text(ens_user['username'])
    ../views/base_view.py:465: in wait_for_element_starts_with_text
        return element.wait_for_element(wait_time)
    ../views/base_element.py:117: in wait_for_element
        raise TimeoutException(
     Device `1`: `Button` by` xpath`: `//*[starts-with(@text,'Legal Vibrant Indianabat')]` is not found on the screen after wait_for_element 
    

    [[Profile is often not opened in e2e builds for some reason. Needs to be investigated.]]

    Device sessions

    Passed tests (31)

    Click to expand

    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_message_edit, id: 702843
    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 TestActivityCenterContactRequestMultipleDevicePR:

    1. test_activity_center_contact_request_cancel_outgoing_no_pn, id: 702871
    Device sessions

    2. test_activity_center_contact_request_decline, id: 702850
    Device sessions

    3. test_activity_center_contact_request_accept_swipe_mark_all_as_read, id: 702851
    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 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 TestDeeplinkOneDeviceNewUI:

    1. test_public_chat_open_using_deep_link, id: 702776
    Device sessions

    2. test_deep_link_with_invalid_user_public_key_own_profile_key, id: 702774
    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

    @status-im-auto
    Copy link
    Member

    94% of end-end tests have passed

    Total executed tests: 33
    Failed tests: 2
    Passed tests: 31
    
    IDs of failed tests: 702775,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:411: in test_community_message_send_check_timestamps_sender_username
        channel.verify_message_is_under_today_text(message, self.errors)
    ../views/chat_view.py:912: 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 TestDeeplinkOneDeviceNewUI:

    1. test_deep_link_open_user_profile, id: 702775

    Device 1: Tap on found: SignInButton
    ## Signed in successfully!

    medium/test_deeplink_chat_share_profile.py:394: in test_deep_link_open_user_profile
        chat.wait_for_element_starts_with_text(ens_user['username'])
    ../views/base_view.py:465: in wait_for_element_starts_with_text
        return element.wait_for_element(wait_time)
    ../views/base_element.py:117: in wait_for_element
        raise TimeoutException(
     Device `1`: `Button` by` xpath`: `//*[starts-with(@text,'Legal Vibrant Indianabat')]` is not found on the screen after wait_for_element 
    

    [[Profile is often not opened in e2e builds for some reason. Needs to be investigated.]]

    Device sessions

    Passed tests (31)

    Click to expand

    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 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 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_message_edit, id: 702843
    Device sessions

    Class TestDeeplinkOneDeviceNewUI:

    1. test_public_chat_open_using_deep_link, id: 702776
    Device sessions

    2. test_deep_link_with_invalid_user_public_key_own_profile_key, id: 702774
    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 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 TestActivityCenterContactRequestMultipleDevicePR:

    1. test_activity_center_contact_request_cancel_outgoing_no_pn, id: 702871
    Device sessions

    2. test_activity_center_contact_request_decline, id: 702850
    Device sessions

    3. test_activity_center_contact_request_accept_swipe_mark_all_as_read, id: 702851
    Device sessions

    @VolodLytvynenko VolodLytvynenko self-assigned this Mar 21, 2023
    @VolodLytvynenko
    Copy link
    Contributor

    hi @OmarBasem thank you for your work. No issues from my side. PR is ready to be merged

    @OmarBasem OmarBasem force-pushed the remove-image-delay branch from 1e6c4e1 to 614b18a Compare March 21, 2023 13:49
    # for free to join this conversation on GitHub. Already have an account? # to comment
    Projects
    No open projects
    Archived in project
    Development

    Successfully merging this pull request may close these issues.

    Lightbox transition delay
    7 participants