diff --git a/src/status_im/chat/models.cljs b/src/status_im/chat/models.cljs index e75ac6592c..37b0ca03bc 100644 --- a/src/status_im/chat/models.cljs +++ b/src/status_im/chat/models.cljs @@ -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" diff --git a/src/status_im/ui/screens/chat/pinned_messages.cljs b/src/status_im/ui/screens/chat/pinned_messages.cljs index ad54daa579..8132cb7090 100644 --- a/src/status_im/ui/screens/chat/pinned_messages.cljs +++ b/src/status_im/ui/screens/chat/pinned_messages.cljs @@ -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}]])) \ No newline at end of file + (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}]])))) \ No newline at end of file diff --git a/src/status_im/ui/screens/profile/contact/views.cljs b/src/status_im/ui/screens/profile/contact/views.cljs index a9ea4b7244..959113e70a 100644 --- a/src/status_im/ui/screens/profile/contact/views.cljs +++ b/src/status_im/ui/screens/profile/contact/views.cljs @@ -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}])