From 36f90fc56707d984b8fbab51875949413b2c9dbf Mon Sep 17 00:00:00 2001 From: Andrea Maria Piana Date: Thu, 19 Nov 2020 14:36:19 +0100 Subject: [PATCH] Dont send unprocessed images When selecting an image from camera roll we would immediately setting the filepath with the raw image, process and later once it was processed we would replace the file path. On slow devices, the user might press send while the image is still processing, causing the raw image to be sent, which might be discarded as too large and never sent. This commit changes the behavior so that we only set the uri once the image is processed, it might add some delay, but the image should be correctly sent. Signed-off-by: Andrea Maria Piana --- src/status_im/chat/models/images.cljs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/status_im/chat/models/images.cljs b/src/status_im/chat/models/images.cljs index c74b84c0c9..d831369556 100644 --- a/src/status_im/chat/models/images.cljs +++ b/src/status_im/chat/models/images.cljs @@ -141,12 +141,11 @@ (let [current-chat-id (:current-chat-id db) images (get-in db [:chats current-chat-id :metadata :sending-image])] (if (get-in db [:chats current-chat-id :timeline?]) - {:db (update-in db [:chats current-chat-id :metadata :sending-image] {uri {:uri uri}}) + {:db (assoc-in db [:chats current-chat-id :metadata :sending-image] {}) ::image-selected uri} (when (and (< (count images) config/max-images-batch) (not (get images uri))) - {:db (update-in db [:chats current-chat-id :metadata :sending-image] assoc uri {:uri uri}) - ::image-selected uri})))) + {::image-selected uri})))) (fx/defn save-image-to-gallery {:events [:chat.ui/save-image-to-gallery]}