Always use waku

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
This commit is contained in:
Gheorghe Pinzaru 2020-09-14 15:36:14 +03:00 committed by Andrea Maria Piana
parent e2071dc968
commit 20b5ad9ebb
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
50 changed files with 243 additions and 417 deletions

View File

@ -4,7 +4,6 @@
[status-im.ethereum.core :as ethereum]
[status-im.i18n :as i18n]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.waku.core :as waku]
[status-im.utils.types :as types]))
(def acquisition-gateway {:mainnet "https://get.status.im"
@ -40,7 +39,7 @@
network (ethereum/chain-keyword db)]
{:db (assoc-in db [:acquisition :network-status]
(get network-statuses :initiated))
::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "signMessageWithChatKey")
::json-rpc/call [{:method (json-rpc/call-ext-method "signMessageWithChatKey")
:params [msg]
:on-error #(re-frame/dispatch [::on-error (i18n/label :t/sign-request-failed)])
:on-success #(re-frame/dispatch [::call-acquisition-gateway

View File

@ -4,7 +4,6 @@
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.transport.filters.core :as transport.filters]
[status-im.contact.core :as contact.core]
[status-im.waku.core :as waku]
[status-im.data-store.chats :as chats-store]
[status-im.data-store.messages :as messages-store]
[status-im.ethereum.json-rpc :as json-rpc]
@ -156,7 +155,7 @@
{:events [:chat.ui/mark-all-read-pressed
:chat.ui/mark-public-all-read]}
[{:keys [db] :as cofx} chat-id]
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "markAllRead")
{::json-rpc/call [{:method (json-rpc/call-ext-method "markAllRead")
:params [chat-id]
:on-success #(re-frame/dispatch [::mark-all-read-successful chat-id])}]})
@ -314,7 +313,7 @@
:chat-id chat-id}
#(re-frame/dispatch [::mute-chat-toggled chat-id muted?]))
{:db (assoc-in db [:chats chat-id :muted] muted?)
::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) method)
::json-rpc/call [{:method (json-rpc/call-ext-method method)
:params [chat-id]
:on-error #(re-frame/dispatch [::mute-chat-failed chat-id muted? %])
:on-success #(log/info method "successful" chat-id)}]})))

View File

@ -2,7 +2,6 @@
(:require [re-frame.core :as re-frame]
[status-im.constants :as constants]
[status-im.ui.screens.chat.state :as chat.state]
[status-im.waku.core :as waku]
[status-im.data-store.chats :as data-store.chats]
[status-im.data-store.messages :as data-store.messages]
[status-im.transport.filters.core :as filters]
@ -137,7 +136,6 @@
(get-in db [:pagination-info current-chat-id :loading-messages?]))
(let [cursor (get-in db [:pagination-info current-chat-id :cursor])
load-messages-fx (data-store.messages/messages-by-chat-id-rpc
(waku/enabled? cofx)
current-chat-id
cursor
constants/default-number-of-messages

View File

@ -11,7 +11,6 @@
[status-im.transport.message.protocol :as protocol]
[status-im.ui.screens.chat.state :as view.state]
[status-im.utils.fx :as fx]
[status-im.waku.core :as waku]
[taoensso.timbre :as log]))
(defn- prepare-message
@ -222,7 +221,7 @@
(fx/defn resend-message
[{:keys [db] :as cofx} chat-id message-id]
(fx/merge cofx
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "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" %)}]}

View File

@ -2,7 +2,6 @@
(:require [status-im.constants :as constants]
[re-frame.core :as re-frame]
[status-im.utils.fx :as fx]
[status-im.waku.core :as waku]
[taoensso.timbre :as log]
[status-im.transport.message.protocol :as message.protocol]
[status-im.data-store.reactions :as data-store.reactions]))
@ -38,7 +37,6 @@
(when-let [current-chat-id (:current-chat-id db)]
(when-let [session-id (get-in db [:pagination-info current-chat-id :messages-initialized?])]
(data-store.reactions/reactions-by-chat-id-rpc
(waku/enabled? cofx)
current-chat-id
cursor
constants/default-number-of-messages

View File

@ -2,8 +2,7 @@
(:require [re-frame.core :as re-frame]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.utils.fx :as fx]
[status-im.waku.core :as waku]))
[status-im.utils.fx :as fx]))
(fx/defn handle-prepare-accept-request-address-for-transaction
{:events [::prepare-accept-request-address-for-transaction]}
@ -23,20 +22,20 @@
{:events [::accept-request-address-for-transaction]}
[{:keys [db] :as cofx} message-id address]
{:db (dissoc db :commands/select-account)
::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "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 (json-rpc/call-ext-method (waku/enabled? cofx) "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 (json-rpc/call-ext-method (waku/enabled? cofx) "declineRequestTransaction")
{::json-rpc/call [{:method (json-rpc/call-ext-method "declineRequestTransaction")
:params [message-id]
:on-success #(re-frame/dispatch [:transport/message-sent % 1])}]})

View File

@ -121,7 +121,6 @@
:wallet/visible-tokens {:mainnet #{:SNT}}
:currency :usd
:appearance 0
:waku-enabled true
:log-level config/log-level
:webview-allow-permission-requests? false})

View File

@ -11,7 +11,6 @@
[status-im.tribute-to-talk.whitelist :as whitelist]
[status-im.navigation :as navigation]
[status-im.utils.fx :as fx]
[status-im.waku.core :as waku]
[taoensso.timbre :as log]
[clojure.string :as string]))
@ -78,7 +77,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 (json-rpc/call-ext-method (waku/enabled? cofx) "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)}]}))

View File

@ -3,7 +3,6 @@
[status-im.data-store.messages :as messages]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.utils.fx :as fx]
[status-im.waku.core :as waku]
[taoensso.timbre :as log]))
(def one-to-one-chat-type 1)
@ -95,7 +94,7 @@
(dissoc :chatType :members)))
(fx/defn save-chat [cofx {:keys [chat-id] :as chat} on-success]
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "saveChat")
{::json-rpc/call [{:method (json-rpc/call-ext-method "saveChat")
:params [(->rpc chat)]
:on-success #(do
(log/debug "saved chat" chat-id "successfuly")
@ -103,7 +102,7 @@
:on-failure #(log/error "failed to save chat" chat-id %)}]})
(fx/defn fetch-chats-rpc [cofx {:keys [on-success]}]
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "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 %)}]})

View File

@ -3,7 +3,6 @@
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.utils.fx :as fx]
[status-im.utils.types :as types]
[status-im.waku.core :as waku]
[taoensso.timbre :as log]))
(defn deserialize-tribute-to-talk [t]
@ -47,20 +46,20 @@
(fx/defn fetch-contacts-rpc
[cofx on-success]
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "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 (json-rpc/call-ext-method (waku/enabled? cofx) "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 (json-rpc/call-ext-method (waku/enabled? cofx) "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)}]})

View File

@ -2,7 +2,6 @@
(:require [clojure.set :as clojure.set]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.utils.fx :as fx]
[status-im.waku.core :as waku]
[taoensso.timbre :as log]))
(defn ->rpc [{:keys [content] :as message}]
@ -43,61 +42,60 @@
:outgoing (boolean (:outgoingStatus message)))
(dissoc :ensName :chatId :text :rtl :responseTo :image :sticker :lineCount :parsedText)))
(defn update-outgoing-status-rpc [waku-enabled? message-id status]
{::json-rpc/call [{:method (json-rpc/call-ext-method waku-enabled? "updateMessageOutgoingStatus")
(defn update-outgoing-status-rpc [message-id status]
{::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 messages-by-chat-id-rpc [waku-enabled?
chat-id
(defn messages-by-chat-id-rpc [chat-id
cursor
limit
on-success
on-failure]
{::json-rpc/call [{:method (json-rpc/call-ext-method waku-enabled? "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 [waku-enabled? chat-id ids on-success]
{::json-rpc/call [{:method (json-rpc/call-ext-method waku-enabled? "markMessagesSeen")
(defn mark-seen-rpc [chat-id ids on-success]
{::json-rpc/call [{:method (json-rpc/call-ext-method "markMessagesSeen")
:params [chat-id ids]
:on-success #(do
(log/debug "successfully marked as seen" %)
(when on-success (on-success chat-id ids %)))
:on-failure #(log/error "failed to get messages" %)}]})
(defn delete-message-rpc [waku-enabled? id]
{::json-rpc/call [{:method (json-rpc/call-ext-method waku-enabled? "deleteMessage")
(defn delete-message-rpc [id]
{::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 [waku-enabled? author]
{::json-rpc/call [{:method (json-rpc/call-ext-method waku-enabled? "deleteMessagesFrom")
(defn delete-messages-from-rpc [author]
{::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 [waku-enabled? chat-id]
{::json-rpc/call [{:method (json-rpc/call-ext-method waku-enabled? "deleteMessagesByChatID")
(defn delete-messages-by-chat-id-rpc [chat-id]
{::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)}]})
(fx/defn delete-message [cofx id]
(delete-message-rpc (waku/enabled? cofx) id))
(delete-message-rpc id))
(fx/defn delete-messages-from [cofx author]
(delete-messages-from-rpc (waku/enabled? cofx) author))
(delete-messages-from-rpc author))
(fx/defn mark-messages-seen [cofx chat-id ids on-success]
(mark-seen-rpc (waku/enabled? cofx) chat-id ids on-success))
(mark-seen-rpc chat-id ids on-success))
(fx/defn update-outgoing-status [cofx message-id status]
(update-outgoing-status-rpc (waku/enabled? cofx) message-id status))
(update-outgoing-status-rpc message-id status))
(fx/defn delete-messages-by-chat-id [cofx chat-id]
(delete-messages-by-chat-id-rpc (waku/enabled? cofx) chat-id))
(delete-messages-by-chat-id-rpc chat-id))

View File

@ -19,13 +19,12 @@
:messageType :message-type
:id :emoji-reaction-id})))
(defn reactions-by-chat-id-rpc [waku-enabled?
chat-id
(defn reactions-by-chat-id-rpc [chat-id
cursor
limit
on-success
on-failure]
{::json-rpc/call [{:method (json-rpc/call-ext-method waku-enabled? "emojiReactionsByChatID")
{::json-rpc/call [{:method (json-rpc/call-ext-method "emojiReactionsByChatID")
:params [chat-id cursor limit]
:on-success (fn [result]
(on-success (map <-rpc result)))

View File

@ -34,79 +34,6 @@
"waku_generateSymKeyFromPassword" {}
"waku_getSymKey" {}
"waku_markTrustedPeer" {}
"shhext_post" {}
"shhext_startMessenger" {}
"shhext_sendPairInstallation" {}
"shhext_syncDevices" {}
"shhext_requestMessages" {}
"shhext_sendDirectMessage" {}
"shhext_sendPublicMessage" {}
"shhext_enableInstallation" {}
"shhext_disableInstallation" {}
"shhext_sendChatMessage" {}
"shhext_confirmJoiningGroup" {}
"shhext_addAdminsToGroupChat" {}
"shhext_addMembersToGroupChat" {}
"shhext_removeMemberFromGroupChat" {}
"shhext_leaveGroupChat" {}
"shhext_changeGroupChatName" {}
"shhext_createGroupChatWithMembers" {}
"shhext_createGroupChatFromInvitation" {}
"shhext_reSendChatMessage" {}
"shhext_getOurInstallations" {}
"shhext_setInstallationMetadata" {}
"shhext_loadFilters" {}
"shhext_loadFilter" {}
"shhext_removeFilters" {}
"shhext_sendContactUpdate" {}
"shhext_sendContactUpdates" {}
"shhext_chats" {}
"shhext_addSystemMessages" {}
"shhext_deleteMessagesFrom" {}
"shhext_deleteMessagesByChatID" {}
"shhext_deleteMessage" {}
"shhext_markMessagesSeen" {}
"shhext_markAllRead" {}
"shhext_confirmMessagesProcessedByID" {}
"shhext_updateMessageOutgoingStatus" {}
"shhext_chatMessages" {}
"shhext_saveChat" {}
"shhext_muteChat" {}
"shhext_unmuteChat" {}
"shhext_contacts" {}
"shhext_prepareContent" {}
"shhext_blockContact" {}
"shhext_updateMailservers" {}
"shhext_sendEmojiReaction" {}
"shhext_sendEmojiReactionRetraction" {}
"shhext_emojiReactionsByChatID" {}
;;TODO not used anywhere?
"shhext_deleteChat" {}
"shhext_saveContact" {}
"shhext_verifyENSNames" {}
"shhext_requestAddressForTransaction" {}
"shhext_requestTransaction" {}
"shhext_acceptRequestAddressForTransaction" {}
"shhext_declineRequestAddressForTransaction" {}
"shhext_declineRequestTransaction" {}
"shhext_sendTransaction" {}
"shhext_acceptRequestTransaction" {}
"shhext_signMessageWithChatKey" {}
"shhext_sendGroupChatInvitationRequest" {}
"shhext_sendGroupChatInvitationRejection" {}
"shhext_getGroupChatInvitations" {}
"shhext_registerForPushNotifications" {}
"shhext_unregisterFromPushNotifications" {}
"shhext_enablePushNotificationsFromContactsOnly" {}
"shhext_disablePushNotificationsFromContactsOnly" {}
"shhext_startPushNotificationsServer" {}
"shhext_stopPushNotificationsServer" {}
"shhext_disableSendingNotifications" {}
"shhext_enableSendingNotifications" {}
"shhext_addPushNotificationsServer" {}
"shhext_getPushNotificationsServers" {}
"shhext_enablePushNotificationsBlockMentions" {}
"shhext_disablePushNotificationsBlockMentions" {}
"wakuext_post" {}
"wakuext_startMessenger" {}
"wakuext_sendPairInstallation" {}
@ -232,10 +159,8 @@
updated-delay)))
on-error))
(defn call-ext-method [waku-enabled? method]
(if waku-enabled?
(str "wakuext_" method)
(str "shhext_" method)))
(defn call-ext-method [method]
(str "wakuext_" method))
(defn call
[{:keys [method params on-success on-error] :as arg}]

View File

@ -12,13 +12,12 @@
[status-im.transport.filters.core :as transport.filters]
[status-im.navigation :as navigation]
[status-im.utils.fx :as fx]
[status-im.waku.core :as waku]
[status-im.constants :as constants]))
(fx/defn remove-member
"Format group update message and sign membership"
[{:keys [db] :as cofx} chat-id member]
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "removeMemberFromGroupChat")
{::json-rpc/call [{:method (json-rpc/call-ext-method "removeMemberFromGroupChat")
:params [nil chat-id member]
:on-success #(re-frame/dispatch [::chat-updated %])}]})
@ -61,14 +60,14 @@
(fx/defn join-chat
[cofx chat-id]
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "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 (json-rpc/call-ext-method (waku/enabled? cofx) "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 %])}]}))
@ -76,20 +75,20 @@
[cofx {:keys [chat-id invitation-admin chat-name]}]
(if (get-in cofx [:db :chats chat-id :is-active])
(models.chat/navigate-to-chat cofx chat-id)
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "createGroupChatFromInvitation")
{::json-rpc/call [{:method (json-rpc/call-ext-method "createGroupChatFromInvitation")
:params [chat-name chat-id invitation-admin]
:on-success #(re-frame/dispatch [::chat-updated %])}]}))
(fx/defn make-admin
[{:keys [db] :as cofx} chat-id member]
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "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 (json-rpc/call-ext-method (waku/enabled? cofx) "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 %])}]})
@ -98,7 +97,7 @@
{:events [:group-chats.ui/add-members-from-invitation]}
[{{:keys [current-chat-id] :as db} :db :as cofx} id participant]
{:db (assoc-in db [:group-chat/invitations id :state] constants/invitation-state-approved)
::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "addMembersToGroupChat")
::json-rpc/call [{:method (json-rpc/call-ext-method "addMembersToGroupChat")
:params [nil current-chat-id [participant]]
:on-success #(re-frame/dispatch [::chat-updated %])}]})
@ -106,7 +105,7 @@
"Leave chat"
{:events [:group-chats.ui/leave-chat-confirmed]}
[{:keys [db] :as cofx} chat-id]
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "leaveGroupChat")
{::json-rpc/call [{:method (json-rpc/call-ext-method "leaveGroupChat")
:params [nil chat-id true]
:on-success #(re-frame/dispatch [::chat-updated %])}]})
@ -130,7 +129,7 @@
[{:keys [db] :as cofx} chat-id new-name]
(when (valid-name? new-name)
{:db (assoc-in db [:chats chat-id :name] new-name)
::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "changeGroupChatName")
::json-rpc/call [{:method (json-rpc/call-ext-method "changeGroupChatName")
:params [nil chat-id new-name]
:on-success #(re-frame/dispatch [::chat-updated %])}]}))
@ -151,7 +150,7 @@
(let [{:keys [invitation-admin]} (get chats current-chat-id)
message (get-in db [:chat/memberships current-chat-id :message])]
{:db (assoc-in db [:chat/memberships current-chat-id] nil)
::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "sendGroupChatInvitationRequest")
::json-rpc/call [{:method (json-rpc/call-ext-method "sendGroupChatInvitationRequest")
:params [nil current-chat-id invitation-admin message]
:on-success #(re-frame/dispatch [:transport/invitation-sent %])}]}))
@ -159,7 +158,7 @@
"Send group chat membership rejection"
{:events [:send-group-chat-membership-rejection]}
[cofx invitation-id]
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "sendGroupChatInvitationRejection")
{::json-rpc/call [{:method (json-rpc/call-ext-method "sendGroupChatInvitationRejection")
:params [nil invitation-id]
:on-success #(re-frame/dispatch [:transport/invitation-sent %])}]})

View File

@ -22,7 +22,6 @@
[status-im.utils.handlers :as handlers]
[status-im.utils.random :as rand]
[status-im.utils.utils :as utils]
[status-im.waku.core :as waku]
[taoensso.timbre :as log]))
;; How do mailserver work ?
@ -86,9 +85,9 @@
;; We now wait for a confirmation from the mailserver before marking the message
;; as sent.
(defn update-mailservers! [waku-enabled? enodes]
(defn update-mailservers! [enodes]
(json-rpc/call
{:method (json-rpc/call-ext-method waku-enabled? "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" %)}))
@ -116,8 +115,8 @@
(re-frame/reg-fx
:mailserver/update-mailservers
(fn [[waku-enabled? enodes]]
(update-mailservers! waku-enabled? enodes)))
(fn [enodes]
(update-mailservers! enodes)))
(defn decrease-limit []
(max constants/min-limit (/ @limit 2)))
@ -143,11 +142,9 @@
(reset! limit (decrease-limit))
(reset! success-counter 0)))
(defn mark-trusted-peer! [waku-enabled? enode]
(defn mark-trusted-peer! [enode]
(json-rpc/call
{:method (if waku-enabled?
"waku_markTrustedPeer"
"shh_markTrustedPeer")
{:method "waku_markTrustedPeer"
:params [enode]
:on-success
#(re-frame/dispatch [:mailserver.callback/mark-trusted-peer-success %])
@ -156,8 +153,8 @@
(re-frame/reg-fx
:mailserver/mark-trusted-peer
(fn [[waku-enabled? enode]]
(mark-trusted-peer! waku-enabled? enode)))
(fn [enode]
(mark-trusted-peer! enode)))
(fx/defn generate-mailserver-symkey
[{:keys [db] :as cofx} {:keys [password id] :as mailserver}]
@ -166,14 +163,13 @@
:generating-sym-key?]
true)
:shh/generate-sym-key-from-password
[(waku/enabled? cofx)
{:password password
:on-success
(fn [_ sym-key-id]
(re-frame/dispatch
[:mailserver.callback/generate-mailserver-symkey-success
mailserver sym-key-id]))
:on-error #(log/error "mailserver: get-sym-key error" %)}]}))
:on-error #(log/error "mailserver: get-sym-key error" %)}}))
(defn registered-peer?
"truthy if the enode is a registered peer"
@ -190,7 +186,7 @@
(fetch-current db)]
(fx/merge cofx
{:db (update-mailserver-state db :added)
:mailserver/mark-trusted-peer [(waku/enabled? cofx) address]}
:mailserver/mark-trusted-peer address}
(when-not (or sym-key-id generating-sym-key?)
(generate-mailserver-symkey mailserver)))))
@ -207,7 +203,7 @@
;; Any message sent before this takes effect will not be marked as sent
;; probably we should improve the UX so that is more transparent to the
;; user
:mailserver/update-mailservers [(waku/enabled? cofx) [address]]}
:mailserver/update-mailservers [address]}
(when-not (or sym-key-id generating-sym-key?)
(generate-mailserver-symkey mailserver)))))
@ -346,8 +342,7 @@
request-id)}))))
(defn request-messages!
[waku-enabled?
{:keys [sym-key-id address]}
[{:keys [sym-key-id address]}
{:keys [topics cursor to from force-to?] :as request}]
;; Add some room to from, unless we break day boundaries so that
;; messages that have been received after the last request are also fetched
@ -363,7 +358,7 @@
" cursor " cursor
" limit " actual-limit)
(json-rpc/call
{:method (json-rpc/call-ext-method waku-enabled? "requestMessages")
{:method (json-rpc/call-ext-method "requestMessages")
:params [(cond-> {:topics topics
:mailServerPeer address
:symKeyID sym-key-id
@ -389,8 +384,8 @@
(re-frame/reg-fx
:mailserver/request-messages
(fn [{:keys [mailserver request waku-enabled?]}]
(request-messages! waku-enabled? mailserver request)))
(fn [{:keys [mailserver request]}]
(request-messages! mailserver request)))
(defn get-mailserver-when-ready
"return the mailserver if the mailserver is ready"
@ -462,8 +457,7 @@
:mailserver/pending-requests (count requests)
:mailserver/current-request request
:mailserver/request-to request-to)
:mailserver/request-messages {:waku-enabled? (waku/enabled? cofx)
:mailserver mailserver
:mailserver/request-messages {:mailserver mailserver
:request request}}
{:db (dissoc db
:mailserver/pending-requests
@ -784,8 +778,7 @@
(when-let [mailserver (get-mailserver-when-ready cofx)]
(let [request-with-cursor (assoc request :cursor cursor)]
{:db (assoc db :mailserver/current-request request-with-cursor)
:mailserver/request-messages {:waku-enabled? (waku/enabled? cofx)
:mailserver mailserver
:mailserver/request-messages {:mailserver mailserver
:request request-with-cursor}}))
(let [{:keys [gap chat-id]} request]
(fx/merge
@ -929,8 +922,7 @@
(not current-request)
(-> (assoc-in [:db :mailserver/current-request] first-request)
(assoc :mailserver/request-messages
{:waku-enabled? (waku/enabled? cofx)
:mailserver mailserver
{:mailserver mailserver
:request first-request})))))
(fx/defn resend-request
@ -972,8 +964,7 @@
{:db (update-in db [:mailserver/current-request :attempts] inc)
:mailserver/decrease-limit []
:mailserver/request-messages
{:waku-enabled? (waku/enabled? cofx)
:mailserver mailserver
{:mailserver mailserver
:request (assoc request :limit (decrease-limit))}})
:else

View File

@ -619,15 +619,13 @@
(is (= "mailserver-password"
(-> (mailserver/connect-to-mailserver {:db db})
:shh/generate-sym-key-from-password
second
:password))))
(let [mailserver-with-sym-key-db (assoc-in db
[:mailserver/mailservers :eth.staging "mailserverid" :sym-key-id]
"somesymkeyid")]
(testing "it does not generate a sym key if already present"
(is (not (-> (mailserver/connect-to-mailserver {:db mailserver-with-sym-key-db})
:shh/generate-sym-key-from-password
first)))))))
:shh/generate-sym-key-from-password)))))))
(deftest check-existing-gaps
(testing "no gaps"

View File

@ -29,8 +29,7 @@
[status-im.wallet.prices :as prices]
[status-im.acquisition.core :as acquisition]
[taoensso.timbre :as log]
[status-im.data-store.invitations :as data-store.invitations]
[status-im.waku.core :as waku]))
[status-im.data-store.invitations :as data-store.invitations]))
(re-frame/reg-fx
::login
@ -168,7 +167,7 @@
(fx/defn get-group-chat-invitations [cofx]
{::json-rpc/call
[{:method (json-rpc/call-ext-method (waku/enabled? cofx) "getGroupChatInvitations")
[{:method (json-rpc/call-ext-method "getGroupChatInvitations")
:on-success #(re-frame/dispatch [::initialize-invitations %])}]})
(fx/defn get-settings-callback
@ -260,7 +259,7 @@
;;so here we set it at 1 already so that it passes the check once it has
;;been initialized
:filters/initialized 1))
:filters/load-filters [[(:waku-enabled multiaccount) []]]}
:filters/load-filters [[]]}
(finish-keycard-setup)
(when first-account?
(acquisition/create))

View File

@ -6,7 +6,7 @@
(fx/defn send-multiaccount-update [{:keys [db] :as cofx}]
(let [multiaccount (:multiaccount db)
{:keys [name preferred-name photo-path address]} multiaccount]
{::json-rpc/call [{:method (json-rpc/call-ext-method (get-in db [:multiaccount :waku-enabled]) "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")}]}))

View File

@ -1,13 +1,12 @@
(ns status-im.multiaccounts.update.publisher
(:require [re-frame.core :as re-frame]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.waku.core :as waku]
[taoensso.timbre :as log]))
;; Publish updates every 48 hours
(def publish-updates-interval (* 48 60 60 1000))
(defn publish-update! [{:keys [db now] :as cofx}]
(defn publish-update! [{:keys [db now]}]
(let [peers-count (:peers-count db)
last-updated (get-in
db
@ -20,7 +19,7 @@
{:keys [name preferred-name photo-path]} multiaccount]
(log/debug "sending contact updates")
(json-rpc/call {:method (json-rpc/call-ext-method (waku/enabled? cofx) "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")

View File

@ -91,7 +91,7 @@
current-fleet (get-current-fleet db)
rendezvous-nodes (pick-nodes 3 (vals (:rendezvous current-fleet)))
{:keys [installation-id log-level
waku-enabled waku-bloom-filter-mode
waku-bloom-filter-mode
custom-bootnodes custom-bootnodes-enabled?]} multiaccount
use-custom-bootnodes (get custom-bootnodes-enabled? current-network)]
(cond-> (get-in networks [current-network :config])
@ -119,7 +119,7 @@
:PermissionsConfig {:Enabled true}
:MailserversConfig {:Enabled true}
:EnableNTPSync true
(if waku-enabled :WakuConfig :WhisperConfig)
:WakuConfig
{:Enabled true
:BloomFilterMode waku-bloom-filter-mode
:LightClient true

View File

@ -7,8 +7,7 @@
[status-im.native-module.core :as status]
[quo.platform :as platform]
[status-im.utils.config :as config]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.waku.core :as waku]))
[status-im.ethereum.json-rpc :as json-rpc]))
(def server-type-default 1)
(def server-type-custom 2)
@ -85,7 +84,7 @@
(fx/defn handle-enable-notifications-event
{:events [::registered-for-push-notifications]}
[cofx token]
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "registerForPushNotifications")
{::json-rpc/call [{:method (json-rpc/call-ext-method "registerForPushNotifications")
:params [token (if platform/ios? config/apn-topic) (if platform/ios? apn-token-type firebase-token-type)]
:on-success #(log/info "[push-notifications] register-success" %)
:on-error #(re-frame/dispatch [::switch-error true %])}]})
@ -93,7 +92,7 @@
(fx/defn handle-disable-notifications-event
{:events [::unregistered-from-push-notifications]}
[cofx]
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "unregisterFromPushNotifications")
{::json-rpc/call [{:method (json-rpc/call-ext-method "unregisterFromPushNotifications")
:params []
:on-success #(log/info "[push-notifications] unregister-success" %)
:on-error #(re-frame/dispatch [::switch-error false %])}]})
@ -102,7 +101,7 @@
[cofx]
(merge {::logout-disable nil}
(when platform/ios?
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "unregisterFromPushNotifications")
{::json-rpc/call [{:method (json-rpc/call-ext-method "unregisterFromPushNotifications")
:params []
:on-success #(log/info "[push-notifications] unregister-success" %)
:on-error #(log/info "[push-notifications] unregister-error" %)}]})))
@ -146,7 +145,7 @@
"enablePushNotificationsFromContactsOnly"
"disablePushNotificationsFromContactsOnly")]
(fx/merge cofx
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) method)
{::json-rpc/call [{:method (json-rpc/call-ext-method method)
:params []
:on-success #(log/info "[push-notifications] contacts-notification-success" %)
:on-error #(re-frame/dispatch [::non-contacts-update-error enabled? %])}]}
@ -161,7 +160,7 @@
"disablePushNotificationsBlockMentions")]
(log/info "USING METHOD" method enabled?)
(fx/merge cofx
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) method)
{::json-rpc/call [{:method (json-rpc/call-ext-method method)
:params []
:on-success #(log/info "[push-notifications] block-mentions-success" %)
:on-error #(re-frame/dispatch [::block-mentions-update-error enabled? %])}]}
@ -175,7 +174,7 @@
"startPushNotificationsServer"
"stopPushNotificationsServer")]
(fx/merge cofx
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) method)
{::json-rpc/call [{:method (json-rpc/call-ext-method method)
:params []
:on-success #(log/info "[push-notifications] switch-server-enabled successful" %)
:on-error #(re-frame/dispatch [::push-notifications-server-update-error enabled? %])}]}
@ -189,7 +188,7 @@
"enableSendingNotifications"
"disableSendingNotifications")]
(fx/merge cofx
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) method)
{::json-rpc/call [{:method (json-rpc/call-ext-method method)
:params []
:on-success #(log/info "[push-notifications] switch-send-notifications successful" %)
:on-error #(re-frame/dispatch [::push-notifications-send-update-error enabled? %])}]}
@ -205,7 +204,7 @@
{:events [::add-server]}
[{:keys [db] :as cofx} public-key]
(fx/merge cofx
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "addPushNotificationsServer")
{::json-rpc/call [{:method (json-rpc/call-ext-method "addPushNotificationsServer")
:params [public-key]
:on-success #(do
(log/info "[push-notifications] switch-send-notifications successful" %)
@ -220,7 +219,7 @@
(fx/defn fetch-push-notifications-servers
{:events [::fetch-servers]}
[cofx]
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "getPushNotificationsServers")
{::json-rpc/call [{:method (json-rpc/call-ext-method "getPushNotificationsServers")
:params []
:on-success #(do
(log/info "[push-notifications] servers fetched" %)

View File

@ -6,29 +6,28 @@
[status-im.utils.config :as config]
[status-im.utils.fx :as fx]
[status-im.utils.platform :as utils.platform]
[status-im.waku.core :as waku]
[taoensso.timbre :as log]))
(defn enable-installation-rpc [waku-enabled? installation-id on-success on-failure]
(json-rpc/call {:method (json-rpc/call-ext-method waku-enabled? "enableInstallation")
(defn enable-installation-rpc [installation-id on-success on-failure]
(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 [waku-enabled? installation-id on-success on-failure]
(json-rpc/call {:method (json-rpc/call-ext-method waku-enabled? "disableInstallation")
(defn disable-installation-rpc [installation-id on-success on-failure]
(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 [waku-enabled? installation-id metadata on-success on-failure]
(json-rpc/call {:method (json-rpc/call-ext-method waku-enabled? "setInstallationMetadata")
(defn set-installation-metadata-rpc [installation-id metadata on-success on-failure]
(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 [waku-enabled? on-success on-failure]
(json-rpc/call {:method (json-rpc/call-ext-method waku-enabled? "getOurInstallations")
(defn get-our-installations-rpc [on-success on-failure]
(json-rpc/call {:method (json-rpc/call-ext-method "getOurInstallations")
:params []
:on-success on-success
:on-failure on-failure}))
@ -55,8 +54,8 @@
(sort (partial compare-installation our-installation-id) installations))
(defn send-pair-installation
[cofx]
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "sendPairInstallation")
[_]
{::json-rpc/call [{:method (json-rpc/call-ext-method "sendPairInstallation")
:params []
:on-success #(log/info "sent pair installation message")}]})
@ -82,13 +81,12 @@
"Set the name of the device"
[{:keys [db] :as cofx} installation-name]
(let [our-installation-id (get-in db [:multiaccount :installation-id])]
{:pairing/set-installation-metadata [(waku/enabled? cofx)
our-installation-id
{:pairing/set-installation-metadata [our-installation-id
{:name installation-name
:deviceType utils.platform/os}]}))
(fx/defn init [cofx]
{:pairing/get-our-installations (waku/enabled? cofx)})
{:pairing/get-our-installations nil})
(fx/defn enable [{:keys [db]} installation-id]
{:db (assoc-in db
@ -120,64 +118,61 @@
[result]
(re-frame/dispatch [:pairing.callback/get-our-installations-success result]))
(defn enable-installation! [waku-enabled? installation-id]
(defn enable-installation! [installation-id]
(enable-installation-rpc
waku-enabled?
installation-id
(partial handle-enable-installation-response-success installation-id)
nil))
(defn disable-installation! [waku-enabled? installation-id]
(defn disable-installation! [installation-id]
(disable-installation-rpc
waku-enabled?
installation-id
(partial handle-disable-installation-response-success installation-id)
nil))
(defn set-installation-metadata! [waku-enabled? installation-id metadata]
(defn set-installation-metadata! [installation-id metadata]
(set-installation-metadata-rpc
waku-enabled?
installation-id
metadata
(partial handle-set-installation-metadata-response-success installation-id metadata)
nil))
(defn get-our-installations [waku-enabled?]
(get-our-installations-rpc waku-enabled? handle-get-our-installations-response-success nil))
(defn get-our-installations []
(get-our-installations-rpc handle-get-our-installations-response-success nil))
(defn enable-fx [cofx installation-id]
(if (< (count (filter :enabled? (vals (get-in cofx [:db :pairing/installations])))) (inc config/max-installations))
{:pairing/enable-installation [(waku/enabled? cofx) installation-id]}
{:pairing/enable-installation [installation-id]}
{:utils/show-popup {:title (i18n/label :t/pairing-maximum-number-reached-title)
:content (i18n/label :t/pairing-maximum-number-reached-content)}}))
(defn disable-fx [cofx installation-id]
{:pairing/disable-installation [(waku/enabled? cofx) installation-id]})
(defn disable-fx [_ installation-id]
{:pairing/disable-installation [installation-id]})
(re-frame/reg-fx
:pairing/enable-installation
(fn [[waku-enabled? installation-id]]
(enable-installation! waku-enabled? installation-id)))
(fn [[installation-id]]
(enable-installation! installation-id)))
(re-frame/reg-fx
:pairing/disable-installation
(fn [[waku-enabled? installation-id]]
(disable-installation! waku-enabled? installation-id)))
(fn [[installation-id]]
(disable-installation! installation-id)))
(re-frame/reg-fx
:pairing/set-installation-metadata
(fn [[waku-enabled? installation-id metadata]]
(set-installation-metadata! waku-enabled? installation-id metadata)))
(fn [[installation-id metadata]]
(set-installation-metadata! installation-id metadata)))
(re-frame/reg-fx
:pairing/get-our-installations
get-our-installations)
(defn send-installation-messages [{:keys [db] :as cofx}]
(defn send-installation-messages [{:keys [db]}]
(let [multiaccount (:multiaccount db)
{:keys [name preferred-name photo-path]} multiaccount]
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "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")}]}))

View File

@ -17,7 +17,6 @@
[status-im.utils.security :as security]
[status-im.utils.types :as types]
[status-im.utils.utils :as utils]
[status-im.waku.core :as waku]
[status-im.wallet.prices :as prices]
[taoensso.timbre :as log]))
@ -223,7 +222,7 @@
(fx/defn send-transaction-message
{:events [:sign/send-transaction-message]}
[cofx chat-id value contract transaction-hash signature]
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "sendTransaction")
{::json-rpc/call [{:method (json-rpc/call-ext-method "sendTransaction")
:params [chat-id value contract transaction-hash
(or (:result (types/json->clj signature))
(ethereum/normalized-hex signature))]
@ -233,7 +232,7 @@
(fx/defn send-accept-request-transaction-message
{:events [:sign/send-accept-transaction-message]}
[cofx message-id transaction-hash signature]
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "acceptRequestTransaction")
{::json-rpc/call [{:method (json-rpc/call-ext-method "acceptRequestTransaction")
:params [transaction-hash message-id
(or (:result (types/json->clj signature))
(ethereum/normalized-hex signature))]

View File

@ -477,12 +477,6 @@
(fn [multiaccount]
(get multiaccount :log-level)))
(re-frame/reg-sub
:waku/enabled
:<- [:multiaccount]
(fn [multiaccount]
(boolean (get multiaccount :waku-enabled))))
(re-frame/reg-sub
:waku/bloom-filter-mode
:<- [:multiaccount]

View File

@ -10,7 +10,6 @@
[status-im.utils.handlers :as handlers]
[status-im.utils.publisher :as publisher]
status-im.transport.shh
[status-im.waku.core :as waku]
[taoensso.timbre :as log]))
(defn set-node-info [{:keys [db]} node-info]
@ -38,7 +37,7 @@
initializiation is completed, otherwise we might receive messages/topics
when the state has not been properly initialized."
[cofx]
{::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "startMessenger")
{::json-rpc/call [{:method (json-rpc/call-ext-method "startMessenger")
:on-success #(do
(log/debug "messenger initialized")
(re-frame/dispatch [::init-whisper]))

View File

@ -9,32 +9,31 @@
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.utils.fx :as fx]
[status-im.utils.handlers :as handlers]
[status-im.waku.core :as waku]
[taoensso.timbre :as log]))
(defn is-public-key? [k]
(string/starts-with? k "0x"))
(defn load-filters-rpc [waku-enabled? chats on-success on-failure]
(json-rpc/call {:method (json-rpc/call-ext-method waku-enabled? "loadFilters")
(defn load-filters-rpc [chats on-success on-failure]
(json-rpc/call {:method (json-rpc/call-ext-method "loadFilters")
:params [chats]
:on-success on-success
:on-failure on-failure}))
(defn remove-filters-rpc [waku-enabled? chats on-success on-failure]
(json-rpc/call {:method (json-rpc/call-ext-method waku-enabled? "removeFilters")
(defn remove-filters-rpc [chats on-success on-failure]
(json-rpc/call {:method (json-rpc/call-ext-method "removeFilters")
:params [chats]
:on-success on-success
:on-failure on-failure}))
;; fx functions
(defn load-filter-fx [waku-enabled? filters]
{:filters/load-filters [[waku-enabled? filters]]})
(defn load-filter-fx [filters]
{:filters/load-filters [[filters]]})
(defn remove-filter-fx [waku-enabled? filters]
(defn remove-filter-fx [filters]
(when (seq filters)
{:filters/remove-filters [waku-enabled? filters]}))
{:filters/remove-filters [filters]}))
;; dispatches
@ -258,7 +257,7 @@
filters (concat
(chats->filter-requests chats)
(contacts->filter-requests contacts))]
(load-filter-fx (waku/enabled? cofx) filters)))
(load-filter-fx filters)))
;; Load functions: utility function to load filters
@ -268,27 +267,27 @@
(when (and (filters-initialized? db)
(not (chat-loaded? db chat-id)))
(let [chat (get-in db [:chats chat-id])]
(load-filter-fx (waku/enabled? cofx) (->filter-request chat)))))
(load-filter-fx (->filter-request chat)))))
(fx/defn load-chats
"Check if a filter already exists for that chat, otherw load the filter"
[{:keys [db] :as cofx} chats]
(let [chats (filter #(chat-loaded? db (:chat-id %)) chats)]
(when (and (filters-initialized? db) (seq chats))
(load-filter-fx (waku/enabled? cofx) (chats->filter-requests chats)))))
(load-filter-fx (chats->filter-requests chats)))))
(fx/defn load-contact
"Check if we already have a filter for that contact, otherwise load the filter
if the contact has been added"
[{:keys [db] :as cofx} contact]
(when-not (chat-loaded? db (:public-key contact))
(load-filter-fx (waku/enabled? cofx) (contacts->filter-requests [contact]))))
(load-filter-fx (contacts->filter-requests [contact]))))
(fx/defn load-member
"Check if we already have a filter for that member, otherwise load the filter, regardless of whether is in our contacts"
[{:keys [db] :as cofx} public-key]
(when-not (chat-loaded? db public-key)
(load-filter-fx (waku/enabled? cofx) (->filter-request {:chat-id public-key}))))
(load-filter-fx (->filter-request {:chat-id public-key}))))
(fx/defn load-members
"Load multiple members"
@ -319,7 +318,6 @@
;; we exclude the negotiated filters as those are not to be removed
;; otherwise we might miss messages
(remove-filter-fx
(waku/enabled? cofx)
(non-negotiated-filters-for-chat-id db chat-id))))))
;; reg-fx
@ -346,10 +344,9 @@
;; we should recreate it.
(re-frame/reg-fx
:filters/remove-filters
(fn [[waku-enabled? filters]]
(fn [[filters]]
(log/debug "removing filters" filters)
(remove-filters-rpc
waku-enabled?
(map ->remove-filter-request filters)
#(filters-removed! filters)
#(log/error "remove-filters: failed error" %))))
@ -357,10 +354,8 @@
(re-frame/reg-fx
:filters/load-filters
(fn [raw-filters]
(let [waku-enabled? (first (first raw-filters))
all-filters (mapcat second raw-filters)]
(let [all-filters (mapcat first raw-filters)]
(load-filters-rpc
waku-enabled?
all-filters
#(filters-added! (map responses->filters %))
#(log/error "load-filters: failed error" %)))))

View File

@ -24,7 +24,7 @@
"b" {:chat-id chat-id :negotiated? true}}}}
chat-id)]
(is fx)
(is (= fx {:filters/remove-filters [nil [{:chat-id chat-id :filter-id "a"}]]})))))
(is (= fx {:filters/remove-filters [[{:chat-id chat-id :filter-id "a"}]]})))))
(testing "the user is still in some group chats"
(testing "we joined, and group chat is active it does not remove filters"
(let [fx (transport.filters/stop-listening {:db {:multiaccount {:public-key me}
@ -46,7 +46,7 @@
{member-1 {:chat-id member-1 :filter-id "a"}}}}
member-1)]
(is fx)
(is (= fx {:filters/remove-filters [nil [{:chat-id member-1 :filter-id "a"}]]})))))
(is (= fx {:filters/remove-filters [[{:chat-id member-1 :filter-id "a"}]]})))))
(testing "we have a 1-to-1 chat with the user"
(testing "it does not remove filter"
(let [fx (transport.filters/stop-listening {:db {:chats
@ -98,17 +98,17 @@
(deftest load-member
(testing "it returns fx for a member"
(is (= {:filters/load-filters [[nil [{:ChatID "0xchat-id-2"
(is (= {:filters/load-filters [[[{:ChatID "0xchat-id-2"
:OneToOne true
:Identity "chat-id-2"}]]]}
(transport.filters/load-member {:db {}} "0xchat-id-2"))))
(testing "merging fx"
(is (=
{:db {}
:filters/load-filters [[nil [{:ChatID "0xchat-id-1"
:filters/load-filters [[[{:ChatID "0xchat-id-1"
:OneToOne true
:Identity "chat-id-1"}]]
[nil [{:ChatID "0xchat-id-2"
[[{:ChatID "0xchat-id-2"
:OneToOne true
:Identity "chat-id-2"}]]]}
(apply fx/merge {:db {}}

View File

@ -17,7 +17,6 @@
content-type]
:as message}]
{::json-rpc/call [{:method (json-rpc/call-ext-method
(get-in cofx [:db :multiaccount :waku-enabled])
"sendChatMessage")
:params [{:chatId chat-id
:text text
@ -34,7 +33,6 @@
(fx/defn send-reaction [cofx {:keys [message-id chat-id emoji-id]}]
{::json-rpc/call [{:method (json-rpc/call-ext-method
(get-in cofx [:db :multiaccount :waku-enabled])
"sendEmojiReaction")
:params [chat-id message-id emoji-id]
:on-success
@ -43,7 +41,6 @@
(fx/defn send-retract-reaction [cofx {:keys [emoji-reaction-id] :as reaction}]
{::json-rpc/call [{:method (json-rpc/call-ext-method
(get-in cofx [:db :multiaccount :waku-enabled])
"sendEmojiReactionRetraction")
:params [emoji-reaction-id]
:on-success

View File

@ -5,19 +5,15 @@
[taoensso.timbre :as log]))
(defn generate-sym-key-from-password
[waku-enabled? {:keys [password on-success on-error]}]
(json-rpc/call {:method (if waku-enabled?
"waku_generateSymKeyFromPassword"
"shh_generateSymKeyFromPassword")
[{:keys [password on-success on-error]}]
(json-rpc/call {:method "waku_generateSymKeyFromPassword"
:params [password]
:on-success on-success
:on-error on-error}))
(defn get-sym-key
[waku-enabled? {:keys [sym-key-id on-success on-error]}]
(json-rpc/call {:method (if waku-enabled?
"waku_getSymKey"
"shh_getSymKey")
[{:keys [sym-key-id on-success on-error]}]
(json-rpc/call {:method "waku_getSymKey"
:params [sym-key-id]
:on-success on-success
:on-error on-error}))
@ -27,13 +23,11 @@
(re-frame/reg-fx
:shh/generate-sym-key-from-password
(fn [[waku-enabled? {:keys [password on-success]}]]
(fn [{:keys [password on-success]}]
(generate-sym-key-from-password
waku-enabled?
{:password password
:on-success (fn [sym-key-id]
(get-sym-key waku-enabled?
{:sym-key-id sym-key-id
(get-sym-key {:sym-key-id sym-key-id
:on-success (fn [sym-key]
(on-success sym-key sym-key-id))
:on-error log-error}))

View File

@ -10,7 +10,6 @@
(defn- normal-mode-settings-data [{:keys [network-name
current-log-level
waku-enabled
waku-bloom-filter-mode
current-fleet]}]
[{:size :small
@ -63,15 +62,6 @@
:on-press
#(re-frame/dispatch [:navigate-to :notifications-advanced-settings])
:chevron true})
{:size :small
:title (i18n/label :t/waku-enabled)
:accessibility-label :waku-enabled-settings-switch
:container-margin-bottom 8
:on-press
#(re-frame/dispatch
[:multiaccounts.ui/waku-enabled-switched (not waku-enabled)])
:accessory :switch
:active waku-enabled}
{:size :small
:title (i18n/label :t/waku-bloom-filter-mode)
:accessibility-label :waku-bloom-filter-mode-settings-switch
@ -131,7 +121,6 @@
(views/defview advanced-settings []
(views/letsubs [{:keys [chaos-mode?]} [:multiaccount]
network-name [:network-name]
waku-enabled [:waku/enabled]
waku-bloom-filter-mode [:waku/bloom-filter-mode]
current-log-level [:log-level/current-log-level]
current-fleet [:fleets/current-fleet]]
@ -143,7 +132,6 @@
:current-log-level current-log-level
:current-fleet current-fleet
:dev-mode? false
:waku-enabled waku-enabled
:waku-bloom-filter-mode waku-bloom-filter-mode
:chaos-mode? chaos-mode?})
:key-fn (fn [_ i] (str i))

View File

@ -35,7 +35,6 @@
(def group-chat-enabled? (enabled? (get-config :GROUP_CHATS_ENABLED "0")))
(def tooltip-events? (enabled? (get-config :TOOLTIP_EVENTS "0")))
(def nimbus-enabled? (enabled? (get-config :STATUS_GO_ENABLE_NIMBUS "0")))
(def waku-enabled? (enabled? (get-config :WAKU_ENABLED "0")))
(def commands-enabled? (enabled? (get-config :COMMANDS_ENABLED "0")))
(def keycard-test-menu-enabled? (enabled? (get-config :KEYCARD_TEST_MENU "0")))
(def qr-test-menu-enabled? (enabled? (get-config :QR_READ_TEST_MENU "0")))

View File

@ -4,18 +4,6 @@
[status-im.node.core :as node]
[status-im.utils.fx :as fx]))
(defn enabled? [cofx]
(get-in cofx [:db :multiaccount :waku-enabled]))
(fx/defn switch-waku-enabled
{:events [:multiaccounts.ui/waku-enabled-switched]}
[cofx enabled?]
(fx/merge cofx
(multiaccounts.update/multiaccount-update :waku-enabled enabled?
{})
(node/prepare-new-config
{:on-success #(re-frame/dispatch [:logout])})))
(fx/defn switch-waku-bloom-filter-mode
{:events [:multiaccounts.ui/waku-bloom-filter-mode-switched]}
[cofx enabled?]

View File

@ -3,7 +3,6 @@
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.constants :as constants]
[status-im.qr-scanner.core :as qr-scaner]
[status-im.waku.core :as waku]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.eip55 :as eip55]
[status-im.ethereum.json-rpc :as json-rpc]
@ -371,7 +370,7 @@
[to-norm amount-hex])})}))
{:db db
::json-rpc/call
[{:method (json-rpc/call-ext-method (waku/enabled? cofx) "requestAddressForTransaction")
[{:method (json-rpc/call-ext-method "requestAddressForTransaction")
:params [(:current-chat-id db)
from-address
amount
@ -387,7 +386,7 @@
identity (:current-chat-id db)]
(fx/merge cofx
{:db (dissoc db :wallet/prepare-transaction)
::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "requestTransaction")
::json-rpc/call [{:method (json-rpc/call-ext-method "requestTransaction")
:params [(:public-key to)
amount
(when-not (= symbol :ETH)

View File

@ -2,7 +2,7 @@
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
"owner": "status-im",
"repo": "status-go",
"version": "v0.61.2",
"commit-sha1": "8f83c5f462de854fa9b616273ccfdd4b0bda4748",
"src-sha256": "1ng699jljs9gjvnpfig73xi5gs8182amab87w6lavvrrdxxzdnr2"
"version": "v0.62.1",
"commit-sha1": "36e742cb70fb7372e0d57ba391523613f6ed87d5",
"src-sha256": "06639pfr782zpp7ysaz4ljlsp87pswdnwlq0j15v7z75xfg4yz6p"
}

View File

@ -1225,7 +1225,6 @@
"waiting-for-wifi-change": "الإعدادات",
"waiting-to-sign": "في انتظار توقيع المعاملة ...",
"waku-bloom-filter-mode": "وضع تصفية واكو بلوم",
"waku-enabled": "تمكين واكو",
"wallet": "المحفظه",
"wallet-address": "عنوان المحفظة",
"wallet-asset": "الأصول",

View File

@ -1179,7 +1179,6 @@
"waiting-for-wifi-change": "Einstellungen",
"waiting-to-sign": "Warten auf die Signierung der Transaktion...",
"waku-bloom-filter-mode": "Waku Bloom Filtermodus",
"waku-enabled": "Waku aktiviert",
"wallet": "Wallet",
"wallet-address": "Wallet-Adresse",
"wallet-asset": "Asset",

View File

@ -1211,7 +1211,6 @@
"account-exists-title": "Account already exists",
"add-private-key-account": "Add account from private key",
"user-not-found": "User not found",
"waku-enabled": "Waku enabled",
"waku-bloom-filter-mode": "Waku bloom filter mode",
"appearance": "Appearance",
"preference": "Preference",

View File

@ -1193,7 +1193,6 @@
"waiting-for-wifi-change": "Ajustes",
"waiting-to-sign": "Esperando para firmar la transacción...",
"waku-bloom-filter-mode": "Modo de filtro Waku bloom",
"waku-enabled": "Waku activado",
"wallet": "Billetera",
"wallet-address": "Dirección de la billetera",
"wallet-asset": "Activo",

View File

@ -1193,7 +1193,6 @@
"waiting-for-wifi-change": "Ajustes",
"waiting-to-sign": "Esperando para firmar la transacción...",
"waku-bloom-filter-mode": "Modo de filtro Waku bloom",
"waku-enabled": "Waku activado",
"wallet": "Billetera",
"wallet-address": "Dirección de la billetera",
"wallet-asset": "Activo",

View File

@ -1225,7 +1225,6 @@
"waiting-for-wifi-change": "Mga settings",
"waiting-to-sign": "Naghihintay na mag-sign ng transaksyon ...",
"waku-bloom-filter-mode": "Waku Bloom mode ng filter",
"waku-enabled": "Pinagana ang Waku",
"wallet": "Pitaka",
"wallet-address": "Address ng Wallet",
"wallet-asset": "Asset",

View File

@ -1147,7 +1147,6 @@
"waiting-for-wifi-change": "Paramètres",
"waiting-to-sign": "En attente de la signature de la transaction....",
"waku-bloom-filter-mode": "Mode filtre de Bloom de Waku",
"waku-enabled": "Waku activé",
"wallet": "Portefeuille",
"wallet-address": "Adresse portefeuille",
"wallet-asset": "Actif",

View File

@ -1074,7 +1074,6 @@
"waiting-for-wifi-change": "Perubahan",
"waiting-to-sign": "Menunggu untuk tanda transaksi ...",
"waku-bloom-filter-mode": "Mode filter mekar Waku",
"waku-enabled": "Waku diaktifkan",
"wallet": "Dompet",
"wallet-address": "Alamat Dompet",
"wallet-asset": "Aset",

View File

@ -1194,7 +1194,6 @@
"waiting-for-wifi-change": "Impostazioni",
"waiting-to-sign": "In attesa di firmare la transazione...",
"waku-bloom-filter-mode": "Modalità Waku bloom filter",
"waku-enabled": "Waku abilitato",
"wallet": "Portafoglio",
"wallet-address": "Indirizzo del portafoglio",
"wallet-asset": "Asset",

View File

@ -1186,7 +1186,6 @@
"waiting-for-wifi-change": "설정",
"waiting-to-sign": "거래 서명 대기중...",
"waku-bloom-filter-mode": "와쿠 블룸 필터 모드",
"waku-enabled": "와쿠 사용",
"wallet": "지갑",
"wallet-address": "지갑 주소",
"wallet-asset": "자산",

View File

@ -1193,7 +1193,6 @@
"waiting-for-wifi-change": "Configurações",
"waiting-to-sign": "Aguardando para assinar a transação",
"waku-bloom-filter-mode": "Modo de filtro Waku bloom",
"waku-enabled": "Waku ativado",
"wallet": "Carteira",
"wallet-address": "Endereço da carteira",
"wallet-asset": "Ativo",

View File

@ -1193,7 +1193,6 @@
"waiting-for-wifi-change": "Configurações",
"waiting-to-sign": "Aguardando para assinar a transação",
"waku-bloom-filter-mode": "Modo de filtro Waku bloom",
"waku-enabled": "Waku ativado",
"wallet": "Carteira",
"wallet-address": "Endereço da carteira",
"wallet-asset": "Ativo",

View File

@ -1217,7 +1217,6 @@
"waiting-for-wifi-change": "Настройки",
"waiting-to-sign": "Ожидание подписания транзакции...",
"waku-bloom-filter-mode": "Режим фильтра Waku bloom",
"waku-enabled": "Waku включен",
"wallet": "Кошелек",
"wallet-address": "Адрес кошелька",
"wallet-asset": "Актив",

View File

@ -1164,7 +1164,6 @@
"waiting-for-wifi-change": "Ayarlar",
"waiting-to-sign": "İşlem imzalanmayı bekliyor ...",
"waku-bloom-filter-mode": "Waku Bloom Filtre Modu",
"waku-enabled": "Waku etkin",
"wallet": "Cüzdan",
"wallet-address": "Cüzdan adresi",
"wallet-asset": "Varlık",

View File

@ -1185,7 +1185,6 @@
"waiting-for-wifi-change": "设定",
"waiting-to-sign": "正在等待签名交易......",
"waku-bloom-filter-mode": "Waku Bloom过滤器模式",
"waku-enabled": "已启用 Waku",
"wallet": "钱包",
"wallet-address": "钱包地址",
"wallet-asset": "资产",

View File

@ -1185,7 +1185,6 @@
"waiting-for-wifi-change": "設定",
"waiting-to-sign": "正在等待簽署交易...",
"waku-bloom-filter-mode": "Waku Bloom過濾器模式",
"waku-enabled": "啟用了Waku",
"wallet": "錢包",
"wallet-address": "錢包地址",
"wallet-asset": "資產",