process backedup(profile/settings) signal (#17306)

This commit is contained in:
frank 2023-09-19 22:05:59 +08:00 committed by GitHub
parent 6eb53ca2db
commit cb9ae21cf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -145,5 +145,9 @@
(js->clj event-js :keywordize-keys true))
"curated.communities.update" (rf/dispatch [:fetched-contract-communities
(js->clj event-js :keywordize-keys true)])
"waku.backedup.profile" (rf/dispatch [:profile/update-profile-from-backup
(js->clj event-js :keywordize-keys true)])
"waku.backedup.settings" (rf/dispatch [:profile/update-setting-from-backup
(js->clj event-js :keywordize-keys true)])
(log/debug "Event " type " not handled"))))

View File

@ -47,3 +47,13 @@
;;if succeed "node.login" signal will be triggered
(login/login-with-biometric-if-available key-uid)))
(navigation/init-root cofx :intro)))
(rf/defn update-setting-from-backup
{:events [:profile/update-setting-from-backup]}
[{:keys [db]} {{:keys [name value]} :backedUpSettings}]
{:db (assoc-in db [:profile/profile (keyword name)] value)})
(rf/defn update-profile-from-backup
{:events [:profile/update-profile-from-backup]}
[_ {{:keys [ensUsernameDetails]} :backedUpProfile}]
{:dispatch [:ens/update-usernames ensUsernameDetails]})