fix keycard account shown as regular account on theme change while login (#13918)

This commit is contained in:
Parvesh Monu 2022-09-05 21:17:39 +05:30 committed by GitHub
parent 337a4d7d1c
commit a5ef9940da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 29 additions and 23 deletions

View File

@ -119,31 +119,35 @@
(fx/defn system-theme-mode-changed (fx/defn system-theme-mode-changed
{:events [:system-theme-mode-changed]} {:events [:system-theme-mode-changed]}
[{:keys [db] :as cofx} theme] [{:keys [db] :as cofx} theme]
(let [cur-theme (get-in db [:multiaccount :appearance]) (let [cur-theme (get-in db [:multiaccount :appearance])
current-tab (get db :current-tab :chat) current-tab (get db :current-tab :chat)
view-id (:view-id db) view-id (:view-id db)
screen-params (get-in db [:navigation/screen-params view-id]) screen-params (get-in db [:navigation/screen-params view-id])
root-id @navigation.state/root-id root-id @navigation.state/root-id
dispatch-later (cond-> [] key-uid (get-in db [:multiaccounts/login :key-uid])
(= view-id :chat) keycard-account? (boolean (get-in db [:multiaccounts/multiaccounts
(conj {:ms 1000 key-uid
:dispatch [:chat.ui/navigate-to-chat (:current-chat-id db)]}) :keycard-pairing]))
dispatch-later (cond-> []
(= view-id :chat)
(conj {:ms 1000
:dispatch [:chat.ui/navigate-to-chat (:current-chat-id db)]})
(and (and
(= root-id :chat-stack) (= root-id :chat-stack)
(not-any? #(= view-id %) '(:home :empty-tab :wallet :status :my-profile :chat))) (not-any? #(= view-id %) '(:home :empty-tab :wallet :status :my-profile :chat)))
(conj {:ms 1000 (conj {:ms 1000
:dispatch [:navigate-to view-id screen-params]}) :dispatch [:navigate-to view-id screen-params]})
(some #(= view-id %) navigation.core/community-screens) (some #(= view-id %) navigation.core/community-screens)
(conj {:ms 800 :dispatch (conj {:ms 800 :dispatch
[:navigate-to :community [:navigate-to :community
(get-in db [:navigation/screen-params :community])]}) (get-in db [:navigation/screen-params :community])]})
(= view-id :community-emoji-thumbnail-picker) (= view-id :community-emoji-thumbnail-picker)
(conj {:ms 900 :dispatch (conj {:ms 900 :dispatch
[:navigate-to :create-community-channel [:navigate-to :create-community-channel
(get-in db [:navigation/screen-params :create-community-channel])]}))] (get-in db [:navigation/screen-params :create-community-channel])]}))]
(when (and (some? root-id) (or (nil? cur-theme) (zero? cur-theme))) (when (and (some? root-id) (or (nil? cur-theme) (zero? cur-theme)))
(navigation.core/dismiss-all-modals) (navigation.core/dismiss-all-modals)
(fx/merge cofx (fx/merge cofx
@ -159,7 +163,9 @@
(visibility-status-popover/hide-visibility-status-popover)) (visibility-status-popover/hide-visibility-status-popover))
(when (get-in db [:signing/tx]) (when (get-in db [:signing/tx])
(signing/discard)) (signing/discard))
(navigation/init-root root-id) (if (and (= root-id :multiaccounts) keycard-account?)
(navigation/init-root-with-component :multiaccounts-keycard :multiaccounts)
(navigation/init-root root-id))
(when (= root-id :chat-stack) (when (= root-id :chat-stack)
(navigation/change-tab current-tab)))))) (navigation/change-tab current-tab))))))