TP-000 | Code Refactor (#642)

This commit is contained in:
Mantri Ramkishor
2023-11-21 19:47:05 +05:30
committed by GitHub
11 changed files with 75 additions and 44 deletions

View File

@@ -133,8 +133,8 @@ def reactNativeArchitectures() {
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}
def VERSION_CODE = 102
def VERSION_NAME = "2.5.7"
def VERSION_CODE = 103
def VERSION_NAME = "2.5.8"
android {
ndkVersion rootProject.ext.ndkVersion

View File

@@ -1,33 +1,34 @@
{
"project_info": {
"project_number": "136591056725",
"project_id": "field-verification-app",
"storage_bucket": "field-verification-app.appspot.com"
"project_number": "60755663443",
"project_id": "address-verification-app",
"storage_bucket": "address-verification-app.appspot.com",
"firebase_url": "https://address-verification-app-default-rtdb.firebaseio.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:136591056725:android:c454085ec6505cc01519dc",
"mobilesdk_app_id": "1:60755663443:android:4a948ee9d0b4e3098584a6",
"android_client_info": {
"package_name": "com.avapp"
}
},
"oauth_client": [
{
"client_id": "136591056725-ev8db4hrlud2m23n0o03or3cmmp3a3cq.apps.googleusercontent.com",
"client_id": "60755663443-40k0fbrbbqv4ci4hrjlbrphab5fj387b.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyBL32d7WRJTcJawKjT1XCEcFbGGQ8wA6j8"
"current_key": "AIzaSyA70_d2M2ke-Mu0OHGZ6iZilBbD6A-_z0c"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "136591056725-ev8db4hrlud2m23n0o03or3cmmp3a3cq.apps.googleusercontent.com",
"client_id": "60755663443-40k0fbrbbqv4ci4hrjlbrphab5fj387b.apps.googleusercontent.com",
"client_type": 3
}
]
@@ -36,4 +37,4 @@
}
],
"configuration_version": "1"
}
}

View File

@@ -2,7 +2,7 @@
<string name="app_name">Cosmos</string>
<string name="appCenterCrashes_whenToSendCrashes" moduleConfig="true" translatable="false">DO_NOT_ASK_JAVASCRIPT</string>
<string name="appCenterAnalytics_whenToEnableAnalytics" moduleConfig="true" translatable="false">ALWAYS_SEND</string>
<string moduleConfig="true" name="CodePushDeploymentKey">7QaWiko4C3MnPgrYqrVT7t2Krx-bUXiOHDJfr</string>
<string moduleConfig="true" name="CodePushDeploymentKey">pastekeyhere</string>
<string name="bottom_sheet_overlay">Bottom Sheet Overlay</string>
<string name="something_went_wrong">Something Went Wrong</string>
<string name="crash_occurred">Crash Occurred</string>

View File

@@ -1,6 +1,6 @@
{
"name": "AV_APP",
"version": "2.5.7",
"version": "2.5.8",
"private": true,
"scripts": {
"android:dev": "yarn move:dev && react-native run-android",

View File

@@ -662,6 +662,11 @@ export const CLICKSTREAM_EVENT_NAMES = {
name: 'FA_NEARBY_CASE_CLICKED',
description: 'FA_NEARBY_CASE_CLICKED',
},
FA_SNAPSHOT_LISTENER: {
name: 'FA_SNAPSHOT_LISTENER',
description: 'FA_SNAPSHOT_LISTENER',
},
} as const;
export enum MimeType {

View File

@@ -1,14 +1,14 @@
import { MILLISECONDS_IN_A_MINUTE, MINUTES_IN_AN_HOUR } from '../../RN-UI-LIB/src/utlis/common';
export const BASE_AV_APP_URL = 'https://longhorn.navi.com/field-app';
export const BASE_AV_APP_URL = 'https://qa-longhorn-portal.np.navi-tech.in/field-app';
export const SENTRY_DSN =
'https://5daa4832fade44b389b265de9b26c2fd@longhorn.navi.com/glitchtip-events/172';
export const JANUS_SERVICE_URL = 'https://longhorn.navi.com/api/events/json';
export const ENV = 'prod';
'https://acef93c884c1424cacc4ec899562e203@qa-longhorn-portal.np.navi-tech.in/glitchtip-events/173';
export const JANUS_SERVICE_URL = 'https://qa-longhorn-portal.np.navi-tech.in/api/events/json';
export const ENV = 'qa';
export const IS_SSO_ENABLED = true;
export const APM_APP_NAME = 'cosmos-app';
export const APM_BASE_URL = 'https://longhorn.navi.com/apm-events';
export const APM_BASE_URL = 'https://qa-longhorn-portal.np.navi-tech.in/apm-events';
export const IS_DATA_SYNC_REQUIRED = true;
export const DATA_SYNC_TIME_INTERVAL = 2 * MINUTES_IN_AN_HOUR * MILLISECONDS_IN_A_MINUTE; // 2hr
export const GOOGLE_SSO_CLIENT_ID =
'136591056725-ev8db4hrlud2m23n0o03or3cmmp3a3cq.apps.googleusercontent.com';
'60755663443-40k0fbrbbqv4ci4hrjlbrphab5fj387b.apps.googleusercontent.com';

View File

@@ -8,7 +8,7 @@ import { type RootState } from '../store/store';
import { useAppDispatch, useAppSelector } from '.';
import { setLoading, updateCaseDetailsFirestore } from '../reducer/allCasesSlice';
import { type CaseDetail } from '../screens/caseDetails/interface';
import { FirestoreUpdateTypes } from '../common/Constants';
import { CLICKSTREAM_EVENT_NAMES, FirestoreUpdateTypes } from '../common/Constants';
import { toast } from '../../RN-UI-LIB/src/components/toast';
import { updateAvTemplateData, updateCollectionTemplateData } from '../reducer/caseReducer';
import { type ILockData, MY_CASE_ITEM, setLockData, VisitPlanStatus } from '../reducer/userSlice';
@@ -18,6 +18,8 @@ import { ToastMessages } from '../screens/allCases/constants';
import { setForceUninstallData } from '../reducer/metadataSlice';
import { logError } from '../components/utlis/errorUtils';
import { type GenericFunctionArgs } from '../common/GenericTypes';
import { addClickstreamEvent } from '@services/clickstreamEventService';
import analytics from '@react-native-firebase/analytics';
export interface CaseUpdates {
updateType: string;
@@ -123,6 +125,12 @@ const useFirestoreUpdates = () => {
});
});
!isInitialLoad && showCaseUpdationToast(newlyAddedCases, deletedCases);
addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_SNAPSHOT_LISTENER, {
snapshot_path: 'handleCasesUpdate',
});
await analytics().logEvent(CLICKSTREAM_EVENT_NAMES.FA_SNAPSHOT_LISTENER.name, {
snapshot_path: 'handleCasesUpdate',
});
};
const handleConfigUpdate = (
@@ -201,9 +209,20 @@ const useFirestoreUpdates = () => {
const subscribeToDoc = (successCb: GenericFunctionArgs, collectionPath: string) =>
firestore()
.doc(collectionPath)
.onSnapshot(successCb, (err) => {
handleError(err, collectionPath);
});
.onSnapshot(
async () => {
successCb();
addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_SNAPSHOT_LISTENER, {
snapshot_path: collectionPath,
});
await analytics().logEvent(CLICKSTREAM_EVENT_NAMES.FA_SNAPSHOT_LISTENER.name, {
snapshot_path: collectionPath,
});
},
(err) => {
handleError(err, collectionPath);
}
);
const subscribeToCases = () => {
let refId = user?.referenceId;

View File

@@ -13,9 +13,12 @@ const useScreenshotTracking = () => {
}));
const screenshotEventEmitter = useMemo(() => new NativeEventEmitter(ScreenshotBlocker), []);
useEffect(() => {
ScreenshotBlocker.startScreenshotTracking();
}, []);
useEffect(() => {
const screenshotTakenSubscription = screenshotEventEmitter.addListener(
'screenshotTaken',
(event) => {

View File

@@ -97,10 +97,23 @@ const CaseItem: React.FC<ICaseItemProps> = ({
case NEARBY_CASES: {
return (
<Pressable onPress={navigateToNearbyCases}>
<View style={styles.nearByCasesContainer}>
<View
style={[
GenericStyles.row,
GenericStyles.alignCenter,
GenericStyles.spaceBetween,
getShadowStyle(2),
GenericStyles.ph12,
GenericStyles.pv12,
GenericStyles.br8,
GenericStyles.mt16,
GenericStyles.mb12,
GenericStyles.whiteBackground,
]}
>
<View style={[GenericStyles.row, GenericStyles.alignCenter]}>
<LocationIcon />
<Text style={styles.nearByCasesText}>View nearby cases</Text>
<Text style={[styles.nearByCasesText, GenericStyles.pl4]}>View nearby cases</Text>
</View>
<ArrowRightOutlineIcon fillColor={COLORS.BACKGROUND.LIGHT} />
</View>
@@ -130,20 +143,7 @@ const styles = StyleSheet.create({
paddingBottom: 6,
paddingHorizontal: 2,
},
nearByCasesContainer: {
...GenericStyles.row,
...GenericStyles.alignCenter,
...GenericStyles.spaceBetween,
...getShadowStyle(2),
...GenericStyles.ph12,
...GenericStyles.pv12,
...GenericStyles.br8,
...GenericStyles.mt16,
...GenericStyles.mb12,
...GenericStyles.whiteBackground,
},
nearByCasesText: {
...GenericStyles.pl4,
color: COLORS.TEXT.DARK,
},
});

View File

@@ -234,9 +234,11 @@ const CollectionCaseDetails: React.FC<ICaseDetails> = (props) => {
});
};
useFocusEffect(() => {
ScreenshotBlocker.unblockScreenshots();
});
useEffect(() => {
if (isFocused) {
ScreenshotBlocker.unblockScreenshots();
}
}, [isFocused]);
return (
<Layout>

View File

@@ -21,7 +21,7 @@ import {
} from '../../components/utlis/commonFunctions';
import { goBack } from '../../components/utlis/navigationUtlis';
import ScreenshotBlocker from '../../components/utlis/ScreenshotBlocker';
import { useFocusEffect } from '@react-navigation/native';
import { useIsFocused } from '@react-navigation/native';
import DocumentDetails from './DocumentDetails';
import { getCachedImageBase64, getDocumentDetails } from './utils/documentUtils';
import CachedImage from '../../common/CachedImage';
@@ -155,9 +155,10 @@ const CustomerProfile: React.FC<ICustomerProfile> = (props) => {
setLoading(false);
};
useFocusEffect(() => {
ScreenshotBlocker.blockScreenshots();
});
const isFocused = useIsFocused();
useEffect(() => {
if (isFocused) ScreenshotBlocker.blockScreenshots();
}, [isFocused]);
const imageUri = getImageURI();