@doorstepai/dropoff-sdk-capacitor 1.0.1 → 1.0.2
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/android/src/main/java/ai/doorstep/dropoffsdk/capacitor/DoorstepAIDropoffSDKPlugin.kt
CHANGED
|
@@ -107,7 +107,8 @@ class DoorstepAIDropoffSDKPlugin : Plugin() {
|
|
|
107
107
|
val timeoutSeconds = call.getDouble("timeoutSeconds")
|
|
108
108
|
val customerId = call.getString("customerId")
|
|
109
109
|
val autoStopAfterDropoffSeconds = call.getDouble("autoStopAfterDropoffSeconds")
|
|
110
|
-
|
|
110
|
+
val manualForeground = call.getBoolean("manualForeground", false) ?: false
|
|
111
|
+
Log.d(TAG, "startDeliveryByPlaceID: placeID=$placeID deliveryId=$deliveryId timeout=$timeoutSeconds customerId=$customerId autoStop=$autoStopAfterDropoffSeconds manualForeground=$manualForeground")
|
|
111
112
|
if (placeID == null || deliveryId == null) {
|
|
112
113
|
return call.reject("placeID or deliveryId missing", "BAD_ARGS")
|
|
113
114
|
}
|
|
@@ -118,6 +119,7 @@ class DoorstepAIDropoffSDKPlugin : Plugin() {
|
|
|
118
119
|
timeoutSeconds = timeoutSeconds,
|
|
119
120
|
autoStopAfterDropoffSeconds = autoStopAfterDropoffSeconds,
|
|
120
121
|
customerId = customerId,
|
|
122
|
+
manualForeground = manualForeground,
|
|
121
123
|
) { sdkResult ->
|
|
122
124
|
sdkResult.onSuccess { call.resolve() }
|
|
123
125
|
.onFailure { error ->
|
|
@@ -169,6 +171,7 @@ class DoorstepAIDropoffSDKPlugin : Plugin() {
|
|
|
169
171
|
val timeoutSeconds = call.getDouble("timeoutSeconds")
|
|
170
172
|
val customerId = call.getString("customerId")
|
|
171
173
|
val autoStopAfterDropoffSeconds = call.getDouble("autoStopAfterDropoffSeconds")
|
|
174
|
+
val manualForeground = call.getBoolean("manualForeground", false) ?: false
|
|
172
175
|
val coordinates = parseCoordinates(call.getObject("coordinates"))
|
|
173
176
|
|
|
174
177
|
if (addrObj == null
|
|
@@ -198,6 +201,7 @@ class DoorstepAIDropoffSDKPlugin : Plugin() {
|
|
|
198
201
|
timeoutSeconds = timeoutSeconds,
|
|
199
202
|
autoStopAfterDropoffSeconds = autoStopAfterDropoffSeconds,
|
|
200
203
|
customerId = customerId,
|
|
204
|
+
manualForeground = manualForeground,
|
|
201
205
|
) { sdkResult ->
|
|
202
206
|
sdkResult.onSuccess { call.resolve() }
|
|
203
207
|
.onFailure { error ->
|
|
@@ -216,6 +220,7 @@ class DoorstepAIDropoffSDKPlugin : Plugin() {
|
|
|
216
220
|
val timeoutSeconds = call.getDouble("timeoutSeconds")
|
|
217
221
|
val customerId = call.getString("customerId")
|
|
218
222
|
val autoStopAfterDropoffSeconds = call.getDouble("autoStopAfterDropoffSeconds")
|
|
223
|
+
val manualForeground = call.getBoolean("manualForeground", false) ?: false
|
|
219
224
|
val coordinates = parseCoordinates(call.getObject("coordinates"))
|
|
220
225
|
if (address == null || deliveryId == null) {
|
|
221
226
|
return call.reject("address or deliveryId missing", "BAD_ARGS")
|
|
@@ -228,6 +233,7 @@ class DoorstepAIDropoffSDKPlugin : Plugin() {
|
|
|
228
233
|
timeoutSeconds = timeoutSeconds,
|
|
229
234
|
autoStopAfterDropoffSeconds = autoStopAfterDropoffSeconds,
|
|
230
235
|
customerId = customerId,
|
|
236
|
+
manualForeground = manualForeground,
|
|
231
237
|
) { sdkResult ->
|
|
232
238
|
sdkResult.onSuccess { call.resolve() }
|
|
233
239
|
.onFailure { error ->
|
|
@@ -37,7 +37,18 @@ export interface SetApiKeyOptions {
|
|
|
37
37
|
declare type CustomerIdOption = {
|
|
38
38
|
customerId?: string;
|
|
39
39
|
};
|
|
40
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Android-only option shared by every `startDelivery*` method.
|
|
42
|
+
*/
|
|
43
|
+
declare type ManualForegroundOption = {
|
|
44
|
+
/**
|
|
45
|
+
* Android only: when `true`, the host app is responsible for its own
|
|
46
|
+
* foreground service/notification and the SDK will not start a second one.
|
|
47
|
+
* Ignored on iOS. Defaults to `false`.
|
|
48
|
+
*/
|
|
49
|
+
manualForeground?: boolean;
|
|
50
|
+
};
|
|
51
|
+
export interface StartDeliveryByPlaceIDOptions extends CustomerIdOption, ManualForegroundOption {
|
|
41
52
|
placeID: string;
|
|
42
53
|
deliveryId: string;
|
|
43
54
|
timeoutSeconds?: number;
|
|
@@ -58,7 +69,7 @@ export interface StartDeliveryByPlusCodeOptions extends CustomerIdOption {
|
|
|
58
69
|
*/
|
|
59
70
|
autoStopAfterDropoffSeconds?: number;
|
|
60
71
|
}
|
|
61
|
-
export interface StartDeliveryByAddressOptions extends CustomerIdOption {
|
|
72
|
+
export interface StartDeliveryByAddressOptions extends CustomerIdOption, ManualForegroundOption {
|
|
62
73
|
address: AddressType;
|
|
63
74
|
deliveryId: string;
|
|
64
75
|
coordinates?: LatLngObject;
|
|
@@ -69,7 +80,7 @@ export interface StartDeliveryByAddressOptions extends CustomerIdOption {
|
|
|
69
80
|
*/
|
|
70
81
|
autoStopAfterDropoffSeconds?: number;
|
|
71
82
|
}
|
|
72
|
-
export interface StartDeliveryByAddressStringOptions extends CustomerIdOption {
|
|
83
|
+
export interface StartDeliveryByAddressStringOptions extends CustomerIdOption, ManualForegroundOption {
|
|
73
84
|
address: string;
|
|
74
85
|
deliveryId: string;
|
|
75
86
|
coordinates?: LatLngObject;
|