Microrefactoring
This commit is contained in:
parent
3f145c2059
commit
33348727a8
|
@ -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))}))
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue