TP-80461 | remove unused code
This commit is contained in:
@@ -7,7 +7,6 @@ import RNFetchBlob from 'rn-fetch-blob';
|
||||
const { ApkInstaller } = NativeModules;
|
||||
|
||||
export const installApk = (filePath: string, callback: (error: string) => void) => {
|
||||
|
||||
ApkInstaller?.installApk(filePath, callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ import React, { ReactNode, useCallback, useState } from 'react';
|
||||
import { AppState, Linking } from 'react-native';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { RootState } from '../store/store';
|
||||
import { IAppState, UninstallInformation } from '../reducer/metadataSlice';
|
||||
import { getAppVersion, getBuildVersion } from '../components/utlis/commonFunctions';
|
||||
import { IAppState } from '../reducer/metadataSlice';
|
||||
import { getBuildVersion } from '../components/utlis/commonFunctions';
|
||||
import BlockerInstructions from './BlockerInstructions';
|
||||
import { BLOCKER_SCREEN_DATA, BuildFlavours, CLICKSTREAM_EVENT_NAMES } from './Constants';
|
||||
import { useAppDispatch, useAppSelector } from '../hooks';
|
||||
@@ -34,7 +34,6 @@ const RETRY_GEOLOCATION_STEPS =
|
||||
'Unable to retrieve location. Kindly follow the given steps and try again.';
|
||||
|
||||
const BlockerScreen = (props: IBlockerScreen) => {
|
||||
const [forceReinstallData, setForceReinstallData] = useState<UninstallInformation>();
|
||||
const { isTimeSynced, isDeviceLocationEnabled } = useAppSelector(
|
||||
(state) => state.foregroundService
|
||||
);
|
||||
@@ -51,36 +50,9 @@ const BlockerScreen = (props: IBlockerScreen) => {
|
||||
const [showActionBtnLoader, setShowActionBtnLoader] = useState(false);
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const forceUninstallData = useSelector((state: RootState) => {
|
||||
return state.metadata?.forceUninstall;
|
||||
});
|
||||
|
||||
const blacklistedAppsInstalled: Apps[] = useSelector((state: RootState) => {
|
||||
return state?.blacklistAppsInstalled?.blacklistedAppsInstalled || [];
|
||||
});
|
||||
|
||||
function compareSemverVersions(a: string, b: string) {
|
||||
return a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' });
|
||||
}
|
||||
|
||||
function openApkDownloadLink(url: string) {
|
||||
Linking.openURL(url);
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
for (const versionName of Object.keys(forceUninstallData)) {
|
||||
const uninstallData = forceUninstallData[versionName];
|
||||
if (
|
||||
compareSemverVersions(getAppVersion(), versionName) < 1 &&
|
||||
Date.now() >= uninstallData.last_operational_time
|
||||
) {
|
||||
setForceReinstallData(uninstallData);
|
||||
return;
|
||||
}
|
||||
}
|
||||
setForceReinstallData(undefined);
|
||||
}, [JSON.stringify(forceUninstallData || {})]);
|
||||
|
||||
const downloadLatestApp = async () => {
|
||||
let apkFileUrl;
|
||||
if (GLOBAL.BUILD_FLAVOUR.includes(BuildFlavours.FIELD_AGENTS)) {
|
||||
@@ -157,12 +129,6 @@ const BlockerScreen = (props: IBlockerScreen) => {
|
||||
}
|
||||
}, [isWifiOrCellularOn]);
|
||||
|
||||
const handleDownloadNewApp = () => {
|
||||
if (forceReinstallData?.reinstall_endpoint) {
|
||||
openApkDownloadLink(forceReinstallData?.reinstall_endpoint);
|
||||
}
|
||||
};
|
||||
|
||||
const handleOpenSettings = useCallback(async () => {
|
||||
await Linking.openSettings();
|
||||
}, []);
|
||||
@@ -189,17 +155,6 @@ const BlockerScreen = (props: IBlockerScreen) => {
|
||||
);
|
||||
}
|
||||
|
||||
if (forceReinstallData?.reinstall_endpoint) {
|
||||
const { heading, instructions } = BLOCKER_SCREEN_DATA.UNINSTALL_APP;
|
||||
return (
|
||||
<BlockerInstructions
|
||||
heading={`${heading}. v${getAppVersion()}`}
|
||||
instructions={instructions}
|
||||
actionBtn={{ title: 'Download New App', action: handleDownloadNewApp }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (!isTimeSynced) {
|
||||
const { heading, instructions } = BLOCKER_SCREEN_DATA.TIME_UNSYNC;
|
||||
return (
|
||||
|
||||
@@ -3,7 +3,6 @@ import firestore, { type FirebaseFirestoreTypes } from '@react-native-firebase/f
|
||||
import auth from '@react-native-firebase/auth';
|
||||
import { setFeedbackFilterTemplate } from '@reducers/feedbackFiltersSlice';
|
||||
import { InteractionManager } from 'react-native';
|
||||
import { type RootState } from '../store/store';
|
||||
import { useAppDispatch, useAppSelector } from '.';
|
||||
import { setLoading, updateCaseDetailsFirestore } from '../reducer/allCasesSlice';
|
||||
import { type CaseDetail } from '../screens/caseDetails/interface';
|
||||
@@ -13,7 +12,7 @@ import { updateCollectionTemplateData } from '../reducer/caseReducer';
|
||||
import { type ILockData, MY_CASE_ITEM, setLockData, VisitPlanStatus } from '../reducer/userSlice';
|
||||
import { setFilters } from '../reducer/filtersSlice';
|
||||
import { ToastMessages } from '../screens/allCases/constants';
|
||||
import { setCurrentProdAPK, setForceUninstallData } from '../reducer/metadataSlice';
|
||||
import { setCurrentProdAPK } from '../reducer/metadataSlice';
|
||||
import { logError } from '../components/utlis/errorUtils';
|
||||
import { type GenericFunctionArgs } from '../common/GenericTypes';
|
||||
import { addClickstreamEvent } from '@services/clickstreamEventService';
|
||||
@@ -136,13 +135,6 @@ const useFirestoreUpdates = () => {
|
||||
dispatch(updateCollectionTemplateData(configData as any));
|
||||
};
|
||||
|
||||
const handleForceUninstallUpdate = (
|
||||
snapshot: FirebaseFirestoreTypes.DocumentSnapshot<FirebaseFirestoreTypes.DocumentData>
|
||||
) => {
|
||||
const configData = snapshot.data();
|
||||
dispatch(setForceUninstallData(configData));
|
||||
};
|
||||
|
||||
const handleFilterUpdate = (
|
||||
snapshot: FirebaseFirestoreTypes.DocumentSnapshot<FirebaseFirestoreTypes.DocumentData>
|
||||
) => {
|
||||
|
||||
@@ -3,10 +3,6 @@ import dayJs from 'dayjs';
|
||||
|
||||
|
||||
const FIRST_DATE = new Date(1970, 1, 1);
|
||||
export interface UninstallInformation {
|
||||
last_operational_time: any;
|
||||
reinstall_endpoint: string;
|
||||
}
|
||||
|
||||
export interface IAppState {
|
||||
version: number;
|
||||
@@ -15,7 +11,6 @@ export interface IAppState {
|
||||
|
||||
interface IMetadata {
|
||||
isOnline: boolean;
|
||||
forceUninstall: Record<string, UninstallInformation>;
|
||||
isWifiOrCellularOn: boolean;
|
||||
appState: {
|
||||
fieldAgents: IAppState,
|
||||
@@ -28,7 +23,6 @@ export type buildFlavour = 'fieldAgents' | 'callingAgents';
|
||||
|
||||
const initialState = {
|
||||
isOnline: true,
|
||||
forceUninstall: {},
|
||||
isWifiOrCellularOn: true,
|
||||
appState: {},
|
||||
lastFirebaseResyncTimestamp: dayJs(FIRST_DATE).toString(),
|
||||
@@ -41,9 +35,6 @@ const MetadataSlice = createSlice({
|
||||
setIsOnline: (state, action) => {
|
||||
state.isOnline = action.payload;
|
||||
},
|
||||
setForceUninstallData: (state, action) => {
|
||||
state.forceUninstall = action.payload;
|
||||
},
|
||||
setIsWifiOrCellularOn: (state, action) => {
|
||||
state.isWifiOrCellularOn = action.payload;
|
||||
},
|
||||
@@ -60,7 +51,6 @@ const MetadataSlice = createSlice({
|
||||
|
||||
export const {
|
||||
setIsOnline,
|
||||
setForceUninstallData,
|
||||
setIsWifiOrCellularOn,
|
||||
setLastFirebaseResyncTimestamp,
|
||||
setCurrentProdAPK
|
||||
|
||||
Reference in New Issue
Block a user