reset shh keys on starting whisper, fix warnings related to outdated shh keys

This commit is contained in:
Roman Volosovskyi 2017-10-03 16:27:09 +02:00
parent 2763c87c40
commit cede095746
5 changed files with 21 additions and 5 deletions

View File

@ -27,7 +27,8 @@
[status-im.utils.listview :as lw]
[status-im.utils.platform :as platform]
[status-im.utils.utils :as utils]
[status-im.utils.money :as money]))
[status-im.utils.money :as money]
[status-im.protocol.core :as protocol]))
(defonce drawer-atom (atom nil))
(defn open-drawer! [] (.openDrawer @drawer-atom))
@ -49,6 +50,8 @@
(defn navigate-to-accounts []
(close-drawer!)
(save-profile!)
;; TODO(rasom): probably not the best place for this call
(protocol/stop-whisper!)
(rf/dispatch [:navigate-to :accounts]))
(defview profile-picture []

View File

@ -68,6 +68,12 @@
(def stop-watching-all! f/remove-all-filters!)
(def reset-all-pending-messages! d/reset-all-pending-messages!)
(def reset-keys! shh-keys/reset-keys!)
(defn stop-whisper! []
(stop-watching-all!)
(reset-all-pending-messages!)
(reset-keys!))
(defn init-whisper!
[{:keys [identity groups callback web3
@ -75,8 +81,7 @@
:as options}]
{:pre [(valid? ::options options)]}
(debug :init-whisper)
(stop-watching-all!)
(d/reset-all-pending-messages!)
(stop-whisper!)
(let [listener-options {:web3 web3
:identity identity
:callback callback}]

View File

@ -1,6 +1,6 @@
(ns status-im.protocol.handlers
(:require [status-im.utils.handlers :as u]
[re-frame.core :refer [dispatch after]]
[re-frame.core :refer [dispatch after] :as re-frame]
[status-im.utils.handlers :refer [register-handler]]
[status-im.data-store.contacts :as contacts]
[status-im.data-store.messages :as messages]
@ -22,6 +22,10 @@
[status-im.utils.web3-provider :as w3]
[status-im.utils.datetime :as time]))
(re-frame/reg-fx
:stop-whisper
(fn [] (protocol/stop-whisper!)))
(register-handler :initialize-protocol
(fn [db [_ current-account-id ethereum-rpc-url]]
(let [{:keys [public-key status updates-public-key

View File

@ -19,3 +19,6 @@
(fn [err res]
(swap! password->keys assoc password res)
(callback res)))))
(defn reset-keys! []
(reset! password->keys {}))

View File

@ -31,4 +31,5 @@
:connect-network
(fn [cofx [_ network]]
(merge (accounts-events/account-update cofx {:network network})
{:dispatch [:navigate-to-clean :accounts]})))
{:dispatch [:navigate-to-clean :accounts]
:stop-whisper nil})))