From 181cf09aa4e57953248585780acff2e9938e63cb Mon Sep 17 00:00:00 2001 From: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com> Date: Thu, 15 Feb 2024 01:56:04 +0530 Subject: [PATCH] [Fix] Broken wallet account emoji when syncing devices Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com> --- src/status_im/contexts/wallet/data_store.cljs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/status_im/contexts/wallet/data_store.cljs b/src/status_im/contexts/wallet/data_store.cljs index 3e8b72170506..77821460769f 100644 --- a/src/status_im/contexts/wallet/data_store.cljs +++ b/src/status_im/contexts/wallet/data_store.cljs @@ -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 " (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))