UAT changes dobne
This commit is contained in:
@@ -119,13 +119,13 @@ public class DeviceUtilsModule extends ReactContextBaseJavaModule {
|
||||
for (PackageInfo packageInfo : installedPackages) {
|
||||
|
||||
final PackageManager pm = RNContext.getApplicationContext().getPackageManager();
|
||||
ApplicationInfo ai;
|
||||
ApplicationInfo appsInstalled;
|
||||
try {
|
||||
ai = pm.getApplicationInfo( packageInfo.packageName, 0);
|
||||
appsInstalled = pm.getApplicationInfo( packageInfo.packageName, 0);
|
||||
} catch (final PackageManager.NameNotFoundException e) {
|
||||
ai = null;
|
||||
appsInstalled = null;
|
||||
}
|
||||
final String applicationName = (String) (ai != null ? pm.getApplicationLabel(ai) : "(unknown)");
|
||||
final String applicationName = (String) (appsInstalled != null ? pm.getApplicationLabel(appsInstalled) : "(unknown)");
|
||||
|
||||
JSONObject mainObject = new JSONObject();
|
||||
JSONObject appDetails = new JSONObject();
|
||||
|
||||
@@ -5,13 +5,15 @@ import { RootState } from '../store/store';
|
||||
import { UninstallInformation } from '../reducer/metadataSlice';
|
||||
import { getAppVersion } from '../components/utlis/commonFunctions';
|
||||
import BlockerInstructions from './BlockerInstructions';
|
||||
import { BLOCKER_SCREEN_DATA } from './Constants';
|
||||
import { BLOCKER_SCREEN_DATA, CLICKSTREAM_EVENT_NAMES } from './Constants';
|
||||
import { useAppDispatch, useAppSelector } from '../hooks';
|
||||
import { setIsDeviceLocationEnabled } from '../reducer/foregroundServiceSlice';
|
||||
import { toast } from '../../RN-UI-LIB/src/components/toast';
|
||||
import { locationEnabled } from '../components/utlis/DeviceUtils';
|
||||
import BlockerScreenApps from '@screens/permissions/BlockerScreenApps';
|
||||
import { Apps } from '@services/blacklistedApps.service';
|
||||
import handleBlacklistedAppsForBlockingCosmos, { Apps } from '@services/blacklistedApps.service';
|
||||
import { addClickstreamEvent } from '@services/clickstreamEventService';
|
||||
import { setBlacklistedAppsInstalledData } from '@reducers/blacklistedAppsInstalledSlice';
|
||||
|
||||
interface IBlockerScreen {
|
||||
children?: ReactNode;
|
||||
@@ -35,7 +37,7 @@ const BlockerScreen = (props: IBlockerScreen) => {
|
||||
});
|
||||
|
||||
const blacklistedAppsInstalled: Apps[] = useSelector((state: RootState) => {
|
||||
return state.blacklistAppsInstalled.blacklistedAppsInstalled;
|
||||
return state?.blacklistAppsInstalled?.blacklistedAppsInstalled;
|
||||
});
|
||||
|
||||
function compareSemverVersions(a: string, b: string) {
|
||||
@@ -60,6 +62,14 @@ const BlockerScreen = (props: IBlockerScreen) => {
|
||||
setForceReinstallData(undefined);
|
||||
}, [JSON.stringify(forceUninstallData || {})]);
|
||||
|
||||
React.useEffect(() => {
|
||||
handleBlacklistedAppsForBlockingCosmos().then((blacklistedAppsInstalled) =>
|
||||
dispatch(
|
||||
setBlacklistedAppsInstalledData({ blacklistedAppsInstalled: blacklistedAppsInstalled })
|
||||
)
|
||||
);
|
||||
}, [blacklistedAppsInstalled]);
|
||||
|
||||
const handleDownloadNewApp = () => {
|
||||
if (forceReinstallData?.reinstall_endpoint) {
|
||||
openApkDownloadLink(forceReinstallData?.reinstall_endpoint);
|
||||
@@ -133,6 +143,7 @@ const BlockerScreen = (props: IBlockerScreen) => {
|
||||
}
|
||||
|
||||
if (blacklistedAppsInstalled?.length > 0) {
|
||||
addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_BLOCKER_SCREEN_LOADED_FOR_BLACKLISTED_APPS);
|
||||
return <BlockerScreenApps blacklistedAppsInstalled={blacklistedAppsInstalled} />;
|
||||
}
|
||||
|
||||
|
||||
@@ -630,6 +630,12 @@ export const CLICKSTREAM_EVENT_NAMES = {
|
||||
name: 'FA_PERFORMANCE_DASHBOARD_BROKEN_PTP_CASES_LOAD',
|
||||
description: 'Performance Dashboard Broken PTP Cases Load',
|
||||
},
|
||||
|
||||
//Blocker Screen for blacklisted Apps
|
||||
FA_BLOCKER_SCREEN_LOADED_FOR_BLACKLISTED_APPS: {
|
||||
name: 'FA_BLOCKER_SCREEN_LOADED_FOR_BLACKLISTED_APPS',
|
||||
description: 'Blocker screen loaded for blacklisted apps',
|
||||
},
|
||||
} as const;
|
||||
|
||||
export enum MimeType {
|
||||
|
||||
@@ -46,7 +46,10 @@ import { get } from 'react-hook-form';
|
||||
import { addClickstreamEvent } from '../services/clickstreamEventService';
|
||||
import { CLICKSTREAM_EVENT_NAMES } from './Constants';
|
||||
import { setBlacklistedAppsInstalledData } from '@reducers/blacklistedAppsInstalledSlice';
|
||||
import handleBlacklistedAppsForBlockingCosmos from '@services/blacklistedApps.service';
|
||||
import handleBlacklistedAppsForBlockingCosmos, { Apps } from '@services/blacklistedApps.service';
|
||||
import fetchUpdatedRemoteConfig, {
|
||||
FIREBASE_FETCH_TIMESTAMP,
|
||||
} from '@services/firebaseFetchAndUpdate.service';
|
||||
|
||||
export enum FOREGROUND_TASKS {
|
||||
GEOLOCATION = 'GEOLOCATION',
|
||||
@@ -56,6 +59,7 @@ export enum FOREGROUND_TASKS {
|
||||
UPDATE_AGENT_ACTIVENESS = 'UPDATE_AGENT_ACTIVENESS',
|
||||
UPDATE_AGENT_ACTIVITY = 'UPDATE_AGENT_ACTIVITY',
|
||||
DELETE_CACHE = 'DELETE_CACHE',
|
||||
FETCH_DATA_FROM_FIREBASE = 'FETCH_DATA_FROM_FIREBASE',
|
||||
}
|
||||
|
||||
interface ITrackingComponent {
|
||||
@@ -108,6 +112,14 @@ const TrackingComponent: React.FC<ITrackingComponent> = ({ children }) => {
|
||||
const userActivityonApp: string =
|
||||
(await getItem(StorageKeys.USER_ACTIVITY_ON_APP)) || AgentActivity.LOW;
|
||||
|
||||
let blacklistedAppsInstalledOnDevice: Apps[] = [];
|
||||
|
||||
await handleBlacklistedAppsForBlockingCosmos().then((blacklistedAppsInstalled) => {
|
||||
if (blacklistedAppsInstalled.length > 0) {
|
||||
blacklistedAppsInstalledOnDevice = blacklistedAppsInstalled;
|
||||
}
|
||||
});
|
||||
|
||||
const geolocation: IGeolocationPayload = {
|
||||
latitude: location.latitude,
|
||||
longitude: location.longitude,
|
||||
@@ -115,6 +127,7 @@ const TrackingComponent: React.FC<ITrackingComponent> = ({ children }) => {
|
||||
timestamp: Date.now(),
|
||||
isActiveOnApp: Boolean(isActiveOnApp),
|
||||
userActivityOnApp: String(userActivityonApp),
|
||||
blacklistedAppsInstalled: blacklistedAppsInstalledOnDevice,
|
||||
};
|
||||
dispatch(setDeviceGeolocationsBuffer(geolocation));
|
||||
dispatch(sendLocationAndActivenessToServer([geolocation]));
|
||||
@@ -291,6 +304,16 @@ const TrackingComponent: React.FC<ITrackingComponent> = ({ children }) => {
|
||||
});
|
||||
};
|
||||
|
||||
const handleFetchUpdatedDataFromFirebase = async () => {
|
||||
const currentTimestamp: number = Date.now();
|
||||
if (
|
||||
FIREBASE_FETCH_TIMESTAMP &&
|
||||
currentTimestamp - FIREBASE_FETCH_TIMESTAMP > 15 * MILLISECONDS_IN_A_MINUTE
|
||||
) {
|
||||
fetchUpdatedRemoteConfig();
|
||||
}
|
||||
};
|
||||
|
||||
const tasks: IForegroundTask[] = [
|
||||
{
|
||||
taskId: FOREGROUND_TASKS.TIME_SYNC,
|
||||
@@ -322,6 +345,12 @@ const TrackingComponent: React.FC<ITrackingComponent> = ({ children }) => {
|
||||
delay: DATA_SYNC_TIME_INTERVAL,
|
||||
onLoop: true,
|
||||
},
|
||||
{
|
||||
taskId: FOREGROUND_TASKS.FETCH_DATA_FROM_FIREBASE,
|
||||
task: handleFetchUpdatedDataFromFirebase,
|
||||
delay: 15 * MILLISECONDS_IN_A_MINUTE, // 15 minutes
|
||||
onLoop: true,
|
||||
},
|
||||
];
|
||||
|
||||
if (!isTeamLead) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
} from '../reducer/foregroundServiceSlice';
|
||||
import { logError } from '../components/utlis/errorUtils';
|
||||
import { toast } from '../../RN-UI-LIB/src/components/toast';
|
||||
import { Apps } from '@services/blacklistedApps.service';
|
||||
|
||||
export interface IGeolocationPayload {
|
||||
latitude: number;
|
||||
@@ -14,6 +15,7 @@ export interface IGeolocationPayload {
|
||||
timestamp: number;
|
||||
isActiveOnApp: boolean;
|
||||
userActivityOnApp: string;
|
||||
blacklistedAppsInstalled: Apps[];
|
||||
}
|
||||
|
||||
export const sendLocationAndActivenessToServer =
|
||||
|
||||
@@ -108,7 +108,9 @@ const AuthRouter = () => {
|
||||
</BlockerScreen>
|
||||
</TrackingComponent>
|
||||
) : (
|
||||
<UnProtectedRouter />
|
||||
<BlockerScreen>
|
||||
<UnProtectedRouter />
|
||||
</BlockerScreen>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -5,10 +5,9 @@ import {
|
||||
setActivityTimeWindowMedium,
|
||||
} from '../common/AgentActivityConfigurableConstants';
|
||||
import { setBlacklistedAppsList } from '@common/BlacklistedAppsList';
|
||||
import handleBlacklistedAppsForBlockingCosmos from './blacklistedApps.service';
|
||||
|
||||
// const FIREBASE_FETCH_TIME = 15 * 60;
|
||||
const FIREBASE_FETCH_TIME = 1;
|
||||
const FIREBASE_FETCH_TIME = 15 * 60;
|
||||
export let FIREBASE_FETCH_TIMESTAMP: number;
|
||||
async function fetchUpdatedRemoteConfig() {
|
||||
await remoteConfig().fetch(FIREBASE_FETCH_TIME); //15 minutes
|
||||
remoteConfig()
|
||||
@@ -36,6 +35,7 @@ async function fetchUpdatedRemoteConfig() {
|
||||
setActivityTimeWindowHigh(ACTIVITY_TIME_WINDOW_HIGH);
|
||||
setActivityTimeWindowMedium(ACTIVITY_TIME_WINDOW_MEDIUM);
|
||||
setBlacklistedAppsList(BLACKLISTED_APPS);
|
||||
FIREBASE_FETCH_TIMESTAMP = Date.now();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user