commit
04f040dd48
|
@ -54,7 +54,7 @@
|
|||
:optimizations :none
|
||||
:target :nodejs}}]}
|
||||
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]
|
||||
:timeout 120000}}
|
||||
:timeout 240000}}
|
||||
:prod {:cljsbuild {:builds [{:id "ios"
|
||||
:source-paths ["src" "env/prod"]
|
||||
:compiler {:output-to "index.ios.js"
|
||||
|
|
|
@ -38,7 +38,8 @@
|
|||
status-im.chat.handlers.webview-bridge
|
||||
status-im.chat.handlers.wallet-chat
|
||||
status-im.chat.handlers.console
|
||||
[taoensso.timbre :as log]))
|
||||
[taoensso.timbre :as log]
|
||||
[tailrecursion.priority-map :refer [priority-map-by]]))
|
||||
|
||||
(register-handler :set-chat-ui-props
|
||||
(fn [db [_ ui-element value]]
|
||||
|
@ -285,6 +286,10 @@
|
|||
((enrich init-chat))
|
||||
((after load-commands!))))
|
||||
|
||||
(defn compare-chats
|
||||
[{timesatmp1 :timestamp} {timestamp2 :timestamp}]
|
||||
(compare timestamp2 timesatmp1))
|
||||
|
||||
(defn initialize-chats
|
||||
[{:keys [loaded-chats account-creation? chats] :as db} _]
|
||||
(let [chats' (if account-creation?
|
||||
|
@ -293,7 +298,7 @@
|
|||
(map (fn [{:keys [chat-id] :as chat}]
|
||||
(let [last-message (messages/get-last-message db chat-id)]
|
||||
[chat-id (assoc chat :last-message last-message)])))
|
||||
(into {})))
|
||||
(into (priority-map-by compare-chats))))
|
||||
ids (set (keys chats'))]
|
||||
|
||||
(-> db
|
||||
|
@ -432,7 +437,8 @@
|
|||
(fn [db [_ {:keys [chat-id clock-value] :as opts}]]
|
||||
(let [chat (if (chats/exists? chat-id)
|
||||
(let [{old-clock-value :clock-value :as chat} (chats/get-by-id chat-id)]
|
||||
(assoc chat :clock-value (max old-clock-value clock-value)))
|
||||
(assoc chat :clock-value (max old-clock-value clock-value)
|
||||
:timestamp (random/timestamp)))
|
||||
(prepare-chat db chat-id opts))]
|
||||
(chats/save chat)
|
||||
(update-in db [:chats chat-id] merge chat))))
|
||||
|
@ -570,5 +576,6 @@
|
|||
(u/side-effect!
|
||||
(fn [_ [_ chat-id]]
|
||||
(let [chat (-> (chats/get-by-id chat-id)
|
||||
(update :clock-value inc))]
|
||||
(update :clock-value inc)
|
||||
(assoc :timestamp (random/timestamp)))]
|
||||
(dispatch [:update-chat! chat])))))
|
||||
|
|
|
@ -77,8 +77,8 @@
|
|||
[view st/chats-container
|
||||
[chats-list-toolbar]
|
||||
[list-view {:dataSource (to-datasource chats)
|
||||
:renderRow (fn [row _ _]
|
||||
(list-item [chat-list-item row]))
|
||||
:renderRow (fn [[id :as row] _ _]
|
||||
(list-item ^{:key id} [chat-list-item row]))
|
||||
:renderFooter #(list-item [chat-shadow-item])
|
||||
:renderSeparator #(list-item
|
||||
(when (< %2 (- (count chats) 1))
|
||||
|
|
Loading…
Reference in New Issue