Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Currency on recovered profile #18433

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/legacy/status_im/data_store/settings.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,9 @@
(visibility-status-updates/<-rpc-settings)
(set/rename-keys {:compressedKey :compressed-key
:emojiHash :emoji-hash})))

(defn rpc->setting-value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any reason we need to have this in legacy folder? seems like something we can move to profile/datastore.cljs ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and start the migration! :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any reason we need to have this in legacy folder? seems like something we can move to profile/datastore.cljs ?

I placed it in the legacy.* ns as the RPC data helpers for settings are used from it.

(data-store.settings/rpc->settings settings)

Moving the data-store for settings to status-im.* ns would be easy when we do it.

cc @flexsurfer

[{:keys [name] :as setting}]
(condp = name
:currency (update setting :value keyword)
setting))
7 changes: 5 additions & 2 deletions src/status_im/contexts/profile/events.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns status-im.contexts.profile.events
(:require
[legacy.status-im.data-store.settings :as data-store.settings]
[native-module.core :as native-module]
[re-frame.core :as re-frame]
[status-im.contexts.profile.edit.name.events]
Expand Down Expand Up @@ -52,8 +53,10 @@

(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)})
[{:keys [db]} {:keys [backedUpSettings]}]
(let [setting (update backedUpSettings :name keyword)
{:keys [name value]} (data-store.settings/rpc->setting-value setting)]
{:db (assoc-in db [:profile/profile name] value)}))

(rf/defn update-profile-from-backup
{:events [:profile/update-profile-from-backup]}
Expand Down