[#12294] "Unknown" if tap "Pinned messages" on user profile from public chat

Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
andrey 2021-07-09 13:11:19 +02:00
parent 5ff854c7c7
commit 06f0ee877b
No known key found for this signature in database
GPG Key ID: 89B67245FD2F0272
3 changed files with 23 additions and 23 deletions

View File

@ -227,7 +227,7 @@
(fx/defn handle-one-to-one-chat-created
{:events [::one-to-one-chat-created]}
[{:keys [db] :as cofx} chat-id response]
[{:keys [db]} chat-id response]
(let [chat (chats-store/<-rpc (first (:chats response)))]
{:db (assoc-in db [:chats chat-id] chat)
:dispatch [:chat.ui/navigate-to-chat chat-id]}))
@ -235,10 +235,8 @@
(fx/defn navigate-to-user-pinned-messages
"Takes coeffects map and chat-id, returns effects necessary for navigation and preloading data"
{:events [:chat.ui/navigate-to-pinned-messages]}
[{db :db :as cofx} chat-id]
(fx/merge cofx
{:db (assoc db :current-chat-id chat-id)}
(navigation/navigate-to :chat-pinned-messages nil)))
[cofx chat-id]
(navigation/navigate-to cofx :chat-pinned-messages {:chat-id chat-id}))
(fx/defn start-chat
"Start a chat, making sure it exists"

View File

@ -13,9 +13,8 @@
[status-im.ui.screens.chat.views :as chat]
[status-im.ui.components.list.views :as list]))
(defn pins-topbar []
(let [{:keys [group-chat chat-id chat-name]}
@(re-frame/subscribe [:chats/current-chat])
(defn pins-topbar [chat]
(let [{:keys [group-chat chat-id chat-name]} chat
pinned-messages @(re-frame/subscribe [:chats/pinned chat-id])
[first-name _] (when-not group-chat @(re-frame.core/subscribe [:contacts/contact-two-names-by-identity chat-id]))]
[topbar/topbar {:show-border? true
@ -78,18 +77,20 @@
:padding-bottom 16}})])))
(defn pinned-messages []
(let [bottom-space (reagent/atom 0)
panel-space (reagent/atom 52)
active-panel (reagent/atom nil)
position-y (animated/value 0)
pan-state (animated/value 0)
text-input-ref (quo.react/create-ref)
pan-responder (accessory/create-pan-responder position-y pan-state)
space-keeper (get-space-keeper-ios bottom-space panel-space active-panel text-input-ref)
chat @(re-frame/subscribe [:chats/current-chat-chat-view])]
[:<>
[pins-topbar]
[connectivity/loading-indicator]
[pinned-messages-view {:chat chat
:pan-responder pan-responder
:space-keeper space-keeper}]]))
(let [{:keys [chat-id]} @(re-frame/subscribe [:get-screen-params])]
(fn []
(let [bottom-space (reagent/atom 0)
panel-space (reagent/atom 52)
active-panel (reagent/atom nil)
position-y (animated/value 0)
pan-state (animated/value 0)
text-input-ref (quo.react/create-ref)
pan-responder (accessory/create-pan-responder position-y pan-state)
space-keeper (get-space-keeper-ios bottom-space panel-space active-panel text-input-ref)
chat @(re-frame/subscribe [:chat-by-id chat-id])]
[:<>
[pins-topbar chat]
[connectivity/loading-indicator]
[pinned-messages-view {:chat chat
:pan-responder pan-responder
:space-keeper space-keeper}]]))))

View File

@ -90,6 +90,7 @@
:accessibility-label :profile-nickname-item
:accessory :text
:accessory-text pin-count
:disabled (zero? pin-count)
:on-press #(re-frame/dispatch [:contact.ui/pinned-messages-pressed public-key])
:chevron true}])