NTP-68468 | Infinte loop for app update fix (#1191)
This commit is contained in:
@@ -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 <PostOperativeHours />;
|
||||
if (!withinOperativeHours && isLoggedIn && !GLOBAL.IS_IMPERSONATED && isFieldApp())
|
||||
return <PostOperativeHours />;
|
||||
|
||||
if (shouldUpdate.newApkCachedUrl) {
|
||||
return <AppUpdate onAppUpdate={handleAppUpdate} />;
|
||||
@@ -307,7 +316,7 @@ const BlockerScreen = (props: IBlockerScreen) => {
|
||||
}
|
||||
|
||||
if (!isCosmosDialerDefault && isCosmosDiallerEnabled) {
|
||||
return <DefaultDialerScreen />
|
||||
return <DefaultDialerScreen />;
|
||||
}
|
||||
|
||||
if (shouldUpdate.switchToFallback) {
|
||||
@@ -383,4 +392,4 @@ const BlockerScreen = (props: IBlockerScreen) => {
|
||||
return <>{props.children}</>;
|
||||
};
|
||||
|
||||
export default BlockerScreen;
|
||||
export default BlockerScreen;
|
||||
|
||||
Reference in New Issue
Block a user