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 <andrea.maria.piana@gmail.com>
This commit is contained in:
parent
22c6635d93
commit
36f90fc567
|
@ -141,12 +141,11 @@
|
||||||
(let [current-chat-id (:current-chat-id db)
|
(let [current-chat-id (:current-chat-id db)
|
||||||
images (get-in db [:chats current-chat-id :metadata :sending-image])]
|
images (get-in db [:chats current-chat-id :metadata :sending-image])]
|
||||||
(if (get-in db [:chats current-chat-id :timeline?])
|
(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}
|
::image-selected uri}
|
||||||
(when (and (< (count images) config/max-images-batch)
|
(when (and (< (count images) config/max-images-batch)
|
||||||
(not (get images uri)))
|
(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
|
(fx/defn save-image-to-gallery
|
||||||
{:events [:chat.ui/save-image-to-gallery]}
|
{:events [:chat.ui/save-image-to-gallery]}
|
||||||
|
|
Loading…
Reference in New Issue