diff --git a/src/messenger/android/core.cljs b/src/messenger/android/core.cljs index 6ea6127b07..63bfee03b2 100644 --- a/src/messenger/android/core.cljs +++ b/src/messenger/android/core.cljs @@ -9,12 +9,13 @@ (:require [om.next :as om :refer-macros [defui]] [re-natal.support :as sup] [messenger.state :as state] + [messenger.utils.utils :refer [log toast]] [messenger.android.login :refer [login]] [messenger.android.contacts-list :refer [contacts-list]] [messenger.android.chat :refer [chat]] [messenger.comm.pubsub :as pubsub] - [messenger.comm.intercom :refer [load-user-phone-number - load-user-whisper-identity]])) + [messenger.comm.intercom :as intercom :refer [load-user-phone-number + load-user-whisper-identity]])) (def app-registry (.-AppRegistry js/React)) @@ -35,20 +36,20 @@ (defui AppRoot static om/IQuery (query [this] - '[:page :contacts-ds :user-phone-number :confirmation-code]) + '[:contacts-ds :user-phone-number :confirmation-code]) Object (render [this] - (let [{:keys [page]} (om/props this)] - (navigator - {:initialRoute {:component login} - :renderScene (fn [route nav] - (when state/*nav-render* - (init-back-button-handler! nav) - (let [{:keys [component]} - (js->clj route :keywordize-keys true)] - (component (om/computed (om/props this) - {:nav nav})))))})))) + (navigator + {:initialRoute {:component login} + :renderScene (fn [route nav] + (when state/*nav-render* + (init-back-button-handler! nav) + (let [{:keys [component]} + (js->clj route :keywordize-keys true)] + (component (om/computed (om/props this) + {:nav nav})))))}))) +;; TODO to service? (swap! state/app-state assoc :contacts-ds (data-source {:rowHasChanged (fn [row1 row2] (not= row1 row2))})) diff --git a/src/messenger/state.cljs b/src/messenger/state.cljs index e47cc1c6b5..598adf8dd2 100644 --- a/src/messenger/state.cljs +++ b/src/messenger/state.cljs @@ -3,6 +3,10 @@ [om.next :as om] [re-natal.support :as sup])) +(def ^{:dynamic true :private true} *nav-render* + "Flag to suppress navigator re-renders from outside om when pushing/popping." + true) + (set! js/React (js/require "react-native")) (defonce app-state (atom {:component nil @@ -11,9 +15,6 @@ :confirmation-code nil :channels {:pub-sub-publisher (chan) :pub-sub-publication nil}})) -(def ^{:dynamic true :private true} *nav-render* - "Flag to suppress navigator re-renders from outside om when pushing/popping." - true) (defmulti read om/dispatch) (defmethod read :default @@ -37,4 +38,4 @@ (def pub-sub-path [:channels :pub-sub-publication]) (def user-notification-path [:user-notification]) -(defn pub-sub-publisher [app] (get-in app pub-sub-bus-path)) \ No newline at end of file +(defn pub-sub-publisher [app] (get-in app pub-sub-bus-path))