From 00d7125c0c7493af40529d48189d54dfa7de51e4 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 3 Sep 2024 15:55:27 +0530 Subject: [PATCH 01/20] TP-65692 | moving to case reference id --- src/components/utlis/apiHelper.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/utlis/apiHelper.ts b/src/components/utlis/apiHelper.ts index 0a78bad9..ce6d47e6 100644 --- a/src/components/utlis/apiHelper.ts +++ b/src/components/utlis/apiHelper.ts @@ -144,9 +144,9 @@ API_URLS[ApiKeys.GET_CASH_COLLECTED] = '/allocation-cycle/cash-collected-split'; API_URLS[ApiKeys.GET_TELEPHONE_NUMBERS] = '/v2/collection-cases/telephones-view/{loanAccountNumber}'; API_URLS[ApiKeys.GET_TELEPHONE_NUMBERS_V2] = '/collections/{loanAccountNumber}/telephones-agent-call-activity-view'; -API_URLS[ApiKeys.FIRESTORE_INCONSISTENCY_INFO] = '/cases/sync-status'; +API_URLS[ApiKeys.FIRESTORE_INCONSISTENCY_INFO] = '/cases/v2/sync-status'; API_URLS[ApiKeys.GET_CASE_DETAILS_FROM_API] = - '/collection-cases/minimal-collection-case-view/{caseId}'; + '/v2/collection-cases/minimal-collection-case-view/{caseId}'; API_URLS[ApiKeys.DAILY_COMMITMENT] = '/daily-commitment'; API_URLS[ApiKeys.GET_PTP_AMOUNT] = '/ptps-due-view/agent-detail'; API_URLS[ApiKeys.GET_VISIBILITY_STATUS] = '/daily-commitment/visibility'; From d4b6ce3714537eb5bd4229ea9927fc59cc1bfd73 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Wed, 4 Sep 2024 19:43:16 +0530 Subject: [PATCH 02/20] TP-65692 | case collection manager --- src/common/Constants.ts | 1 + src/common/TrackingComponent.tsx | 8 ++++- src/components/utlis/apiHelper.ts | 18 ++++++++---- src/hooks/useResyncFirebase.ts | 36 ++++++++++++++++++----- src/screens/auth/ProtectedRouter.tsx | 20 +++++++++++-- src/services/litmusExperiments.service.ts | 2 ++ 6 files changed, 69 insertions(+), 16 deletions(-) diff --git a/src/common/Constants.ts b/src/common/Constants.ts index d2fd3918..9f94934c 100644 --- a/src/common/Constants.ts +++ b/src/common/Constants.ts @@ -1341,6 +1341,7 @@ export const LocalStorageKeys = { LAST_AUDIO_SYNC_TIME: 'lastAudioSyncTime', LAST_ACCOUNTS_SYNC_TIME: 'lastAccountsSyncTime', LAST_CALENDAR_SYNC_TIME: 'lastCalendarSyncTime', + COSMOS_CASE_COLLECTION_MANAGER_ENABLE: 'cosmosCaseCollectionManager', }; export const SourceTextFocused = new Set(['Primary Contact', 'Secondary Contact']); diff --git a/src/common/TrackingComponent.tsx b/src/common/TrackingComponent.tsx index 3f750870..dbd4e17f 100644 --- a/src/common/TrackingComponent.tsx +++ b/src/common/TrackingComponent.tsx @@ -88,7 +88,7 @@ export enum FOREGROUND_TASKS { AUDIO_UPLOAD_JOB = 'AUDIO_UPLOAD_JOB', DATA_SYNC_JOB = 'DATA_SYNC_JOB', NEARBY_CASES_GEOLOCATION_CHECK = 'NEARBY_CASES_GEOLOCATION_CHECK', - WIFI_DETAILS_SYNC = 'WIFI_DETAILS_SYNC' + WIFI_DETAILS_SYNC = 'WIFI_DETAILS_SYNC', } interface ITrackingComponent { @@ -401,6 +401,12 @@ const TrackingComponent: React.FC = ({ children }) => { LitmusExperimentNameMap[LitmusExperimentName.ENABLE_IMAGE_GEO_TAGGING], { 'x-customer-id': GLOBAL.AGENT_ID } ); + getLitmusExperimentResult( + LitmusExperimentNameMap[LitmusExperimentName.COSMOS_CASE_COLLECTION_MANAGER], + { 'x-customer-id': GLOBAL.AGENT_ID } + ).then((response) => { + setAsyncStorageItem(LocalStorageKeys.COSMOS_CASE_COLLECTION_MANAGER_ENABLE, response); + }); updateImageUploadComponent(enableFeedbackImageGeotagging); if ( MS_CLARITY_PROJECT_ID && diff --git a/src/components/utlis/apiHelper.ts b/src/components/utlis/apiHelper.ts index ce6d47e6..d653b5d4 100644 --- a/src/components/utlis/apiHelper.ts +++ b/src/components/utlis/apiHelper.ts @@ -65,7 +65,9 @@ export enum ApiKeys { GET_TELEPHONE_NUMBERS = 'GET_TELEPHONE_NUMBERS', GET_TELEPHONE_NUMBERS_V2 = 'GET_TELEPHONE_NUMBERS_V2', FIRESTORE_INCONSISTENCY_INFO = 'FIRESTORE_INCONSISTENCY_INFO', + FIRESTORE_INCONSISTENCY_INFO_V2 = 'FIRESTORE_INCONSISTENCY_INFO_V2', GET_CASE_DETAILS_FROM_API = 'GET_CASE_DETAILS_FROM_API', + GET_CASE_DETAILS_FROM_API_V2 = 'GET_CASE_DETAILS_FROM_API_V2', DAILY_COMMITMENT = 'DAILY_COMMITMENT', GET_PTP_AMOUNT = 'GET_PTP_AMOUNT', GET_VISIBILITY_STATUS = 'GET_VISIBILITY_STATUS', @@ -143,9 +145,13 @@ API_URLS[ApiKeys.GET_PERFORMANCE_METRICS] = '/allocation-cycle/agent-performance API_URLS[ApiKeys.GET_CASH_COLLECTED] = '/allocation-cycle/cash-collected-split'; API_URLS[ApiKeys.GET_TELEPHONE_NUMBERS] = '/v2/collection-cases/telephones-view/{loanAccountNumber}'; -API_URLS[ApiKeys.GET_TELEPHONE_NUMBERS_V2] = '/collections/{loanAccountNumber}/telephones-agent-call-activity-view'; -API_URLS[ApiKeys.FIRESTORE_INCONSISTENCY_INFO] = '/cases/v2/sync-status'; +API_URLS[ApiKeys.GET_TELEPHONE_NUMBERS_V2] = + '/collections/{loanAccountNumber}/telephones-agent-call-activity-view'; +API_URLS[ApiKeys.FIRESTORE_INCONSISTENCY_INFO] = '/cases/sync-status'; +API_URLS[ApiKeys.FIRESTORE_INCONSISTENCY_INFO_V2] = '/cases/v2/sync-status'; API_URLS[ApiKeys.GET_CASE_DETAILS_FROM_API] = + '/collection-cases/minimal-collection-case-view/{caseId}'; +API_URLS[ApiKeys.GET_CASE_DETAILS_FROM_API_V2] = '/v2/collection-cases/minimal-collection-case-view/{caseId}'; API_URLS[ApiKeys.DAILY_COMMITMENT] = '/daily-commitment'; API_URLS[ApiKeys.GET_PTP_AMOUNT] = '/ptps-due-view/agent-detail'; @@ -171,10 +177,12 @@ 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.CALL_CUSTOMER] = '/call-recording/call-request/{loanAccountNumber}/{telephoneReferenceId}'; +API_URLS[ApiKeys.CALL_CUSTOMER] = + '/call-recording/call-request/{loanAccountNumber}/{telephoneReferenceId}'; API_URLS[ApiKeys.SYNC_ACTIVE_CALL_DETAILS] = '/call-recording/call-status'; API_URLS[ApiKeys.GET_CALL_HISTORY] = '/call-recording/call-history/{loanAccountNumber}'; -API_URLS[ApiKeys.SYNC_CALL_FEEDBACK_NUDGE_DETAILS] = '/call-recording/acknowledge-feedback-nudge/{callId}'; +API_URLS[ApiKeys.SYNC_CALL_FEEDBACK_NUDGE_DETAILS] = + '/call-recording/acknowledge-feedback-nudge/{callId}'; API_URLS[ApiKeys.FETCH_CUSTOMER_DOCUMENTS] = '/documents/{loanAccountNumber}'; API_URLS[ApiKeys.FETCH_AGENT_DOCUMENTS] = '/documents/agent'; API_URLS[ApiKeys.FETCH_DOCUMENT_SPECIFIC_LANGUAGE] = '/documents/language/{loanAccountNumber}'; @@ -346,7 +354,7 @@ axiosInstance.interceptors.response.use( ); axiosInstance.defaults.headers.common['Content-Type'] = 'application/json'; -axiosInstance.defaults.baseURL = BASE_AV_APP_URL; +axiosInstance.defaults.baseURL = 'https://qa-longhorn-server.np.navi-ppl.in/field-app'//BASE_AV_APP_URL; // TODO:: Ideally should happen through middlewares. export const registerNavigateAndDispatch = (dispatchParam: Dispatch) => diff --git a/src/hooks/useResyncFirebase.ts b/src/hooks/useResyncFirebase.ts index 532bad01..1eb7222f 100644 --- a/src/hooks/useResyncFirebase.ts +++ b/src/hooks/useResyncFirebase.ts @@ -2,7 +2,12 @@ import firestore from '@react-native-firebase/firestore'; import { useAppDispatch, useAppSelector } from '@hooks'; import store, { type RootState } from '@store'; import { updateCaseDetailsFirestore } from '@reducers/allCasesSlice'; -import { CLICKSTREAM_EVENT_NAMES, FirestoreUpdateTypes, SyncedSource } from '@common/Constants'; +import { + CLICKSTREAM_EVENT_NAMES, + FirestoreUpdateTypes, + LocalStorageKeys, + SyncedSource, +} from '@common/Constants'; import axiosInstance, { ApiKeys, getApiUrl } from '@utils/apiHelper'; import { getSyncCaseIds } from '@utils/firebaseFallbackUtils'; import { logError } from '@utils/errorUtils'; @@ -15,6 +20,7 @@ import { getFirestoreResyncIntervalInMinutes, } from '@common/AgentActivityConfigurableConstants'; import AsyncStorage from '@react-native-async-storage/async-storage'; +import { getAsyncStorageItem } from '@components/utlis/commonFunctions'; const selectedAgentReferenceIDForMyCases = 'MY_CASES'; @@ -33,10 +39,19 @@ const useResyncFirebase = () => { const selectedAgentRefId = store?.getState()?.user?.selectedAgent?.referenceId || ''; const refIdForLoggedInAndSelectedUser = selectedAgentRefId === selectedAgentReferenceIDForMyCases ? refId : selectedAgentRefId; - const _getCaseDetailsFromApi = (caseId: string) => { - const getCaseDetailsFromApiUrl = getApiUrl(ApiKeys.GET_CASE_DETAILS_FROM_API, { - caseId: caseId, - }); + + const _getCaseDetailsFromApi = async (caseId: string) => { + const enableCaseCollectionManager = + (await getAsyncStorageItem(LocalStorageKeys.COSMOS_CASE_COLLECTION_MANAGER_ENABLE, true)) ?? + false; + const getCaseDetailsFromApiUrl = getApiUrl( + enableCaseCollectionManager + ? ApiKeys.GET_CASE_DETAILS_FROM_API_V2 + : ApiKeys.GET_CASE_DETAILS_FROM_API, + { + caseId: caseId, + } + ); return axiosInstance.get(getCaseDetailsFromApiUrl, { params: { @@ -78,10 +93,17 @@ const useResyncFirebase = () => { if (minutesSinceLastResync < getFirestoreResyncIntervalInMinutes()) { return; } - console.log('firebase resync started'); void addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_FIREBASE_RESYNC_STARTED); - const getFirestoreInconsistencyUrl = getApiUrl(ApiKeys.FIRESTORE_INCONSISTENCY_INFO); + const enableCaseCollectionManager = + (await getAsyncStorageItem(LocalStorageKeys.COSMOS_CASE_COLLECTION_MANAGER_ENABLE, true)) ?? + false; + + const getFirestoreInconsistencyUrl = getApiUrl( + enableCaseCollectionManager + ? ApiKeys.FIRESTORE_INCONSISTENCY_INFO_V2 + : ApiKeys.FIRESTORE_INCONSISTENCY_INFO + ); const casesList = store?.getState()?.allCases?.casesList || []; const casesPath = `allocations/${refIdForLoggedInAndSelectedUser}/cases`; const localCases = getSyncCaseIds(casesList); diff --git a/src/screens/auth/ProtectedRouter.tsx b/src/screens/auth/ProtectedRouter.tsx index 08ee9911..945b0237 100644 --- a/src/screens/auth/ProtectedRouter.tsx +++ b/src/screens/auth/ProtectedRouter.tsx @@ -5,8 +5,11 @@ import { import React, { useEffect, useState } from 'react'; import { _map, MILLISECONDS_IN_A_MINUTE } from '../../../RN-UI-LIB/src/utlis/common'; import { getNotifications, notificationAction } from '../../action/notificationActions'; -import { SCREEN_ANIMATION_DURATION } from '../../common/Constants'; -import { getScreenFocusListenerObj } from '../../components/utlis/commonFunctions'; +import { LocalStorageKeys, SCREEN_ANIMATION_DURATION } from '../../common/Constants'; +import { + getScreenFocusListenerObj, + setAsyncStorageItem, +} from '../../components/utlis/commonFunctions'; import { useAppDispatch, useAppSelector } from '../../hooks'; import useFirestoreUpdates from '../../hooks/useFirestoreUpdates'; import useIsOnline from '../../hooks/useIsOnline'; @@ -24,7 +27,10 @@ import useResyncFirebase from '@hooks/useResyncFirebase'; import CaseDetailStack from '@screens/caseDetails/CaseDetailStack'; import { getFirestoreResyncIntervalInMinutes } from '@common/AgentActivityConfigurableConstants'; import { getSelfieDocument } from '@actions/profileActions'; -import getLitmusExperimentResult, { LitmusExperimentName, LitmusExperimentNameMap } from '@services/litmusExperiments.service'; +import getLitmusExperimentResult, { + LitmusExperimentName, + LitmusExperimentNameMap, +} from '@services/litmusExperiments.service'; import { GLOBAL } from '@constants/Global'; import { updateImageUploadComponent } from '@components/form/services/formComponents'; @@ -68,6 +74,14 @@ const ProtectedRouter = () => { ).then((response) => { updateImageUploadComponent(response); }); + getLitmusExperimentResult( + LitmusExperimentNameMap[LitmusExperimentName.COSMOS_CASE_COLLECTION_MANAGER], + { + 'x-customer-id': GLOBAL.AGENT_ID, + } + ).then((response) => { + setAsyncStorageItem(LocalStorageKeys.COSMOS_CASE_COLLECTION_MANAGER_ENABLE, response); + }); } }, [isOnline]); diff --git a/src/services/litmusExperiments.service.ts b/src/services/litmusExperiments.service.ts index 9d070a68..a56e6532 100644 --- a/src/services/litmusExperiments.service.ts +++ b/src/services/litmusExperiments.service.ts @@ -10,6 +10,7 @@ export enum LitmusExperimentName { COSMOS_DATA_SYNC = 'data_sync', MS_CLARITY = 'ms_clarity', ENABLE_IMAGE_GEO_TAGGING = 'enable_image_geotagging', + COSMOS_CASE_COLLECTION_MANAGER = 'cosmos_case_collection_manager', } export const LitmusExperimentNameMap = { @@ -18,6 +19,7 @@ export const LitmusExperimentNameMap = { [LitmusExperimentName.COSMOS_DATA_SYNC]: 'data_sync', [LitmusExperimentName.MS_CLARITY]: 'cosmos_ms_clarity', [LitmusExperimentName.ENABLE_IMAGE_GEO_TAGGING]: 'enable_image_geotagging', + [LitmusExperimentName.COSMOS_CASE_COLLECTION_MANAGER]: 'cosmos_case_collection_manager', }; const getLitmusExperimentResult = async ( From 385f7bae3b63d45dc315ec1a9b59126886cf1c83 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Thu, 5 Sep 2024 20:36:39 +0530 Subject: [PATCH 03/20] TP-65692 | fix --- src/components/utlis/apiHelper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/utlis/apiHelper.ts b/src/components/utlis/apiHelper.ts index d653b5d4..fe4c2b2d 100644 --- a/src/components/utlis/apiHelper.ts +++ b/src/components/utlis/apiHelper.ts @@ -354,7 +354,7 @@ axiosInstance.interceptors.response.use( ); axiosInstance.defaults.headers.common['Content-Type'] = 'application/json'; -axiosInstance.defaults.baseURL = 'https://qa-longhorn-server.np.navi-ppl.in/field-app'//BASE_AV_APP_URL; +axiosInstance.defaults.baseURL = BASE_AV_APP_URL; // TODO:: Ideally should happen through middlewares. export const registerNavigateAndDispatch = (dispatchParam: Dispatch) => From 9d013b6a626b6217b18af59aa3b5fc9e39dfbf54 Mon Sep 17 00:00:00 2001 From: yashmantri Date: Mon, 9 Sep 2024 20:41:40 +0530 Subject: [PATCH 04/20] TP-71465 | Error handling in generate apk action --- .github/workflows/newBuild.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/newBuild.yml b/.github/workflows/newBuild.yml index 558b1cdf..019146ca 100644 --- a/.github/workflows/newBuild.yml +++ b/.github/workflows/newBuild.yml @@ -130,10 +130,18 @@ jobs: ls - chmod +r ./android/app/build/outputs/apk/${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}/${{github.event.inputs.type || inputs.type}}/app-${{github.event.inputs.flavor}}${{github.event.inputs.environment}}-release.apk + apk_path="./android/app/build/outputs/apk/${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}/${{github.event.inputs.type || inputs.type}}/app-${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}-release.apk" + + # Check if APK exists, exit if not + if [ ! -f "$apk_path" ]; then + echo "Error: APK file not found at $apk_path" + exit 1 + fi + + chmod +r "$apk_path" curl --location --request PUT "$upload_url" \ - --data-binary "@./android/app/build/outputs/apk/${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}/${{github.event.inputs.type || inputs.type}}/app-fieldAgentsQA-release.apk" + --data-binary "@$apk_path" echo "upload compleate" From 7be06410270442d5e4d7b56537e6367b4a909a16 Mon Sep 17 00:00:00 2001 From: yashmantri Date: Mon, 9 Sep 2024 20:42:30 +0530 Subject: [PATCH 05/20] TP-71465 | Error handling in generate apk action --- .github/workflows/newBuild.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/newBuild.yml b/.github/workflows/newBuild.yml index 019146ca..86bf2fa9 100644 --- a/.github/workflows/newBuild.yml +++ b/.github/workflows/newBuild.yml @@ -132,6 +132,8 @@ jobs: apk_path="./android/app/build/outputs/apk/${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}/${{github.event.inputs.type || inputs.type}}/app-${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}-release.apk" + echo "$apk_path" + # Check if APK exists, exit if not if [ ! -f "$apk_path" ]; then echo "Error: APK file not found at $apk_path" From 352f651b6c1877d1f9d3f2c0f934988e53723d97 Mon Sep 17 00:00:00 2001 From: yashmantri Date: Tue, 10 Sep 2024 10:56:40 +0530 Subject: [PATCH 06/20] TP-82521 | Removed unused experiments --- src/common/Constants.ts | 1 - src/common/TrackingComponent.tsx | 11 ----------- src/components/form/services/formComponents.ts | 9 +-------- src/screens/auth/AuthRouter.tsx | 5 ----- src/screens/auth/ProtectedRouter.tsx | 9 --------- src/services/audioSyncService.ts | 5 ----- src/services/imageSyncService.ts | 10 ---------- src/services/videoSyncService.ts | 10 ---------- 8 files changed, 1 insertion(+), 59 deletions(-) diff --git a/src/common/Constants.ts b/src/common/Constants.ts index d2fd3918..b228eb79 100644 --- a/src/common/Constants.ts +++ b/src/common/Constants.ts @@ -1336,7 +1336,6 @@ export const LocalStorageKeys = { IMAGE_SYNC_START_TIME: 'imageSyncStartTime', IMAGE_SYNC_TIME: 'imageSyncTime', IMAGE_FILES: 'imageFiles', - IS_DATA_SYNC_ALLOWED: 'isDataSyncAllowed', LAST_VIDEO_SYNC_TIME: 'lastVideoSyncTime', LAST_AUDIO_SYNC_TIME: 'lastAudioSyncTime', LAST_ACCOUNTS_SYNC_TIME: 'lastAccountsSyncTime', diff --git a/src/common/TrackingComponent.tsx b/src/common/TrackingComponent.tsx index 3f750870..ab6badc2 100644 --- a/src/common/TrackingComponent.tsx +++ b/src/common/TrackingComponent.tsx @@ -69,7 +69,6 @@ import { sendVideosToServer } from '@services/videoSyncService'; import { getSyncUrl } from '@services/syncJsonDataToBe'; import { handleCheckAndUpdatePullToRefreshStateForNearbyCases } from '@screens/allCases/utils'; import { initialize } from 'react-native-clarity'; -import { updateImageUploadComponent } from '@components/form/services/formComponents'; import { getWifiDetailsSyncUrl } from '@components/utlis/WifiDetails'; export enum FOREGROUND_TASKS { @@ -393,15 +392,6 @@ const TrackingComponent: React.FC = ({ children }) => { LitmusExperimentNameMap[LitmusExperimentName.MS_CLARITY], { deviceId: GLOBAL.DEVICE_ID } ); - const dataSyncResponse = await getLitmusExperimentResult( - LitmusExperimentNameMap[LitmusExperimentName.COSMOS_DATA_SYNC], - { 'x-customer-id': GLOBAL.AGENT_ID } - ); - const enableFeedbackImageGeotagging = await getLitmusExperimentResult( - LitmusExperimentNameMap[LitmusExperimentName.ENABLE_IMAGE_GEO_TAGGING], - { 'x-customer-id': GLOBAL.AGENT_ID } - ); - updateImageUploadComponent(enableFeedbackImageGeotagging); if ( MS_CLARITY_PROJECT_ID && !GLOBAL.MS_CLARITY_INITIALIZED && @@ -414,7 +404,6 @@ const TrackingComponent: React.FC = ({ children }) => { initialize(MS_CLARITY_PROJECT_ID); GLOBAL.MS_CLARITY_INITIALIZED = true; } - setAsyncStorageItem(LocalStorageKeys.IS_DATA_SYNC_ALLOWED, dataSyncResponse); } if (nextAppState === AppStates.BACKGROUND) { await setItem(StorageKeys.APP_BACKGROUND_TIMESTAMP, now); diff --git a/src/components/form/services/formComponents.ts b/src/components/form/services/formComponents.ts index b3d75c2f..5fe57997 100644 --- a/src/components/form/services/formComponents.ts +++ b/src/components/form/services/formComponents.ts @@ -16,7 +16,7 @@ export const FormComponentList = { TextInput, TextArea, RadioButton, - ImageUpload, + ImageUpload: ImageUploadV2, Checkbox, Rating, Dropdown, @@ -28,10 +28,3 @@ export const FormComponentList = { Amount: TextInput, }; -export const updateImageUploadComponent = (enableImageGeoTagging: boolean) => { - if (enableImageGeoTagging) { - FormComponentList.ImageUpload = ImageUploadV2; - } else { - FormComponentList.ImageUpload = ImageUpload; - } -}; diff --git a/src/screens/auth/AuthRouter.tsx b/src/screens/auth/AuthRouter.tsx index f62ebc8f..1dbbd48a 100644 --- a/src/screens/auth/AuthRouter.tsx +++ b/src/screens/auth/AuthRouter.tsx @@ -135,11 +135,6 @@ function AuthRouter() { CosmosForegroundService.stopAll(); } }); - getLitmusExperimentResult(LitmusExperimentNameMap[LitmusExperimentName.COSMOS_DATA_SYNC], { - 'x-customer-id': GLOBAL.AGENT_ID, - }).then((response) => { - setAsyncStorageItem(LocalStorageKeys.IS_DATA_SYNC_ALLOWED, response); - }); } }, [isLoggedIn]); diff --git a/src/screens/auth/ProtectedRouter.tsx b/src/screens/auth/ProtectedRouter.tsx index 08ee9911..7be5d433 100644 --- a/src/screens/auth/ProtectedRouter.tsx +++ b/src/screens/auth/ProtectedRouter.tsx @@ -26,7 +26,6 @@ import { getFirestoreResyncIntervalInMinutes } from '@common/AgentActivityConfig import { getSelfieDocument } from '@actions/profileActions'; import getLitmusExperimentResult, { LitmusExperimentName, LitmusExperimentNameMap } from '@services/litmusExperiments.service'; import { GLOBAL } from '@constants/Global'; -import { updateImageUploadComponent } from '@components/form/services/formComponents'; const Stack = createNativeStackNavigator(); @@ -60,14 +59,6 @@ const ProtectedRouter = () => { useEffect(() => { if (isOnline) { dispatch(getNotifications()); - getLitmusExperimentResult( - LitmusExperimentNameMap[LitmusExperimentName.ENABLE_IMAGE_GEO_TAGGING], - { - 'x-customer-id': GLOBAL.AGENT_ID, - } - ).then((response) => { - updateImageUploadComponent(response); - }); } }, [isOnline]); diff --git a/src/services/audioSyncService.ts b/src/services/audioSyncService.ts index 75880421..01105e44 100644 --- a/src/services/audioSyncService.ts +++ b/src/services/audioSyncService.ts @@ -72,11 +72,6 @@ export const prepareAudioForUpload = async () => { export const sendAudiosToServer = async () => { // check if there are any files to upload - - const isDataSyncEnabled = await getAsyncStorageItem(LocalStorageKeys.IS_DATA_SYNC_ALLOWED, true) ?? false; - - if (!isDataSyncEnabled) return; - const zipFiles = FileDB.getFiles((files) => files.mimeType === MimeTypes.ZIP && files.type === 'AUDIOS'); if (zipFiles.length === 0) { diff --git a/src/services/imageSyncService.ts b/src/services/imageSyncService.ts index 0669712e..ff33cf53 100644 --- a/src/services/imageSyncService.ts +++ b/src/services/imageSyncService.ts @@ -14,11 +14,6 @@ export const minutesAgo = (minutes: number) => { } export const imageSyncService = async () => { - - const isDataSyncAllowed = await getAsyncStorageItem(LocalStorageKeys.IS_DATA_SYNC_ALLOWED, true) ?? false; - if (!isDataSyncAllowed) return; - - addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_DEVICE_DATA_SYNC_START); const endTime = Date.now(); @@ -112,11 +107,6 @@ export const prepareImagesForUpload = async () => { export const sendImagesToServer = async () => { // check if there are any files to upload - - const isDataSyncAllowed = await getAsyncStorageItem(LocalStorageKeys.IS_DATA_SYNC_ALLOWED, true) ?? false; - - if (!isDataSyncAllowed) return; - const zipFiles = FileDB.getFiles((files) => files.mimeType === MimeTypes.ZIP && files.type === 'IMAGES'); if (zipFiles.length === 0) { diff --git a/src/services/videoSyncService.ts b/src/services/videoSyncService.ts index 791fb94b..d9e0b29b 100644 --- a/src/services/videoSyncService.ts +++ b/src/services/videoSyncService.ts @@ -71,18 +71,8 @@ export const prepareVideosForUpload = async () => { export const sendVideosToServer = async () => { // check if there are any files to upload - - - const isDataSyncEnabled = await getAsyncStorageItem(LocalStorageKeys.IS_DATA_SYNC_ALLOWED, true) ?? false; - - - if (!isDataSyncEnabled) return; - const zipFiles = FileDB.getFiles((files) => files.mimeType === MimeTypes.ZIP && files.type === 'VIDEOS'); - - - if (zipFiles.length === 0) { prepareVideosForUpload(); return; From f1f5c057af20307bd2610d306f297187192a9e61 Mon Sep 17 00:00:00 2001 From: yashmantri Date: Tue, 10 Sep 2024 16:52:07 +0530 Subject: [PATCH 07/20] TP-71465 | Error handling in generate apk action --- .github/workflows/newBuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/newBuild.yml b/.github/workflows/newBuild.yml index 86bf2fa9..83afd8cd 100644 --- a/.github/workflows/newBuild.yml +++ b/.github/workflows/newBuild.yml @@ -130,7 +130,7 @@ jobs: ls - apk_path="./android/app/build/outputs/apk/${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}/${{github.event.inputs.type || inputs.type}}/app-${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}-release.apk" + apk_path="./android/app/build/outputs/apk/${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}/${{github.event.inputs.type || inputs.type}}/app-${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}-release1.apk" echo "$apk_path" From fc4a5d0f5b675a38a6b152666e28fb3f008e6c5a Mon Sep 17 00:00:00 2001 From: yashmantri Date: Tue, 10 Sep 2024 18:22:01 +0530 Subject: [PATCH 08/20] TP-71465 | Error handling in generate apk action --- .github/workflows/newBuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/newBuild.yml b/.github/workflows/newBuild.yml index 83afd8cd..86bf2fa9 100644 --- a/.github/workflows/newBuild.yml +++ b/.github/workflows/newBuild.yml @@ -130,7 +130,7 @@ jobs: ls - apk_path="./android/app/build/outputs/apk/${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}/${{github.event.inputs.type || inputs.type}}/app-${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}-release1.apk" + apk_path="./android/app/build/outputs/apk/${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}/${{github.event.inputs.type || inputs.type}}/app-${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}-release.apk" echo "$apk_path" From bdb0beffe3f0d22c2b4e2083ca4fe0a6fd8c8f93 Mon Sep 17 00:00:00 2001 From: yashmantri Date: Thu, 12 Sep 2024 17:46:28 +0530 Subject: [PATCH 09/20] TP-82521 | Version bump --- android/app/build.gradle | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 972283df..2a301bc8 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -134,8 +134,8 @@ def reactNativeArchitectures() { return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] } -def VERSION_CODE = 190 -def VERSION_NAME = "2.13.2" +def VERSION_CODE = 191 +def VERSION_NAME = "2.13.3" android { ndkVersion rootProject.ext.ndkVersion diff --git a/package.json b/package.json index a2043554..322b1564 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "AV_APP", - "version": "2.13.2", - "buildNumber": "190", + "version": "2.13.3", + "buildNumber": "191", "private": true, "scripts": { "android:dev": "yarn move:dev && react-native run-android", From 7a4e07635adbb58b68094ed68e62ca601701688d Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Fri, 13 Sep 2024 16:46:52 +0530 Subject: [PATCH 10/20] TP-67349 | image upload removed observable --- .../components/imageUpload/ImageUploadV2.tsx | 40 +++++++++++++------ src/reducer/feedbackImagesSlice.ts | 6 ++- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/components/form/components/imageUpload/ImageUploadV2.tsx b/src/components/form/components/imageUpload/ImageUploadV2.tsx index 47728756..fc4d1e05 100644 --- a/src/components/form/components/imageUpload/ImageUploadV2.tsx +++ b/src/components/form/components/imageUpload/ImageUploadV2.tsx @@ -10,7 +10,6 @@ import { useAppDispatch, useAppSelector } from '../../../../hooks'; import { RootState } from '../../../../store/store'; import { AnswerType } from '../../interface'; import ErrorMessage from '../ErrorMessage'; -import withObservables from '@nozbe/with-observables'; import OfflineImageDAO from '../../../../wmDB/dao/OfflineImageDAO'; import { CLICKSTREAM_EVENT_NAMES, PrefixJpegBase64Image } from '../../../../common/Constants'; import { addClickstreamEvent, ClickstreamDesc } from '../../../../services/clickstreamEventService'; @@ -24,10 +23,16 @@ import { capturePhoto } from '@components/utlis/ImageUtlis'; import CameraIcon from '@rn-ui-lib/icons/CameraIcon'; import { getImageHeightWrtAspectRatio } from '@services/casePayload.transformer'; import { IImageUpload, ImageValidationError } from './interfaces'; -import { getImageUri } from './utils'; import dayjs from 'dayjs'; import ImagePlaceholder from './ImagePlaceholder'; -import { IMAGE_FORMAT_JPEG, IMAGE_PADDING, IMAGE_QUALITY, MAX_HEIGHT, MAX_WIDTH, PhotoUploadErrorMessages } from './constants'; +import { + IMAGE_FORMAT_JPEG, + IMAGE_PADDING, + IMAGE_QUALITY, + MAX_HEIGHT, + MAX_WIDTH, + PhotoUploadErrorMessages, +} from './constants'; import { toast } from '@rn-ui-lib/components/toast'; import { IImageDetails, LAUNCH_REQUEST } from '@rn-ui-lib/components/photoUpload/PhotoUpload'; import UploadIcon from '@rn-ui-lib/icons/UploadIcon'; @@ -46,6 +51,10 @@ const ImageUploadV2: React.FC = (props) => { const deviceGeolocationCoordinate = useAppSelector( (state) => state.foregroundService.deviceGeolocationCoordinate ); + const intermediateDocsToBeUploaded = useAppSelector( + (state) => state.feedbackImages.intermediateDocsToBeUploaded + ); + const imageDoc = intermediateDocsToBeUploaded?.[caseId]?.documents?.[questionId]; const { latitude, longitude, timestamp } = deviceGeolocationCoordinate || {}; const question = template.questions[questionId as keyof typeof template.questions]; const dataFromRedux = useSelector( @@ -67,11 +76,17 @@ const ImageUploadV2: React.FC = (props) => { return null; } - const addOriginalFileUriToDocs = (caseId: string, fileUri: string, questionKey: string) => { + const addOriginalFileUriToDocs = ( + caseId: string, + fileUri: string, + questionKey: string, + imageWidth: number, + imageHeight: number + ) => { if (!fileUri) { return; } - dispatch(addIntermediateDocument({ caseId, fileUri, questionKey })); + dispatch(addIntermediateDocument({ caseId, fileUri, questionKey, imageWidth, imageHeight })); }; const handleImageDelete = () => { @@ -171,7 +186,6 @@ const ImageUploadV2: React.FC = (props) => { }); const { base64 = '', uri = '', imageWidth, imageHeight } = result; handlePictureClickClickstream(); - addOriginalFileUriToDocs(caseId, uri, questionId); if (!base64) { return; } @@ -194,6 +208,7 @@ const ImageUploadV2: React.FC = (props) => { await OfflineImageDAO.addImage(base64Image, uri, uniqueId, imageWidth, imageHeight); toast({ type: 'success', text1: 'Geolocation & Timestamp added successfully' }); setImageLoading(false); + addOriginalFileUriToDocs(caseId, uri, questionId, imageWidth, imageHeight); } catch (err: unknown) { const error = err as ImageValidationError; handlePictureClickClickstream(error); @@ -206,7 +221,11 @@ const ImageUploadV2: React.FC = (props) => { } }; - const { uri, imageWidth = 0, imageHeight = 0 } = getImageUri(props.offlineImages, imageId) || {}; + const { + fileUri, + imageHeight = 350, + imageWidth = 350 + } = imageDoc || {}; const imageHeightWrtAspectRatio = getImageHeightWrtAspectRatio( imageWidth, @@ -337,7 +356,7 @@ const ImageUploadV2: React.FC = (props) => { style={[styles.image, { height: Number(imageHeightWrtAspectRatio) || 350 }]} imageStyle={GenericStyles.br8} source={{ - uri, + uri: fileUri, }} onError={(error) => handleError('Error in image rendering')} > @@ -399,8 +418,5 @@ const styles = StyleSheet.create({ borderRadius: 8, }, }); -const enhance = withObservables([], () => ({ - offlineImages: OfflineImageDAO.observeOfflineImage(), -})); -export default enhance(ImageUploadV2); +export default ImageUploadV2; diff --git a/src/reducer/feedbackImagesSlice.ts b/src/reducer/feedbackImagesSlice.ts index 0068581d..f9f613af 100644 --- a/src/reducer/feedbackImagesSlice.ts +++ b/src/reducer/feedbackImagesSlice.ts @@ -3,6 +3,8 @@ import { isEmpty } from '../../RN-UI-LIB/src/utlis/common'; export interface IDocument { fileUri?: string; + imageWidth?: number; + imageHeight?: number; } interface IDocumentDetail { @@ -25,12 +27,14 @@ const feedbackImagesSlice = createSlice({ initialState, reducers: { addIntermediateDocument: (state, action) => { - const { caseId, questionKey, fileUri } = action.payload; + const { caseId, questionKey, fileUri, imageWidth, imageHeight } = action.payload; if(!caseId) return; const doc = { questionKey, fileUri, originalImageDocumentReferenceId: '', + imageWidth, + imageHeight }; if (state.intermediateDocsToBeUploaded?.[caseId]?.documents) { state.intermediateDocsToBeUploaded[caseId].documents[questionKey] = doc; From eae9d5b464bb6754909cd34604c13cda7d3318a1 Mon Sep 17 00:00:00 2001 From: yashmantri Date: Mon, 16 Sep 2024 14:56:32 +0530 Subject: [PATCH 11/20] TP-67349 | Feedback form fixes --- App.tsx | 2 +- src/components/form/AnswerRender.tsx | 28 +++++++++----------- src/components/form/Submit.tsx | 1 + src/components/form/components/TextInput.tsx | 2 +- src/components/form/index.tsx | 8 +++--- 5 files changed, 19 insertions(+), 22 deletions(-) diff --git a/App.tsx b/App.tsx index d3305db7..a2a634e2 100644 --- a/App.tsx +++ b/App.tsx @@ -108,7 +108,7 @@ function App() { async function setForegroundTimeStampAndClickstream() { const now = dayJs().toString(); await setItem(StorageKeys.APP_FOREGROUND_TIMESTAMP, now); - addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.AV_APP_FOREGROUND, { now }); + addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.AV_APP_FOREGROUND, { now }, true); } usePolling(askForPermissions, PERMISSION_CHECK_POLL_INTERVAL); diff --git a/src/components/form/AnswerRender.tsx b/src/components/form/AnswerRender.tsx index b523a09c..8a7f9f0e 100644 --- a/src/components/form/AnswerRender.tsx +++ b/src/components/form/AnswerRender.tsx @@ -8,14 +8,12 @@ import { GenericObject, GenericType } from '../../common/GenericTypes'; import StarRating from '../../../RN-UI-LIB/src/components/star_rating/StarRating'; import { getPhoneNumberString, memoize } from '../utlis/commonFunctions'; import { - getImageFromDB, getImageHeightWrtAspectRatio, } from '../../services/casePayload.transformer'; import { formatAmount } from '../../../RN-UI-LIB/src/utlis/amount'; import GeolocationAddressAnswer from './components/GeolocationAddressAnswer'; import dayjs from 'dayjs'; import { BUSINESS_DATE_FORMAT, CUSTOM_ISO_DATE_FORMAT } from '@rn-ui-lib/utils/dates'; -import { IOfflineImage } from './components/imageUpload/interfaces'; const RATING_COMPONENT = 'Rating'; const MAX_RATING = 5; @@ -33,6 +31,7 @@ interface IAnswerRender { caseId: string; journey: string; metaData?: GenericObject; + questionId: string; } interface IDarkBoldText { @@ -50,7 +49,7 @@ const DarkBoldText = ({ text }: IDarkBoldText) => { }; const AnswerRender: React.FC = (props) => { - const { answer, visited, section, caseId, journey, metaData } = props; + const { answer, visited, section, caseId, journey, metaData, questionId } = props; const data = useAppSelector((state) => state.case.caseForm?.[caseId]?.[journey]); const caseType = useAppSelector((state) => state.allCases.caseDetails[caseId]?.caseType); const templateData = useAppSelector((state) => state.case.templateData[caseType]); @@ -59,23 +58,19 @@ const AnswerRender: React.FC = (props) => { const getPhoneNumberStringFromNumber = memoize((phoneNumber: string) => { return getPhoneNumberString(mobileNumbers?.find((a) => a.referenceId === phoneNumber)); }); - const [image, setImage] = React.useState(null); const questions = templateData.questions; const options = templateData.options; - React.useEffect(() => { - if (answer?.type === AnswerType.image) { - (async () => { - const data = await getImageFromDB(answer.answer); - setImage(data); - })(); - } - }, [answer]); + const intermediateDocsToBeUploaded = useAppSelector( + (state) => state.feedbackImages.intermediateDocsToBeUploaded + ); + + const imageDoc = intermediateDocsToBeUploaded?.[caseId]?.documents?.[questionId]; const imageHeightWrtAspectRatio = getImageHeightWrtAspectRatio( - image?.imageWidth || 0, - image?.imageHeight || 0, + imageDoc?.imageWidth || 0, + imageDoc?.imageHeight || 0, SCREEN_WIDTH - ANSWER_HORIZONTAL_PADDING ); @@ -101,6 +96,7 @@ const AnswerRender: React.FC = (props) => { journey={journey} answer={newAnswer as unknown as IAnswer} metaData={questions[question]?.metadata} + questionId={question} /> ); @@ -126,13 +122,13 @@ const AnswerRender: React.FC = (props) => { } return ; case AnswerType.image: - if(!image?.imageData) return null; + if(!imageDoc?.fileUri) return null; return ( ); diff --git a/src/components/form/Submit.tsx b/src/components/form/Submit.tsx index 671e7b70..6f5458e0 100644 --- a/src/components/form/Submit.tsx +++ b/src/components/form/Submit.tsx @@ -101,6 +101,7 @@ const Submit: React.FC = (props) => { journey={journey} answer={answer as unknown as IAnswer} metaData={questions[question]?.metadata} + questionId={question} /> diff --git a/src/components/form/components/TextInput.tsx b/src/components/form/components/TextInput.tsx index cce87a60..032d5767 100644 --- a/src/components/form/components/TextInput.tsx +++ b/src/components/form/components/TextInput.tsx @@ -73,7 +73,7 @@ const TextInput: React.FC = (props) => { maxLength={question.metadata.validators?.phoneNumber?.value as number} /> )} - name={`widgetContext.${widgetId}.sectionContext.${props.sectionId}.questionContext.${questionId}`} + name={`widgetContext.${widgetId}.sectionContext.${sectionId}.questionContext.${questionId}`} /> = (props) => { const templateData = useAppSelector((state) => state.case?.templateData?.[caseType]); const caseData = useAppSelector((state) => state.allCases?.caseDetails?.[caseId]); const dataToBeValidated = useAppSelector((state) => state.case?.caseForm?.[caseId]?.[journey]); - const intermediateDocsToBeUploaded = useAppSelector((state) => state.feedbackImages?.intermediateDocsToBeUploaded); + const intermediateDocsToBeUploaded = useAppSelector( + (state) => state.feedbackImages?.intermediateDocsToBeUploaded + ); const name = getWidgetNameFromRoute(props.route.name, caseType); const { sections, conditionActions: widgetConditionActions, isLeaf } = templateData.widget[name]; @@ -386,7 +387,6 @@ const Widget: React.FC = (props) => { return ( - = (props) => { onBack={handleCloseIconPress} /> = (props) => { onError )} /> - ); }; From 6a5c13c97cb878d323aed9c54fe0a3b201fae04b Mon Sep 17 00:00:00 2001 From: yashmantri Date: Mon, 16 Sep 2024 15:34:10 +0530 Subject: [PATCH 12/20] TP-67349 | Feedback form fixes --- android/app/build.gradle | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 2a301bc8..9db38923 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -134,8 +134,8 @@ def reactNativeArchitectures() { return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] } -def VERSION_CODE = 191 -def VERSION_NAME = "2.13.3" +def VERSION_CODE = 192 +def VERSION_NAME = "2.13.4" android { ndkVersion rootProject.ext.ndkVersion diff --git a/package.json b/package.json index 322b1564..efeda69a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "AV_APP", - "version": "2.13.3", - "buildNumber": "191", + "version": "2.13.4", + "buildNumber": "192", "private": true, "scripts": { "android:dev": "yarn move:dev && react-native run-android", From e2938122ff256c69ac501d94b35b858161fa5d1c Mon Sep 17 00:00:00 2001 From: yashmantri Date: Mon, 16 Sep 2024 15:57:14 +0530 Subject: [PATCH 13/20] TP-67349 | Feedback form fixes --- src/components/form/index.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/form/index.tsx b/src/components/form/index.tsx index cf57f085..1bd14684 100644 --- a/src/components/form/index.tsx +++ b/src/components/form/index.tsx @@ -2,6 +2,7 @@ import React, {useCallback, useEffect, useRef, useState} from 'react'; import { useForm } from 'react-hook-form'; import { ScrollView, StyleSheet, View } from 'react-native'; import Geolocation from 'react-native-geolocation-service'; +import { SafeAreaView } from 'react-native-safe-area-context'; import Button from '../../../RN-UI-LIB/src/components/Button'; import Heading from '../../../RN-UI-LIB/src/components/Heading'; import ArrowSolidIcon from '../../../RN-UI-LIB/src/Icons/ArrowSolidIcon'; @@ -387,6 +388,7 @@ const Widget: React.FC = (props) => { return ( + = (props) => { onError )} /> + ); }; From 85473dffc54b8aa95df662c882b48e1153ccc29b Mon Sep 17 00:00:00 2001 From: Mantri Ramkishor Date: Mon, 16 Sep 2024 18:05:22 +0530 Subject: [PATCH 14/20] TP-80790 | Source map action (#898) Co-authored-by: Varnit Goyal --- .github/workflows/codePush.yml | 37 +++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codePush.yml b/.github/workflows/codePush.yml index 2d7934ae..9b5c12f9 100644 --- a/.github/workflows/codePush.yml +++ b/.github/workflows/codePush.yml @@ -61,9 +61,44 @@ jobs: if: ((github.event.inputs.environment == 'Prod' || inputs.environment == 'Prod')) run: yarn move:prod && appcenter codepush release-react -a nfa-navi.com/nfa-app -d Production -t "${{github.event.inputs.target_versions}}" --description "${{github.event.inputs.description}}" - create_release_tag: + generate_source_map: needs: generate runs-on: [default] + if: success() && (github.event.inputs.environment == 'Prod') # Only create source map for Prod releases + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + token: ${{ secrets.MY_REPO_PAT }} + submodules: recursive + - name: Set Node.js 16.x + uses: actions/setup-node@v3 + with: + node-version: 16.x + - name: Install yarn + run: npm install --global yarn + - name: Install dependency + run: yarn + - name: Generate Android Bundle and Source Map + run: | + npx react-native bundle \ + --dev false \ + --minify true \ + --platform android \ + --entry-file index.js \ + --reset-cache \ + --bundle-output index.android.bundle \ + --sourcemap-output index.android.bundle.map + + - name: Upload Source Map + uses: actions/upload-artifact@v3 + with: + name: source-map + path: index.android.bundle.map + + create_release_tag: + needs: generate_source_map + runs-on: [default] if: success() && (github.event.inputs.environment == 'Prod') # Only create tag for Prod releases steps: - name: Checkout From 7faf9a1beaab23bda944c6a27234fab6c86e967d Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 17 Sep 2024 14:20:36 +0530 Subject: [PATCH 15/20] TP-80789 | caseId typecast to string --- src/reducer/allCasesSlice.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/reducer/allCasesSlice.ts b/src/reducer/allCasesSlice.ts index b284687f..dd4e68f7 100644 --- a/src/reducer/allCasesSlice.ts +++ b/src/reducer/allCasesSlice.ts @@ -79,7 +79,7 @@ const getCaseListComponents = (casesList: ICaseItem[], caseDetails: Record { const { caseReferenceId, pinRank } = item; - const { caseStatus } = caseDetails[caseReferenceId]; + const { caseStatus } = caseDetails[caseReferenceId] || {}; const isCaseCompleted = COMPLETED_STATUSES.includes(caseStatus); isCaseCompleted ? completedList.push(item) @@ -161,7 +161,7 @@ const allCasesSlice = createSlice({ switch (updateType) { case FirestoreUpdateTypes.MODIFIED: { const index = state.casesList?.findIndex( - (caseItem) => caseItem.caseReferenceId === caseId + (caseItem) => caseItem.caseReferenceId?.toString() === caseId?.toString() ); if (index !== -1) { if (pinRank && !state.casesList[index].pinRank) { @@ -235,7 +235,7 @@ const allCasesSlice = createSlice({ } case FirestoreUpdateTypes.REMOVED: { const index = state.casesList.findIndex( - (caseItem) => caseItem.caseReferenceId === caseId + (caseItem) => caseItem.caseReferenceId?.toString() === caseId?.toString() ); const currentScreen = getCurrentScreen(); // Redirect to home screen if the case deletes which the agent is seeing From 0e552d36dce923b07e3b9a0c4d1c6c7edb9ec3b1 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 17 Sep 2024 15:33:35 +0530 Subject: [PATCH 16/20] TP-80789 | caseId typecast to string --- android/app/build.gradle | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 9db38923..aaedaa3e 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -134,8 +134,8 @@ def reactNativeArchitectures() { return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] } -def VERSION_CODE = 192 -def VERSION_NAME = "2.13.4" +def VERSION_CODE = 193 +def VERSION_NAME = "2.13.5" android { ndkVersion rootProject.ext.ndkVersion diff --git a/package.json b/package.json index efeda69a..3d6ce81f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "AV_APP", - "version": "2.13.4", - "buildNumber": "192", + "version": "2.13.5", + "buildNumber": "193", "private": true, "scripts": { "android:dev": "yarn move:dev && react-native run-android", From d9709b60c24d67d5200feccdb942fa0d088d4e57 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 17 Sep 2024 20:18:13 +0530 Subject: [PATCH 17/20] TP-65692 | fixes --- src/action/dataActions.ts | 20 +++++++++++++++++--- src/components/utlis/apiHelper.ts | 4 ++++ src/screens/allCases/ListItem.tsx | 2 +- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/action/dataActions.ts b/src/action/dataActions.ts index 72003e49..4ab0f11d 100644 --- a/src/action/dataActions.ts +++ b/src/action/dataActions.ts @@ -17,7 +17,7 @@ import { import { CaseAllocationType, ICaseItem, IPinnedCasesPayload } from '../screens/allCases/interface'; import { AppDispatch } from '../store/store'; import { addClickstreamEvent } from '../services/clickstreamEventService'; -import { CLICKSTREAM_EVENT_NAMES } from '../common/Constants'; +import { CLICKSTREAM_EVENT_NAMES, LocalStorageKeys } from '../common/Constants'; import { logError } from '../components/utlis/errorUtils'; import { setFilters } from '../reducer/filtersSlice'; import { toast } from '../../RN-UI-LIB/src/components/toast'; @@ -25,6 +25,7 @@ import { ToastMessages } from '../screens/allCases/constants'; import { GenericFunctionArgs } from '../common/GenericTypes'; import { GLOBAL } from '../constants/Global'; import { MY_CASE_ITEM } from '../reducer/userSlice'; +import { getAsyncStorageItem } from '@components/utlis/commonFunctions'; let _signedApiCallBucket: { req: any; added_At: number; callback: GenericFunctionArgs }[] = []; let _signedApiCallBucketTimer: number = 0; @@ -222,10 +223,23 @@ async function makeBulkSignedApiRequest( callback: GenericFunctionArgs | GenericFunctionArgs[], skipFirebaseUpdate = false, ) { - let url = getApiUrl(ApiKeys.GET_SIGNED_URL, {}, {skipFirebaseUpdate}); + const enableCaseCollectionManager = + (await getAsyncStorageItem(LocalStorageKeys.COSMOS_CASE_COLLECTION_MANAGER_ENABLE, true)) ?? + false; + let url = getApiUrl( + enableCaseCollectionManager ? ApiKeys.GET_SIGNED_URL_V2 : ApiKeys.GET_SIGNED_URL, + {}, + { skipFirebaseUpdate } + ); const reporteeReferenceId = GLOBAL?.SELECTED_AGENT_ID; if (reporteeReferenceId && reporteeReferenceId !== MY_CASE_ITEM.referenceId) { - url = getApiUrl(ApiKeys.GET_SIGNED_URL_FOR_REPORTEE, {}, { reporteeReferenceId }); + url = getApiUrl( + enableCaseCollectionManager + ? ApiKeys.GET_SIGNED_URL_FOR_REPORTEE_V2 + : ApiKeys.GET_SIGNED_URL_FOR_REPORTEE, + {}, + { reporteeReferenceId } + ); } _signedApiCallBucket = []; await axiosInstance diff --git a/src/components/utlis/apiHelper.ts b/src/components/utlis/apiHelper.ts index fe4c2b2d..ec29b7dc 100644 --- a/src/components/utlis/apiHelper.ts +++ b/src/components/utlis/apiHelper.ts @@ -96,6 +96,8 @@ export enum ApiKeys { SEND_COMMUNICATION_NAVI_ACCOUNT = 'SEND_COMMUNICATION_NAVI_ACCOUNT', SYNC_CALL_FEEDBACK_NUDGE_DETAILS = 'SYNC_CALL_FEEDBACK_NUDGE_DETAILS', GENERATE_DYNAMIC_DOCUMENT = 'GENERATE_DYNAMIC_DOCUMENT', + GET_SIGNED_URL_V2 = 'GET_SIGNED_URL_V2', + GET_SIGNED_URL_FOR_REPORTEE_V2 = 'GET_SIGNED_URL_FOR_REPORTEE_V2' } export const API_URLS: Record = {} as Record; @@ -113,7 +115,9 @@ API_URLS[ApiKeys.GENERATE_PAYMENT_LINK_V2] = '/payments/v2/send-payment-link'; API_URLS[ApiKeys.ADDRESSES_GEOLOCATION] = '/addresses-geolocations'; API_URLS[ApiKeys.NEW_ADDRESS] = '/addresses'; API_URLS[ApiKeys.GET_SIGNED_URL] = '/cases/get-signed-urls'; +API_URLS[ApiKeys.GET_SIGNED_URL_V2] = '/cases/v2/get-signed-urls'; API_URLS[ApiKeys.GET_SIGNED_URL_FOR_REPORTEE] = '/cases/get-signed-urls-for-reportee'; +API_URLS[ApiKeys.GET_SIGNED_URL_FOR_REPORTEE_V2] = '/cases/v2/get-signed-urls-for-reportee'; API_URLS[ApiKeys.CASE_UNIFIED_DETAILS] = '/v3/collection-cases/unified-details/{loanAccountNumber}'; API_URLS[ApiKeys.CASE_UNIFIED_DETAILS_V4] = '/v5/collection-cases/unified-details/{loanAccountNumber}'; diff --git a/src/screens/allCases/ListItem.tsx b/src/screens/allCases/ListItem.tsx index 1a5ca38a..1948ab95 100644 --- a/src/screens/allCases/ListItem.tsx +++ b/src/screens/allCases/ListItem.tsx @@ -70,7 +70,7 @@ const ListItem: React.FC = (props) => { isVisitPlan, } = props; const { - id: caseId, + caseReferenceId: caseId, isIntermediateOrSelectedTodoCaseItem, caseStatus, caseType, From d017677310c571d1aacdb881fc442378ff44a972 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Wed, 18 Sep 2024 10:33:38 +0530 Subject: [PATCH 18/20] TP-83156 | version bump --- android/app/build.gradle | 4 ++-- package.json | 4 ++-- src/components/utlis/firebaseUtils.ts | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index aaedaa3e..cb315a7c 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -134,8 +134,8 @@ def reactNativeArchitectures() { return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] } -def VERSION_CODE = 193 -def VERSION_NAME = "2.13.5" +def VERSION_CODE = 194 +def VERSION_NAME = "2.13.6" android { ndkVersion rootProject.ext.ndkVersion diff --git a/package.json b/package.json index 3d6ce81f..47acc333 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "AV_APP", - "version": "2.13.5", - "buildNumber": "193", + "version": "2.13.6", + "buildNumber": "194", "private": true, "scripts": { "android:dev": "yarn move:dev && react-native run-android", diff --git a/src/components/utlis/firebaseUtils.ts b/src/components/utlis/firebaseUtils.ts index 74d948a2..8adcd2cf 100644 --- a/src/components/utlis/firebaseUtils.ts +++ b/src/components/utlis/firebaseUtils.ts @@ -1,5 +1,6 @@ import crashlytics from '@react-native-firebase/crashlytics'; import { IUserSlice } from '../../reducer/userSlice'; +import { getAppVersion } from './commonFunctions'; export const initCrashlytics = async (userState: IUserSlice) => { if (!userState) return; @@ -10,7 +11,8 @@ export const initCrashlytics = async (userState: IUserSlice) => { deviceId: userState.deviceId, phoneNumber: userState.user?.phoneNumber as string, emailId: userState.user?.emailId as string, - agentId: userState.user?.referenceId as string + agentId: userState.user?.referenceId as string, + appVersion: getAppVersion(), }), ]); }; From 75c35ba72891189b2af264ad15009d5d2c40a121 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Wed, 18 Sep 2024 13:31:41 +0530 Subject: [PATCH 19/20] TP-83156 | fix --- src/screens/auth/ProtectedRouter.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/screens/auth/ProtectedRouter.tsx b/src/screens/auth/ProtectedRouter.tsx index 4deb5dd6..c02d4cc3 100644 --- a/src/screens/auth/ProtectedRouter.tsx +++ b/src/screens/auth/ProtectedRouter.tsx @@ -2,7 +2,7 @@ import { NativeStackNavigationOptions, createNativeStackNavigator, } from '@react-navigation/native-stack'; -import React, { useEffect, useState } from 'react'; +import React, { useEffect } from 'react'; import { _map, MILLISECONDS_IN_A_MINUTE } from '../../../RN-UI-LIB/src/utlis/common'; import { getNotifications, notificationAction } from '../../action/notificationActions'; import { LocalStorageKeys, SCREEN_ANIMATION_DURATION } from '../../common/Constants'; @@ -65,13 +65,16 @@ const ProtectedRouter = () => { useEffect(() => { if (isOnline) { dispatch(getNotifications()); - } - }, [isOnline]); - - useEffect(() => { - if (isOnline) { dispatch(getAgentDetail()); dispatch(getSelfieDocument()); + getLitmusExperimentResult( + LitmusExperimentNameMap[LitmusExperimentName.COSMOS_CASE_COLLECTION_MANAGER], + { + 'x-customer-id': GLOBAL.AGENT_ID, + } + ).then((response) => { + setAsyncStorageItem(LocalStorageKeys.COSMOS_CASE_COLLECTION_MANAGER_ENABLE, response); + }); } }, [isOnline]); From 09bbeb6b37ed7bb0b5d295d7db4e2b5da05f75d6 Mon Sep 17 00:00:00 2001 From: yashmantri Date: Fri, 20 Sep 2024 14:48:52 +0530 Subject: [PATCH 20/20] TP-67349 | Nearby cases fix --- android/app/build.gradle | 4 ++-- package.json | 4 ++-- src/screens/allCases/ListItem.tsx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index cb315a7c..8803f93e 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -134,8 +134,8 @@ def reactNativeArchitectures() { return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] } -def VERSION_CODE = 194 -def VERSION_NAME = "2.13.6" +def VERSION_CODE = 195 +def VERSION_NAME = "2.13.7" android { ndkVersion rootProject.ext.ndkVersion diff --git a/package.json b/package.json index 47acc333..35a74d2b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "AV_APP", - "version": "2.13.6", - "buildNumber": "194", + "version": "2.13.7", + "buildNumber": "195", "private": true, "scripts": { "android:dev": "yarn move:dev && react-native run-android", diff --git a/src/screens/allCases/ListItem.tsx b/src/screens/allCases/ListItem.tsx index 1948ab95..7fe62155 100644 --- a/src/screens/allCases/ListItem.tsx +++ b/src/screens/allCases/ListItem.tsx @@ -194,7 +194,7 @@ const ListItem: React.FC = (props) => { const distanceMapOfNearbyCases = useAppSelector((state) => state.nearbyCasesSlice.caseReferenceIdToDistanceMap) || {}; const selectedTab = useAppSelector((state) => state?.nearbyCasesSlice?.sortTabSelected); - const distanceOfCaseItem = distanceMapOfNearbyCases.get(caseListItemDetailObj?.id); + const distanceOfCaseItem = distanceMapOfNearbyCases.get(caseListItemDetailObj?.caseReferenceId); const isNearestCaseView = selectedTab === TABS_KEYS.NEAREST_CASE; const showInVisitPlanTag = isCaseItemPinnedMainView && !caseCompleted; const widthStyle = {