diff --git a/src/status_im/chat/models/loading.cljs b/src/status_im/chat/models/loading.cljs index 3163fef31e..6b69ab0173 100644 --- a/src/status_im/chat/models/loading.cljs +++ b/src/status_im/chat/models/loading.cljs @@ -45,12 +45,21 @@ (when current-chat-id {:db (assoc-in db [:pagination-info current-chat-id :loading-messages?] false)})) +(defn mark-chat-all-read + [db chat-id] + (update-in db [:chats chat-id] assoc + :unviewed-messages-count 0 + :unviewed-mentions-count 0)) + (fx/defn handle-mark-all-read-successful {:events [::mark-all-read-successful]} [{:keys [db]} chat-id] - {:db (update-in db [:chats chat-id] assoc - :unviewed-messages-count 0 - :unviewed-mentions-count 0)}) + {:db (mark-chat-all-read db chat-id)}) + +(fx/defn handle-mark-all-read-in-community-successful + {:events [::mark-all-read-in-community-successful]} + [{:keys [db]} chat-ids] + {:db (reduce mark-chat-all-read db chat-ids)}) (fx/defn handle-mark-all-read {:events [:chat.ui/mark-all-read-pressed :chat/mark-all-as-read]} @@ -60,6 +69,14 @@ :params [chat-id] :on-success #(re-frame/dispatch [::mark-all-read-successful chat-id])}]}) +(fx/defn handle-mark-mark-all-read-in-community + {:events [:chat.ui/mark-all-read-in-community-pressed]} + [_ community-id] + {:clear-message-notifications community-id + ::json-rpc/call [{:method (json-rpc/call-ext-method "markAllReadInCommunity") + :params [community-id] + :on-success #(re-frame/dispatch [::mark-all-read-in-community-successful %])}]}) + (fx/defn messages-loaded "Loads more messages for current chat" {:events [::messages-loaded]} diff --git a/src/status_im/ethereum/json_rpc.cljs b/src/status_im/ethereum/json_rpc.cljs index 829ea49374..c6aa28c15d 100644 --- a/src/status_im/ethereum/json_rpc.cljs +++ b/src/status_im/ethereum/json_rpc.cljs @@ -80,6 +80,7 @@ "wakuext_deleteMessage" {} "wakuext_markMessagesSeen" {} "wakuext_markAllRead" {} + "wakuext_markAllReadInCommunity" {} "wakuext_confirmMessagesProcessedByID" {} "wakuext_updateMessageOutgoingStatus" {} "wakuext_chatMessages" {} diff --git a/src/status_im/ui/screens/communities/community.cljs b/src/status_im/ui/screens/communities/community.cljs index 59375af245..d31311a137 100644 --- a/src/status_im/ui/screens/communities/community.cljs +++ b/src/status_im/ui/screens/communities/community.cljs @@ -117,6 +117,12 @@ true name (or color (rand-nth colors/chat-colors))])}] + [quo/list-item + {:theme :accent + :title (i18n/label :t/mark-all-read) + :accessibility-label :mark-all-read-button + :icon :main-icons/check + :on-press #(hide-sheet-and-dispatch [:chat.ui/mark-all-read-in-community-pressed id])}] (when can-manage-users? [:<> [quo/list-item diff --git a/src/status_im/ui/screens/communities/views.cljs b/src/status_im/ui/screens/communities/views.cljs index 568252b684..dbb400bd96 100644 --- a/src/status_im/ui/screens/communities/views.cljs +++ b/src/status_im/ui/screens/communities/views.cljs @@ -12,6 +12,7 @@ [status-im.ui.components.toolbar :as toolbar] [status-im.ui.components.badge :as badge] [status-im.ui.components.react :as react] + [status-im.ui.screens.communities.community :as community] [status-im.ui.screens.communities.icon :as communities.icon] [quo.design-system.colors :as quo.colors])) @@ -35,13 +36,16 @@ :accessibility-label :unviewed-messages-public}]))) (defn community-home-list-item [{:keys [id name last?] :as community}] - [react/touchable-opacity {:style (merge {:height 64} - (when last? - {:border-bottom-color (quo.colors/get-color :ui-01) - :border-bottom-width 1})) - :on-press (fn [] - (>evt [:dismiss-keyboard]) - (>evt [:navigate-to :community {:community-id id}]))} + [react/touchable-opacity {:style (merge {:height 64} + (when last? + {:border-bottom-color (quo.colors/get-color :ui-01) + :border-bottom-width 1})) + :on-press (fn [] + (>evt [:dismiss-keyboard]) + (>evt [:navigate-to :community {:community-id id}])) + :on-long-press #(>evt [:bottom-sheet/show-sheet + {:content (fn [] + [community/community-actions community])}])} [:<> [react/view {:top 12 :left 16 :position :absolute} [communities.icon/community-icon community]] diff --git a/status-go-version.json b/status-go-version.json index db8effa05c..e3ab0e8ac8 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -1,9 +1,9 @@ { - "_comment": "THIS SHOULD NOT BE EDITTED BY HAND.", + "_comment": "THIS SHOULD NOT BE EDITED BY HAND.", "_comment": "Instead use: scripts/update-status-go.sh ", "owner": "status-im", "repo": "status-go", - "version": "v0.86.7", - "commit-sha1": "93497f464410864ecf386e7494a544969ba9bd9e", - "src-sha256": "01kvn8bkijrlxar3ky2cyiwxvzig8h23wl3cazx4zamqgpnpijhq" + "version": "v0.87.0", + "commit-sha1": "fb218761d9d1620916ae7e8b19b9b4a03f92c767", + "src-sha256": "073qgjfn2cn1li6g4r38xizkifsl4xd1sm51784jmy7kq6gqs1gr" }