From 96f82189a1f2ce9ea724ca52e977cc8ddd70a976 Mon Sep 17 00:00:00 2001 From: Parvesh Monu Date: Wed, 20 Nov 2024 22:35:00 +0530 Subject: [PATCH] fix Unable to tap on chats/channels after opening profile link --- src/legacy/status_im/qr_scanner/core.cljs | 2 +- src/status_im/common/universal_links.cljs | 2 +- .../contexts/chat/messenger/messages/navigation/view.cljs | 8 +++++++- src/status_im/navigation/events.cljs | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/legacy/status_im/qr_scanner/core.cljs b/src/legacy/status_im/qr_scanner/core.cljs index 1181adab66..9ddf87401c 100644 --- a/src/legacy/status_im/qr_scanner/core.cljs +++ b/src/legacy/status_im/qr_scanner/core.cljs @@ -62,7 +62,7 @@ (cond (and public-key own) (rf/merge cofx - {:pop-to-root-fx :shell-stack} + (navigation/pop-to-root :shell-stack) (navigation/navigate-to :my-profile nil)) (and public-key (not own)) diff --git a/src/status_im/common/universal_links.cljs b/src/status_im/common/universal_links.cljs index 503e7ed54e..35e47849da 100644 --- a/src/status_im/common/universal_links.cljs +++ b/src/status_im/common/universal_links.cljs @@ -74,7 +74,7 @@ (cond (and public-key (own-public-key? db public-key)) (rf/merge cofx - {:pop-to-root-fx :shell-stack} + (navigation/pop-to-root :shell-stack) (navigation/navigate-to :settings nil)) public-key diff --git a/src/status_im/contexts/chat/messenger/messages/navigation/view.cljs b/src/status_im/contexts/chat/messenger/messages/navigation/view.cljs index 29c35775dc..44e7326743 100644 --- a/src/status_im/contexts/chat/messenger/messages/navigation/view.cljs +++ b/src/status_im/contexts/chat/messenger/messages/navigation/view.cljs @@ -103,7 +103,13 @@ :background :blur :size 32 :accessibility-label :back-button - :on-press #(rf/dispatch [:navigate-back])} + :on-press (fn [] + (rf/dispatch [:navigate-back]) + ;; In IOS view-id might be incorrect (if screen closed using swipe), + ;; so we can't rely on `:navigate-back` to close the chat. + ;; https://github.com/status-im/status-mobile/pull/21643#issuecomment-248896204451 + (when platform/ios? + (rf/dispatch [:chat/close])))} (if (= chat-type constants/community-chat-type) :i/arrow-left :i/close)] [header-content-container chat] [quo/button diff --git a/src/status_im/navigation/events.cljs b/src/status_im/navigation/events.cljs index 1841364553..d2fbfee559 100644 --- a/src/status_im/navigation/events.cljs +++ b/src/status_im/navigation/events.cljs @@ -3,6 +3,7 @@ [clojure.string :as string] [re-frame.core :as re-frame] [react-native.core :as react] + [react-native.platform :as platform] [utils.re-frame :as rf] [utils.url :as url])) @@ -50,7 +51,8 @@ {:events [:navigate-back]} [{:keys [db]}] {:fx [[:navigate-back nil] - (when (= (:view-id db) :chat) + ;; Required for navigating back using the Android hardware back button + (when (and platform/android? (= (:view-id db) :chat)) [:dispatch [:chat/close]])]}) (rf/defn navigate-back-to