TP-74667 | fix
This commit is contained in:
@@ -44,6 +44,7 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.text.DateFormatSymbols;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
@@ -129,9 +130,11 @@ public class PhotoModule extends ReactContextBaseJavaModule {
|
||||
|
||||
// Get time in the format "DD MMM YYYY, HH:mm A"
|
||||
private String getTime() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy, HH:mm a", Locale.getDefault());
|
||||
Log.d("PhotoModule", "getTime: " + sdf.format(new Date()));
|
||||
return sdf.format(new Date());
|
||||
DateFormatSymbols symbols = new DateFormatSymbols(Locale.getDefault());
|
||||
symbols.setAmPmStrings(new String[] { "AM", "PM" });
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy, h:mm a", symbols);
|
||||
String formattedDate = sdf.format(new Date());
|
||||
return formattedDate;
|
||||
}
|
||||
|
||||
private Bitmap addTextToBottom(Bitmap img, Context context) {
|
||||
@@ -375,22 +378,18 @@ public class PhotoModule extends ReactContextBaseJavaModule {
|
||||
// Add a method to fetch location
|
||||
private void fetchLocationAndManipulatePhoto(Activity currentActivity) {
|
||||
Log.d("PhotoModule", "fetchLocationAndManipulatePhoto");
|
||||
// Create a HandlerThread
|
||||
HandlerThread handlerThread = new HandlerThread("LocationThread");
|
||||
handlerThread.start();
|
||||
// Create a Handler attached to the HandlerThread's Looper
|
||||
Handler locationHandler = new Handler(handlerThread.getLooper());
|
||||
|
||||
locationHandler.post(() -> {
|
||||
// If geolocation passed down by the app is not old, then proceed with that
|
||||
if (!photoText.isEmpty()) {
|
||||
currentActivity.runOnUiThread(() -> {
|
||||
continueEditingPhoto(currentActivity);
|
||||
// Consider stopping the HandlerThread when done
|
||||
handlerThread.quitSafely();
|
||||
});
|
||||
} else {
|
||||
// If geolocation is old, then capture a newer one and use that
|
||||
// If geolocation passed down by the app is not old, then proceed with that
|
||||
if (!photoText.isEmpty()) {
|
||||
currentActivity.runOnUiThread(() -> {
|
||||
continueEditingPhoto(currentActivity);
|
||||
});
|
||||
} else {
|
||||
// If geolocation is old, then capture a newer one and use that
|
||||
HandlerThread handlerThread = new HandlerThread("LocationThread");
|
||||
handlerThread.start();
|
||||
// Create a Handler attached to the HandlerThread's Looper
|
||||
Handler locationHandler = new Handler(handlerThread.getLooper());
|
||||
locationHandler.post(() -> {
|
||||
GeolocationModule geolocationModule = new GeolocationModule(getReactApplicationContext());
|
||||
geolocationModule.fetchLocation(new GeolocationModule.LocationCallbackInterface() {
|
||||
@Override
|
||||
@@ -418,8 +417,8 @@ public class PhotoModule extends ReactContextBaseJavaModule {
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
|
||||
@@ -73,6 +73,7 @@ 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/forms.service';
|
||||
|
||||
export enum FOREGROUND_TASKS {
|
||||
GEOLOCATION = 'GEOLOCATION',
|
||||
@@ -396,7 +397,7 @@ const TrackingComponent: React.FC<ITrackingComponent> = ({ children }) => {
|
||||
LitmusExperimentNameMap[LitmusExperimentName.ENABLE_IMAGE_GEO_TAGGING],
|
||||
{ 'x-customer-id': GLOBAL.AGENT_ID }
|
||||
);
|
||||
GLOBAL.ENABLE_IMAGE_GEOTAGGING = enableFeedbackImageGeotagging;
|
||||
updateImageUploadComponent(enableFeedbackImageGeotagging);
|
||||
if (
|
||||
MS_CLARITY_PROJECT_ID &&
|
||||
!GLOBAL.MS_CLARITY_INITIALIZED &&
|
||||
|
||||
@@ -126,6 +126,7 @@ const AnswerRender: React.FC<IAnswerRender> = (props) => {
|
||||
}
|
||||
return <DarkBoldText text={answer.answer} />;
|
||||
case AnswerType.image:
|
||||
if(!image?.imageData) return null;
|
||||
return (
|
||||
<ImageBackground
|
||||
style={[styles.image, { height: Number(imageHeightWrtAspectRatio) || 350 }]}
|
||||
|
||||
@@ -1,37 +1,8 @@
|
||||
import React from 'react';
|
||||
import { Control, UseFormSetValue } from 'react-hook-form';
|
||||
import { View } from 'react-native';
|
||||
import Checkbox from './components/Checkbox';
|
||||
import CheckboxGroup from './components/CheckboxGroup';
|
||||
import ImageUploadV2 from './components/imageUpload/ImageUploadV2';
|
||||
import RadioButton from './components/RadioButton';
|
||||
import Rating from './components/Rating';
|
||||
import TextArea from './components/TextArea';
|
||||
import TextInput from './components/TextInput';
|
||||
import Dropdown from './components/Dropdown';
|
||||
import AddressSelection from './components/AddressSelection';
|
||||
import PhoneNumberSelection from './components/PhoneNumberSelection';
|
||||
import DateInput from './components/DateInput';
|
||||
import TimeInput from './components/TimeInput';
|
||||
import { IVisitedWidgetContext } from '../../types/template.types';
|
||||
import ImageUpload from './components/ImageUpload';
|
||||
import { GLOBAL } from '@constants/Global';
|
||||
|
||||
const Component = {
|
||||
TextInput,
|
||||
TextArea,
|
||||
RadioButton,
|
||||
ImageUpload,
|
||||
Checkbox,
|
||||
Rating,
|
||||
Dropdown,
|
||||
CheckboxGroup,
|
||||
AddressSelection,
|
||||
PhoneNumberSelection,
|
||||
DateInput,
|
||||
TimeInput,
|
||||
Amount: TextInput,
|
||||
};
|
||||
import { FormComponentList } from './services/forms.service';
|
||||
|
||||
interface IQuestionRenderingEngine {
|
||||
questionType: string;
|
||||
@@ -48,23 +19,15 @@ interface IQuestionRenderingEngine {
|
||||
}
|
||||
|
||||
const QuestionRenderingEngine: React.FC<IQuestionRenderingEngine> = (props) => {
|
||||
if (props.questionType === 'ImageUpload' && GLOBAL.ENABLE_IMAGE_GEOTAGGING) {
|
||||
return (
|
||||
<View>
|
||||
<ImageUploadV2 {...props} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
// todo write proper schema
|
||||
// @ts-ignore
|
||||
const Comp = Component[props.questionType];
|
||||
if (!Comp) {
|
||||
const QuestionComponent = FormComponentList[props.questionType];
|
||||
if (!QuestionComponent) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<View>
|
||||
<Comp {...props} />
|
||||
<QuestionComponent {...props} />
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -204,7 +204,7 @@ const Widget: React.FC<IWidget> = (props) => {
|
||||
if (!docs) {
|
||||
return;
|
||||
}
|
||||
dispatch(setDocumentInteractionId({ caseKey: caseKey.current, interactionId }));
|
||||
dispatch(setDocumentInteractionId({ caseId, caseKey: caseKey.current, interactionId }));
|
||||
dispatch(uploadImages(caseKey.current, docs, interactionId));
|
||||
};
|
||||
|
||||
|
||||
@@ -7,6 +7,35 @@ import {
|
||||
ConditionAction,
|
||||
FormTemplateV1,
|
||||
} from '../../../types/template.types';
|
||||
import Checkbox from '../components/Checkbox';
|
||||
import CheckboxGroup from '../components/CheckboxGroup';
|
||||
import ImageUploadV2 from '../components/imageUpload/ImageUploadV2';
|
||||
import RadioButton from '../components/RadioButton';
|
||||
import Rating from '../components/Rating';
|
||||
import TextArea from '../components/TextArea';
|
||||
import TextInput from '../components/TextInput';
|
||||
import Dropdown from '../components/Dropdown';
|
||||
import AddressSelection from '../components/AddressSelection';
|
||||
import PhoneNumberSelection from '../components/PhoneNumberSelection';
|
||||
import DateInput from '../components/DateInput';
|
||||
import TimeInput from '../components/TimeInput';
|
||||
import ImageUpload from '../components/ImageUpload';
|
||||
|
||||
export const FormComponentList = {
|
||||
TextInput,
|
||||
TextArea,
|
||||
RadioButton,
|
||||
ImageUpload,
|
||||
Checkbox,
|
||||
Rating,
|
||||
Dropdown,
|
||||
CheckboxGroup,
|
||||
AddressSelection,
|
||||
PhoneNumberSelection,
|
||||
DateInput,
|
||||
TimeInput,
|
||||
Amount: TextInput,
|
||||
};
|
||||
|
||||
export const getVisitedWidgetsNodeList = (
|
||||
templateData: FormTemplateV1,
|
||||
@@ -63,3 +92,11 @@ export function getNextJourneyActions(conditionActions: ConditionAction[], conte
|
||||
}
|
||||
return nextActions;
|
||||
}
|
||||
|
||||
export const updateImageUploadComponent = (enableImageGeoTagging: boolean) => {
|
||||
if (enableImageGeoTagging) {
|
||||
FormComponentList.ImageUpload = ImageUploadV2;
|
||||
} else {
|
||||
FormComponentList.ImageUpload = ImageUpload;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,7 +2,6 @@ import {
|
||||
LinkingOptions,
|
||||
getStateFromPath as getDefaultStateFromPath,
|
||||
} from '@react-navigation/native';
|
||||
import { CaseDetailStackEnum } from '@screens/caseDetails/CaseDetailStack';
|
||||
import { Linking } from 'react-native';
|
||||
import notifee, { InitialNotification } from '@notifee/react-native';
|
||||
import { GenericType } from '@common/GenericTypes';
|
||||
@@ -14,6 +13,30 @@ import { AgentRevivalNotificationTemplateActionMap } from '@hooks/useFCM/notific
|
||||
|
||||
export const LAST_INITIAL_NOTIFICATION_ID = 'LAST_INITIAL_NOTIFICATION_ID';
|
||||
|
||||
enum CaseDetailStackEnum {
|
||||
COLLECTION_CASE_DETAIL = 'collectionCaseDetail',
|
||||
CUSTOMER_PROFILE = 'customerProfile',
|
||||
VKYC_FULL = 'vkycFull',
|
||||
PDF_FULL = 'pdfFull',
|
||||
IMAGE_FULL = 'imageFull',
|
||||
PAYMENTS = 'registerPayments',
|
||||
ADDRESS_GEO = 'addressGeolocation',
|
||||
NEW_ADDRESS = 'newAddress',
|
||||
ADDITIONAL_ADDRESSES = 'additionalAddresses',
|
||||
GEOLOCATION_OLD_FEEDBACKS = 'geolocationOldFeedbacks',
|
||||
PAST_FEEDBACK_DETAIL = 'pastFeedbackDetail',
|
||||
EMI_SCHEDULE = 'EmiSchedule',
|
||||
ADD_NEW_NUMBER = 'AddNewNumber',
|
||||
VIEW_RequestHistory = 'viewRequestHistory',
|
||||
VIEW_REQUEST_DETAIL = 'viewRequestDetail',
|
||||
RAISE_REQUEST = 'raiseRequest',
|
||||
SIMILAR_GEOLOCATIONS = 'SimilarGeolocations',
|
||||
ADDITIONAL_GEOLOCATIONS = 'AdditionalGeolocations',
|
||||
FEE_WAIVER = 'FeeWaiver',
|
||||
FEE_WAIVER_HISTORY = 'FeeWaiverHistory',
|
||||
CALL_CUSTOMER = 'CallCustomer',
|
||||
}
|
||||
|
||||
// Define a type for the Route object for better type checking
|
||||
type Route = {
|
||||
name: string;
|
||||
|
||||
@@ -17,7 +17,6 @@ export const GLOBAL = {
|
||||
SELECTED_AGENT_ID: '',
|
||||
BUILD_FLAVOUR: '',
|
||||
MS_CLARITY_INITIALIZED: false,
|
||||
ENABLE_IMAGE_GEOTAGGING: false,
|
||||
};
|
||||
|
||||
interface IGlobalUserData {
|
||||
|
||||
@@ -60,14 +60,15 @@ const feedbackImagesSlice = createSlice({
|
||||
state.docsToBeUploaded[caseKey] = {
|
||||
...state.intermediateDocsToBeUploaded[caseId],
|
||||
};
|
||||
delete state.intermediateDocsToBeUploaded?.[caseId];
|
||||
}
|
||||
},
|
||||
setDocumentInteractionId: (state, action) => {
|
||||
const { caseKey, interactionId } = action.payload;
|
||||
const { caseId, caseKey, interactionId } = action.payload;
|
||||
if (state.docsToBeUploaded[caseKey]) {
|
||||
state.docsToBeUploaded[caseKey].interactionId = interactionId;
|
||||
}
|
||||
// delete intermediate docs once the interaction id is set
|
||||
delete state.intermediateDocsToBeUploaded?.[caseId];
|
||||
},
|
||||
removeDocumentByQuestionKey: (state, action) => {
|
||||
const { caseKey, questionKey } = action.payload;
|
||||
|
||||
@@ -153,15 +153,6 @@ function AuthRouter() {
|
||||
GLOBAL.MS_CLARITY_INITIALIZED = true;
|
||||
}
|
||||
});
|
||||
|
||||
getLitmusExperimentResult(
|
||||
LitmusExperimentNameMap[LitmusExperimentName.ENABLE_IMAGE_GEO_TAGGING],
|
||||
{
|
||||
'x-customer-id': GLOBAL.AGENT_ID,
|
||||
}
|
||||
).then((response) => {
|
||||
GLOBAL.ENABLE_IMAGE_GEOTAGGING = response;
|
||||
});
|
||||
}
|
||||
}, [deviceId]);
|
||||
|
||||
|
||||
@@ -24,6 +24,9 @@ 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 { GLOBAL } from '@constants/Global';
|
||||
import { updateImageUploadComponent } from '@components/form/services/forms.service';
|
||||
|
||||
const Stack = createNativeStackNavigator();
|
||||
|
||||
@@ -57,6 +60,14 @@ 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]);
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@ const interactionsHandler = () => {
|
||||
|
||||
const inProgressCaseIds = useRef<string[]>([]);
|
||||
|
||||
const handleSuccessSubmit = (caseKey: string, interactionId: string) => {
|
||||
const handleSuccessSubmit = (caseKey: string, interactionId: string, caseId: string) => {
|
||||
const docs = docsToBeUploaded?.[caseKey]?.documents;
|
||||
if (!docs) {
|
||||
return;
|
||||
}
|
||||
dispatch(setDocumentInteractionId({ caseKey, interactionId }));
|
||||
dispatch(setDocumentInteractionId({ caseKey, interactionId, caseId }));
|
||||
dispatch(uploadImages(caseKey, docs, interactionId));
|
||||
};
|
||||
|
||||
@@ -73,7 +73,7 @@ const interactionsHandler = () => {
|
||||
}
|
||||
dispatch(
|
||||
syncCaseDetail(modifiedCaseItem, {
|
||||
onSuccessCB: (_, interactionId) => handleSuccessSubmit(caseKey, interactionId),
|
||||
onSuccessCB: (_, interactionId) => handleSuccessSubmit(caseKey, interactionId, caseItem.caseId),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ export enum TableName {
|
||||
CLICKSTREAM_EVENTS = 'clickstream_events',
|
||||
}
|
||||
|
||||
export const DB_VERSION = 5;
|
||||
export const DB_VERSION = 7;
|
||||
|
||||
export const DB_NAME = 'AVAPP';
|
||||
|
||||
@@ -8,6 +8,8 @@ export default class OfflineImage extends Model {
|
||||
@field('idx') idx!: string;
|
||||
@field('image_data') imageData!: string;
|
||||
@field('original_image_uri') originalImageUri!: string;
|
||||
@field('image_width') imageWidth!: string;
|
||||
@field('image_height') imageHeight!: string;
|
||||
@readonly @date('created_at') createdAt!: any;
|
||||
@readonly @date('updated_at') updatedAt!: any;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ export default appSchema({
|
||||
{ name: 'idx', type: 'string' },
|
||||
{ name: 'image_data', type: 'string' },
|
||||
{ name: 'original_image_uri', type: 'string' },
|
||||
{ name: 'image_width', type: 'string' },
|
||||
{ name: 'image_height', type: 'string' },
|
||||
],
|
||||
}),
|
||||
tableSchema({
|
||||
|
||||
Reference in New Issue
Block a user