parent
ff91912a7a
commit
b69ddbe651
|
@ -11,7 +11,7 @@
|
|||
[messenger.state :as state]
|
||||
[messenger.utils.utils :refer [log toast]]
|
||||
[messenger.android.login :refer [login]]
|
||||
[messenger.android.contacts-list :refer [contacts-list]]
|
||||
[messenger.components.contact-list.contact-list :refer [contact-list]]
|
||||
[messenger.comm.pubsub :as pubsub]
|
||||
[messenger.comm.intercom :as intercom :refer [load-user-phone-number]]
|
||||
[messenger.protocol.protocol-handler :refer [make-handler]]
|
||||
|
@ -55,7 +55,6 @@
|
|||
(swap! state/app-state assoc :contacts-ds
|
||||
(data-source {:rowHasChanged (fn [row1 row2]
|
||||
(not= row1 row2))}))
|
||||
(swap! state/app-state assoc :component contacts-list)
|
||||
|
||||
(defonce RootNode (sup/root-node! 1))
|
||||
(defonce app-root (om/factory RootNode))
|
||||
|
|
|
@ -11,16 +11,16 @@
|
|||
[messenger.utils.utils :refer [log toast]]
|
||||
[messenger.utils.resources :as res]
|
||||
[messenger.components.spinner :refer [spinner]]
|
||||
[messenger.comm.intercom :as intercom :refer [set-confirmation-code]]
|
||||
[messenger.android.contacts-list :refer [contacts-list]]))
|
||||
[messenger.components.contact-list.contact-list :refer [contact-list]]
|
||||
[messenger.comm.intercom :as intercom :refer [set-confirmation-code]]))
|
||||
|
||||
(def nav-atom (atom nil))
|
||||
|
||||
(defn show-home-view []
|
||||
(swap! state/app-state assoc :loading false)
|
||||
(binding [state/*nav-render* false]
|
||||
(.replace @nav-atom (clj->js {:component contacts-list
|
||||
:name "contacts-list"}))))
|
||||
(.replace @nav-atom (clj->js {:component contact-list
|
||||
:name "contact-list"}))))
|
||||
|
||||
(defn sync-contacts []
|
||||
(intercom/sync-contacts show-home-view))
|
||||
|
|
|
@ -1,20 +1,12 @@
|
|||
(ns messenger.android.contacts-list
|
||||
(ns messenger.components.contact-list.contact
|
||||
(:require-macros
|
||||
[natal-shell.components :refer [view text image touchable-highlight list-view
|
||||
toolbar-android]]
|
||||
[natal-shell.core :refer [with-error-view]])
|
||||
[natal-shell.components :refer [view text image touchable-highlight]])
|
||||
(:require [om.next :as om :refer-macros [defui]]
|
||||
[re-natal.support :as sup]
|
||||
[messenger.state :as state]
|
||||
[messenger.utils.utils :refer [log toast http-post]]
|
||||
[messenger.utils.resources :as res]
|
||||
[messenger.comm.intercom :as intercom]
|
||||
[messenger.components.chat.chat :refer [chat]]))
|
||||
|
||||
(def fake-contacts? true)
|
||||
|
||||
(def react-native-contacts (js/require "react-native-contacts"))
|
||||
|
||||
(defn nav-push [nav route]
|
||||
(binding [state/*nav-render* false]
|
||||
(.push nav (clj->js route))))
|
||||
|
@ -32,7 +24,8 @@
|
|||
'[:name :photo-path :delivery-status :datetime :new-messages-count :online])
|
||||
Object
|
||||
(render [this]
|
||||
(let [{:keys [name photo-path delivery-status datetime new-messages-count online]}
|
||||
(let [{:keys [name photo-path delivery-status datetime new-messages-count
|
||||
online]}
|
||||
(dissoc (om/props this) :om.next/computed)
|
||||
{:keys [nav]} (om/get-computed this)]
|
||||
(touchable-highlight
|
||||
|
@ -129,34 +122,3 @@
|
|||
new-messages-count)))))))))
|
||||
|
||||
(def contact (om/factory Contact {:keyfn :name}))
|
||||
|
||||
(defn render-row [nav row section-id row-id]
|
||||
(contact (om/computed (js->clj row :keywordize-keys true)
|
||||
{:nav nav})))
|
||||
|
||||
(defn load-contacts []
|
||||
(intercom/load-syng-contacts))
|
||||
|
||||
(defui ContactsList
|
||||
static om/IQuery
|
||||
(query [this]
|
||||
'[:contacts-ds])
|
||||
Object
|
||||
(componentDidMount [this]
|
||||
(load-contacts))
|
||||
(render [this]
|
||||
(let [{:keys [contacts-ds]} (om/props this)
|
||||
{:keys [nav]} (om/get-computed this)]
|
||||
(view {:style {:flex 1
|
||||
:backgroundColor "white"}}
|
||||
(toolbar-android {:logo res/logo-icon
|
||||
:title "Chats"
|
||||
:titleColor "#4A5258"
|
||||
:style {:backgroundColor "white"
|
||||
:height 56
|
||||
:elevation 2}})
|
||||
(list-view {:dataSource contacts-ds
|
||||
:renderRow (partial render-row nav)
|
||||
:style {:backgroundColor "white"}})))))
|
||||
|
||||
(def contacts-list (om/factory ContactsList))
|
|
@ -0,0 +1,42 @@
|
|||
(ns messenger.components.contact-list.contact-list
|
||||
(:require-macros
|
||||
[natal-shell.components :refer [view text image touchable-highlight list-view
|
||||
toolbar-android]]
|
||||
[natal-shell.core :refer [with-error-view]])
|
||||
(:require [om.next :as om :refer-macros [defui]]
|
||||
[messenger.state :as state]
|
||||
[messenger.utils.utils :refer [log toast http-post]]
|
||||
[messenger.utils.resources :as res]
|
||||
[messenger.comm.intercom :as intercom]
|
||||
[messenger.components.contact-list.contact :refer [contact]]))
|
||||
|
||||
(defn render-row [nav row section-id row-id]
|
||||
(contact (om/computed (js->clj row :keywordize-keys true)
|
||||
{:nav nav})))
|
||||
|
||||
(defn load-contacts []
|
||||
(intercom/load-syng-contacts))
|
||||
|
||||
(defui ContactList
|
||||
static om/IQuery
|
||||
(query [this]
|
||||
'[:contacts-ds])
|
||||
Object
|
||||
(componentDidMount [this]
|
||||
(load-contacts))
|
||||
(render [this]
|
||||
(let [{:keys [contacts-ds]} (om/props this)
|
||||
{:keys [nav]} (om/get-computed this)]
|
||||
(view {:style {:flex 1
|
||||
:backgroundColor "white"}}
|
||||
(toolbar-android {:logo res/logo-icon
|
||||
:title "Chats"
|
||||
:titleColor "#4A5258"
|
||||
:style {:backgroundColor "white"
|
||||
:height 56
|
||||
:elevation 2}})
|
||||
(list-view {:dataSource contacts-ds
|
||||
:renderRow (partial render-row nav)
|
||||
:style {:backgroundColor "white"}})))))
|
||||
|
||||
(def contact-list (om/factory ContactList))
|
Loading…
Reference in New Issue