parent
9f249a1da9
commit
b4852df7f8
|
@ -9,12 +9,13 @@
|
||||||
(:require [om.next :as om :refer-macros [defui]]
|
(:require [om.next :as om :refer-macros [defui]]
|
||||||
[re-natal.support :as sup]
|
[re-natal.support :as sup]
|
||||||
[messenger.state :as state]
|
[messenger.state :as state]
|
||||||
|
[messenger.utils.utils :refer [log toast]]
|
||||||
[messenger.android.login :refer [login]]
|
[messenger.android.login :refer [login]]
|
||||||
[messenger.android.contacts-list :refer [contacts-list]]
|
[messenger.android.contacts-list :refer [contacts-list]]
|
||||||
[messenger.android.chat :refer [chat]]
|
[messenger.android.chat :refer [chat]]
|
||||||
[messenger.comm.pubsub :as pubsub]
|
[messenger.comm.pubsub :as pubsub]
|
||||||
[messenger.comm.intercom :refer [load-user-phone-number
|
[messenger.comm.intercom :as intercom :refer [load-user-phone-number
|
||||||
load-user-whisper-identity]]))
|
load-user-whisper-identity]]))
|
||||||
|
|
||||||
(def app-registry (.-AppRegistry js/React))
|
(def app-registry (.-AppRegistry js/React))
|
||||||
|
|
||||||
|
@ -35,20 +36,20 @@
|
||||||
(defui AppRoot
|
(defui AppRoot
|
||||||
static om/IQuery
|
static om/IQuery
|
||||||
(query [this]
|
(query [this]
|
||||||
'[:page :contacts-ds :user-phone-number :confirmation-code])
|
'[:contacts-ds :user-phone-number :confirmation-code])
|
||||||
Object
|
Object
|
||||||
(render [this]
|
(render [this]
|
||||||
(let [{:keys [page]} (om/props this)]
|
(navigator
|
||||||
(navigator
|
{:initialRoute {:component login}
|
||||||
{:initialRoute {:component login}
|
:renderScene (fn [route nav]
|
||||||
:renderScene (fn [route nav]
|
(when state/*nav-render*
|
||||||
(when state/*nav-render*
|
(init-back-button-handler! nav)
|
||||||
(init-back-button-handler! nav)
|
(let [{:keys [component]}
|
||||||
(let [{:keys [component]}
|
(js->clj route :keywordize-keys true)]
|
||||||
(js->clj route :keywordize-keys true)]
|
(component (om/computed (om/props this)
|
||||||
(component (om/computed (om/props this)
|
{:nav nav})))))})))
|
||||||
{:nav nav})))))}))))
|
|
||||||
|
|
||||||
|
;; TODO to service?
|
||||||
(swap! state/app-state assoc :contacts-ds
|
(swap! state/app-state assoc :contacts-ds
|
||||||
(data-source {:rowHasChanged (fn [row1 row2]
|
(data-source {:rowHasChanged (fn [row1 row2]
|
||||||
(not= row1 row2))}))
|
(not= row1 row2))}))
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
[om.next :as om]
|
[om.next :as om]
|
||||||
[re-natal.support :as sup]))
|
[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"))
|
(set! js/React (js/require "react-native"))
|
||||||
|
|
||||||
(defonce app-state (atom {:component nil
|
(defonce app-state (atom {:component nil
|
||||||
|
@ -11,9 +15,6 @@
|
||||||
:confirmation-code nil
|
:confirmation-code nil
|
||||||
:channels {:pub-sub-publisher (chan)
|
:channels {:pub-sub-publisher (chan)
|
||||||
:pub-sub-publication nil}}))
|
: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)
|
(defmulti read om/dispatch)
|
||||||
(defmethod read :default
|
(defmethod read :default
|
||||||
|
|
Loading…
Reference in New Issue