fix_: delay in fetching the currencies list (#21239)

This commit fixes the delay in showing the currency symbol in the wallet by moving the RPC call to login phase 1 along with wallet initialisation. This helps us to improve the wallet UX by skipping the waiting to start the messenger.

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
This commit is contained in:
Mohamed Javid 2024-09-12 21:45:11 +05:30 committed by GitHub
parent c329d5e69f
commit dc12a0ff97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 7 deletions

View File

@ -62,6 +62,9 @@
;; loading chats and communities. This globally helps alleviate
;; stuttering immediately after login.
[:dispatch-later [{:ms 500 :dispatch [:wallet/initialize]}]]
;; Fetching the currencies along with wallet initialization as
;; we rely on it for displaying currency symbol
[:dispatch-later [{:ms 500 :dispatch [:settings/get-currencies]}]]
[:logs/set-level log-level]
@ -95,7 +98,6 @@
[:dispatch-later [{:ms 1500 :dispatch [:profile.login/non-critical-initialization]}]]
[:dispatch [:network/check-expensive-connection]]
[:profile.settings/get-profile-picture key-uid]
[:settings/get-currencies]
(when (ff/enabled? ::ff/wallet.wallet-connect)
[:dispatch [:wallet-connect/init]])
(when (ff/enabled? ::ff/wallet.swap)

View File

@ -1,6 +1,5 @@
(ns status-im.contexts.settings.language-and-currency.events
(:require [status-im.common.json-rpc.events :as json-rpc]
[status-im.contexts.settings.language-and-currency.data-store :as data-store]
(:require [status-im.contexts.settings.language-and-currency.data-store :as data-store]
[utils.collection]
[utils.re-frame :as rf]))
@ -11,8 +10,9 @@
:currencies
(utils.collection/index-by :id all-currencies))})))
(rf/reg-fx :settings/get-currencies
(rf/reg-event-fx :settings/get-currencies
(fn []
(json-rpc/call {:method "appgeneral_getCurrencies"
:on-success [:settings/get-currencies-success]
:on-error [:log-rpc-error {:event :settings/get-currencies}]})))
{:fx [[:json-rpc/call
[{:method "appgeneral_getCurrencies"
:on-success [:settings/get-currencies-success]
:on-error [:log-rpc-error {:event :settings/get-currencies}]}]]]}))