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