Merge pull request #513 from status-im/bug/#507

Several messaging fixes: latest message (#507), no more clock-value bugs, some UI fixes
This commit is contained in:
Roman Volosovskyi 2016-11-30 18:14:56 +02:00 committed by GitHub
commit 746ec2d1fe
5 changed files with 16 additions and 15 deletions

View File

@ -70,6 +70,7 @@
[list-view {:dataSource (lw/to-datasource accounts) [list-view {:dataSource (lw/to-datasource accounts)
:enableEmptySections true :enableEmptySections true
:renderRow render-row :renderRow render-row
:bounces false
:style st/account-list :style st/account-list
:contentContainerStyle (st/account-list-content (count accounts))}] :contentContainerStyle (st/account-list-content (count accounts))}]
[view st/bottom-actions-container [view st/bottom-actions-container

View File

@ -14,6 +14,7 @@
content-type-command content-type-command
content-type-command-request content-type-command-request
default-number-of-messages default-number-of-messages
console-chat-id
wallet-chat-id]] wallet-chat-id]]
[status-im.utils.random :as random] [status-im.utils.random :as random]
[status-im.chat.sign-up :as sign-up-service] [status-im.chat.sign-up :as sign-up-service]
@ -27,7 +28,6 @@
status-im.chat.handlers.commands status-im.chat.handlers.commands
[status-im.commands.utils :refer [command-prefix]] [status-im.commands.utils :refer [command-prefix]]
[status-im.chat.utils :refer [console? not-console?]] [status-im.chat.utils :refer [console? not-console?]]
[status-im.constants :refer [console-chat-id]]
[status-im.utils.gfycat.core :refer [generate-gfy]] [status-im.utils.gfycat.core :refer [generate-gfy]]
status-im.chat.handlers.animation status-im.chat.handlers.animation
status-im.chat.handlers.requests status-im.chat.handlers.requests
@ -216,7 +216,6 @@
(-> db (-> db
(assoc :new-chat new-chat) (assoc :new-chat new-chat)
(update :chats assoc console-chat-id new-chat) (update :chats assoc console-chat-id new-chat)
(update :chats-ids conj console-chat-id)
(assoc :current-chat-id console-chat-id))))))) (assoc :current-chat-id console-chat-id)))))))
(register-handler :init-console-chat (register-handler :init-console-chat
@ -303,7 +302,6 @@
(-> db (-> db
(assoc :chats chats') (assoc :chats chats')
(assoc :chats-ids ids)
(dissoc :loaded-chats) (dissoc :loaded-chats)
(init-console-chat true)))) (init-console-chat true))))
@ -381,14 +379,15 @@
[db [_ chat-id chat]] [db [_ chat-id chat]]
(assoc db :new-chat (prepare-chat db chat-id chat))) (assoc db :new-chat (prepare-chat db chat-id chat)))
(defn add-chat [{:keys [new-chat] :as db} [_ chat-id]] (defn add-chat [{:keys [new-chat chats] :as db} [_ chat-id]]
(-> db (if-not (get chats chat-id)
(update :chats assoc chat-id new-chat) (update db :chats assoc chat-id new-chat)
(update :chats-ids conj chat-id))) db))
(defn save-new-chat! (defn save-new-chat!
[{:keys [new-chat]} _] [{{:keys [chat-id] :as new-chat} :new-chat} _]
(chats/save new-chat)) (when-not (chats/exists? chat-id)
(chats/save new-chat)))
(defn open-chat! (defn open-chat!
[_ [_ chat-id _ navigation-type]] [_ [_ chat-id _ navigation-type]]

View File

@ -376,8 +376,7 @@
:from from :from from
:message-id message-id}]))) :message-id message-id}])))
:reagent-render :reagent-render
(fn [{:keys [outgoing group-chat] :as message}] (fn [{:keys [outgoing group-chat clock-value] :as message}]
(log/debug "I HAVE A MESSAGE: " message)
[message-container message [message-container message
[view [view
(let [incoming-group (and group-chat (not outgoing))] (let [incoming-group (and group-chat (not outgoing))]

View File

@ -114,7 +114,8 @@
{:flex 1}) {:flex 1})
(def list-container (def list-container
{:background-color color-light-gray}) {:background-color color-light-gray
:margin-bottom 72})
(def create-icon (def create-icon
{:fontSize 20 {:fontSize 20

View File

@ -84,9 +84,10 @@
[{:keys [chats] :as db} chat-id] [{:keys [chats] :as db} chat-id]
(if-let [message (first (get-in db [:chats chat-id :messages]))] (if-let [message (first (get-in db [:chats chat-id :messages]))]
message message
(let [{:keys [content-type] :as message} (data-store/get-last-message chat-id)] (if-let [{:keys [content-type] :as message} (data-store/get-last-message chat-id)]
(when (and message (command-type? content-type)) (if (command-type? content-type)
(clojure.core/update message :content str-to-map))))) (clojure.core/update message :content str-to-map)
message))))
(defn get-unviewed (defn get-unviewed
[] []