From 0d237b53d4b71982156e64ff6e3d3f38bf09b924 Mon Sep 17 00:00:00 2001 From: virvar Date: Wed, 11 May 2016 10:36:13 +0300 Subject: [PATCH] Fix back navigation. Add 'discovery' drawer item. Former-commit-id: c89f2820aa62d11a07b12a47db25734453c3842c --- src/syng_im/android/core.cljs | 2 +- src/syng_im/components/drawer.cljs | 3 +++ src/syng_im/db.cljs | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/syng_im/android/core.cljs b/src/syng_im/android/core.cljs index 3009ccd213..a2ecc6c3d5 100644 --- a/src/syng_im/android/core.cljs +++ b/src/syng_im/android/core.cljs @@ -30,7 +30,7 @@ ;; this listener and handle application's closing ;; in handlers (let [stack (subscribe [:navigation-stack])] - (when (< 1 (count stack)) + (when (< 1 (count @stack)) (dispatch [:navigate-back]) true)))] (add-event-listener "hardwareBackPress" new-listener))) diff --git a/src/syng_im/components/drawer.cljs b/src/syng_im/components/drawer.cljs index e930d59f15..c1f7b807f2 100644 --- a/src/syng_im/components/drawer.cljs +++ b/src/syng_im/components/drawer.cljs @@ -50,6 +50,9 @@ :handler (fn [] ;; TODO not implemented )}] + [menu-item {:name "Discovery" + :handler (fn [] + (dispatch [:navigate-to :discovery]))}] [menu-item {:name "Contacts" :handler (fn [] (dispatch [:show-contacts navigator]))}] diff --git a/src/syng_im/db.cljs b/src/syng_im/db.cljs index dfeacbd0c5..54280b7d11 100644 --- a/src/syng_im/db.cljs +++ b/src/syng_im/db.cljs @@ -4,7 +4,7 @@ ;; schema of app-db (def schema {:greeting s/Str}) -(def default-view :discovery) +(def default-view :chat-list) ;; initial state of app-db (def app-db {:greeting "Hello Clojure in iOS and Android!"