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