@os1-platform/dispatch-mobile 2.1.6 → 2.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/analytics/firebase/FirebaseLogging.js +11 -2
- package/lib/commonjs/analytics/firebase/FirebaseLogging.js.map +1 -1
- package/lib/commonjs/analytics/sentry/SentryAnalyticsUtils.js +6 -2
- package/lib/commonjs/analytics/sentry/SentryAnalyticsUtils.js.map +1 -1
- package/lib/commonjs/analytics/sentry/SentrySdkConstants.js +3 -0
- package/lib/commonjs/analytics/sentry/SentrySdkConstants.js.map +1 -1
- package/lib/commonjs/components/executiontasks/doodle/SignatureET.js +8 -1
- package/lib/commonjs/components/executiontasks/doodle/SignatureET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/imageCapture/CaptureSchema.js.map +1 -1
- package/lib/commonjs/components/executiontasks/imageCapture/CaptureUtils.js +16 -15
- package/lib/commonjs/components/executiontasks/imageCapture/CaptureUtils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/imageCapture/ImageCapture.js +9 -1
- package/lib/commonjs/components/executiontasks/imageCapture/ImageCapture.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/manager/location/LocationManager.js +9 -2
- package/lib/commonjs/manager/location/LocationManager.js.map +1 -1
- package/lib/commonjs/manager/sdk/DispatchSDKManager.js +3 -3
- package/lib/commonjs/manager/sdk/DispatchSDKManager.js.map +1 -1
- package/lib/commonjs/manager/sdk/callbacksHandler.js +8 -1
- package/lib/commonjs/manager/sdk/callbacksHandler.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/DBConfig.js +3 -1
- package/lib/commonjs/manager/syncmanager/DBConfig.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/document/DocumentHttpClient.js +77 -3
- package/lib/commonjs/manager/syncmanager/document/DocumentHttpClient.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/document/DocumentManager.js +17 -3
- package/lib/commonjs/manager/syncmanager/document/DocumentManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/document/DocumentSyncManager.js +206 -6
- package/lib/commonjs/manager/syncmanager/document/DocumentSyncManager.js.map +1 -1
- package/lib/commonjs/models/sdk.js.map +1 -1
- package/lib/commonjs/utils/ExecTaskUtils.js.map +1 -1
- package/lib/commonjs/utils/SyncManagerUtils.js +12 -2
- package/lib/commonjs/utils/SyncManagerUtils.js.map +1 -1
- package/lib/commonjs/utils/utils.js +24 -0
- package/lib/commonjs/utils/utils.js.map +1 -1
- package/lib/module/analytics/firebase/FirebaseLogging.js +11 -2
- package/lib/module/analytics/firebase/FirebaseLogging.js.map +1 -1
- package/lib/module/analytics/sentry/SentryAnalyticsUtils.js +6 -2
- package/lib/module/analytics/sentry/SentryAnalyticsUtils.js.map +1 -1
- package/lib/module/analytics/sentry/SentrySdkConstants.js +3 -0
- package/lib/module/analytics/sentry/SentrySdkConstants.js.map +1 -1
- package/lib/module/components/executiontasks/doodle/SignatureET.js +8 -1
- package/lib/module/components/executiontasks/doodle/SignatureET.js.map +1 -1
- package/lib/module/components/executiontasks/imageCapture/CaptureSchema.js.map +1 -1
- package/lib/module/components/executiontasks/imageCapture/CaptureUtils.js +16 -15
- package/lib/module/components/executiontasks/imageCapture/CaptureUtils.js.map +1 -1
- package/lib/module/components/executiontasks/imageCapture/ImageCapture.js +9 -1
- package/lib/module/components/executiontasks/imageCapture/ImageCapture.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/manager/location/LocationManager.js +9 -2
- package/lib/module/manager/location/LocationManager.js.map +1 -1
- package/lib/module/manager/sdk/DispatchSDKManager.js +3 -3
- package/lib/module/manager/sdk/DispatchSDKManager.js.map +1 -1
- package/lib/module/manager/sdk/callbacksHandler.js +8 -1
- package/lib/module/manager/sdk/callbacksHandler.js.map +1 -1
- package/lib/module/manager/syncmanager/DBConfig.js +3 -1
- package/lib/module/manager/syncmanager/DBConfig.js.map +1 -1
- package/lib/module/manager/syncmanager/document/DocumentHttpClient.js +77 -3
- package/lib/module/manager/syncmanager/document/DocumentHttpClient.js.map +1 -1
- package/lib/module/manager/syncmanager/document/DocumentManager.js +17 -3
- package/lib/module/manager/syncmanager/document/DocumentManager.js.map +1 -1
- package/lib/module/manager/syncmanager/document/DocumentSyncManager.js +207 -7
- package/lib/module/manager/syncmanager/document/DocumentSyncManager.js.map +1 -1
- package/lib/module/models/sdk.js.map +1 -1
- package/lib/module/utils/ExecTaskUtils.js.map +1 -1
- package/lib/module/utils/SyncManagerUtils.js +12 -2
- package/lib/module/utils/SyncManagerUtils.js.map +1 -1
- package/lib/module/utils/utils.js +22 -0
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/typescript/analytics/sentry/SentrySdkConstants.d.ts +3 -0
- package/lib/typescript/components/executiontasks/imageCapture/CaptureSchema.d.ts +4 -0
- package/lib/typescript/components/executiontasks/imageCapture/CaptureUtils.d.ts +7 -1
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/manager/location/LocationManager.d.ts +1 -0
- package/lib/typescript/manager/sdk/callbacksHandler.d.ts +3 -1
- package/lib/typescript/manager/syncmanager/DBConfig.d.ts +4 -0
- package/lib/typescript/manager/syncmanager/document/DocumentManager.d.ts +3 -1
- package/lib/typescript/manager/syncmanager/document/DocumentSyncManager.d.ts +5 -1
- package/lib/typescript/models/sdk.d.ts +1 -0
- package/lib/typescript/utils/SyncManagerUtils.d.ts +1 -1
- package/lib/typescript/utils/utils.d.ts +4 -0
- package/package.json +6 -5
- package/src/analytics/firebase/FirebaseLogging.ts +22 -10
- package/src/analytics/sentry/SentryAnalyticsUtils.ts +8 -2
- package/src/analytics/sentry/SentrySdkConstants.ts +3 -0
- package/src/components/executiontasks/doodle/SignatureET.tsx +14 -1
- package/src/components/executiontasks/imageCapture/CaptureSchema.ts +4 -0
- package/src/components/executiontasks/imageCapture/CaptureUtils.ts +32 -17
- package/src/components/executiontasks/imageCapture/ImageCapture.tsx +10 -2
- package/src/index.tsx +2 -0
- package/src/manager/location/LocationManager.ts +8 -1
- package/src/manager/sdk/DispatchSDKManager.ts +8 -2
- package/src/manager/sdk/callbacksHandler.ts +12 -1
- package/src/manager/syncmanager/DBConfig.ts +4 -0
- package/src/manager/syncmanager/document/DocumentHttpClient.ts +105 -5
- package/src/manager/syncmanager/document/DocumentManager.ts +28 -2
- package/src/manager/syncmanager/document/DocumentSyncManager.ts +230 -5
- package/src/models/sdk.ts +1 -0
- package/src/utils/ExecTaskUtils.ts +1 -1
- package/src/utils/SyncManagerUtils.ts +20 -2
- package/src/utils/utils.ts +23 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { CaptureInput, CaptureOutput, ImageData } from './CaptureSchema';
|
|
2
|
-
import type { ImageResult } from 'expo-image-manipulator';
|
|
3
2
|
export declare function deleteImage(imageData: {
|
|
4
3
|
path: string;
|
|
5
4
|
id: {
|
|
@@ -10,5 +9,12 @@ export declare function getMaxImagesCount(props: CaptureInput): number;
|
|
|
10
9
|
export declare function getImagesFileName(): string;
|
|
11
10
|
export declare function getCompressionRatio(uri: string, maxSize: number): Promise<number>;
|
|
12
11
|
export declare function checkCameraPermissionUtil(): Promise<boolean>;
|
|
12
|
+
declare type ImageResult = {
|
|
13
|
+
uri: string;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
base64?: string;
|
|
17
|
+
};
|
|
13
18
|
export declare function captureImage(imageWidth: number, imageHeight: number, fileSize: number): Promise<ImageResult | null>;
|
|
14
19
|
export declare function getCaptureOutput(imageDataList: ImageData[], captureProps: CaptureInput): Promise<CaptureOutput>;
|
|
20
|
+
export {};
|
|
@@ -26,6 +26,7 @@ import SentryAnalyticsSingleton from './analytics/sentry/SentryAnalyticsSingleto
|
|
|
26
26
|
import { fireEventWithScreenName } from './analytics/sentry/SentryAnalyticsUtils';
|
|
27
27
|
import { ScreenNameSdkConstants, SentryEventNameSdkConstants, SeverityLevelValue } from './analytics/sentry/SentrySdkConstants';
|
|
28
28
|
import { DispatchAndUserData, SentryEvent } from './analytics/sentry/SentryModels';
|
|
29
|
+
import DocumentManager from './manager/syncmanager/document/DocumentManager';
|
|
29
30
|
export { DispatchExecutor, IDispatch, IDispatchExecutor };
|
|
30
31
|
export { Storage, DispatchExecNavigator };
|
|
31
32
|
export { ETSummary, CompleteSummary, ObjectiveSummary, DispatchSyncType };
|
|
@@ -39,3 +40,4 @@ export type { MTSStartRequest, MTSInitRequest };
|
|
|
39
40
|
export { MtsSdk };
|
|
40
41
|
export { Helper };
|
|
41
42
|
export { SentryAnalyticsSingleton, fireEventWithScreenName, SeverityLevelValue, ScreenNameSdkConstants, SentryEventNameSdkConstants, DispatchAndUserData, SentryEvent };
|
|
43
|
+
export { DocumentManager };
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
declare class CallbacksHandler {
|
|
2
2
|
private _callbackToFetchPhoneNumbers;
|
|
3
|
+
private _callbackToFetchDateTime;
|
|
3
4
|
init(phoneCallback: (sdsIds: string[]) => Promise<{
|
|
4
5
|
key: string;
|
|
5
6
|
value: string[];
|
|
6
|
-
}>): void;
|
|
7
|
+
}>, dateTimeCallBack: () => Promise<string>): void;
|
|
7
8
|
getPhoneNumbers(sdsIds: string[]): Promise<{
|
|
8
9
|
key: string;
|
|
9
10
|
value: string[];
|
|
10
11
|
} | null>;
|
|
12
|
+
getDateTime(): Promise<string | ''>;
|
|
11
13
|
}
|
|
12
14
|
declare const callbackHandler: CallbacksHandler;
|
|
13
15
|
export default callbackHandler;
|
|
@@ -38,6 +38,8 @@ export declare const DOCUMENT_COLUMNS: {
|
|
|
38
38
|
DISPATCH_ID: string;
|
|
39
39
|
JOB_ID: string;
|
|
40
40
|
OBJECTIVE_REF: string;
|
|
41
|
+
GEO_TIMESTAMP: string;
|
|
42
|
+
PROCESSED_FILE_PATH: string;
|
|
41
43
|
};
|
|
42
44
|
export type DocumentRow = {
|
|
43
45
|
id: number;
|
|
@@ -55,6 +57,8 @@ export type DocumentRow = {
|
|
|
55
57
|
dispatch_id: string;
|
|
56
58
|
job_id: string;
|
|
57
59
|
objective_ref: string;
|
|
60
|
+
geo_timestamp: string;
|
|
61
|
+
processed_file_path: string;
|
|
58
62
|
};
|
|
59
63
|
export type EventRow = {
|
|
60
64
|
id: number;
|
|
@@ -5,11 +5,13 @@ export default class DocumentManager {
|
|
|
5
5
|
private constructor();
|
|
6
6
|
static getInstance(): Promise<DocumentManager>;
|
|
7
7
|
init(): Promise<void>;
|
|
8
|
-
|
|
8
|
+
truncateDocumentTable(): Promise<void>;
|
|
9
|
+
insertDocument(fmsFolderID: string | null, desc: string, dspID: string, base64: boolean, fileName: string, fileType: string, data?: string | null, filePath?: string | null, geoTimeStamp?: string | null, processedFilePath?: string | null, priority?: number): Promise<SQLResultSet>;
|
|
9
10
|
getAllDocuments(dispatchID?: string): Promise<DocumentRow[]>;
|
|
10
11
|
getAllUnsyncedDocs(): Promise<DocumentRow[]>;
|
|
11
12
|
deleteAllSyncedDocuments(dispatchID: string): Promise<SQLResultSet>;
|
|
12
13
|
markDocumentSynced(id: number, fmsID: string): Promise<void>;
|
|
14
|
+
updateProcesedFilePath(id: number, origialFilePath: String, processedFilePath: String): Promise<void>;
|
|
13
15
|
updateDocSyncError(id: number, uploadError: string): Promise<void>;
|
|
14
16
|
getUnsyncedDocument(): Promise<DocumentRow[]>;
|
|
15
17
|
}
|
|
@@ -14,11 +14,15 @@ export default class DocumentSyncManager {
|
|
|
14
14
|
static getInstance(): DocumentSyncManager;
|
|
15
15
|
startDocumentSync(): Promise<void>;
|
|
16
16
|
isSyncPending(): Promise<boolean>;
|
|
17
|
-
insertDocument(fmsFolderID: string | null, data: string | null, base64: boolean, desc: string, dspID: string, filePath: string | null, fileType: string, fileName: string, priority?: number): Promise<SQLResultSet>;
|
|
17
|
+
insertDocument(fmsFolderID: string | null, data: string | null, base64: boolean, desc: string, dspID: string, filePath: string | null, fileType: string, fileName: string, geoTimeStamp: string, processedFilePath: string, priority?: number): Promise<SQLResultSet>;
|
|
18
18
|
forceDocumentSync(): Promise<void>;
|
|
19
19
|
private updateDocument;
|
|
20
|
+
private updateDocumentProcessedPath;
|
|
20
21
|
private updateDocError;
|
|
21
22
|
private checkForInitialization;
|
|
23
|
+
private processImageData;
|
|
24
|
+
private processBase64Data;
|
|
25
|
+
private processPODData;
|
|
22
26
|
private uploadDocToServer;
|
|
23
27
|
getAllDocuments(dispatchID?: string): Promise<DocumentRow[]>;
|
|
24
28
|
clearSyncedDocs(dspID: string): Promise<void>;
|
|
@@ -7,5 +7,5 @@ export declare function pushBulkEventForSync(pushData: BulkEvent): Promise<boole
|
|
|
7
7
|
* @private
|
|
8
8
|
*/
|
|
9
9
|
export declare function clearCache(dspID: string): Promise<void>;
|
|
10
|
-
export declare function insertDocumentInDB(fileName: string, fmsFolderName: string, base64Image: string | null, imageDesc: string, filePath: string | null): Promise<number | undefined>;
|
|
10
|
+
export declare function insertDocumentInDB(fileName: string, fmsFolderName: string, base64Image: string | null, imageDesc: string, filePath: string | null, dateTime: string | null, lat: string, lng: string, accuracy: string): Promise<number | undefined>;
|
|
11
11
|
export declare function createFmsFolder(dispatchID: string): Promise<void>;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export declare function isEmptyOrBlank(str: string | null | undefined): boolean;
|
|
2
2
|
export declare function isMandatoryKeysPresent(obj: object, keys: string[]): boolean;
|
|
3
3
|
export declare function isTokenExpired(accessToken: string): boolean;
|
|
4
|
+
export declare function flattenObject(obj: Record<string, any>, prefix?: string): string;
|
|
5
|
+
export declare function createObjectWithoutNullValues<T extends {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}>(obj: T): Partial<T>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@os1-platform/dispatch-mobile",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.7",
|
|
4
4
|
"description": "Dispatch SDK React Native Package",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -101,7 +101,6 @@
|
|
|
101
101
|
"expo-camera": "~12.1.2",
|
|
102
102
|
"expo-file-system": "~13.0.3",
|
|
103
103
|
"expo-font": "~10.0.3",
|
|
104
|
-
"expo-image-manipulator": "~10.1.2",
|
|
105
104
|
"expo-image-picker": "~11.0.3",
|
|
106
105
|
"expo-location": "~13.0.4",
|
|
107
106
|
"expo-sqlite": "~11.0.0",
|
|
@@ -152,7 +151,6 @@
|
|
|
152
151
|
"expo-camera": "~13.1.0",
|
|
153
152
|
"expo-file-system": "~15.1.1",
|
|
154
153
|
"expo-font": "~11.0.1",
|
|
155
|
-
"expo-image-manipulator": "~11.0.0",
|
|
156
154
|
"expo-image-picker": "~14.1.0",
|
|
157
155
|
"expo-location": "~15.0.1",
|
|
158
156
|
"expo-sqlite": "~11.0.0",
|
|
@@ -189,7 +187,7 @@
|
|
|
189
187
|
"<rootDir>/__tests__/**/*"
|
|
190
188
|
],
|
|
191
189
|
"transformIgnorePatterns": [
|
|
192
|
-
"node_modules/(?!react-native|@react-native|@react-native-firebase/app|@react-native-firebase/messaging|@react-native-async-storage/async-storage|expo-sqlite|expo|expo-modules-core|expo-asset|expo-constants|expo-file-system|expo-image-loader|expo-modules-autolinking|expo-image-picker|expo-
|
|
190
|
+
"node_modules/(?!react-native|@react-native|@react-native-firebase/app|@react-native-firebase/messaging|@react-native-async-storage/async-storage|expo-sqlite|expo|expo-modules-core|expo-asset|expo-constants|expo-file-system|expo-image-loader|expo-modules-autolinking|expo-image-picker|expo-barcode-scanner|expo-intent-launcher|expo-location|expo-modules-autolinking|expo-application|expo-asset|expo-sqlite|expo-constants|@react-native-community/netinfo)"
|
|
193
191
|
]
|
|
194
192
|
},
|
|
195
193
|
"husky": {},
|
|
@@ -260,7 +258,7 @@
|
|
|
260
258
|
]
|
|
261
259
|
},
|
|
262
260
|
"dependencies": {
|
|
263
|
-
"@os1-platform/platform-coreos-execution-engine-sdk": "1.0.
|
|
261
|
+
"@os1-platform/platform-coreos-execution-engine-sdk": "1.0.9",
|
|
264
262
|
"@rjsf/core": "^2.0.0",
|
|
265
263
|
"apollo-link-timeout": "^4.0.0",
|
|
266
264
|
"decompress": "^4.2.1",
|
|
@@ -268,7 +266,10 @@
|
|
|
268
266
|
"json-logic-js": "^2.0.1",
|
|
269
267
|
"jsonpath-plus": "^6.0.1",
|
|
270
268
|
"jwt-decode": "^3.1.2",
|
|
269
|
+
"latlng-to-dms": "^1.0.2",
|
|
271
270
|
"lodash": "^4.17.21",
|
|
271
|
+
"react-native-fs": "^2.20.0",
|
|
272
|
+
"react-native-image-marker": "1.1.15",
|
|
272
273
|
"react-native-otp-textinput": "0.0.8",
|
|
273
274
|
"react-native-svg": "^13.6.0",
|
|
274
275
|
"recyclerlistview": "^4.2.0",
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import analytics from '@react-native-firebase/analytics';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Extras,
|
|
9
|
-
} from '@sentry/types';
|
|
3
|
+
createObjectWithoutNullValues,
|
|
4
|
+
flattenObject,
|
|
5
|
+
} from '../../utils/utils';
|
|
6
|
+
import { Event } from '@sentry/types';
|
|
7
|
+
import { SentryEventNameSdkConstants } from '../sentry/SentrySdkConstants';
|
|
10
8
|
|
|
11
|
-
export async function fireFirebaseEvent(eventName:string, data:Event) {
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
export async function fireFirebaseEvent(eventName: string, data: Event) {
|
|
10
|
+
let strEventVal = '';
|
|
11
|
+
console.log('fireFirebaseEvent:eventName', eventName);
|
|
12
|
+
console.log('fireFirebaseEvent:data', data.extra);
|
|
13
|
+
|
|
14
|
+
if (
|
|
15
|
+
eventName === SentryEventNameSdkConstants.API_CALL ||
|
|
16
|
+
eventName === SentryEventNameSdkConstants.API_RESPONSE ||
|
|
17
|
+
eventName === SentryEventNameSdkConstants.API_ERROR
|
|
18
|
+
) {
|
|
19
|
+
strEventVal = JSON.stringify(data.extra);
|
|
20
|
+
} else {
|
|
21
|
+
strEventVal = eventName;
|
|
22
|
+
}
|
|
23
|
+
console.log('fireFirebaseEvent:strEventVal', strEventVal);
|
|
24
|
+
analytics().logEvent(eventName, { eventNameData: strEventVal });
|
|
25
|
+
}
|
|
@@ -10,8 +10,13 @@ import {
|
|
|
10
10
|
import SentryAnalyticsSingleton from './SentryAnalyticsSingleton';
|
|
11
11
|
import { SentryEvent } from './SentryModels';
|
|
12
12
|
import { fireFirebaseEvent } from '../firebase/FirebaseLogging';
|
|
13
|
+
import { SentryEventNameSdkConstants } from './SentrySdkConstants';
|
|
13
14
|
|
|
14
15
|
export async function fireEventWithScreenName({ severityLevel, eventName, cta="N/A",screenName="N/A",extraParams=null } : SentryEvent){
|
|
16
|
+
|
|
17
|
+
//ignoring the button clicked event for now
|
|
18
|
+
if(eventName === SentryEventNameSdkConstants.BUTTON_CLICKED) return;
|
|
19
|
+
|
|
15
20
|
console.log("sentry::fireEventWithScreenName()"," called")
|
|
16
21
|
console.log("sentry::fireEventWithScreenName::severityLevel", severityLevel)
|
|
17
22
|
console.log("sentry::fireEventWithScreenName::eventName", eventName)
|
|
@@ -42,7 +47,7 @@ export async function fireEventWithScreenName({ severityLevel, eventName, cta="N
|
|
|
42
47
|
cta:cta??"N/A",
|
|
43
48
|
ref:SentryAnalyticsSingleton.ref,
|
|
44
49
|
},
|
|
45
|
-
extra
|
|
50
|
+
extra: extraParams ?? '',
|
|
46
51
|
};
|
|
47
52
|
|
|
48
53
|
//fetch user details only if tenantId is present
|
|
@@ -58,7 +63,8 @@ export async function fireEventWithScreenName({ severityLevel, eventName, cta="N
|
|
|
58
63
|
event.environment = await getEnvironment();
|
|
59
64
|
//
|
|
60
65
|
Sentry.captureEvent(event);
|
|
61
|
-
//fire firebase event
|
|
66
|
+
//fire firebase event
|
|
67
|
+
|
|
62
68
|
await fireFirebaseEvent(event.message??"No_Event_Name", event);
|
|
63
69
|
}
|
|
64
70
|
|
|
@@ -44,6 +44,9 @@ export enum ScreenNameSdkConstants {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
export enum SentryEventNameSdkConstants{
|
|
47
|
+
API_CALL = "API_CALL",
|
|
48
|
+
API_RESPONSE = "API_RESPONSE",
|
|
49
|
+
API_ERROR = "API_ERROR",
|
|
47
50
|
BUTTON_CLICKED = "BUTTON_CLICKED",
|
|
48
51
|
SDK_INIT_STARTED = "SDK_INIT_STARTED",
|
|
49
52
|
SDK_INIT_DONE = "SDK_INIT_DONE",
|
|
@@ -36,6 +36,8 @@ import { getStr } from '../../../locale/util';
|
|
|
36
36
|
import Str from '../../../locale/Str';
|
|
37
37
|
import { ScreenNameSdkConstants, SentryEventNameSdkConstants, SeverityLevelValue } from '../../../analytics/sentry/SentrySdkConstants';
|
|
38
38
|
import { fireEventWithScreenName } from '../../../analytics/sentry/SentryAnalyticsUtils';
|
|
39
|
+
import LocationManager from '../../../manager/location/LocationManager';
|
|
40
|
+
import callbackHandler from '../../../manager/sdk/callbacksHandler';
|
|
39
41
|
|
|
40
42
|
const SignatureET = (props: SignatureInput) => {
|
|
41
43
|
const signatureViewRef = useRef<any>();
|
|
@@ -139,6 +141,13 @@ lineHeight: 24 }}>{props.title}</Text>
|
|
|
139
141
|
(await DispatchSdkCache.getInstance().getKeyFromCache(
|
|
140
142
|
DispatchSdkCache.KEYS.FMS_FOLDER
|
|
141
143
|
)) ?? 'NULL';
|
|
144
|
+
const dateTime = await callbackHandler.getDateTime();
|
|
145
|
+
console.log('saveAndSubmit:dateTime: ', dateTime);
|
|
146
|
+
|
|
147
|
+
let lat = LocationManager.getInstance().getLastLocation().latitude;
|
|
148
|
+
let lng = LocationManager.getInstance().getLastLocation().longitude;
|
|
149
|
+
let accuracy = LocationManager.getInstance().getLastLocation().accuracy;
|
|
150
|
+
|
|
142
151
|
let insertID = await insertDocumentInDB(
|
|
143
152
|
fileName,
|
|
144
153
|
folderName,
|
|
@@ -146,7 +155,11 @@ lineHeight: 24 }}>{props.title}</Text>
|
|
|
146
155
|
// JSON.stringify(props.objRefs),
|
|
147
156
|
image,
|
|
148
157
|
props.title ?? 'Signature',
|
|
149
|
-
null
|
|
158
|
+
null,
|
|
159
|
+
dateTime,
|
|
160
|
+
lat,
|
|
161
|
+
lng,
|
|
162
|
+
accuracy
|
|
150
163
|
);
|
|
151
164
|
if (insertID) {
|
|
152
165
|
props.onSubmitET({
|
|
@@ -9,8 +9,6 @@ import * as FileSystem from 'expo-file-system';
|
|
|
9
9
|
import * as ImagePicker from 'expo-image-picker';
|
|
10
10
|
import { PermissionStatus } from 'expo-image-picker';
|
|
11
11
|
import { showToast } from '../../widgets/Toaster';
|
|
12
|
-
import type { ActionResize, ImageResult } from 'expo-image-manipulator';
|
|
13
|
-
import * as ImageManipulator from 'expo-image-manipulator';
|
|
14
12
|
import Logger, { LOG_TYPE } from '../../../utils/Logger';
|
|
15
13
|
import { getBaseETResponse } from '../../../utils/ExecTaskUtils';
|
|
16
14
|
import { getEventCodeByET } from '../../../manager/dispatchCodes/EventCodeContainer';
|
|
@@ -24,6 +22,7 @@ import DispatchSdkCache from '../../../manager/sdk/DispatchSdkCache';
|
|
|
24
22
|
import { insertDocumentInDB } from '../../../utils/SyncManagerUtils';
|
|
25
23
|
import {CameraOptions, launchCamera} from 'react-native-image-picker';
|
|
26
24
|
import { Image } from 'react-native-compressor';
|
|
25
|
+
import Storage from '../../../utils/storage';
|
|
27
26
|
|
|
28
27
|
export async function deleteImage(imageData: { path: string; id: { toString: () => string; }; }, images: any[]) {
|
|
29
28
|
await FileSystem.deleteAsync(imageData.path);
|
|
@@ -83,6 +82,13 @@ interface responseType {
|
|
|
83
82
|
assets?: any[];
|
|
84
83
|
}
|
|
85
84
|
|
|
85
|
+
declare type ImageResult = {
|
|
86
|
+
uri: string;
|
|
87
|
+
width: number;
|
|
88
|
+
height: number;
|
|
89
|
+
base64?: string;
|
|
90
|
+
};
|
|
91
|
+
|
|
86
92
|
export async function captureImage(
|
|
87
93
|
imageWidth: number,
|
|
88
94
|
imageHeight: number,
|
|
@@ -181,32 +187,36 @@ export async function captureImage(
|
|
|
181
187
|
|
|
182
188
|
console.log("aks:uri-after=", uri)
|
|
183
189
|
//
|
|
184
|
-
if(uri != null){
|
|
185
|
-
|
|
190
|
+
if (uri != null) {
|
|
191
|
+
|
|
186
192
|
let compressionRatio = await getCompressionRatio(uri, fileSize);
|
|
187
|
-
console.log(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
const saveOptions = {
|
|
191
|
-
compress: compressionRatio,
|
|
192
|
-
}
|
|
193
|
-
//
|
|
194
|
-
console.log("aks:uri=blank")
|
|
195
|
-
console.log("aks:uri=", uri)
|
|
196
|
-
// let resizedImage = await ImageManipulator.manipulateAsync(uri, [], saveOptions,);
|
|
193
|
+
console.log('aks:compressionRatio=', compressionRatio);
|
|
194
|
+
Storage.getInstance().setItem('maxSize', String(fileSize));
|
|
195
|
+
Storage.getInstance().setItem('cRatio', String(compressionRatio));
|
|
197
196
|
|
|
198
|
-
|
|
197
|
+
console.log('aks:uri=', uri);
|
|
198
|
+
|
|
199
|
+
let resizedImage1 = await Image.compress(uri, {
|
|
199
200
|
compressionMethod: 'manual',
|
|
200
201
|
quality: compressionRatio,
|
|
201
202
|
});
|
|
202
203
|
//
|
|
204
|
+
console.log('aks:resizedImage1=', resizedImage1);
|
|
205
|
+
// If captured image file path does not have prefix file:// then we are addding manually
|
|
206
|
+
if (!resizedImage1.includes('file')) {
|
|
207
|
+
resizedImage1 = 'file://' + resizedImage1;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
console.log('aks:resizedImage2=', resizedImage1);
|
|
211
|
+
|
|
203
212
|
let resizedImageResult: ImageResult = {
|
|
204
213
|
uri: resizedImage1,
|
|
205
214
|
width: imageWidth,
|
|
206
215
|
height: imageHeight,
|
|
207
216
|
base64: '',
|
|
208
217
|
};
|
|
209
|
-
console.log('aks:
|
|
218
|
+
console.log('aks:resizedImageResult=', resizedImageResult);
|
|
219
|
+
|
|
210
220
|
//delete file
|
|
211
221
|
FileSystem.deleteAsync(uri)
|
|
212
222
|
.then(() =>
|
|
@@ -306,6 +316,7 @@ async function getImagesData(
|
|
|
306
316
|
(await DispatchSdkCache.getInstance().getKeyFromCache(
|
|
307
317
|
DispatchSdkCache.KEYS.FMS_FOLDER
|
|
308
318
|
)) ?? 'NULL';
|
|
319
|
+
console.log('getImagesData:',folderName);
|
|
309
320
|
for (const data of imagesDataList) {
|
|
310
321
|
let insertID = await insertDocumentInDB(
|
|
311
322
|
data.id,
|
|
@@ -314,7 +325,11 @@ async function getImagesData(
|
|
|
314
325
|
// JSON.stringify(captureProps.objRefs),
|
|
315
326
|
null,
|
|
316
327
|
captureProps.title,
|
|
317
|
-
data.path
|
|
328
|
+
data.path,
|
|
329
|
+
data.dateTime,
|
|
330
|
+
data.lat,
|
|
331
|
+
data.lng,
|
|
332
|
+
data.accuracy
|
|
318
333
|
);
|
|
319
334
|
if (insertID)
|
|
320
335
|
output.push({
|
|
@@ -17,10 +17,11 @@ import { hasGoBackConnector } from '../../../components/utils';
|
|
|
17
17
|
import GoBackModal from '../../../components/widgets/GoBackModal';
|
|
18
18
|
import { useFocusEffect } from '@react-navigation/native';
|
|
19
19
|
import Circle from "./circle-xmark.svg"
|
|
20
|
-
|
|
21
20
|
import CameraIcon from "./camera.svg"
|
|
22
21
|
import { ScreenNameSdkConstants, SentryEventNameSdkConstants, SeverityLevelValue } from '../../../analytics/sentry/SentrySdkConstants';
|
|
23
22
|
import { fireEventWithScreenName } from '../../../analytics/sentry/SentryAnalyticsUtils';
|
|
23
|
+
import LocationManager from '../../../manager/location/LocationManager';
|
|
24
|
+
import callbackHandler from '../../../manager/sdk/callbacksHandler';
|
|
24
25
|
|
|
25
26
|
const ImageCapture = (props: any) => {
|
|
26
27
|
let numberOfImagesToCapture: any;
|
|
@@ -279,6 +280,7 @@ style={{
|
|
|
279
280
|
// }, [images, props, showCapture]);
|
|
280
281
|
|
|
281
282
|
const captureImage = useCallback(async (index) => {
|
|
283
|
+
|
|
282
284
|
// // if (!showCapture) {
|
|
283
285
|
// // showToast(`Max Image Limit reached`);
|
|
284
286
|
// // return;
|
|
@@ -295,12 +297,18 @@ style={{
|
|
|
295
297
|
|
|
296
298
|
let imgArray = [];
|
|
297
299
|
imgArray = imagesDummy;
|
|
300
|
+
const dateTime = await callbackHandler.getDateTime();
|
|
301
|
+
console.log('captureImage:dateTime: ',dateTime);
|
|
298
302
|
imgArray[index] = {
|
|
299
303
|
id: CaptureUtils.getImagesFileName(),
|
|
300
304
|
// @ts-ignore
|
|
301
305
|
path: imageDataResponse.uri,
|
|
302
306
|
url: '',
|
|
303
307
|
timestamp: Date.now(),
|
|
308
|
+
dateTime: dateTime,
|
|
309
|
+
lat: LocationManager.getInstance().getLastLocation().latitude,
|
|
310
|
+
lng: LocationManager.getInstance().getLastLocation().longitude,
|
|
311
|
+
accuracy: LocationManager.getInstance().getLastLocation().accuracy,
|
|
304
312
|
};
|
|
305
313
|
setImagesDummy([...imgArray])
|
|
306
314
|
console.log("images211:", JSON.stringify(imgArray));
|
|
@@ -318,7 +326,7 @@ style={{
|
|
|
318
326
|
let initialProceedValue = false;
|
|
319
327
|
for (let i = 0; i < imageDummyArray.length; i++) {
|
|
320
328
|
if (imageDummyArray[i]?.path) {
|
|
321
|
-
initialProceedValue = true
|
|
329
|
+
initialProceedValue = true;
|
|
322
330
|
}
|
|
323
331
|
}
|
|
324
332
|
setButtonProceed(initialProceedValue);
|
package/src/index.tsx
CHANGED
|
@@ -50,6 +50,7 @@ import SentryAnalyticsSingleton from './analytics/sentry/SentryAnalyticsSingleto
|
|
|
50
50
|
import { fireEventWithScreenName } from './analytics/sentry/SentryAnalyticsUtils';
|
|
51
51
|
import { ScreenNameSdkConstants, SentryEventNameSdkConstants, SeverityLevelValue } from './analytics/sentry/SentrySdkConstants';
|
|
52
52
|
import { DispatchAndUserData, SentryEvent } from './analytics/sentry/SentryModels';
|
|
53
|
+
import DocumentManager from './manager/syncmanager/document/DocumentManager';
|
|
53
54
|
export { DispatchExecutor, IDispatch, IDispatchExecutor };
|
|
54
55
|
export { Storage, DispatchExecNavigator };
|
|
55
56
|
export { ETSummary, CompleteSummary, ObjectiveSummary, DispatchSyncType };
|
|
@@ -85,3 +86,4 @@ export { MtsSdk };
|
|
|
85
86
|
export { Helper };
|
|
86
87
|
//sentry function export
|
|
87
88
|
export { SentryAnalyticsSingleton, fireEventWithScreenName, SeverityLevelValue, ScreenNameSdkConstants, SentryEventNameSdkConstants, DispatchAndUserData, SentryEvent};
|
|
89
|
+
export { DocumentManager };
|
|
@@ -56,12 +56,18 @@ export default class LocationManager {
|
|
|
56
56
|
}
|
|
57
57
|
public getLastLocation(): DLocation {
|
|
58
58
|
if (this.lastLocation != null && this.lastLocation.coords != null) {
|
|
59
|
+
let accuracy = '';
|
|
60
|
+
if (this.lastLocation.coords.accuracy !== null) {
|
|
61
|
+
let accuracyVal = Math.round(this.lastLocation.coords.accuracy);
|
|
62
|
+
accuracy = accuracyVal.toString();
|
|
63
|
+
}
|
|
59
64
|
return {
|
|
60
65
|
latitude: this.lastLocation.coords.latitude.toString(),
|
|
61
66
|
longitude: this.lastLocation.coords.longitude.toString(),
|
|
67
|
+
accuracy: accuracy,
|
|
62
68
|
};
|
|
63
69
|
} else {
|
|
64
|
-
return { latitude: 'null', longitude: 'null' };
|
|
70
|
+
return { latitude: 'null', longitude: 'null', accuracy: 'null' };
|
|
65
71
|
}
|
|
66
72
|
}
|
|
67
73
|
public stopLocationUpdates() {
|
|
@@ -74,4 +80,5 @@ export default class LocationManager {
|
|
|
74
80
|
export interface DLocation {
|
|
75
81
|
latitude: string;
|
|
76
82
|
longitude: string;
|
|
83
|
+
accuracy: string;
|
|
77
84
|
}
|
|
@@ -78,8 +78,14 @@ export class DispatchSDKManager {
|
|
|
78
78
|
Logger.getInstance().setLogging(sdkConfig.enableLogging ?? true, sdkConfig);
|
|
79
79
|
let storage = Storage.getInstance();
|
|
80
80
|
|
|
81
|
-
if (
|
|
82
|
-
|
|
81
|
+
if (
|
|
82
|
+
sdkConfig.callbacks?.fetchPhoneNumbersCallback &&
|
|
83
|
+
sdkConfig?.callbacks?.fetchDateTimeCallback
|
|
84
|
+
) {
|
|
85
|
+
await callbackHandler.init(
|
|
86
|
+
sdkConfig.callbacks.fetchPhoneNumbersCallback,
|
|
87
|
+
sdkConfig.callbacks.fetchDateTimeCallback
|
|
88
|
+
);
|
|
83
89
|
}
|
|
84
90
|
await dispatchExecutor.init(
|
|
85
91
|
{
|
|
@@ -3,12 +3,16 @@ class CallbacksHandler {
|
|
|
3
3
|
sdsIds: string[]
|
|
4
4
|
) => Promise<{ key: string; value: string[] }>;
|
|
5
5
|
|
|
6
|
+
private _callbackToFetchDateTime!: () => Promise<string>;
|
|
7
|
+
|
|
6
8
|
public init(
|
|
7
9
|
phoneCallback: (
|
|
8
10
|
sdsIds: string[]
|
|
9
|
-
) => Promise<{ key: string; value: string[] }
|
|
11
|
+
) => Promise<{ key: string; value: string[] }>,
|
|
12
|
+
dateTimeCallBack: () => Promise<string>
|
|
10
13
|
) {
|
|
11
14
|
this._callbackToFetchPhoneNumbers = phoneCallback;
|
|
15
|
+
this._callbackToFetchDateTime = dateTimeCallBack;
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
public async getPhoneNumbers(
|
|
@@ -19,6 +23,13 @@ class CallbacksHandler {
|
|
|
19
23
|
return await this._callbackToFetchPhoneNumbers(sdsIds);
|
|
20
24
|
}
|
|
21
25
|
}
|
|
26
|
+
|
|
27
|
+
public async getDateTime(): Promise<string | ''> {
|
|
28
|
+
if (!this._callbackToFetchDateTime) return '';
|
|
29
|
+
else {
|
|
30
|
+
return await this._callbackToFetchDateTime();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
22
33
|
}
|
|
23
34
|
|
|
24
35
|
const callbackHandler = new CallbacksHandler();
|
|
@@ -42,6 +42,8 @@ export const DOCUMENT_COLUMNS = {
|
|
|
42
42
|
DISPATCH_ID: 'dispatch_id',
|
|
43
43
|
JOB_ID: 'job_id',
|
|
44
44
|
OBJECTIVE_REF: 'objective_ref',
|
|
45
|
+
GEO_TIMESTAMP: 'geo_timestamp',
|
|
46
|
+
PROCESSED_FILE_PATH: 'processed_file_path',
|
|
45
47
|
};
|
|
46
48
|
export type DocumentRow = {
|
|
47
49
|
id: number;
|
|
@@ -59,6 +61,8 @@ export type DocumentRow = {
|
|
|
59
61
|
dispatch_id: string;
|
|
60
62
|
job_id: string;
|
|
61
63
|
objective_ref: string;
|
|
64
|
+
geo_timestamp: string;
|
|
65
|
+
processed_file_path: string;
|
|
62
66
|
};
|
|
63
67
|
export type EventRow = {
|
|
64
68
|
id: number;
|