diff --git a/src/status_im/android/core.cljs b/src/status_im/android/core.cljs index d4b17c948f..ac69264003 100644 --- a/src/status_im/android/core.cljs +++ b/src/status_im/android/core.cljs @@ -20,12 +20,16 @@ ;; in handlers (let [stack (subscribe [:get :navigation-stack]) result-box (subscribe [:get-current-chat-ui-prop :result-box]) - webview (subscribe [:get :webview-bridge])] + webview (subscribe [:get :webview-bridge]) + view-id (subscribe [:get :view-id])] (cond (and @webview (:can-go-back? @result-box)) (do (.goBack @webview) true) + (#{:home :wallet :my-profile} view-id) + (do (.exitApp react/back-handler)) + (< 1 (count @stack)) (do (dispatch [:navigate-back]) true) diff --git a/src/status_im/chat/screen.cljs b/src/status_im/chat/screen.cljs index 1566f566e5..c1c3eeb86e 100644 --- a/src/status_im/chat/screen.cljs +++ b/src/status_im/chat/screen.cljs @@ -57,7 +57,7 @@ (if (= chat-id constants/console-chat-id) [toolbar/simple-toolbar name] [toolbar/platform-agnostic-toolbar {} - toolbar/nav-back-count + (toolbar/nav-back-count {:home? true}) [toolbar-content/toolbar-content-view] [toolbar/actions [{:icon :icons/options :icon-opts {:color :black diff --git a/src/status_im/ui/components/toolbar/actions.cljs b/src/status_im/ui/components/toolbar/actions.cljs index 3ebcc78165..58688c77f5 100644 --- a/src/status_im/ui/components/toolbar/actions.cljs +++ b/src/status_im/ui/components/toolbar/actions.cljs @@ -18,9 +18,14 @@ (def default-handler #(re-frame/dispatch [:navigate-back])) +(def home-handler #(re-frame/dispatch [:navigate-to-clean :home])) + (def default-back (back default-handler)) +(def home-back + (back home-handler)) + (defn back-white [handler] {:icon :icons/back :icon-opts {:color :white} diff --git a/src/status_im/ui/components/toolbar/view.cljs b/src/status_im/ui/components/toolbar/view.cljs index a8438f0dbd..9796180085 100644 --- a/src/status_im/ui/components/toolbar/view.cljs +++ b/src/status_im/ui/components/toolbar/view.cljs @@ -51,7 +51,11 @@ (def default-nav-back [nav-button actions/default-back]) -(def nav-back-count [nav-button-with-count actions/default-back]) +(defn nav-back-count + ([] + [nav-button-with-count actions/default-back]) + ([{:keys [home?]}] + [nav-button-with-count (if home? actions/home-back actions/default-back)])) (defn default-done "Renders a touchable icon on Android or a label or iOS." diff --git a/src/status_im/ui/screens/browser/views.cljs b/src/status_im/ui/screens/browser/views.cljs index 4287353979..b5b0382fc2 100644 --- a/src/status_im/ui/screens/browser/views.cljs +++ b/src/status_im/ui/screens/browser/views.cljs @@ -80,7 +80,7 @@ [react/keyboard-avoiding-view styles/browser [status-bar/status-bar] [toolbar.view/toolbar {} - toolbar.view/nav-back-count + (toolbar.view/nav-back-count) (if dapp? [toolbar-content-dapp contact unread-messages-number] [toolbar-content browser unread-messages-number])]