From 21ef5a68b884e9170ea85a63509184112f38e13c Mon Sep 17 00:00:00 2001 From: Andrea Maria Piana Date: Tue, 18 Feb 2020 20:23:02 +0100 Subject: [PATCH] Add mark all read Signed-off-by: Andrea Maria Piana --- src/status_im/chat/models.cljs | 12 ++++++++ src/status_im/chat/models/message.cljs | 4 +-- src/status_im/commands/core.cljs | 12 ++------ src/status_im/contact/core.cljs | 4 +-- src/status_im/data_store/chats.cljs | 8 ++---- src/status_im/data_store/contacts.cljs | 12 ++------ src/status_im/data_store/messages.cljs | 28 +++++-------------- src/status_im/ens/core.cljs | 4 +-- src/status_im/ethereum/json_rpc.cljs | 8 ++++++ src/status_im/group_chats/core.cljs | 28 +++++-------------- src/status_im/mailserver/core.cljs | 8 ++---- src/status_im/multiaccounts/update/core.cljs | 4 +-- .../multiaccounts/update/publisher.cljs | 4 +-- src/status_im/pairing/core.cljs | 24 ++++------------ src/status_im/signing/core.cljs | 8 ++---- src/status_im/transport/core.cljs | 4 +-- src/status_im/transport/filters/core.cljs | 8 ++---- src/status_im/transport/message/protocol.cljs | 4 +-- .../ui/components/popup_menu/views.cljs | 2 ++ src/status_im/ui/screens/chat/sheets.cljs | 18 ++++++++++++ src/status_im/wallet/core.cljs | 8 ++---- status-go-version.json | 6 ++-- translations/en.json | 1 + 23 files changed, 87 insertions(+), 132 deletions(-) diff --git a/src/status_im/chat/models.cljs b/src/status_im/chat/models.cljs index 8a844f701d..3dc82fcc4b 100644 --- a/src/status_im/chat/models.cljs +++ b/src/status_im/chat/models.cljs @@ -118,6 +118,18 @@ [{:keys [db] :as cofx} chat-id] (chats-store/save-chat cofx (get-in db [:chats chat-id]))) +(fx/defn handle-mark-all-read-successful + {:events [::mark-all-read-successful]} + [{:keys [db] :as cofx} chat-id] + {:db (assoc-in db [:chats chat-id :unviewed-messages-count] 0)}) + +(fx/defn handle-mark-all-read + {:events [:chat.ui/mark-all-read-pressed]} + [{:keys [db] :as cofx} chat-id] + {::json-rpc/call [{:method (json-rpc/call-ext-method "markAllRead") + :params [chat-id] + :on-success #(re-frame/dispatch [::mark-all-read-successful chat-id])}]}) + (fx/defn add-public-chat "Adds new public group chat to db" [cofx topic] diff --git a/src/status_im/chat/models/message.cljs b/src/status_im/chat/models/message.cljs index 88d8499e37..7776551a0c 100644 --- a/src/status_im/chat/models/message.cljs +++ b/src/status_im/chat/models/message.cljs @@ -209,9 +209,7 @@ (fx/defn resend-message [{:keys [db] :as cofx} chat-id message-id] (fx/merge cofx - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_reSendChatMessage" - "shhext_reSendChatMessage") + {::json-rpc/call [{:method (json-rpc/call-ext-method "reSendChatMessage") :params [message-id] :on-success #(log/debug "re-sent message successfully") :on-error #(log/error "failed to re-send message" %)}]} diff --git a/src/status_im/commands/core.cljs b/src/status_im/commands/core.cljs index a41ce13020..2a56c05793 100644 --- a/src/status_im/commands/core.cljs +++ b/src/status_im/commands/core.cljs @@ -24,26 +24,20 @@ {:events [::accept-request-address-for-transaction]} [{:keys [db]} message-id address] {:db (dissoc db :commands/select-account) - ::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_acceptRequestAddressForTransaction" - "shhext_acceptRequestAddressForTransaction") + ::json-rpc/call [{:method (json-rpc/call-ext-method "acceptRequestAddressForTransaction") :params [message-id address] :on-success #(re-frame/dispatch [:transport/message-sent % 1])}]}) (fx/defn handle-decline-request-address-for-transaction {:events [::decline-request-address-for-transaction]} [cofx message-id] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_declineRequestAddressForTransaction" - "shhext_declineRequestAddressForTransaction") + {::json-rpc/call [{:method (json-rpc/call-ext-method "declineRequestAddressForTransaction") :params [message-id] :on-success #(re-frame/dispatch [:transport/message-sent % 1])}]}) (fx/defn handle-decline-request-transaction {:events [::decline-request-transaction]} [cofx message-id] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_declineRequestTransaction" - "shhext_declineRequestTransaction") + {::json-rpc/call [{:method (json-rpc/call-ext-method "declineRequestTransaction") :params [message-id] :on-success #(re-frame/dispatch [:transport/message-sent % 1])}]}) diff --git a/src/status_im/contact/core.cljs b/src/status_im/contact/core.cljs index 731d31880c..8e6a4b84dc 100644 --- a/src/status_im/contact/core.cljs +++ b/src/status_im/contact/core.cljs @@ -86,9 +86,7 @@ (fx/defn send-contact-request [{:keys [db] :as cofx} {:keys [public-key] :as contact}] (let [{:keys [name profile-image]} (own-info db)] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_sendContactUpdate" - "shhext_sendContactUpdate") + {::json-rpc/call [{:method (json-rpc/call-ext-method "sendContactUpdate") :params [public-key name profile-image] :on-success #(log/debug "contact request sent" public-key)}]})) diff --git a/src/status_im/data_store/chats.cljs b/src/status_im/data_store/chats.cljs index ec80bb8fbe..fb91d481d7 100644 --- a/src/status_im/data_store/chats.cljs +++ b/src/status_im/data_store/chats.cljs @@ -114,17 +114,13 @@ (dissoc :chatType :members))) (fx/defn save-chat [cofx {:keys [chat-id] :as chat}] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_saveChat" - "shhext_saveChat") + {::json-rpc/call [{:method (json-rpc/call-ext-method "saveChat") :params [(->rpc chat)] :on-success #(log/debug "saved chat" chat-id "successfuly") :on-failure #(log/error "failed to save chat" chat-id %)}]}) (fx/defn fetch-chats-rpc [cofx {:keys [on-success]}] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_chats" - "shhext_chats") + {::json-rpc/call [{:method (json-rpc/call-ext-method "chats") :params [] :on-success #(on-success (map <-rpc %)) :on-failure #(log/error "failed to fetch chats" 0 -1 %)}]}) diff --git a/src/status_im/data_store/contacts.cljs b/src/status_im/data_store/contacts.cljs index d6bb45f4d3..21e6826dcb 100644 --- a/src/status_im/data_store/contacts.cljs +++ b/src/status_im/data_store/contacts.cljs @@ -46,26 +46,20 @@ (fx/defn fetch-contacts-rpc [cofx on-success] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_contacts" - "shhext_contacts") + {::json-rpc/call [{:method (json-rpc/call-ext-method "contacts") :params [] :on-success #(on-success (map <-rpc %)) :on-failure #(log/error "failed to fetch contacts" %)}]}) (fx/defn save-contact [cofx {:keys [public-key] :as contact}] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_saveContact" - "shhext_saveContact") + {::json-rpc/call [{:method (json-rpc/call-ext-method "saveContact") :params [(->rpc contact)] :on-success #(log/debug "saved contact" public-key "successfuly") :on-failure #(log/error "failed to save contact" public-key %)}]}) (fx/defn block [cofx contact on-success] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_blockContact" - "shhext_blockContact") + {::json-rpc/call [{:method (json-rpc/call-ext-method "blockContact") :params [(->rpc contact)] :on-success on-success :on-failure #(log/error "failed to block contact" % contact)}]}) diff --git a/src/status_im/data_store/messages.cljs b/src/status_im/data_store/messages.cljs index ba3c863e57..b12f42b2f0 100644 --- a/src/status_im/data_store/messages.cljs +++ b/src/status_im/data_store/messages.cljs @@ -47,17 +47,13 @@ (dissoc :ensName :chatId :text :rtl :responseTo :sticker :lineCount :parsedText))) (defn update-outgoing-status-rpc [message-id status] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_updateMessageOutgoingStatus" - "shhext_updateMessageOutgoingStatus") + {::json-rpc/call [{:method (json-rpc/call-ext-method "updateMessageOutgoingStatus") :params [message-id status] :on-success #(log/debug "updated message outgoing stauts" message-id status) :on-failure #(log/error "failed to update message outgoing status" message-id status %)}]}) (defn save-system-messages-rpc [messages] - (json-rpc/call {:method (if config/waku-enabled? - "wakuext_addSystemMessages" - "shhext_addSystemMessages") + (json-rpc/call {:method (json-rpc/call-ext-method "addSystemMessages") :params [(map ->rpc messages)] :on-success #(re-frame/dispatch [:messages/system-messages-saved (map <-rpc %)]) :on-failure #(log/error "failed to save messages" %)})) @@ -67,42 +63,32 @@ limit on-success on-failure] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_chatMessages" - "shhext_chatMessages") + {::json-rpc/call [{:method (json-rpc/call-ext-method "chatMessages") :params [chat-id cursor limit] :on-success (fn [result] (on-success (update result :messages #(map <-rpc %)))) :on-failure on-failure}]}) (defn mark-seen-rpc [chat-id ids] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_markMessagesSeen" - "shhext_markMessagesSeen") + {::json-rpc/call [{:method (json-rpc/call-ext-method "markMessagesSeen") :params [chat-id ids] :on-success #(log/debug "successfully marked as seen") :on-failure #(log/error "failed to get messages" %)}]}) (defn delete-message-rpc [id] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_deleteMessage" - "shhext_deleteMessage") + {::json-rpc/call [{:method (json-rpc/call-ext-method "deleteMessage") :params [id] :on-success #(log/debug "successfully deleted message" id) :on-failure #(log/error "failed to delete message" % id)}]}) (defn delete-messages-from-rpc [author] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_deleteMessagesFrom" - "shhext_deleteMessagesFrom") + {::json-rpc/call [{:method (json-rpc/call-ext-method "deleteMessagesFrom") :params [author] :on-success #(log/debug "successfully deleted messages from" author) :on-failure #(log/error "failed to delete messages from" % author)}]}) (defn delete-messages-by-chat-id-rpc [chat-id] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_deleteMessagesByChatID" - "shhext_deleteMessagesByChatID") + {::json-rpc/call [{:method (json-rpc/call-ext-method "deleteMessagesByChatID") :params [chat-id] :on-success #(log/debug "successfully deleted messages by chat-id" chat-id) :on-failure #(log/error "failed to delete messages by chat-id" % chat-id)}]}) diff --git a/src/status_im/ens/core.cljs b/src/status_im/ens/core.cljs index 1216f9ad6e..322b4bfe9a 100644 --- a/src/status_im/ens/core.cljs +++ b/src/status_im/ens/core.cljs @@ -293,9 +293,7 @@ (navigation/navigate-to-cofx :ens-search {}))) (defn verify-names [names] - (json-rpc/call {:method (if config/waku-enabled? - "wakuext_verifyENSNames" - "shhext_verifyENSNames") + (json-rpc/call {:method (json-rpc/call-ext-method "verifyENSNames") :params [names] :on-success #(re-frame/dispatch [:contacts/ens-names-verified %]) :on-failure #(log/error "failed to resolve ens names" % names)})) diff --git a/src/status_im/ethereum/json_rpc.cljs b/src/status_im/ethereum/json_rpc.cljs index 0eabb58562..c4c3f8e4d1 100644 --- a/src/status_im/ethereum/json_rpc.cljs +++ b/src/status_im/ethereum/json_rpc.cljs @@ -2,6 +2,7 @@ (:require [clojure.string :as string] [re-frame.core :as re-frame] [status-im.ethereum.abi-spec :as abi-spec] + [status-im.utils.config :as config] [status-im.ethereum.decode :as decode] [status-im.native-module.core :as status] [status-im.utils.money :as money] @@ -64,6 +65,7 @@ "shhext_deleteMessagesByChatID" {} "shhext_deleteMessage" {} "shhext_markMessagesSeen" {} + "shhext_markAllRead" {} "shhext_confirmMessagesProcessedByID" {} "shhext_updateMessageOutgoingStatus" {} "shhext_chatMessages" {} @@ -114,6 +116,7 @@ "wakuext_deleteMessagesByChatID" {} "wakuext_deleteMessage" {} "wakuext_markMessagesSeen" {} + "wakuext_markAllRead" {} "wakuext_confirmMessagesProcessedByID" {} "wakuext_updateMessageOutgoingStatus" {} "wakuext_chatMessages" {} @@ -175,6 +178,11 @@ (call-method (update arg :number-of-retries dec))) on-error)) +(defn call-ext-method [method] + (if config/waku-enabled? + (str "wakuext_" method) + (str "shhext_" method))) + (defn call [{:keys [method params on-success] :as arg}] (if-let [method-options (json-rpc-api method)] diff --git a/src/status_im/group_chats/core.cljs b/src/status_im/group_chats/core.cljs index 81091bb05c..69d74a82a1 100644 --- a/src/status_im/group_chats/core.cljs +++ b/src/status_im/group_chats/core.cljs @@ -31,9 +31,7 @@ (fx/defn remove-member "Format group update message and sign membership" [{:keys [db] :as cofx} chat-id member] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_removeMemberFromGroupChat" - "shhext_removeMemberFromGroupChat") + {::json-rpc/call [{:method (json-rpc/call-ext-method "removeMemberFromGroupChat") :params [nil chat-id member] :on-success #(re-frame/dispatch [::chat-updated %])}]}) @@ -76,43 +74,33 @@ (fx/defn join-chat [cofx chat-id] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_confirmJoiningGroup" - "shhext_confirmJoiningGroup") + {::json-rpc/call [{:method (json-rpc/call-ext-method "confirmJoiningGroup") :params [chat-id] :on-success #(re-frame/dispatch [::chat-updated %])}]}) (fx/defn create [{:keys [db] :as cofx} group-name] (let [selected-contacts (:group/selected-contacts db)] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_createGroupChatWithMembers" - "shhext_createGroupChatWithMembers") + {::json-rpc/call [{:method (json-rpc/call-ext-method "createGroupChatWithMembers") :params [nil group-name (into [] selected-contacts)] :on-success #(re-frame/dispatch [::chat-updated %])}]})) (fx/defn make-admin [{:keys [db] :as cofx} chat-id member] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_addAdminsToGroupChat" - "shhext_addAdminsToGroupChat") + {::json-rpc/call [{:method (json-rpc/call-ext-method "addAdminsToGroupChat") :params [nil chat-id [member]] :on-success #(re-frame/dispatch [::chat-updated %])}]}) (fx/defn add-members "Add members to a group chat" [{{:keys [current-chat-id selected-participants]} :db :as cofx}] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_addMembersToGroupChat" - "shhext_addMembersToGroupChat") + {::json-rpc/call [{:method (json-rpc/call-ext-method "addMembersToGroupChat") :params [nil current-chat-id selected-participants] :on-success #(re-frame/dispatch [::chat-updated %])}]}) (fx/defn remove "Remove & leave chat" [{:keys [db] :as cofx} chat-id] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_leaveGroupChat" - "shhext_leaveGroupChat") + {::json-rpc/call [{:method (json-rpc/call-ext-method "leaveGroupChat") :params [nil chat-id] :on-success #(re-frame/dispatch [::chat-updated %])}]}) @@ -135,9 +123,7 @@ (let [new-name (get-in cofx [:db :group-chat-profile/profile :name]) current-chat-id (:current-chat-id db)] (when (valid-name? new-name) - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_changeGroupChatName" - "shhext_changeGroupChatName") + {::json-rpc/call [{:method (json-rpc/call-ext-method "changeGroupChatName") :params [nil current-chat-id new-name] :on-success #(re-frame/dispatch [::chat-updated %])}]}))) diff --git a/src/status_im/mailserver/core.cljs b/src/status_im/mailserver/core.cljs index 318dc15c6a..0b17cf95e0 100644 --- a/src/status_im/mailserver/core.cljs +++ b/src/status_im/mailserver/core.cljs @@ -89,9 +89,7 @@ ;; as sent. (defn update-mailservers! [enodes] (json-rpc/call - {:method (if config/waku-enabled? - "wakuext_updateMailservers" - "shhext_updateMailservers") + {:method (json-rpc/call-ext-method "updateMailservers") :params [enodes] :on-success #(log/debug "mailserver: update-mailservers success" %) :on-error #(log/error "mailserver: update-mailservers error" %)})) @@ -363,9 +361,7 @@ " cursor " cursor " limit " actual-limit) (json-rpc/call - {:method (if config/waku-enabled? - "wakuext_requestMessages" - "shhext_requestMessages") + {:method (json-rpc/call-ext-method "requestMessages") :params [(cond-> {:topics topics :mailServerPeer address :symKeyID sym-key-id diff --git a/src/status_im/multiaccounts/update/core.cljs b/src/status_im/multiaccounts/update/core.cljs index 0de9deccb9..8e96b7dbef 100644 --- a/src/status_im/multiaccounts/update/core.cljs +++ b/src/status_im/multiaccounts/update/core.cljs @@ -10,9 +10,7 @@ (fx/defn send-multiaccount-update [{:keys [db]}] (let [multiaccount (:multiaccount db) {:keys [name preferred-name photo-path address]} multiaccount] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_sendContactUpdates" - "shhext_sendContactUpdates") + {::json-rpc/call [{:method (json-rpc/call-ext-method "sendContactUpdates") :params [(or preferred-name name) photo-path] :on-success #(log/debug "sent contact update")}]})) diff --git a/src/status_im/multiaccounts/update/publisher.cljs b/src/status_im/multiaccounts/update/publisher.cljs index 01330ed691..72e99a946d 100644 --- a/src/status_im/multiaccounts/update/publisher.cljs +++ b/src/status_im/multiaccounts/update/publisher.cljs @@ -25,9 +25,7 @@ {:keys [name preferred-name photo-path address]} multiaccount] (log/debug "sending contact updates") - (json-rpc/call {:method (if config/waku-enabled? - "wakuext_sendContactUpdates" - "shhext_sendContactUpdates") + (json-rpc/call {:method (json-rpc/call-ext-method "sendContactUpdates") :params [(or preferred-name name) photo-path] :on-failure #(do (log/warn "failed to send contact updates") diff --git a/src/status_im/pairing/core.cljs b/src/status_im/pairing/core.cljs index 788325e281..2bfb31a390 100644 --- a/src/status_im/pairing/core.cljs +++ b/src/status_im/pairing/core.cljs @@ -19,33 +19,25 @@ [status-im.utils.types :as types])) (defn enable-installation-rpc [installation-id on-success on-failure] - (json-rpc/call {:method (if config/waku-enabled? - "wakuext_enableInstallation" - "shhext_enableInstallation") + (json-rpc/call {:method (json-rpc/call-ext-method "enableInstallation") :params [installation-id] :on-success on-success :on-failure on-failure})) (defn disable-installation-rpc [installation-id on-success on-failure] - (json-rpc/call {:method (if config/waku-enabled? - "wakuext_disableInstallation" - "shhext_disableInstallation") + (json-rpc/call {:method (json-rpc/call-ext-method "disableInstallation") :params [installation-id] :on-success on-success :on-failure on-failure})) (defn set-installation-metadata-rpc [installation-id metadata on-success on-failure] - (json-rpc/call {:method (if config/waku-enabled? - "wakuext_setInstallationMetadata" - "shhext_setInstallationMetadata") + (json-rpc/call {:method (json-rpc/call-ext-method "setInstallationMetadata") :params [installation-id metadata] :on-success on-success :on-failure on-failure})) (defn get-our-installations-rpc [on-success on-failure] - (json-rpc/call {:method (if config/waku-enabled? - "wakuext_getOurInstallations" - "shhext_getOurInstallations") + (json-rpc/call {:method (json-rpc/call-ext-method "getOurInstallations") :params [] :on-success on-success :on-failure on-failure})) @@ -73,9 +65,7 @@ (defn send-pair-installation [cofx] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_sendPairInstallation" - "shhext_sendPairInstallation") + {::json-rpc/call [{:method (json-rpc/call-ext-method "sendPairInstallation") :params [] :on-success #(log/info "sent pair installation message")}]}) @@ -199,9 +189,7 @@ (defn send-installation-messages [{:keys [db]}] (let [multiaccount (:multiaccount db) {:keys [name preferred-name photo-path]} multiaccount] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_syncDevices" - "shhext_syncDevices") + {::json-rpc/call [{:method (json-rpc/call-ext-method "syncDevices") :params [(or preferred-name name) photo-path] :on-success #(log/debug "successfully synced devices")}]})) diff --git a/src/status_im/signing/core.cljs b/src/status_im/signing/core.cljs index c226770313..fd87bb9ff3 100644 --- a/src/status_im/signing/core.cljs +++ b/src/status_im/signing/core.cljs @@ -212,9 +212,7 @@ (fx/defn send-transaction-message {:events [::send-transaction-message]} [cofx chat-id value contract transaction-hash signature] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_sendTransaction" - "shhext_sendTransaction") + {::json-rpc/call [{:method (json-rpc/call-ext-method "sendTransaction") :params [chat-id value contract transaction-hash (:result (types/json->clj signature))] :on-success @@ -223,9 +221,7 @@ (fx/defn send-accept-request-transaction-message {:events [::send-accept-transaction-message]} [cofx message-id transaction-hash signature] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_acceptRequestTransaction" - "shhext_acceptRequestTransaction") + {::json-rpc/call [{:method (json-rpc/call-ext-method "acceptRequestTransaction") :params [transaction-hash message-id (:result (types/json->clj signature))] :on-success diff --git a/src/status_im/transport/core.cljs b/src/status_im/transport/core.cljs index 20d5eadc84..bb9317ef79 100644 --- a/src/status_im/transport/core.cljs +++ b/src/status_im/transport/core.cljs @@ -40,9 +40,7 @@ initializiation is completed, otherwise we might receive messages/topics when the state has not been properly initialized." [cofx] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_startMessenger" - "shhext_startMessenger") + {::json-rpc/call [{:method (json-rpc/call-ext-method "startMessenger") :on-success #(do (log/debug "messenger initialized") (re-frame/dispatch [::init-whisper])) diff --git a/src/status_im/transport/filters/core.cljs b/src/status_im/transport/filters/core.cljs index 0af0f0895e..4c9dbccf68 100644 --- a/src/status_im/transport/filters/core.cljs +++ b/src/status_im/transport/filters/core.cljs @@ -18,17 +18,13 @@ (string/starts-with? k "0x")) (defn load-filters-rpc [chats on-success on-failure] - (json-rpc/call {:method (if config/waku-enabled? - "wakuext_loadFilters" - "shhext_loadFilters") + (json-rpc/call {:method (json-rpc/call-ext-method "loadFilters") :params [chats] :on-success on-success :on-failure on-failure})) (defn remove-filters-rpc [chats on-success on-failure] - (json-rpc/call {:method (if config/waku-enabled? - "wakuext_removeFilters" - "shhext_removeFilters") + (json-rpc/call {:method (json-rpc/call-ext-method "removeFilters") :params [chats] :on-success on-success :on-failure on-failure})) diff --git a/src/status_im/transport/message/protocol.cljs b/src/status_im/transport/message/protocol.cljs index 0663b0c89b..81d58380ba 100644 --- a/src/status_im/transport/message/protocol.cljs +++ b/src/status_im/transport/message/protocol.cljs @@ -14,9 +14,7 @@ sticker content-type] :as message}] - {::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_sendChatMessage" - "shhext_sendChatMessage") + {::json-rpc/call [{:method (json-rpc/call-ext-method "sendChatMessage") :params [{:chatId chat-id :text text :responseTo response-to diff --git a/src/status_im/ui/components/popup_menu/views.cljs b/src/status_im/ui/components/popup_menu/views.cljs index 81a8878fca..fd60f6d074 100644 --- a/src/status_im/ui/components/popup_menu/views.cljs +++ b/src/status_im/ui/components/popup_menu/views.cljs @@ -20,6 +20,8 @@ (when (and group-chat (not public?)) {:text (i18n/label :t/group-info) :on-select #(re-frame/dispatch [:show-group-chat-profile])}) + {:text (i18n/label :t/mark-all-read) + :on-select #(re-frame/dispatch [:chat.ui/mark-all-read-pressed chat-id])} {:text (i18n/label :t/clear-history) :on-select #(re-frame/dispatch [:chat.ui/clear-history-pressed chat-id])} {:text (i18n/label :t/fetch-history) diff --git a/src/status_im/ui/screens/chat/sheets.cljs b/src/status_im/ui/screens/chat/sheets.cljs index b7cfa0c90e..0bfe088bd0 100644 --- a/src/status_im/ui/screens/chat/sheets.cljs +++ b/src/status_im/ui/screens/chat/sheets.cljs @@ -37,6 +37,12 @@ :accessibility-label :view-chat-details-button :accessories [:chevron] :on-press #(hide-sheet-and-dispatch [:chat.ui/show-profile chat-id])}] + [list-item/list-item + {:theme :action + :title :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-pressed chat-id])}] [list-item/list-item {:theme :action :title :t/clear-history @@ -69,6 +75,12 @@ :on-press (fn [] (re-frame/dispatch [:bottom-sheet/hide-sheet]) (list-selection/open-share {:message message}))}]) + [list-item/list-item + {:theme :action + :title :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-pressed chat-id])}] [list-item/list-item {:theme :action :title :t/clear-history @@ -99,6 +111,12 @@ contact group-chat chat-name color online] :accessories [:chevron] :on-press #(hide-sheet-and-dispatch [:show-group-chat-profile chat-id])}] + [list-item/list-item + {:theme :action + :title :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-pressed chat-id])}] [list-item/list-item {:theme :action :title :t/clear-history diff --git a/src/status_im/wallet/core.cljs b/src/status_im/wallet/core.cljs index 85082ebb0f..ce42be8ff1 100644 --- a/src/status_im/wallet/core.cljs +++ b/src/status_im/wallet/core.cljs @@ -407,9 +407,7 @@ [to-norm amount-hex])})})) {:db db ::json-rpc/call - [{:method (if config/waku-enabled? - "wakuext_requestAddressForTransaction" - "shhext_requestAddressForTransaction") + [{:method (json-rpc/call-ext-method "requestAddressForTransaction") :params [(:current-chat-id db) from-address amount @@ -428,9 +426,7 @@ {:db (-> db (update-in [:chat-ui-props identity] dissoc :input-bottom-sheet) (dissoc db :wallet/prepare-transaction)) - ::json-rpc/call [{:method (if config/waku-enabled? - "wakuext_requestTransaction" - "shhext_requestTransaction") + ::json-rpc/call [{:method (json-rpc/call-ext-method "requestTransaction") :params [(:public-key to) amount (when-not (= symbol :ETH) diff --git a/status-go-version.json b/status-go-version.json index 95716797df..99a8857488 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -2,7 +2,7 @@ "_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh ' instead", "owner": "status-im", "repo": "status-go", - "version": "v0.45.1", - "commit-sha1": "9c2c08d44c839895f7e98a0c8f652d094d53cb2f", - "src-sha256": "0b03q4znblj737bgdbxi7qqpxqamii5ja8hw8rk1br0lll4i1jcr" + "version": "v0.47.0", + "commit-sha1": "5cc60de80b315c12c8a0583705be8d5c35b073f2", + "src-sha256": "1zqbadpwg4iizfwzfmw38hf98hj3zf99a3svyj22bbwqnqaxpbh4" } diff --git a/translations/en.json b/translations/en.json index 9c30256463..2c684388ed 100644 --- a/translations/en.json +++ b/translations/en.json @@ -655,6 +655,7 @@ "mainnet-text": "You’re on the Mainnet. Real ETH will be sent", "maintain-card-to-phone-contact": "Maintain card-to-phone contact during process.", "make-admin": "Make admin", + "mark-all-read": "Mark all read", "maybe-later": "Maybe later", "members": { "one": "1 member",