mirror of
https://github.com/status-im/status-mobile.git
synced 2025-03-01 08:40:50 +00:00
feat: show pinned messages bottom sheet in channel home (#19105)
This commit is contained in:
parent
e5cee4b640
commit
3b5afb5d60
@ -33,7 +33,7 @@
|
|||||||
:description (i18n/label :t/no-pinned-messages-desc)}]])
|
:description (i18n/label :t/no-pinned-messages-desc)}]])
|
||||||
|
|
||||||
(defn f-pinned-messages
|
(defn f-pinned-messages
|
||||||
[{:keys [theme chat-id]}]
|
[{:keys [theme chat-id disable-message-long-press?]}]
|
||||||
(let [pinned (rf/sub [:chats/pinned-sorted-list chat-id])
|
(let [pinned (rf/sub [:chats/pinned-sorted-list chat-id])
|
||||||
render-data (rf/sub [:chats/current-chat-message-list-view-context :in-pinned-view])
|
render-data (rf/sub [:chats/current-chat-message-list-view-context :in-pinned-view])
|
||||||
current-chat (rf/sub [:chats/chat-by-id chat-id])
|
current-chat (rf/sub [:chats/chat-by-id chat-id])
|
||||||
@ -60,7 +60,7 @@
|
|||||||
(if (pos? (count pinned))
|
(if (pos? (count pinned))
|
||||||
[rn/flat-list
|
[rn/flat-list
|
||||||
{:data pinned
|
{:data pinned
|
||||||
:render-data render-data
|
:render-data (assoc render-data :disable-message-long-press? disable-message-long-press?)
|
||||||
:render-fn message-render-fn
|
:render-fn message-render-fn
|
||||||
:footer [rn/view {:style style/list-footer}]
|
:footer [rn/view {:style style/list-footer}]
|
||||||
:key-fn list-key-fn
|
:key-fn list-key-fn
|
||||||
|
@ -153,6 +153,7 @@
|
|||||||
(let [{:keys [content-type quoted-message content
|
(let [{:keys [content-type quoted-message content
|
||||||
outgoing outgoing-status pinned-by
|
outgoing outgoing-status pinned-by
|
||||||
message-id chat-id]} message-data
|
message-id chat-id]} message-data
|
||||||
|
{:keys [disable-message-long-press?]} context
|
||||||
first-image (first (:album message-data))
|
first-image (first (:album message-data))
|
||||||
outgoing-status (if (= content-type
|
outgoing-status (if (= content-type
|
||||||
constants/content-type-album)
|
constants/content-type-album)
|
||||||
@ -204,7 +205,8 @@
|
|||||||
(reset! show-delivery-state? true)
|
(reset! show-delivery-state? true)
|
||||||
(js/setTimeout #(reset! show-delivery-state? false)
|
(js/setTimeout #(reset! show-delivery-state? false)
|
||||||
delivery-state-showing-time-ms))))
|
delivery-state-showing-time-ms))))
|
||||||
:on-long-press #(on-long-press message-data context keyboard-shown?)}
|
:on-long-press (when-not disable-message-long-press?
|
||||||
|
#(on-long-press message-data context keyboard-shown?))}
|
||||||
[:<>
|
[:<>
|
||||||
(when pinned-by
|
(when pinned-by
|
||||||
[pin/pinned-by-view pinned-by])
|
[pin/pinned-by-view pinned-by])
|
||||||
|
@ -128,4 +128,8 @@
|
|||||||
(rf/defn show-pins-bottom-sheet
|
(rf/defn show-pins-bottom-sheet
|
||||||
{:events [:pin-message/show-pins-bottom-sheet]}
|
{:events [:pin-message/show-pins-bottom-sheet]}
|
||||||
[cofx chat-id]
|
[cofx chat-id]
|
||||||
(navigation/show-bottom-sheet cofx {:content (fn [] [pinned-messages-menu/view {:chat-id chat-id}])}))
|
(navigation/show-bottom-sheet
|
||||||
|
cofx
|
||||||
|
{:content (fn [] [pinned-messages-menu/view
|
||||||
|
{:chat-id chat-id
|
||||||
|
:disable-message-long-press? (not= :chat (get-in cofx [:db :view-id]))}])}))
|
||||||
|
@ -78,11 +78,13 @@
|
|||||||
:sub-label (i18n/label :t/only-mentions)})
|
:sub-label (i18n/label :t/only-mentions)})
|
||||||
|
|
||||||
(defn- action-pinned-messages
|
(defn- action-pinned-messages
|
||||||
[]
|
[chat-id]
|
||||||
{:icon :i/pin
|
{:icon :i/pin
|
||||||
:right-icon :i/chevron-right
|
:right-icon :i/chevron-right
|
||||||
:accessibility-label :chat-pinned-messages
|
:accessibility-label :chat-pinned-messages
|
||||||
:on-press not-implemented/alert
|
:on-press (fn []
|
||||||
|
(rf/dispatch [:pin-message/load-pin-messages chat-id])
|
||||||
|
(rf/dispatch [:pin-message/show-pins-bottom-sheet chat-id]))
|
||||||
:label (i18n/label :t/pinned-messages)})
|
:label (i18n/label :t/pinned-messages)})
|
||||||
|
|
||||||
|
|
||||||
@ -124,7 +126,7 @@
|
|||||||
(action-mark-as-read)
|
(action-mark-as-read)
|
||||||
(action-toggle-muted chat-id muted muted-till chat-type)
|
(action-toggle-muted chat-id muted muted-till chat-type)
|
||||||
(action-notification-settings)
|
(action-notification-settings)
|
||||||
(action-pinned-messages)
|
(action-pinned-messages chat-id)
|
||||||
(action-invite-people)
|
(action-invite-people)
|
||||||
(action-qr-code chat-id)
|
(action-qr-code chat-id)
|
||||||
(action-share chat-id)]]]
|
(action-share chat-id)]]]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user