TP-69871 | permissions boolean added
This commit is contained in:
@@ -344,14 +344,5 @@ public class DeviceUtilsModule extends ReactContextBaseJavaModule {
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getBuildFlavour(Promise promise) {
|
||||
try {
|
||||
String buildFlavour = BuildConfig.FLAVOR;
|
||||
promise.resolve(buildFlavour);
|
||||
} catch (Exception err) {
|
||||
promise.reject(err);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ import { syncCasesByFallback } from '../reducer/allCasesSlice';
|
||||
import { MILLISECONDS_IN_A_MINUTE, noop } from '../../RN-UI-LIB/src/utlis/common';
|
||||
import { setCaseSyncLock, setLockData } from '../reducer/userSlice';
|
||||
import { getConfigData } from '../action/configActions';
|
||||
import { GLOBAL } from '../constants/Global';
|
||||
import { getBuildFlavour } from '../components/utlis/DeviceUtils';
|
||||
import { AppStates } from '../types/appStates';
|
||||
import { StorageKeys } from '../types/storageKeys';
|
||||
|
||||
@@ -66,4 +66,3 @@ export const sendContentToWhatsapp = (
|
||||
): Promise<boolean> =>
|
||||
DeviceUtilsModule?.sendContentToWhatsapp(message, imageUrl, mimeType, format, fileName);
|
||||
|
||||
export const getBuildFlavour = (): Promise<buildFlavour> => DeviceUtilsModule.getBuildFlavour();
|
||||
|
||||
@@ -83,6 +83,7 @@ export enum ApiKeys {
|
||||
FEE_WAIVER_HISTORY = 'FEE_WAIVER_HISTORY',
|
||||
FEE_WAIVER_V2 = 'FEE_WAIVER_V2',
|
||||
GET_PIN_CODES_DETAILS = 'GET_PIN_CODES_DETAILS',
|
||||
SYNC_COSMOS_TO_LONGHORN = 'SYNC_COSMOS_TO_LONGHORN',
|
||||
}
|
||||
|
||||
export const API_URLS: Record<ApiKeys, string> = {} as Record<ApiKeys, string>;
|
||||
@@ -158,6 +159,7 @@ API_URLS[ApiKeys.DUE_AMOUNT_SUMMARY] = '/collection-cases/{loanAccountNumber}/am
|
||||
API_URLS[ApiKeys.FEE_WAIVER_HISTORY] = '/collection-cases/{loanAccountNumber}/waiver-history';
|
||||
API_URLS[ApiKeys.FEE_WAIVER_V2] = '/loan/request/{loanAccountNumber}/adjust-component/v2';
|
||||
API_URLS[ApiKeys.GET_PIN_CODES_DETAILS] = '/api/v1/pincodes/{pinCode}';
|
||||
API_URLS[ApiKeys.SYNC_COSMOS_TO_LONGHORN] = '/sync/cosmos-sync';
|
||||
|
||||
export const API_STATUS_CODE = {
|
||||
OK: 200,
|
||||
@@ -325,6 +327,7 @@ axiosInstance.interceptors.response.use(
|
||||
|
||||
axiosInstance.defaults.headers.common['Content-Type'] = 'application/json';
|
||||
axiosInstance.defaults.baseURL = BASE_AV_APP_URL;
|
||||
axiosInstance.defaults.headers.common['routing_key'] = 'a833bdaf-3504-4639-b202-461e28f6a4b6';
|
||||
|
||||
// TODO:: Ideally should happen through middlewares.
|
||||
export const registerNavigateAndDispatch = (dispatchParam: Dispatch<any>) =>
|
||||
|
||||
20
src/miniModules/callingAgents/screens/homeScreen/action.ts
Normal file
20
src/miniModules/callingAgents/screens/homeScreen/action.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import axiosInstance, { ApiKeys, getApiUrl } from "@components/utlis/apiHelper";
|
||||
import { toast } from "@rn-ui-lib/components/toast";
|
||||
|
||||
export const syncToLonghorn = async (
|
||||
allPermissionsGranted: boolean,
|
||||
agentId: string,
|
||||
appVersion: string
|
||||
) => {
|
||||
const url = getApiUrl(ApiKeys.SYNC_COSMOS_TO_LONGHORN);
|
||||
const payload = {
|
||||
allPermissionsGranted,
|
||||
agentReferenceId: agentId,
|
||||
appVersion,
|
||||
};
|
||||
try {
|
||||
await axiosInstance.post(url, payload);
|
||||
} catch {
|
||||
toast({ type: 'error', text1: 'Could not sync. Please try again' });
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,39 @@
|
||||
import React from 'react';
|
||||
import { View } from 'react-native';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { View, StyleSheet } from 'react-native';
|
||||
import { GenericStyles } from '../../../../../RN-UI-LIB/src/styles';
|
||||
import Heading from '../../../../../RN-UI-LIB/src/components/Heading';
|
||||
import { useAppSelector } from '../../../../hooks';
|
||||
import NavigationHeader from '../../../../../RN-UI-LIB/src/components/NavigationHeader';
|
||||
import NaviLogoIcon from '../../../../../RN-UI-LIB/src/Icons/NaviLogoIcon';
|
||||
import Button from '@rn-ui-lib/components/Button';
|
||||
import RefreshIcon from '@rn-ui-lib/icons/RefreshIcon';
|
||||
import { syncToLonghorn } from './action';
|
||||
import { getAppVersion } from '@components/utlis/commonFunctions';
|
||||
import { COLORS } from '@rn-ui-lib/colors';
|
||||
import { getPermissionsToRequest } from '@components/utlis/PermissionUtils';
|
||||
|
||||
|
||||
const CallingAgentHomeScreen = () => {
|
||||
|
||||
const [isAllPermissionsGranted, setIsAllPermissionsGranted] = useState(false);
|
||||
|
||||
const checkPermissions = async () => {
|
||||
const permissionsToRequest = await getPermissionsToRequest();
|
||||
const allPermissionsGranted = permissionsToRequest.length === 0;
|
||||
setIsAllPermissionsGranted(allPermissionsGranted);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
checkPermissions();
|
||||
}, []);
|
||||
|
||||
const user = useAppSelector((state) => state.user.user);
|
||||
const agentId = useAppSelector((state) => state.user.user?.referenceId) || '';
|
||||
const appVersion = getAppVersion();
|
||||
const handleOnPress = () => {
|
||||
syncToLonghorn(isAllPermissionsGranted, agentId, appVersion);
|
||||
};
|
||||
|
||||
return (
|
||||
<View style={GenericStyles.fill}>
|
||||
<NavigationHeader
|
||||
@@ -24,14 +50,30 @@ const CallingAgentHomeScreen = () => {
|
||||
</View>
|
||||
}
|
||||
/>
|
||||
<View style={[GenericStyles.centerAlignedRow, GenericStyles.fill]}>
|
||||
<View>
|
||||
<Heading type="h3">Welcome,</Heading>
|
||||
<Heading type="h1">{user?.name}</Heading>
|
||||
<View style={[GenericStyles.centerAligned, GenericStyles.fill]}>
|
||||
<View style={GenericStyles.centerAligned}>
|
||||
<Heading style={styles.heading} type='h5'>
|
||||
Welcome
|
||||
</Heading>
|
||||
<Heading type="h2" dark bold>{user?.name}</Heading>
|
||||
</View>
|
||||
<View style={[GenericStyles.mt16]}>
|
||||
<Button
|
||||
variant="primaryText"
|
||||
title="Sync instantly to longhorn"
|
||||
leftIcon={<RefreshIcon />}
|
||||
onPress={handleOnPress}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
heading: {
|
||||
color: COLORS.TEXT.BLACK,
|
||||
}
|
||||
});
|
||||
|
||||
export default CallingAgentHomeScreen;
|
||||
|
||||
@@ -19,7 +19,7 @@ import { getAgentDetail } from '../../action/authActions';
|
||||
import { CaptureGeolocation, DeviceLocation } from '@components/form/services/geoLocation.service';
|
||||
import { setDeviceGeolocation } from '@reducers/foregroundServiceSlice';
|
||||
import { GLOBAL } from '@constants/Global';
|
||||
import CallingAgentRoutes from 'src/miniModules/callingAgents/routes';
|
||||
import CallingAgentRoutes from '../../miniModules/callingAgents/routes';
|
||||
import NearbyCases from '@screens/allCases/NearbyCases';
|
||||
import usePolling from '@hooks/usePolling';
|
||||
import useResyncFirebase from '@hooks/useResyncFirebase';
|
||||
|
||||
Reference in New Issue
Block a user