From 1cba83ba5f1136ef6d04f79af5a3bed275c53ea8 Mon Sep 17 00:00:00 2001 From: Ldoppea Date: Wed, 4 Dec 2024 16:16:04 +0100 Subject: [PATCH] feat: Delay icon's caching manager 30s after startup Icons caching may slow down the startup process but is not necessary for the app to work If not called in time, this would only impact cozy-apps opening animation that will use generic icons (if never called before) or potentially old icons (in the rare cases when we update a cozy-app icon) So we chose to delay this call a short delay after the startup (for now 30s) --- src/hooks/useAppBootstrap.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hooks/useAppBootstrap.js b/src/hooks/useAppBootstrap.js index 9f82c090b..41ced75bb 100644 --- a/src/hooks/useAppBootstrap.js +++ b/src/hooks/useAppBootstrap.js @@ -25,6 +25,8 @@ import { useHomeStateContext } from '/screens/home/HomeStateProvider' const log = Minilog('useAppBootstrap') +const MANAGE_ICON_CACHE_DELAY_IN_MS = 30 * 1000 + export const useAppBootstrap = client => { const [markName] = useState(() => rnperformance.mark('useAppBootstrap')) const [initialRoute, setInitialRoute] = useState('fetching') @@ -176,7 +178,8 @@ export const useAppBootstrap = client => { return } - client && manageIconCache(client) + client && + setTimeout(() => manageIconCache(client), MANAGE_ICON_CACHE_DELAY_IN_MS) client && setSentryTag(SentryCustomTags.Instance, client.stackClient?.uri) const subscription = Linking.addEventListener('url', ({ url }) => {