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)
:enableEmptySections true
:renderRow render-row
:bounces false
:style st/account-list
:contentContainerStyle (st/account-list-content (count accounts))}]
[view st/bottom-actions-container

View File

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

View File

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

View File

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

View File

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