[FIX #3852] Back button refinements

This commit is contained in:
kwingram25 2018-04-12 18:23:55 -07:00 committed by Roman Volosovskyi
parent 0ed067af6a
commit 8effc5974f
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
5 changed files with 17 additions and 4 deletions

View File

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

View File

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

View File

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

View File

@ -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."

View File

@ -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])]