[Fix] Broken wallet account emoji when syncing devices (#18828)

This commit fixes the broken wallet account emoji when syncing devices by adding a sanitization method for the wallet account emoji. The desktop can handle both variants (raw emoji and img tag); this PR adds the same for mobile.

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
This commit is contained in:
Mohamed Javid 2024-02-15 18:52:59 +05:30 committed by GitHub
parent 2e13cfc47f
commit 10f9fe11db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 0 deletions

View File

@ -22,6 +22,15 @@
[account]
(assoc account :watch-only? (= (:type account) :watch)))
(defn- sanitize-emoji
"As Desktop uses Twemoji, the emoji received can be an img tag
with raw emoji in alt attribute. This function help us to extract
the emoji from it as mobile doesn't support HTML rendering and Twemoji"
[emoji]
(if (string/starts-with? emoji "<img")
(-> (re-find #"alt=\"(.*?)\"" emoji) last)
emoji))
(defn rpc->account
[account]
(-> account
@ -33,6 +42,7 @@
(update :test-preferred-chain-ids chain-ids-string->set)
(update :type keyword)
(update :color #(if (seq %) (keyword %) constants/account-default-customization-color))
(update :emoji sanitize-emoji)
(assoc :default-account? (:wallet account))
add-keys-to-account))