fix contacts loading

This commit is contained in:
Roman Volosovskyi 2016-06-02 14:23:28 +03:00
parent ba1d5d1c4e
commit 9ae6e752d8
3 changed files with 16 additions and 11 deletions

View File

@ -230,9 +230,9 @@
(sign-up-service/stop-listening-confirmation-code-sms db))) (sign-up-service/stop-listening-confirmation-code-sms db)))
(register-handler :sign-up-confirm (register-handler :sign-up-confirm
(fn [db [_ confirmation-code]] (u/side-effect!
(server/sign-up-confirm confirmation-code sign-up-service/on-send-code-response) (fn [_ [_ confirmation-code]]
db)) (server/sign-up-confirm confirmation-code sign-up-service/on-send-code-response))))
(register-handler :set-signed-up (register-handler :set-signed-up
(fn [db [_ signed-up]] (fn [db [_ signed-up]]

View File

@ -6,7 +6,8 @@
image image
icon]] icon]]
[status-im.components.chat-icon.styles :as st] [status-im.components.chat-icon.styles :as st]
[status-im.components.styles :refer [color-purple]])) [status-im.components.styles :refer [color-purple]]
[clojure.string :as s]))
(defn default-chat-icon [name styles] (defn default-chat-icon [name styles]
[view (:default-chat-icon styles) [view (:default-chat-icon styles)
@ -26,10 +27,10 @@
(defview chat-icon-view [chat-id group-chat name online styles] (defview chat-icon-view [chat-id group-chat name online styles]
[photo-path [:chat-photo chat-id]] [photo-path [:chat-photo chat-id]]
[view (:container styles) [view (:container styles)
(if (and photo-path (not (empty? photo-path))) (if-not (s/blank? photo-path)
[chat-icon photo-path styles] [chat-icon photo-path styles]
[default-chat-icon name styles]) [default-chat-icon name styles])
(when (not group-chat) (when-not group-chat
[contact-online online styles])]) [contact-online online styles])])
(defn chat-icon-view-chat-list [chat-id group-chat name color online] (defn chat-icon-view-chat-list [chat-id group-chat name color online]

View File

@ -92,10 +92,14 @@
(defn add-new-contacts (defn add-new-contacts
[{:keys [contacts] :as db} [_ new-contacts]] [{:keys [contacts] :as db} [_ new-contacts]]
(let [identities (set (map :whisper-identity contacts)) (let [identities (set (map :whisper-identity contacts))
new-contacts' (remove #(identities (:whisper-identity %)) new-contacts)] new-contacts' (->> new-contacts
(remove #(identities (:whisper-identity %)))
(map #(vector (:whisper-identity %) %))
(into {}))]
(println new-contacts')
(-> db (-> db
(update :contacts concat new-contacts') (update :contacts merge new-contacts')
(assoc :new-contacts new-contacts')))) (assoc :new-contacts (vals new-contacts')))))
(register-handler :add-contacts (register-handler :add-contacts
(after save-contacts!) (after save-contacts!)