@doorstepai/dropoff-sdk 1.0.7 → 1.0.9
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/README.md +33 -19
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/doorstepai/dropoffsdk/DoorstepAIModule.kt +42 -32
- package/ios/DoorstepAI.mm +8 -2
- package/ios/DoorstepAI.swift +27 -22
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.abi.json +215 -57
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +6 -5
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.swiftinterface +6 -5
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +8 -8
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +735 -677
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +215 -57
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +6 -5
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +6 -5
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +215 -57
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +6 -5
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +6 -5
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +16 -16
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +759 -701
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/DoorstepDropoffSDK.yml +759 -700
- package/lib/module/DoorstepAI.js +56 -29
- package/lib/module/DoorstepAI.js.map +1 -1
- package/lib/module/RootDoorstepAI.js.map +1 -1
- package/lib/typescript/src/DoorstepAI.d.ts +6 -5
- package/lib/typescript/src/DoorstepAI.d.ts.map +1 -1
- package/lib/typescript/src/RootDoorstepAI.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/DoorstepAI.tsx +64 -42
- package/src/RootDoorstepAI.tsx +4 -7
package/lib/module/DoorstepAI.js
CHANGED
|
@@ -6,6 +6,9 @@ const {
|
|
|
6
6
|
} = NativeModules;
|
|
7
7
|
class DoorstepAIModule {
|
|
8
8
|
static isInitialized = false;
|
|
9
|
+
static enableDevMode() {
|
|
10
|
+
DoorstepAI.setDevMode(true);
|
|
11
|
+
}
|
|
9
12
|
static async init() {
|
|
10
13
|
if (Platform.OS === 'android') {
|
|
11
14
|
if (this.isInitialized) {
|
|
@@ -14,50 +17,74 @@ class DoorstepAIModule {
|
|
|
14
17
|
try {
|
|
15
18
|
await DoorstepAI.init();
|
|
16
19
|
console.log('DoorstepAI initialized');
|
|
20
|
+
this.isInitialized = true; // Mark as initialized on success
|
|
17
21
|
} catch (error) {
|
|
18
22
|
console.error('Failed to initialize DoorstepAI:', error);
|
|
19
23
|
throw error;
|
|
20
24
|
}
|
|
21
|
-
}
|
|
25
|
+
} // iOS does not require explicit init in the bridge
|
|
22
26
|
}
|
|
23
27
|
static setApiKey(apiKey) {
|
|
24
|
-
console.log(DoorstepAI);
|
|
25
28
|
DoorstepAI.setApiKey(apiKey);
|
|
26
29
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
|
|
31
|
+
// Add deliveryId parameter
|
|
32
|
+
static async startDeliveryByPlaceID(placeID, deliveryId) {
|
|
33
|
+
try {
|
|
34
|
+
const result = await DoorstepAI.startDeliveryByPlaceID(placeID, deliveryId);
|
|
35
|
+
console.log('Delivery started successfully by Place ID:', result);
|
|
36
|
+
return result; // Return result (e.g., session ID from Android)
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error('Failed to start delivery by Place ID:', error);
|
|
39
|
+
throw error; // Re-throw error for caller handling
|
|
40
|
+
}
|
|
33
41
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
|
|
43
|
+
// Add deliveryId parameter
|
|
44
|
+
static async startDeliveryByPlusCode(plusCode, deliveryId) {
|
|
45
|
+
try {
|
|
46
|
+
const result = await DoorstepAI.startDeliveryByPlusCode(plusCode, deliveryId);
|
|
47
|
+
console.log('Delivery started successfully by Plus Code:', result);
|
|
48
|
+
return result;
|
|
49
|
+
} catch (error) {
|
|
50
|
+
console.error('Failed to start delivery by Plus Code:', error);
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
40
53
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
54
|
+
|
|
55
|
+
// Add deliveryId parameter and handle platform difference
|
|
56
|
+
static async startDeliveryByAddress(address, deliveryId) {
|
|
57
|
+
try {
|
|
58
|
+
let result = await DoorstepAI.startDeliveryByAddress(address, deliveryId);
|
|
59
|
+
console.log('Delivery started successfully by Address:', result);
|
|
60
|
+
return result;
|
|
61
|
+
} catch (error) {
|
|
62
|
+
console.error('Failed to start delivery by Address:', error);
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
47
65
|
}
|
|
48
|
-
|
|
49
|
-
|
|
66
|
+
|
|
67
|
+
// Add deliveryId parameter
|
|
68
|
+
static async stopDelivery(deliveryId) {
|
|
69
|
+
try {
|
|
70
|
+
await DoorstepAI.stopDelivery(deliveryId);
|
|
50
71
|
console.log('Delivery stopped successfully');
|
|
51
|
-
}
|
|
72
|
+
} catch (error) {
|
|
52
73
|
console.error('Failed to stop delivery:', error);
|
|
53
|
-
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
54
76
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
77
|
+
|
|
78
|
+
// Add deliveryId parameter
|
|
79
|
+
static async newEvent(eventName, deliveryId) {
|
|
80
|
+
try {
|
|
81
|
+
const result = await DoorstepAI.newEvent(eventName, deliveryId);
|
|
82
|
+
console.log('Event sent successfully:', result);
|
|
83
|
+
return result;
|
|
84
|
+
} catch (error) {
|
|
59
85
|
console.error('Failed to send event:', error);
|
|
60
|
-
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
61
88
|
}
|
|
62
89
|
}
|
|
63
90
|
export { DoorstepAIModule as DoorstepAI };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","DoorstepAI","DoorstepAIModule","isInitialized","init","OS","console","log","error","setApiKey","apiKey","startDeliveryByPlaceID","placeID","
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","DoorstepAI","DoorstepAIModule","isInitialized","enableDevMode","setDevMode","init","OS","console","log","error","setApiKey","apiKey","startDeliveryByPlaceID","placeID","deliveryId","result","startDeliveryByPlusCode","plusCode","startDeliveryByAddress","address","stopDelivery","newEvent","eventName"],"sourceRoot":"../../src","sources":["DoorstepAI.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["requireNativeComponent","View","Platform","StyleSheet","PermissionsAndroid","useEffect","DoorstepAI","jsx","_jsx","DoorstepAIView","RootDoorstepAI","props","initializeAndRequestPermissions","OS","init","setApiKey","apiKey","permissionsToRequest","PERMISSIONS","ACCESS_FINE_LOCATION","ACTIVITY_RECOGNITION","granted","requestMultiple","RESULTS","GRANTED","console","log","warn","err","style","styles","container","children","create","height","width"],"sourceRoot":"../../src","sources":["RootDoorstepAI.tsx"],"mappings":";;AAAA,SACEA,sBAAsB,EACtBC,IAAI,EACJC,QAAQ,EACRC,UAAU,EACVC,kBAAkB,QACb,cAAc;AAErB,SAASC,SAAS,QAAQ,OAAO;AAEjC,SAASC,UAAU,QAAQ,iBAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1C,MAAMC,cAAc,GAAGT,sBAAsB,CAAC,oBAAoB,CAAC;AACnE,OAAO,SAASU,cAAcA,CAACC,KAAyB,EAAE;EACxDN,SAAS,CAAC,MAAM;IACd,MAAMO,+BAA+B,GAAG,MAAAA,CAAA,KAAY;
|
|
1
|
+
{"version":3,"names":["requireNativeComponent","View","Platform","StyleSheet","PermissionsAndroid","useEffect","DoorstepAI","jsx","_jsx","DoorstepAIView","RootDoorstepAI","props","initializeAndRequestPermissions","OS","init","setApiKey","apiKey","permissionsToRequest","PERMISSIONS","ACCESS_FINE_LOCATION","ACTIVITY_RECOGNITION","granted","requestMultiple","RESULTS","GRANTED","console","log","warn","err","style","styles","container","children","create","height","width"],"sourceRoot":"../../src","sources":["RootDoorstepAI.tsx"],"mappings":";;AAAA,SACEA,sBAAsB,EACtBC,IAAI,EACJC,QAAQ,EACRC,UAAU,EACVC,kBAAkB,QACb,cAAc;AAErB,SAASC,SAAS,QAAQ,OAAO;AAEjC,SAASC,UAAU,QAAQ,iBAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1C,MAAMC,cAAc,GAAGT,sBAAsB,CAAC,oBAAoB,CAAC;AACnE,OAAO,SAASU,cAAcA,CAACC,KAAyB,EAAE;EACxDN,SAAS,CAAC,MAAM;IACd,MAAMO,+BAA+B,GAAG,MAAAA,CAAA,KAAY;MAClD,IAAIV,QAAQ,CAACW,EAAE,KAAK,SAAS,EAAE;QAC7B,MAAMP,UAAU,CAACQ,IAAI,CAAC,CAAC;MACzB;MAEAR,UAAU,CAACS,SAAS,CAACJ,KAAK,CAACK,MAAM,CAAC;MAElC,IAAId,QAAQ,CAACW,EAAE,KAAK,SAAS,EAAE;QAC7B,IAAI;UACF,MAAMI,oBAAoB,GAAG,CAC3Bb,kBAAkB,CAACc,WAAW,CAACC,oBAAoB,EACnDf,kBAAkB,CAACc,WAAW,CAACE,oBAAoB,CACpD;UAED,MAAMC,OAAO,GACX,MAAMjB,kBAAkB,CAACkB,eAAe,CAACL,oBAAoB,CAAC;UAEhE,IACEI,OAAO,CAACjB,kBAAkB,CAACc,WAAW,CAACC,oBAAoB,CAAC,KAC1Df,kBAAkB,CAACmB,OAAO,CAACC,OAAO,IACpCH,OAAO,CAACjB,kBAAkB,CAACc,WAAW,CAACE,oBAAoB,CAAC,KAC1DhB,kBAAkB,CAACmB,OAAO,CAACC,OAAO,EACpC;YACAC,OAAO,CAACC,GAAG,CAAC,sCAAsC,CAAC;UACrD,CAAC,MAAM;YACLD,OAAO,CAACE,IAAI,CAAC,iDAAiD,CAAC;UACjE;QACF,CAAC,CAAC,OAAOC,GAAG,EAAE;UACZH,OAAO,CAACE,IAAI,CAAC,uCAAuC,EAAEC,GAAG,CAAC;QAC5D;MACF,CAAC,MAAM,IAAI1B,QAAQ,CAACW,EAAE,KAAK,KAAK,EAAE;QAChCY,OAAO,CAACC,GAAG,CACT,sEACF,CAAC;MACH;IACF,CAAC;IAEDd,+BAA+B,CAAC,CAAC;EACnC,CAAC,EAAE,CAACD,KAAK,CAACK,MAAM,CAAC,CAAC;;EAElB;EACA;EACA,oBACER,IAAA,CAACP,IAAI;IAAC4B,KAAK,EAAEC,MAAM,CAACC,SAAU;IAAAC,QAAA,EAC3B9B,QAAQ,CAACW,EAAE,KAAK,KAAK,gBAAGL,IAAA,CAACC,cAAc,IAAE,CAAC,GAAG;EAAI,CAC9C,CAAC;AAEX;AAEA,MAAMqB,MAAM,GAAG3B,UAAU,CAAC8B,MAAM,CAAC;EAC/BF,SAAS,EAAE;IACTG,MAAM,EAAE,CAAC;IACTC,KAAK,EAAE;EACT;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -8,13 +8,14 @@ type AddressType = {
|
|
|
8
8
|
};
|
|
9
9
|
declare class DoorstepAIModule {
|
|
10
10
|
static isInitialized: boolean;
|
|
11
|
+
static enableDevMode(): void;
|
|
11
12
|
static init(): Promise<void>;
|
|
12
13
|
static setApiKey(apiKey: string): void;
|
|
13
|
-
static startDeliveryByPlaceID(placeID: string): Promise<
|
|
14
|
-
static startDeliveryByPlusCode(plusCode: string):
|
|
15
|
-
static startDeliveryByAddress(address: AddressType):
|
|
16
|
-
static stopDelivery(): void
|
|
17
|
-
static newEvent(eventName: string):
|
|
14
|
+
static startDeliveryByPlaceID(placeID: string, deliveryId: string): Promise<any>;
|
|
15
|
+
static startDeliveryByPlusCode(plusCode: string, deliveryId: string): Promise<any>;
|
|
16
|
+
static startDeliveryByAddress(address: AddressType, deliveryId: string): Promise<any>;
|
|
17
|
+
static stopDelivery(deliveryId: string): Promise<void>;
|
|
18
|
+
static newEvent(eventName: string, deliveryId: string): Promise<any>;
|
|
18
19
|
}
|
|
19
20
|
export { DoorstepAIModule as DoorstepAI };
|
|
20
21
|
//# sourceMappingURL=DoorstepAI.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DoorstepAI.d.ts","sourceRoot":"","sources":["../../../src/DoorstepAI.tsx"],"names":[],"mappings":"AAGA,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,wBAAwB,EAAE,MAAM,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,cAAM,gBAAgB;IACpB,MAAM,CAAC,aAAa,UAAS;
|
|
1
|
+
{"version":3,"file":"DoorstepAI.d.ts","sourceRoot":"","sources":["../../../src/DoorstepAI.tsx"],"names":[],"mappings":"AAGA,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,wBAAwB,EAAE,MAAM,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,cAAM,gBAAgB;IACpB,MAAM,CAAC,aAAa,UAAS;IAE7B,MAAM,CAAC,aAAa;WAIP,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBlC,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM;WAKlB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;WAe1D,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;WAe5D,sBAAsB,CACjC,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM;WAaP,YAAY,CAAC,UAAU,EAAE,MAAM;WAW/B,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAU5D;AAED,OAAO,EAAE,gBAAgB,IAAI,UAAU,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RootDoorstepAI.d.ts","sourceRoot":"","sources":["../../../src/RootDoorstepAI.tsx"],"names":[],"mappings":"AAaA,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"RootDoorstepAI.d.ts","sourceRoot":"","sources":["../../../src/RootDoorstepAI.tsx"],"names":[],"mappings":"AAaA,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,2CAiDvD"}
|
package/package.json
CHANGED
package/src/DoorstepAI.tsx
CHANGED
|
@@ -13,6 +13,10 @@ type AddressType = {
|
|
|
13
13
|
class DoorstepAIModule {
|
|
14
14
|
static isInitialized = false;
|
|
15
15
|
|
|
16
|
+
static enableDevMode() {
|
|
17
|
+
DoorstepAI.setDevMode(true);
|
|
18
|
+
}
|
|
19
|
+
|
|
16
20
|
static async init(): Promise<void> {
|
|
17
21
|
if (Platform.OS === 'android') {
|
|
18
22
|
if (this.isInitialized) {
|
|
@@ -21,66 +25,84 @@ class DoorstepAIModule {
|
|
|
21
25
|
try {
|
|
22
26
|
await DoorstepAI.init();
|
|
23
27
|
console.log('DoorstepAI initialized');
|
|
28
|
+
this.isInitialized = true; // Mark as initialized on success
|
|
24
29
|
} catch (error) {
|
|
25
30
|
console.error('Failed to initialize DoorstepAI:', error);
|
|
26
31
|
throw error;
|
|
27
32
|
}
|
|
28
|
-
}
|
|
33
|
+
} // iOS does not require explicit init in the bridge
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
static setApiKey(apiKey: string) {
|
|
32
|
-
console.log(DoorstepAI);
|
|
33
37
|
DoorstepAI.setApiKey(apiKey);
|
|
34
38
|
}
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
// Add deliveryId parameter
|
|
41
|
+
static async startDeliveryByPlaceID(placeID: string, deliveryId: string) {
|
|
42
|
+
try {
|
|
43
|
+
const result = await DoorstepAI.startDeliveryByPlaceID(
|
|
44
|
+
placeID,
|
|
45
|
+
deliveryId
|
|
46
|
+
);
|
|
47
|
+
console.log('Delivery started successfully by Place ID:', result);
|
|
48
|
+
return result; // Return result (e.g., session ID from Android)
|
|
49
|
+
} catch (error: any) {
|
|
50
|
+
console.error('Failed to start delivery by Place ID:', error);
|
|
51
|
+
throw error; // Re-throw error for caller handling
|
|
52
|
+
}
|
|
44
53
|
}
|
|
45
54
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
// Add deliveryId parameter
|
|
56
|
+
static async startDeliveryByPlusCode(plusCode: string, deliveryId: string) {
|
|
57
|
+
try {
|
|
58
|
+
const result = await DoorstepAI.startDeliveryByPlusCode(
|
|
59
|
+
plusCode,
|
|
60
|
+
deliveryId
|
|
61
|
+
);
|
|
62
|
+
console.log('Delivery started successfully by Plus Code:', result);
|
|
63
|
+
return result;
|
|
64
|
+
} catch (error: any) {
|
|
65
|
+
console.error('Failed to start delivery by Plus Code:', error);
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
54
68
|
}
|
|
55
69
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
// Add deliveryId parameter and handle platform difference
|
|
71
|
+
static async startDeliveryByAddress(
|
|
72
|
+
address: AddressType,
|
|
73
|
+
deliveryId: string
|
|
74
|
+
) {
|
|
75
|
+
try {
|
|
76
|
+
let result = await DoorstepAI.startDeliveryByAddress(address, deliveryId);
|
|
77
|
+
console.log('Delivery started successfully by Address:', result);
|
|
78
|
+
return result;
|
|
79
|
+
} catch (error: any) {
|
|
80
|
+
console.error('Failed to start delivery by Address:', error);
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
64
83
|
}
|
|
65
84
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
85
|
+
// Add deliveryId parameter
|
|
86
|
+
static async stopDelivery(deliveryId: string) {
|
|
87
|
+
try {
|
|
88
|
+
await DoorstepAI.stopDelivery(deliveryId);
|
|
89
|
+
console.log('Delivery stopped successfully');
|
|
90
|
+
} catch (error: any) {
|
|
91
|
+
console.error('Failed to stop delivery:', error);
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
74
94
|
}
|
|
75
95
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
96
|
+
// Add deliveryId parameter
|
|
97
|
+
static async newEvent(eventName: string, deliveryId: string) {
|
|
98
|
+
try {
|
|
99
|
+
const result = await DoorstepAI.newEvent(eventName, deliveryId);
|
|
100
|
+
console.log('Event sent successfully:', result);
|
|
101
|
+
return result;
|
|
102
|
+
} catch (error: any) {
|
|
103
|
+
console.error('Failed to send event:', error);
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
84
106
|
}
|
|
85
107
|
}
|
|
86
108
|
|
package/src/RootDoorstepAI.tsx
CHANGED
|
@@ -14,24 +14,21 @@ const DoorstepAIView = requireNativeComponent('RootDoorstepAIView');
|
|
|
14
14
|
export function RootDoorstepAI(props: { apiKey: string }) {
|
|
15
15
|
useEffect(() => {
|
|
16
16
|
const initializeAndRequestPermissions = async () => {
|
|
17
|
-
|
|
18
17
|
if (Platform.OS === 'android') {
|
|
19
18
|
await DoorstepAI.init();
|
|
20
19
|
}
|
|
20
|
+
|
|
21
21
|
DoorstepAI.setApiKey(props.apiKey);
|
|
22
22
|
|
|
23
|
-
|
|
24
23
|
if (Platform.OS === 'android') {
|
|
25
24
|
try {
|
|
26
25
|
const permissionsToRequest = [
|
|
27
26
|
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
|
|
28
27
|
PermissionsAndroid.PERMISSIONS.ACTIVITY_RECOGNITION,
|
|
29
28
|
];
|
|
30
|
-
|
|
31
29
|
|
|
32
|
-
const granted =
|
|
33
|
-
permissionsToRequest
|
|
34
|
-
);
|
|
30
|
+
const granted =
|
|
31
|
+
await PermissionsAndroid.requestMultiple(permissionsToRequest);
|
|
35
32
|
|
|
36
33
|
if (
|
|
37
34
|
granted[PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION] ===
|
|
@@ -48,7 +45,7 @@ export function RootDoorstepAI(props: { apiKey: string }) {
|
|
|
48
45
|
}
|
|
49
46
|
} else if (Platform.OS === 'ios') {
|
|
50
47
|
console.log(
|
|
51
|
-
'iOS: Ensure location and motion usage descriptions are in Info.plist'
|
|
48
|
+
'iOS: Ensure location and motion usage descriptions are in Info.plist'
|
|
52
49
|
);
|
|
53
50
|
}
|
|
54
51
|
};
|