From 2ddcfbacbc3ca002720339f57337f68ee6c92d7e Mon Sep 17 00:00:00 2001 From: Mantri Ramkishor Date: Wed, 11 Jun 2025 13:59:38 +0530 Subject: [PATCH] NTP-68468 | Infinte loop for app update fix (#1191) --- src/common/BlockerScreen.tsx | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/common/BlockerScreen.tsx b/src/common/BlockerScreen.tsx index bbdfd84a..af0d3475 100644 --- a/src/common/BlockerScreen.tsx +++ b/src/common/BlockerScreen.tsx @@ -64,8 +64,7 @@ const BlockerScreen = (props: IBlockerScreen) => { ); const shouldDialerAppUpdate = useAppSelector((state) => state.appUpdate.shouldDialerAppUpdate) || {}; - const isCosmosDialerDefault = - useAppSelector((state) => state.appUpdate.isCosmosDialerDefault); + const isCosmosDialerDefault = useAppSelector((state) => state.appUpdate.isCosmosDialerDefault); const withinOperativeHours = useAppSelector((state) => state.user?.withinOperativeHours); const isLoggedIn = useAppSelector((state: RootState) => state.user?.isLoggedIn); @@ -162,8 +161,6 @@ const BlockerScreen = (props: IBlockerScreen) => { }); }; - - const handleDialerAppUpdate = async () => { const url = dialerAppState?.currentProdAPK; if (!shouldDialerAppUpdate.newApkCachedUrl) { @@ -207,6 +204,17 @@ const BlockerScreen = (props: IBlockerScreen) => { }) ); deleteCachedApkFiles(); + } else if ( + shouldUpdate.switchToFallback && + flavorToUpdate && + currentBuildNumber === flavorToUpdate.version + ) { + dispatch( + setShouldUpdate({ + newApkCachedUrl: '', + switchToFallback: false, + }) + ); } }, [appState]); @@ -244,7 +252,7 @@ const BlockerScreen = (props: IBlockerScreen) => { ); deleteCachedApkFiles(true); } - const defaultCallingApp = await getDefaultCallingApp()=== COSMOS_DIALER_PACKAGE_NAME; + const defaultCallingApp = (await getDefaultCallingApp()) === COSMOS_DIALER_PACKAGE_NAME; dispatch(setDefaultDialer(defaultCallingApp)); }, [dialerAppState, shouldDialerAppUpdate, isCosmosDiallerEnabled] @@ -296,7 +304,8 @@ const BlockerScreen = (props: IBlockerScreen) => { }; // Higher Priotrity to Post Operative Hours - if (!withinOperativeHours && isLoggedIn && !GLOBAL.IS_IMPERSONATED && isFieldApp()) return ; + if (!withinOperativeHours && isLoggedIn && !GLOBAL.IS_IMPERSONATED && isFieldApp()) + return ; if (shouldUpdate.newApkCachedUrl) { return ; @@ -307,7 +316,7 @@ const BlockerScreen = (props: IBlockerScreen) => { } if (!isCosmosDialerDefault && isCosmosDiallerEnabled) { - return + return ; } if (shouldUpdate.switchToFallback) { @@ -383,4 +392,4 @@ const BlockerScreen = (props: IBlockerScreen) => { return <>{props.children}; }; -export default BlockerScreen; \ No newline at end of file +export default BlockerScreen;