[#7139] Fix crash on logout
The crash was caused by RPC calls which happened after `StopNode` call. Implementation: - The first suggestion was to `StopNode` only after all `.stopWatching` calls are done, but this only lowered probability of the crash, but did not fix the issue. - Another suggestion was to prevent RPC calls after `StopNode` call, but it also only lowered probability of the crash. - So the last resort was a fix on `status-go` side https://github.com/status-im/status-go/pull/1329, and it actually worked. - Advanced settings are hidden until `Statusgo.Login` is finished
This commit is contained in:
parent
b81cb82fc6
commit
dd2ff11216
|
@ -1 +1 @@
|
||||||
0.17.9-beta
|
0.17.10-beta.1
|
||||||
|
|
|
@ -13,7 +13,13 @@
|
||||||
{:keychain/clear-user-password (get-in db [:account/account :address])
|
{:keychain/clear-user-password (get-in db [:account/account :address])
|
||||||
:dev-server/stop nil}
|
:dev-server/stop nil}
|
||||||
(transactions/stop-sync)
|
(transactions/stop-sync)
|
||||||
(transport/stop-whisper)
|
(transport/stop-whisper
|
||||||
|
#(re-frame/dispatch [:accounts.logout/filters-removed]))))
|
||||||
|
|
||||||
|
(fx/defn leave-account
|
||||||
|
[cofx]
|
||||||
|
(fx/merge
|
||||||
|
cofx
|
||||||
(init/initialize-app-db)
|
(init/initialize-app-db)
|
||||||
(init/load-accounts-and-initialize-views)
|
(init/load-accounts-and-initialize-views)
|
||||||
(node/stop)))
|
(node/stop)))
|
||||||
|
|
|
@ -286,15 +286,19 @@
|
||||||
|
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
:accounts.logout.ui/logout-confirmed
|
:accounts.logout.ui/logout-confirmed
|
||||||
[(re-frame/inject-cofx :data-store/get-all-accounts)]
|
|
||||||
(fn [cofx _]
|
(fn [cofx _]
|
||||||
(accounts.logout/logout cofx)))
|
(accounts.logout/logout cofx)))
|
||||||
|
|
||||||
|
(handlers/register-handler-fx
|
||||||
|
:accounts.logout/filters-removed
|
||||||
|
[(re-frame/inject-cofx :data-store/get-all-accounts)]
|
||||||
|
(fn [cofx]
|
||||||
|
(accounts.logout/leave-account cofx)))
|
||||||
|
|
||||||
;; accounts update module
|
;; accounts update module
|
||||||
|
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
:accounts.update.callback/save-settings-success
|
:accounts.update.callback/save-settings-success
|
||||||
[(re-frame/inject-cofx :data-store/get-all-accounts)]
|
|
||||||
(fn [cofx _]
|
(fn [cofx _]
|
||||||
(accounts.logout/logout cofx)))
|
(accounts.logout/logout cofx)))
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,14 @@
|
||||||
(defn start-node [config]
|
(defn start-node [config]
|
||||||
(native-module/start-node config))
|
(native-module/start-node config))
|
||||||
|
|
||||||
|
(def node-started (atom false))
|
||||||
|
|
||||||
(defn node-ready []
|
(defn node-ready []
|
||||||
|
(reset! node-started true)
|
||||||
(native-module/node-ready))
|
(native-module/node-ready))
|
||||||
|
|
||||||
(defn stop-node []
|
(defn stop-node []
|
||||||
|
(reset! node-started false)
|
||||||
(native-module/stop-node))
|
(native-module/stop-node))
|
||||||
|
|
||||||
(defn create-account [password callback]
|
(defn create-account [password callback]
|
||||||
|
@ -31,10 +35,12 @@
|
||||||
(native-module/clear-web-data))
|
(native-module/clear-web-data))
|
||||||
|
|
||||||
(defn call-rpc [payload callback]
|
(defn call-rpc [payload callback]
|
||||||
(native-module/call-rpc payload callback))
|
(when @node-started
|
||||||
|
(native-module/call-rpc payload callback)))
|
||||||
|
|
||||||
(defn call-private-rpc [payload callback]
|
(defn call-private-rpc [payload callback]
|
||||||
(native-module/call-private-rpc payload callback))
|
(when @node-started
|
||||||
|
(native-module/call-private-rpc payload callback)))
|
||||||
|
|
||||||
(defn sign-message [rpcParams callback]
|
(defn sign-message [rpcParams callback]
|
||||||
(native-module/sign-message rpcParams callback))
|
(native-module/sign-message rpcParams callback))
|
||||||
|
|
|
@ -68,6 +68,6 @@
|
||||||
It is necessary to remove the filters because status-go there isn't currently a logout feature in status-go
|
It is necessary to remove the filters because status-go there isn't currently a logout feature in status-go
|
||||||
to clean-up after logout. When logging out of account A and logging in account B, account B would receive
|
to clean-up after logout. When logging out of account A and logging in account B, account B would receive
|
||||||
account A messages without this."
|
account A messages without this."
|
||||||
[{:keys [db]}]
|
[{:keys [db]} callback]
|
||||||
(let [{:transport/keys [filters]} db]
|
(let [{:transport/keys [filters]} db]
|
||||||
{:shh/remove-filters filters}))
|
{:shh/remove-filters [filters callback]}))
|
||||||
|
|
|
@ -7,12 +7,14 @@
|
||||||
[status-im.utils.handlers :as handlers]
|
[status-im.utils.handlers :as handlers]
|
||||||
[taoensso.timbre :as log]))
|
[taoensso.timbre :as log]))
|
||||||
|
|
||||||
(defn remove-filter! [{:keys [chat-id filter]}]
|
(defn remove-filter! [{:keys [chat-id filter success-callback?]
|
||||||
|
:or {success-callback? true}}]
|
||||||
(.stopWatching filter
|
(.stopWatching filter
|
||||||
(fn [error _]
|
(fn [error _]
|
||||||
(if error
|
(if error
|
||||||
(log/warn :remove-filter-error filter error)
|
(log/warn :remove-filter-error filter error)
|
||||||
(re-frame/dispatch [:shh.callback/filter-removed chat-id]))))
|
(when success-callback?
|
||||||
|
(re-frame/dispatch [:shh.callback/filter-removed chat-id])))))
|
||||||
(log/debug :stop-watching filter))
|
(log/debug :stop-watching filter))
|
||||||
|
|
||||||
(defn add-filter!
|
(defn add-filter!
|
||||||
|
@ -72,7 +74,10 @@
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
:shh/remove-filters
|
:shh/remove-filters
|
||||||
(fn [filters]
|
(fn [[filters callback]]
|
||||||
(doseq [[chat-id filter] filters]
|
(doseq [[chat-id filter] filters]
|
||||||
(when filter (remove-filter! {:chat-id chat-id
|
(when filter (remove-filter!
|
||||||
:filter filter})))))
|
{:chat-id chat-id
|
||||||
|
:filter filter
|
||||||
|
:success-callback false})))
|
||||||
|
(callback)))
|
||||||
|
|
|
@ -255,4 +255,5 @@
|
||||||
(i18n/label :t/share-my-profile)]]
|
(i18n/label :t/share-my-profile)]]
|
||||||
[react/view styles/my-profile-info-container
|
[react/view styles/my-profile-info-container
|
||||||
[my-profile-settings current-account shown-account currency (nil? login-data)]]
|
[my-profile-settings current-account shown-account currency (nil? login-data)]]
|
||||||
[advanced shown-account on-show-advanced]]])))
|
(when (nil? login-data)
|
||||||
|
[advanced shown-account on-show-advanced])]])))
|
||||||
|
|
Loading…
Reference in New Issue