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

View File

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

View File

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