Microrefactoring

Former-commit-id: 33348727a8
This commit is contained in:
virvar 2016-03-17 10:25:20 +03:00
parent 9f249a1da9
commit b4852df7f8
2 changed files with 19 additions and 17 deletions

View File

@ -9,11 +9,12 @@
(: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
[messenger.comm.intercom :as intercom :refer [load-user-phone-number
load-user-whisper-identity]]))
(def app-registry (.-AppRegistry js/React))
@ -35,10 +36,9 @@
(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]
@ -47,8 +47,9 @@
(let [{:keys [component]}
(js->clj route :keywordize-keys true)]
(component (om/computed (om/props this)
{:nav nav})))))}))))
{:nav nav})))))})))
;; TODO to service?
(swap! state/app-state assoc :contacts-ds
(data-source {:rowHasChanged (fn [row1 row2]
(not= row1 row2))}))

View File

@ -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