Edit message issues (#14638)
This commit is contained in:
parent
915b8ebd9a
commit
77629fa7e1
|
@ -64,9 +64,14 @@
|
||||||
(i18n/label :t/message-deleted)]])
|
(i18n/label :t/message-deleted)]])
|
||||||
|
|
||||||
(defn reply-message
|
(defn reply-message
|
||||||
[{:keys [from identicon content-type contentType parsed-text content deleted? deleted-for-me?]}
|
[{:keys [chat-id id]}
|
||||||
in-chat-input? pin?]
|
in-chat-input? pin?]
|
||||||
(let [contact-name (rf/sub [:contacts/contact-name-by-identity from])
|
(let [reply-content-sub (-> [:chats/chat-messages chat-id]
|
||||||
|
rf/sub
|
||||||
|
(get id))
|
||||||
|
{:keys [from identicon content-type contentType parsed-text content deleted? deleted-for-me?]}
|
||||||
|
reply-content-sub
|
||||||
|
contact-name (rf/sub [:contacts/contact-name-by-identity from])
|
||||||
current-public-key (rf/sub [:multiaccount/public-key])
|
current-public-key (rf/sub [:multiaccount/public-key])
|
||||||
content-type (or content-type contentType)]
|
content-type (or content-type contentType)]
|
||||||
[rn/view
|
[rn/view
|
||||||
|
|
|
@ -250,21 +250,27 @@
|
||||||
max-height
|
max-height
|
||||||
set-bg-opacity)]
|
set-bg-opacity)]
|
||||||
(quo.react/effect!
|
(quo.react/effect!
|
||||||
#(do
|
(fn []
|
||||||
(when (and @keyboard-was-shown? (not keyboard-shown))
|
(let [input-text (-> [:chat/inputs]
|
||||||
(swap! context assoc :state :min)
|
rf/sub
|
||||||
(set-bg-opacity 0))
|
(get chat-id)
|
||||||
(when (and blank-composer? (not (seq images)) (not edit))
|
:input-text)
|
||||||
(clean-and-minimize-composer-fn false))
|
edited? (not= input-text (-> edit :content :text))]
|
||||||
(when (seq images)
|
(when (and @keyboard-was-shown? (not keyboard-shown))
|
||||||
(input/show-send refs))
|
(swap! context assoc :state :min)
|
||||||
(reset! keyboard-was-shown? keyboard-shown)
|
(set-bg-opacity 0))
|
||||||
(if (#{:max :custom-chat-unavailable} (:state @context))
|
(when (and blank-composer? (empty? images) (not edit))
|
||||||
(set-bg-opacity 1)
|
(clean-and-minimize-composer-fn false))
|
||||||
(set-bg-opacity 0))
|
(if (or (seq images) (and (not blank-composer?) edited?))
|
||||||
(reanimated/set-shared-value translate-y (reanimated/with-timing (- y)))
|
(input/show-send refs)
|
||||||
(reanimated/set-shared-value shared-height
|
(input/hide-send refs))
|
||||||
(reanimated/with-timing (min y max-height)))))
|
(reset! keyboard-was-shown? keyboard-shown)
|
||||||
|
(if (#{:max :custom-chat-unavailable} (:state @context))
|
||||||
|
(set-bg-opacity 1)
|
||||||
|
(set-bg-opacity 0))
|
||||||
|
(reanimated/set-shared-value translate-y (reanimated/with-timing (- y)))
|
||||||
|
(reanimated/set-shared-value shared-height
|
||||||
|
(reanimated/with-timing (min y max-height))))))
|
||||||
[reanimated/view
|
[reanimated/view
|
||||||
{:style (reanimated/apply-animations-to-style
|
{:style (reanimated/apply-animations-to-style
|
||||||
{:height shared-height}
|
{:height shared-height}
|
||||||
|
@ -325,7 +331,7 @@
|
||||||
{:icon true
|
{:icon true
|
||||||
:size 32
|
:size 32
|
||||||
:accessibility-label :send-message-button
|
:accessibility-label :send-message-button
|
||||||
:on-press #(do (clean-and-minimize-composer-fn false)
|
:on-press #(do (clean-and-minimize-composer-fn (some? edit))
|
||||||
(scroll-to-bottom)
|
(scroll-to-bottom)
|
||||||
(rf/dispatch [:chat.ui/send-current-message]))}
|
(rf/dispatch [:chat.ui/send-current-message]))}
|
||||||
:i/arrow-up]]])
|
:i/arrow-up]]])
|
||||||
|
|
|
@ -145,7 +145,8 @@
|
||||||
message-id)
|
message-id)
|
||||||
reply (assoc reply
|
reply (assoc reply
|
||||||
:deleted? deleted?
|
:deleted? deleted?
|
||||||
:deleted-for-me? deleted-for-me?)]
|
:deleted-for-me? deleted-for-me?
|
||||||
|
:chat-id chat-id)]
|
||||||
[rn/view {:style (when-not pin? (style/quoted-message-container))}
|
[rn/view {:style (when-not pin? (style/quoted-message-container))}
|
||||||
[components.reply/reply-message reply false pin?]]))
|
[components.reply/reply-message reply false pin?]]))
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,12 @@
|
||||||
(defn banner
|
(defn banner
|
||||||
[chat-id]
|
[chat-id]
|
||||||
(let [pinned-messages (rf/sub [:chats/pinned chat-id])
|
(let [pinned-messages (rf/sub [:chats/pinned chat-id])
|
||||||
latest-pin-text (get-in (last (vals pinned-messages)) [:content :text])
|
latest-pin-id (-> pinned-messages
|
||||||
|
vals
|
||||||
|
last
|
||||||
|
(get :message-id))
|
||||||
|
latest-pin-text (get-in (rf/sub [:chats/chat-messages chat-id])
|
||||||
|
[latest-pin-id :content :text])
|
||||||
pins-count (count (seq pinned-messages))]
|
pins-count (count (seq pinned-messages))]
|
||||||
(when (> pins-count 0)
|
(when (> pins-count 0)
|
||||||
;; TODO (flexsurfer) this should be banner component in quo2
|
;; TODO (flexsurfer) this should be banner component in quo2
|
||||||
|
|
|
@ -10,22 +10,23 @@
|
||||||
(def list-key-fn #(or (:message-id %) (:value %)))
|
(def list-key-fn #(or (:message-id %) (:value %)))
|
||||||
|
|
||||||
(defn message-render-fn
|
(defn message-render-fn
|
||||||
[{:keys [whisper-timestamp] :as message}
|
[{:keys [whisper-timestamp message-id chat-id] :as message}
|
||||||
_
|
_
|
||||||
{:keys [group-chat public? community? current-public-key show-input? edit-enabled]}]
|
{:keys [group-chat public? community? current-public-key show-input? edit-enabled]}]
|
||||||
;; TODO (flexsurfer) probably we don't want reactions here
|
;; TODO (flexsurfer) probably we don't want reactions here
|
||||||
[message/message-with-reactions
|
(let [message-content-sub (get-in (rf/sub [:chats/chat-messages chat-id]) [message-id :content])]
|
||||||
message
|
[message/message-with-reactions
|
||||||
{:group-chat group-chat
|
(assoc message :content message-content-sub)
|
||||||
:public? public?
|
{:group-chat group-chat
|
||||||
:community? community?
|
:public? public?
|
||||||
:current-public-key current-public-key
|
:community? community?
|
||||||
:show-input? show-input?
|
:current-public-key current-public-key
|
||||||
:message-pin-enabled true
|
:show-input? show-input?
|
||||||
:in-pinned-view? true
|
:message-pin-enabled true
|
||||||
:pinned true
|
:in-pinned-view? true
|
||||||
:timestamp-str (time/timestamp->time whisper-timestamp)
|
:pinned true
|
||||||
:edit-enabled edit-enabled}])
|
:timestamp-str (time/timestamp->time whisper-timestamp)
|
||||||
|
:edit-enabled edit-enabled}]))
|
||||||
|
|
||||||
(defn pinned-messages-list
|
(defn pinned-messages-list
|
||||||
[chat-id]
|
[chat-id]
|
||||||
|
|
Loading…
Reference in New Issue