android device back button goes back in webview #1204

This commit is contained in:
Gustavo Nunes 2017-05-25 02:42:44 -03:00 committed by Roman Volosovskyi
parent dd976fb2af
commit a623c02d53
1 changed files with 7 additions and 2 deletions

View File

@ -55,11 +55,16 @@
;; todo: it might be better always return false from
;; this listener and handle application's closing
;; in handlers
(let [stack (subscribe [:get :navigation-stack])
creating? (subscribe [:get :creating-account?])]
(let [stack (subscribe [:get :navigation-stack])
creating? (subscribe [:get :creating-account?])
result-box (subscribe [:chat-ui-props :result-box])
webview (subscribe [:get :webview-bridge])]
(cond
@creating? true
(and @webview (:can-go-back? @result-box))
(do (.goBack @webview) true)
(< 1 (count @stack))
(do (dispatch [:navigate-back]) true)