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

disable chat swipe back navigation in ios #16035

Merged
merged 1 commit into from
May 29, 2023
Merged

Conversation

Parveshdhull
Copy link
Member

@Parveshdhull Parveshdhull commented May 26, 2023

fixes: #16034

Summary

While navigating back using swipe in ios, navigate-back-handler don't get called and chat never gets closed.

Testing

So now we are remove chat from db, when chat screen is not visible, like going back to home screen.
Is there any other screen we can open without closing chat screen, like having chat screen in background?
In that case this solution might create problem. Please let me know if there are any such cases.

status: ready

@status-im-auto
Copy link
Member

status-im-auto commented May 26, 2023

Jenkins Builds

Click to see older builds (9)
Commit #️⃣ Finished (UTC) Duration Platform Result
6bc1bdd #1 2023-05-26 13:02:25 ~2 min ios 📄log
✔️ 6bc1bdd #1 2023-05-26 13:05:37 ~5 min android-e2e 🤖apk 📲
✔️ 6bc1bdd #1 2023-05-26 13:06:07 ~6 min android 🤖apk 📲
✔️ 6bc1bdd #1 2023-05-26 13:12:47 ~13 min tests 📄log
✔️ 6bc1bdd #2 2023-05-26 13:35:40 ~6 min ios 📱ipa 📲
a5dd2a5 #3 2023-05-26 15:26:05 ~4 min tests 📄log
✔️ a5dd2a5 #3 2023-05-26 15:27:50 ~6 min android 🤖apk 📲
✔️ a5dd2a5 #3 2023-05-26 15:28:17 ~6 min android-e2e 🤖apk 📲
✔️ a5dd2a5 #4 2023-05-26 15:29:01 ~7 min ios 📱ipa 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 7ebdf0c #5 2023-05-26 15:54:27 ~5 min ios 📱ipa 📲
✔️ 7ebdf0c #4 2023-05-26 15:54:37 ~5 min android 🤖apk 📲
✔️ 7ebdf0c #4 2023-05-26 15:55:44 ~6 min android-e2e 🤖apk 📲
✔️ 7ebdf0c #4 2023-05-26 15:59:41 ~10 min tests 📄log
✔️ 908fcc4 #6 2023-05-29 10:06:53 ~5 min ios 📱ipa 📲
✔️ 908fcc4 #5 2023-05-29 10:09:31 ~8 min android-e2e 🤖apk 📲
✔️ 908fcc4 #5 2023-05-29 10:10:48 ~9 min tests 📄log
✔️ 908fcc4 #5 2023-05-29 10:12:45 ~11 min android 🤖apk 📲

@Parveshdhull
Copy link
Member Author

Parveshdhull commented May 26, 2023

So now we are remove chat from db, when chat screen is not visible, like going back to home screen.

I guess more robust solution would be to add this in reg-component-did-appear-listener and dispatching close-chat when appeared screen is :chat-stack or :shell. But then db will get spam with :close-chat events. (Also community chats will be marked as read, until community is closed, so not good)

or finding out why navigate-back-handler not getting called in ios

@Parveshdhull
Copy link
Member Author

or finding out why navigate-back-handler not getting called in ios

might be related to upgrade (if this behavior is new)

@Parveshdhull Parveshdhull requested a review from ibrkhalil May 26, 2023 13:20
@churik
Copy link
Member

churik commented May 26, 2023

I tested all scenarios that we found for the issue reproduction - none is working for me, so the issue is fixed from my POV.

Thank you for jumping in and for amazing work, as always @Parveshdhull !
Let's wait for e2e and merge PR.

Is there any other screen we can open without closing chat screen, like having chat screen in background?

For now only images selection, all composer elements, chat options in future. What issues can is cause?

@@ -51,6 +52,11 @@
(when-not @state/curr-modal
(reset! state/pushed-screen-id view-id)))))

(navigation/reg-component-did-disappear-listener
Copy link
Member

Choose a reason for hiding this comment

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

unfortunately, this won't work, because did-disappear-listener is very late, this is our pain point, we need to listen for swipe on ios, same how we do with back button on android

Copy link
Member

Choose a reason for hiding this comment

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

so it will be possible to swipe quick and open chat, and did-disappear-listener will happen and chat screen will be broken

Copy link
Member Author

Choose a reason for hiding this comment

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

so it will be possible to swipe quick and open chat, and did-disappear-listener will happen and chat screen will be broken

Yes, this can be problematic. @churik please can you check if this is reproducible for you?

Copy link
Member

Choose a reason for hiding this comment

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

it was reported before so its possible

Copy link
Member Author

@Parveshdhull Parveshdhull May 26, 2023

Choose a reason for hiding this comment

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

apparently this is known issue, and solution is to rely on navigation listeners (which doesn't work for us).
Another solution I can try is to call :chat/close on unmount

Copy link
Member Author

Choose a reason for hiding this comment

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

yup it works, will push changes

@Parveshdhull
Copy link
Member Author

Parveshdhull commented May 26, 2023

For now only images selection, all composer elements, chat options in future.

Hi, they are fine, they are just modals. Issue will only happen if we open overlapping screen.

What issues can is cause?

Chat will be closed, probably will show Unknown contact.

@Parveshdhull
Copy link
Member Author

Thank you very much @flexsurfer and @churik, pushed new solution.
Please also test on android

(rn/hw-back-remove-listener navigate-back-handler)
(rn/hw-back-add-listener navigate-back-handler))
:component-will-unmount (fn [] (rn/hw-back-remove-listener navigate-back-handler))
{:component-will-unmount (fn [] (rf/dispatch [:chat/close]))
Copy link
Member

Choose a reason for hiding this comment

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

i don't remember why but this won't work as well, there are lots of edge cases., the only way is to dispatch on swipe :(

Copy link
Member Author

Choose a reason for hiding this comment

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

the only way is to dispatch on swipe :(

Any suggestion on how to detect that?

Copy link
Member Author

Choose a reason for hiding this comment

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

Means is there any event, or have to use gesture handler etc,?

Copy link
Member

Choose a reason for hiding this comment

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

no probably its not possible, and i disabled swipe, but someone enabled it

Copy link
Member Author

Choose a reason for hiding this comment

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

btw, if its working for now, can we keep this solution for release? Because once #15893 is merged, we will have our own navigation for this screen, so don't need to rely on these events.

Copy link
Member

Choose a reason for hiding this comment

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

can we keep this solution

its not a solution, its even worse, because chat will be broken

Copy link
Member Author

Choose a reason for hiding this comment

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

Please can you create a PR for disabling swipe for ios, or point me in the direction. I am not finding option in navigation docs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you

@status-im-auto
Copy link
Member

70% of end-end tests have passed

Total executed tests: 33
Failed tests: 10
Passed tests: 23
IDs of failed tests: 702840,703194,702859,702732,702844,702786,702894,703133,703086,702838 

Failed tests (10)

Click to expand
  • Rerun failed tests

  • Class TestCommunityOneDeviceMerged:

    1. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133

    Device 1: Wait for element `Button` for max 30s and click when it is available
    Device 1: Find `Button` by `accessibility id`: `skip-identifiers`

    critical/test_public_chat_browsing.py:354: in test_restore_multiaccount_with_waku_backup_remove_switch
        self.sign_in.recover_access(passphrase=waku_user.seed, second_user=True)
    ../views/sign_in_view.py:265: in recover_access
        self.identifiers_button.wait_and_click(30)
    ../views/base_element.py:404: in wait_and_click
        self.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: `skip-identifiers` is not found on the screen
    



    Device sessions

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_pin_messages, id: 702732

    Device 2: Find Text by xpath: //*[@content-desc='pinned-messages-menu']//*[starts-with(@text,'Message 4')]/../../*[@content-desc='pinned-by']/android.widget.TextView
    Device 2: Text is user admin

    critical/chats/test_group_chat.py:337: in test_group_chat_pin_messages
        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))]))
     Message 1 is not pinned in group chat!
    E    Pinned messages count 2 doesn't match expected 3 for user 2
    E    Message 'Message 1' is missed on Pinned messages list for user 2
    



    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_emoji_send_copy_paste_reply, id: 702840

    Device 1: Sending message 'emoji'

    critical/test_public_chat_browsing.py:572: in test_community_emoji_send_copy_paste_reply
        self.channel_1.send_message(emoji_message)
    ../views/chat_view.py:954: 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

    2. test_community_several_images_send_reply, id: 703194

    # STEP: Send several images in 1-1 chat from Gallery
    Device 1: Find Button by accessibility id: open-images-button

    critical/test_public_chat_browsing.py:549: in test_community_several_images_send_reply
        self.channel_1.send_images_with_description(image_description, [0, 1])
    ../views/chat_view.py:1160: in send_images_with_description
        self.show_images_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: `open-images-button` is not found on the screen
    



    Device sessions

    3. test_community_one_image_send_reply, id: 702859

    Device 1: Tap on found: Button
    Device 1: Find ChatMessageInput by accessibility id: chat-message-input

    critical/test_public_chat_browsing.py:501: in test_community_one_image_send_reply
        self.channel_1.send_images_with_description(image_description)
    ../views/chat_view.py:1164: in send_images_with_description
        self.chat_message_input.set_value(description)
    ../views/base_element.py:352: in set_value
        self.find_element().set_value(value)
    ../views/base_element.py:80: in find_element
        raise NoSuchElementException(
     Device 1: ChatMessageInput by accessibility id: `chat-message-input` is not found on the screen
    



    Device sessions

    4. test_community_links_with_previews_github_youtube_twitter_gif_send_enable, id: 702844

    Device 2: Tap on found: SendMessageButton
    Device 1: Getting preview message for link: #11707

    critical/test_public_chat_browsing.py:644: in test_community_links_with_previews_github_youtube_twitter_gif_send_enable
        self.channel_1.get_preview_message_by_text(url).wait_for_element(60)
    ../views/base_element.py:117: in wait_for_element
        raise TimeoutException(
     Device `1`: `PreviewMessage` by` xpath`: `//*[starts-with(@text,'https://github.com/status-im/status-mobile/pull/11707')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']` is not found on the screen after wait_for_element
    



    Device sessions

    5. test_community_mentions_push_notification, id: 702786

    # STEP: Admin gets push notification with the mention and tap it
    Device 1: Getting PN by 'user_1'

    critical/test_public_chat_browsing.py:837: in test_community_mentions_push_notification
        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))]))
     Push notification with the mention was not received by admin
    



    Device sessions

    6. test_community_contact_block_unblock_offline, id: 702894

    Device 1: Looking for a message by text: I should not be in chat
    Device 1: Find Button by accessibility id: jump-to

    critical/test_public_chat_browsing.py:698: in test_community_contact_block_unblock_offline
        self.chat_1.jump_to_messages_home()
    ../views/base_view.py:601: in jump_to_messages_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

    7. test_community_mark_all_messages_as_read, id: 703086

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

    critical/test_public_chat_browsing.py:752: 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

    8. 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:456: in test_community_message_send_check_timestamps_sender_username
        channel.verify_message_is_under_today_text(message, self.errors)
    ../views/chat_view.py:944: 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

    Passed tests (23)

    Click to expand

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

    1. test_group_chat_join_send_text_messages_push, id: 702807
    Device sessions

    2. test_group_chat_offline_pn, id: 702808
    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_decline, id: 702850
    Device sessions

    2. test_activity_center_contact_request_accept_swipe_mark_all_as_read, id: 702851
    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 TestCommunityMultipleDeviceMerged:

    1. test_community_leave, id: 702845
    Device sessions

    2. test_community_unread_messages_badge, id: 702841
    Device sessions

    3. test_community_message_delete, id: 702839
    Device sessions

    4. test_community_message_edit, id: 702843
    Device sessions

    @Parveshdhull Parveshdhull changed the title fix ios chat not closing on swipe navigation disable chat swipe back navigation in ios May 26, 2023
    @churik churik self-assigned this May 29, 2023
    @status-im-auto
    Copy link
    Member

    85% of end-end tests have passed

    Total executed tests: 33
    Failed tests: 5
    Passed tests: 28
    
    IDs of failed tests: 702840,702894,703133,702783,702838 
    

    Failed tests (5)

    Click to expand
  • Rerun failed tests

  • Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_is_shown_message_sent_delivered_from_offline, id: 702783

    # STEP: Device1 goes back online and checks that 1-1 chat will be fetched
    Device 1: Looking for a message by text: test message

    critical/chats/test_1_1_public_chats.py:1230: in test_1_1_chat_is_shown_message_sent_delivered_from_offline
        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))]))
     Message status was not delivered after back up online, it is "Sending"!
    



    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_emoji_send_copy_paste_reply, id: 702840

    Device 2: Tap on found: SendMessageButton
    Device 1: Looking for a message by text: test message

    critical/test_public_chat_browsing.py:591: in test_community_emoji_send_copy_paste_reply
        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))]))
     Reply message was not received by the sender
    



    Device sessions

    2. test_community_contact_block_unblock_offline, id: 702894

    Device 1: Looking for a message by text: Hurray! unblocked
    Device 1: Find ChatElementByText by xpath: //*[starts-with(@text,'Hurray! unblocked')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']

    critical/test_public_chat_browsing.py:735: in test_community_contact_block_unblock_offline
        chat_element.find_element()
    ../views/chat_view.py:134: in find_element
        self.wait_for_visibility_of_element(20)
    ../views/base_element.py:135: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 1: ChatElementByText by xpath:`//*[starts-with(@text,'Hurray! unblocked')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']` is not found on the screen after wait_for_visibility_of_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:456: in test_community_message_send_check_timestamps_sender_username
        channel.verify_message_is_under_today_text(message, self.errors)
    ../views/chat_view.py:944: 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 TestCommunityOneDeviceMerged:

    1. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133

    Device 1: Tap on found: Button
    Device 1: Wait for element Button for max 30s and click when it is available

    critical/test_public_chat_browsing.py:354: in test_restore_multiaccount_with_waku_backup_remove_switch
        self.sign_in.recover_access(passphrase=waku_user.seed, second_user=True)
    ../views/sign_in_view.py:265: in recover_access
        self.identifiers_button.wait_and_click(30)
    ../views/base_element.py:403: in wait_and_click
        self.wait_for_visibility_of_element(sec)
    ../views/base_element.py:135: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 1: Button by accessibility id:`skip-identifiers` 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

    2. test_activity_center_contact_request_accept_swipe_mark_all_as_read, id: 702851
    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 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 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_pin_messages, id: 702731
    Device sessions

    7. test_1_1_chat_push_emoji, id: 702813
    Device sessions

    8. test_1_1_chat_delete_via_long_press_relogin, id: 702784
    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_several_images_send_reply, id: 703194
    Device sessions

    2. test_community_one_image_send_reply, id: 702859
    Device sessions

    3. test_community_links_with_previews_github_youtube_twitter_gif_send_enable, id: 702844
    Device sessions

    4. test_community_mentions_push_notification, id: 702786
    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

    @churik
    Copy link
    Member

    churik commented May 29, 2023

    Thanks for amazing work!
    e2e failures are known not related to PR.
    Tested basic flows, LGTM!

    We found one more way to reproduce this issue, but this flow is not that crucial, so ready to be merged.

    Devices:

    • IPhone 12 Mini (IOS 16)
    • BlackView BV5200 Pro (Android 12)

    @Parveshdhull Parveshdhull merged commit bbdac4e into develop May 29, 2023
    @Parveshdhull Parveshdhull deleted the fix/ios-unread branch May 29, 2023 10: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
    5 participants