capacitor-record360sdk 7.24.0 → 7.30.1
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/CapacitorRecord360sdk.podspec +2 -2
- package/README.md +42 -9
- package/android/build.gradle +5 -5
- package/android/src/main/java/com/record360/plugins/CapacitorRecord360SDKPlugin.kt +67 -36
- package/android/src/main/java/com/record360/plugins/SampleRecord360Activity.kt +22 -9
- package/dist/docs.json +16 -4
- package/dist/esm/definitions.d.ts +11 -6
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +4 -3
- package/dist/esm/web.js.map +1 -1
- package/ios/Sources/CapacitorRecord360SDKPlugin/CapacitorRecord360SDKPlugin.swift +72 -38
- package/package.json +3 -3
|
@@ -11,8 +11,8 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
13
|
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
-
s.ios.deployment_target = '
|
|
14
|
+
s.ios.deployment_target = '15.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
|
-
s.dependency 'Record360SDK', '4.
|
|
16
|
+
s.dependency 'Record360SDK', '4.24.7'
|
|
17
17
|
s.swift_version = '5.1'
|
|
18
18
|
end
|
package/README.md
CHANGED
|
@@ -40,12 +40,12 @@ launchRecord360(identity?: Record360Identity | undefined) => Promise<void>
|
|
|
40
40
|
### launchReferenceCapture(...)
|
|
41
41
|
|
|
42
42
|
```typescript
|
|
43
|
-
launchReferenceCapture(options: { referenceNumber: string;
|
|
43
|
+
launchReferenceCapture(options: { referenceNumber: string; department?: string; sequence?: string; fieldData?: Record360FieldData; identity?: Record360Identity; }) => Promise<void>
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
| Param | Type
|
|
47
|
-
| ------------- |
|
|
48
|
-
| **`options`** | <code>{ referenceNumber: string;
|
|
46
|
+
| Param | Type |
|
|
47
|
+
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
48
|
+
| **`options`** | <code>{ referenceNumber: string; department?: string; sequence?: string; fieldData?: <a href="#record360fielddata">Record360FieldData</a>; identity?: <a href="#record360identity">Record360Identity</a>; }</code> |
|
|
49
49
|
|
|
50
50
|
--------------------
|
|
51
51
|
|
|
@@ -53,13 +53,13 @@ launchReferenceCapture(options: { referenceNumber: string; workOrderId?: number;
|
|
|
53
53
|
### addListener('Record360Event', ...)
|
|
54
54
|
|
|
55
55
|
```typescript
|
|
56
|
-
addListener(eventName: 'Record360Event', listenerFunc: (data: { type: 'onFailedToAuthenticate' | 'onInspectionCancelled' | 'onInspectionComplete' | 'onInspectionUploadFailed' | 'onInspectionUploadProgress' | 'onInspectionUploaded' | 'onInspectionStarted' | 'onUserAuthenticated'; referenceNumber?: string;
|
|
56
|
+
addListener(eventName: 'Record360Event', listenerFunc: (data: { type: 'onFailedToAuthenticate' | 'onInspectionCancelled' | 'onInspectionComplete' | 'onInspectionUploadFailed' | 'onInspectionUploadProgress' | 'onInspectionUploaded' | 'onInspectionUploadDeleted' | 'onInspectionStarted' | 'onUserAuthenticated' | 'onSDKShouldRelaunch' | 'onSDKShouldExit'; referenceNumber?: string; inspectionNonce?: string; percentComplete?: number; error?: string; userId?: string; inspectionJSON?: string; }) => void) => Promise<PluginListenerHandle>
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
| Param | Type
|
|
60
|
-
| ------------------ |
|
|
61
|
-
| **`eventName`** | <code>'Record360Event'</code>
|
|
62
|
-
| **`listenerFunc`** | <code>(data: { type: 'onFailedToAuthenticate' \| 'onInspectionCancelled' \| 'onInspectionComplete' \| 'onInspectionUploadFailed' \| 'onInspectionUploadProgress' \| 'onInspectionUploaded' \| 'onInspectionStarted' \| 'onUserAuthenticated'; referenceNumber?: string;
|
|
59
|
+
| Param | Type |
|
|
60
|
+
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
61
|
+
| **`eventName`** | <code>'Record360Event'</code> |
|
|
62
|
+
| **`listenerFunc`** | <code>(data: { type: 'onFailedToAuthenticate' \| 'onInspectionCancelled' \| 'onInspectionComplete' \| 'onInspectionUploadFailed' \| 'onInspectionUploadProgress' \| 'onInspectionUploaded' \| 'onInspectionUploadDeleted' \| 'onInspectionStarted' \| 'onUserAuthenticated' \| 'onSDKShouldRelaunch' \| 'onSDKShouldExit'; referenceNumber?: string; inspectionNonce?: string; percentComplete?: number; error?: string; userId?: string; inspectionJSON?: string; }) => void</code> |
|
|
63
63
|
|
|
64
64
|
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
65
65
|
|
|
@@ -99,4 +99,37 @@ addListener(eventName: 'Record360Event', listenerFunc: (data: { type: 'onFailedT
|
|
|
99
99
|
|
|
100
100
|
<code><a href="#r360passwordidentity">R360PasswordIdentity</a> | <a href="#r360usertokenidentity">R360UserTokenIdentity</a></code>
|
|
101
101
|
|
|
102
|
+
|
|
103
|
+
#### Record360FieldData
|
|
104
|
+
|
|
105
|
+
<code>{ [key: string]: unknown }</code>
|
|
106
|
+
|
|
102
107
|
</docgen-api>
|
|
108
|
+
|
|
109
|
+
## Changelog
|
|
110
|
+
|
|
111
|
+
### 7.30.1
|
|
112
|
+
|
|
113
|
+
Capacitor 7 release carrying the unified Record360 SDK callbacks. Pairs with Android SDK 4.30.1 and iOS SDK 4.24.7.
|
|
114
|
+
|
|
115
|
+
Requirements (updates needed in the consuming app):
|
|
116
|
+
- Android: `minSdkVersion` 26, Kotlin Gradle plugin 2.1 or newer (the SDK is compiled with Kotlin 2.2), compileSdk 36
|
|
117
|
+
- iOS: deployment target 15.0
|
|
118
|
+
|
|
119
|
+
Event payload changes on `Record360Event`:
|
|
120
|
+
- Every inspection event now carries `inspectionNonce`, an id unique per inspection and identical across all of that inspection's events. Reference numbers repeat across inspections of the same unit; correlate on the nonce.
|
|
121
|
+
- `onInspectionUploadProgress` sends `percentComplete` as a fraction from 0 to 1. `bytesComplete` and `bytesTotal` are removed.
|
|
122
|
+
- `onInspectionUploadFailed` carries an `error` message on both platforms.
|
|
123
|
+
- `onUserAuthenticated` no longer includes `username`.
|
|
124
|
+
- `onInspectionStarted` fires once the inspection has been created, on both platforms. It previously fired from the reference-number prefill request on Android only.
|
|
125
|
+
|
|
126
|
+
New event types:
|
|
127
|
+
- `onInspectionUploadDeleted`: the user removed a queued upload from the Uploads screen.
|
|
128
|
+
- `onSDKShouldExit`: the SDK handed control back to the app. Fires exactly once per launch, after any inspection event. On iOS the plugin dismisses the SDK view controller on this event.
|
|
129
|
+
- `onSDKShouldRelaunch`: iOS only; the SDK dismissed after a workflow update and the plugin relaunches it with the last launch call.
|
|
130
|
+
|
|
131
|
+
Behavior changes:
|
|
132
|
+
- `onInspectionCancelled` fires whenever an in-progress inspection is discarded: the delete dialog, logout, session expiry, or a new launch for a different reference number or user. On iOS it no longer fires for plain dismissal, a cancelled sign-in, or declined terms; those report `onSDKShouldExit` only.
|
|
133
|
+
- On iOS, `onInspectionComplete` and `onInspectionCancelled` no longer dismiss the SDK view controller themselves; dismissal happens on `onSDKShouldExit`.
|
|
134
|
+
- Android `onInspectionUploaded` now passes the reference number; it previously passed an internal upload id.
|
|
135
|
+
|
package/android/build.gradle
CHANGED
|
@@ -5,10 +5,10 @@ buildscript {
|
|
|
5
5
|
androidxJunitVersion = '1.2.1'
|
|
6
6
|
androidxEspressoCoreVersion = '3.6.1'
|
|
7
7
|
androidXCore = '1.15.0'
|
|
8
|
-
compileSdk =
|
|
9
|
-
minSdkVersion =
|
|
10
|
-
targetSdkVersion =
|
|
11
|
-
kotlinVersion = '2.0
|
|
8
|
+
compileSdk = 36
|
|
9
|
+
minSdkVersion = 26
|
|
10
|
+
targetSdkVersion = 36
|
|
11
|
+
kotlinVersion = '2.2.0'
|
|
12
12
|
androidxCoreVersion = '1.15.0'
|
|
13
13
|
androidxActivityVersion = '1.9.2'
|
|
14
14
|
androidxFragmentVersion = '1.8.4'
|
|
@@ -101,6 +101,6 @@ dependencies {
|
|
|
101
101
|
testImplementation "junit:junit:$junitVersion"
|
|
102
102
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
103
103
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
104
|
-
implementation 'com.record360.sdk:android-sdk:4.
|
|
104
|
+
implementation 'com.record360.sdk:android-sdk:4.30.1'
|
|
105
105
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
|
|
106
106
|
}
|
|
@@ -8,12 +8,14 @@ import com.getcapacitor.Plugin
|
|
|
8
8
|
import com.getcapacitor.PluginCall
|
|
9
9
|
import com.getcapacitor.PluginMethod
|
|
10
10
|
import com.getcapacitor.annotation.CapacitorPlugin
|
|
11
|
+
import com.record360.plugins.SampleRecord360Activity.Companion.DEPARTMENT_INTENT
|
|
12
|
+
import com.record360.plugins.SampleRecord360Activity.Companion.FIELD_DATA_INTENT
|
|
13
|
+
import com.record360.plugins.SampleRecord360Activity.Companion.REFERENCE_NUMBER_INTENT
|
|
14
|
+
import com.record360.plugins.SampleRecord360Activity.Companion.SEQUENCE_INTENT
|
|
11
15
|
import com.record360.plugins.SampleRecord360Activity.Companion.USER_ID_INTENT
|
|
12
16
|
import com.record360.plugins.SampleRecord360Activity.Companion.USER_NAME_INTENT
|
|
13
17
|
import com.record360.plugins.SampleRecord360Activity.Companion.USER_PASSWORD_INTENT
|
|
14
18
|
import com.record360.plugins.SampleRecord360Activity.Companion.USER_TOKEN_INTENT
|
|
15
|
-
import com.record360.plugins.SampleRecord360Activity.Companion.WORK_ORDER_ID_INTENT
|
|
16
|
-
import com.record360.plugins.SampleRecord360Activity.Companion.WORK_ORDER_LABEL_INTENT
|
|
17
19
|
import com.record360.sdk.IRecord360Interface
|
|
18
20
|
import com.record360.sdk.R360Identity
|
|
19
21
|
import com.record360.sdk.Record360SDK
|
|
@@ -42,10 +44,9 @@ open class CapacitorRecord360SDKPlugin : Plugin(), IRecord360Interface {
|
|
|
42
44
|
|
|
43
45
|
private fun startRefCap(referenceNumber: String, data: JSObject?) {
|
|
44
46
|
val intent = Intent(bridge.context, SampleRecord360Activity::class.java)
|
|
45
|
-
intent.putExtra(SampleRecord360Activity.REFERENCE_NUMBER_INTENT, referenceNumber)
|
|
46
47
|
val identity = checkForIdentity(data?.getJSObject("identity"))
|
|
47
48
|
identity?.let { intent.addIdentity(it) }
|
|
48
|
-
intent.
|
|
49
|
+
intent.refCapIntent(referenceNumber, data)
|
|
49
50
|
context.startActivity(intent)
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -62,14 +63,15 @@ open class CapacitorRecord360SDKPlugin : Plugin(), IRecord360Interface {
|
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
private fun Intent.
|
|
66
|
+
private fun Intent.refCapIntent(referenceNumber: String, data: JSObject?) {
|
|
67
|
+
putExtra(REFERENCE_NUMBER_INTENT, referenceNumber)
|
|
66
68
|
data?.let { dataObj ->
|
|
67
|
-
val
|
|
68
|
-
val
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
69
|
+
val department = dataObj.getString("department")
|
|
70
|
+
val sequence = dataObj.getString("sequence")
|
|
71
|
+
val fieldData = dataObj.getJSObject("fieldData")
|
|
72
|
+
department?.let { putExtra(DEPARTMENT_INTENT, it) }
|
|
73
|
+
sequence?.let { putExtra(SEQUENCE_INTENT, it) }
|
|
74
|
+
fieldData?.let { putExtra(FIELD_DATA_INTENT, it.toString()) }
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
|
|
@@ -112,82 +114,111 @@ open class CapacitorRecord360SDKPlugin : Plugin(), IRecord360Interface {
|
|
|
112
114
|
return contractFieldData
|
|
113
115
|
}
|
|
114
116
|
|
|
115
|
-
override fun
|
|
116
|
-
Log.i(TAG, "
|
|
117
|
+
override fun onFailedAuthentication(error: Throwable) {
|
|
118
|
+
Log.i(TAG, "onFailedAuthentication")
|
|
117
119
|
val data = JSObject().apply {
|
|
118
120
|
put("type", "onFailedToAuthenticate")
|
|
121
|
+
put("error", error.localizedMessage)
|
|
119
122
|
}
|
|
120
123
|
notifyListeners(EVENT_NAME, data)
|
|
121
124
|
}
|
|
122
125
|
|
|
123
|
-
override fun onInspectionCancelled(
|
|
124
|
-
Log.i(TAG, "onInspectionCancelled")
|
|
126
|
+
override fun onInspectionCancelled(refNum: String, inspectionNonce: String) {
|
|
127
|
+
Log.i(TAG, "onInspectionCancelled refNum=$refNum nonce=$inspectionNonce")
|
|
125
128
|
val data = JSObject().apply {
|
|
126
129
|
put("type", "onInspectionCancelled")
|
|
127
|
-
put("referenceNumber",
|
|
130
|
+
put("referenceNumber", refNum)
|
|
131
|
+
put("inspectionNonce", inspectionNonce)
|
|
128
132
|
}
|
|
129
133
|
notifyListeners(EVENT_NAME, data)
|
|
130
134
|
}
|
|
131
135
|
|
|
132
|
-
override fun onInspectionComplete(
|
|
133
|
-
Log.i(TAG, "onInspectionComplete")
|
|
136
|
+
override fun onInspectionComplete(refNum: String, inspectionNonce: String) {
|
|
137
|
+
Log.i(TAG, "onInspectionComplete refNum=$refNum nonce=$inspectionNonce")
|
|
134
138
|
val data = JSObject().apply {
|
|
135
139
|
put("type", "onInspectionComplete")
|
|
136
|
-
put("referenceNumber",
|
|
140
|
+
put("referenceNumber", refNum)
|
|
141
|
+
put("inspectionNonce", inspectionNonce)
|
|
137
142
|
}
|
|
138
143
|
notifyListeners(EVENT_NAME, data)
|
|
139
144
|
}
|
|
140
145
|
|
|
141
|
-
override fun onInspectionUploadFailed(
|
|
142
|
-
Log.i(TAG, "onInspectionUploadFailed")
|
|
146
|
+
override fun onInspectionUploadFailed(refNum: String, inspectionNonce: String, error: String) {
|
|
147
|
+
Log.i(TAG, "onInspectionUploadFailed refNum=$refNum nonce=$inspectionNonce error=$error")
|
|
143
148
|
val data = JSObject().apply {
|
|
144
149
|
put("type", "onInspectionUploadFailed")
|
|
145
|
-
put("referenceNumber",
|
|
150
|
+
put("referenceNumber", refNum)
|
|
151
|
+
put("inspectionNonce", inspectionNonce)
|
|
146
152
|
put("error", error)
|
|
147
153
|
}
|
|
148
154
|
notifyListeners(EVENT_NAME, data)
|
|
149
155
|
}
|
|
150
156
|
|
|
151
|
-
override fun onInspectionUploadProgress(
|
|
152
|
-
Log.i(TAG, "onInspectionUploadProgress")
|
|
157
|
+
override fun onInspectionUploadProgress(refNum: String, inspectionNonce: String, percentComplete: Double) {
|
|
158
|
+
Log.i(TAG, "onInspectionUploadProgress refNum=$refNum nonce=$inspectionNonce percent=$percentComplete")
|
|
153
159
|
val data = JSObject().apply {
|
|
154
160
|
put("type", "onInspectionUploadProgress")
|
|
155
|
-
put("referenceNumber",
|
|
156
|
-
put("
|
|
157
|
-
put("
|
|
161
|
+
put("referenceNumber", refNum)
|
|
162
|
+
put("inspectionNonce", inspectionNonce)
|
|
163
|
+
put("percentComplete", percentComplete)
|
|
158
164
|
}
|
|
159
165
|
notifyListeners(EVENT_NAME, data)
|
|
160
166
|
}
|
|
161
167
|
|
|
162
|
-
override fun onInspectionUploaded(
|
|
163
|
-
Log.i(TAG, "onInspectionUploaded")
|
|
168
|
+
override fun onInspectionUploaded(refNum: String, inspectionNonce: String, inspectionJSON: String) {
|
|
169
|
+
Log.i(TAG, "onInspectionUploaded refNum=$refNum nonce=$inspectionNonce")
|
|
164
170
|
val data = JSObject().apply {
|
|
165
171
|
put("type", "onInspectionUploaded")
|
|
166
|
-
put("referenceNumber",
|
|
167
|
-
put("
|
|
172
|
+
put("referenceNumber", refNum)
|
|
173
|
+
put("inspectionNonce", inspectionNonce)
|
|
174
|
+
put("inspectionJSON", inspectionJSON)
|
|
168
175
|
}
|
|
169
176
|
notifyListeners(EVENT_NAME, data)
|
|
170
177
|
}
|
|
171
178
|
|
|
179
|
+
override fun onInspectionUploadDeleted(refNum: String, inspectionNonce: String) {
|
|
180
|
+
Log.i(TAG, "onInspectionUploadDeleted refNum=$refNum nonce=$inspectionNonce")
|
|
181
|
+
val data = JSObject().apply {
|
|
182
|
+
put("type", "onInspectionUploadDeleted")
|
|
183
|
+
put("referenceNumber", refNum)
|
|
184
|
+
put("inspectionNonce", inspectionNonce)
|
|
185
|
+
}
|
|
186
|
+
notifyListeners(EVENT_NAME, data)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
override fun onSDKShouldRelaunch() {
|
|
190
|
+
Log.i(TAG, "onSDKShouldRelaunch")
|
|
191
|
+
notifyListeners(EVENT_NAME, JSObject().apply { put("type", "onSDKShouldRelaunch") })
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
override fun onSDKShouldExit() {
|
|
195
|
+
Log.i(TAG, "onSDKShouldExit")
|
|
196
|
+
notifyListeners(EVENT_NAME, JSObject().apply { put("type", "onSDKShouldExit") })
|
|
197
|
+
}
|
|
198
|
+
|
|
172
199
|
override fun onReferenceNumberEnteredWithFieldData(
|
|
173
200
|
referenceNumber: String?,
|
|
174
201
|
fieldData: Map<String?, String?>?
|
|
175
202
|
): Map<String?, String?>? {
|
|
176
203
|
Log.i(TAG, "onRefNumEntered")
|
|
204
|
+
return fieldData
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
override fun onInspectionStarted(refNum: String, inspectionNonce: String) {
|
|
208
|
+
Log.i(TAG, "onInspectionStarted refNum=$refNum nonce=$inspectionNonce")
|
|
177
209
|
val data = JSObject().apply {
|
|
178
210
|
put("type", "onInspectionStarted")
|
|
179
|
-
put("referenceNumber",
|
|
211
|
+
put("referenceNumber", refNum)
|
|
212
|
+
put("inspectionNonce", inspectionNonce)
|
|
180
213
|
}
|
|
181
214
|
notifyListeners(EVENT_NAME, data)
|
|
182
|
-
return fieldData
|
|
183
215
|
}
|
|
184
216
|
|
|
185
|
-
override fun
|
|
186
|
-
Log.i(TAG, "
|
|
217
|
+
override fun onSuccessfulAuthentication(userToken: String, userId: String) {
|
|
218
|
+
Log.i(TAG, "onSuccessfulAuthentication")
|
|
187
219
|
val data = JSObject().apply {
|
|
188
220
|
put("type", "onUserAuthenticated")
|
|
189
221
|
put("userId", userId)
|
|
190
|
-
put("username", username)
|
|
191
222
|
}
|
|
192
223
|
notifyListeners(EVENT_NAME, data)
|
|
193
224
|
}
|
|
@@ -4,6 +4,7 @@ import android.os.Bundle
|
|
|
4
4
|
import com.record360.sdk.R360Identity
|
|
5
5
|
import com.record360.sdk.Record360Activity
|
|
6
6
|
import com.record360.sdk.ui.insets.EdgeToEdgeInitializer
|
|
7
|
+
import org.json.JSONObject
|
|
7
8
|
|
|
8
9
|
class SampleRecord360Activity: Record360Activity() {
|
|
9
10
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
@@ -13,10 +14,11 @@ class SampleRecord360Activity: Record360Activity() {
|
|
|
13
14
|
val userToken = if (intent.hasExtra(USER_TOKEN_INTENT)) intent.getStringExtra(USER_TOKEN_INTENT) else null
|
|
14
15
|
val userName = if (intent.hasExtra(USER_NAME_INTENT)) intent.getStringExtra(USER_NAME_INTENT) else null
|
|
15
16
|
val password = if (intent.hasExtra(USER_PASSWORD_INTENT)) intent.getStringExtra(USER_PASSWORD_INTENT) else null
|
|
16
|
-
val
|
|
17
|
-
|
|
18
|
-
val
|
|
19
|
-
|
|
17
|
+
val department = if (intent.hasExtra(DEPARTMENT_INTENT)) intent.getStringExtra(DEPARTMENT_INTENT) else null
|
|
18
|
+
val sequence = if (intent.hasExtra(SEQUENCE_INTENT)) intent.getStringExtra(SEQUENCE_INTENT) else null
|
|
19
|
+
val fieldData = if (intent.hasExtra(FIELD_DATA_INTENT)) {
|
|
20
|
+
parseFieldData(intent.getStringExtra(FIELD_DATA_INTENT))
|
|
21
|
+
} else null
|
|
20
22
|
val referenceNumber = if (intent.hasExtra(REFERENCE_NUMBER_INTENT)) {
|
|
21
23
|
intent.getStringExtra(REFERENCE_NUMBER_INTENT)
|
|
22
24
|
} else null
|
|
@@ -24,20 +26,31 @@ class SampleRecord360Activity: Record360Activity() {
|
|
|
24
26
|
when {
|
|
25
27
|
userId != null && userToken != null -> {
|
|
26
28
|
val identity = R360Identity.UserTokenIdentity(userId, userToken)
|
|
27
|
-
startRecord360WithIdentity(this, identity, referenceNumber,
|
|
29
|
+
startRecord360WithIdentity(this, identity, referenceNumber, department, sequence, fieldData)
|
|
28
30
|
}
|
|
29
31
|
userName != null && password != null -> {
|
|
30
32
|
val identity = R360Identity.PasswordIdentity(userName, password)
|
|
31
|
-
startRecord360WithIdentity(this, identity, referenceNumber,
|
|
33
|
+
startRecord360WithIdentity(this, identity, referenceNumber, department, sequence, fieldData)
|
|
32
34
|
}
|
|
33
|
-
else -> startRecord360(this, referenceNumber,
|
|
35
|
+
else -> startRecord360(this, referenceNumber, department, sequence, null, fieldData)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private fun parseFieldData(json: String?): Map<String, String>? {
|
|
40
|
+
if (json.isNullOrEmpty()) return null
|
|
41
|
+
return try {
|
|
42
|
+
val obj = JSONObject(json)
|
|
43
|
+
obj.keys().asSequence().associateWith { key -> obj.get(key).toString() }
|
|
44
|
+
} catch (e: Exception) {
|
|
45
|
+
null
|
|
34
46
|
}
|
|
35
47
|
}
|
|
36
48
|
|
|
37
49
|
companion object {
|
|
38
50
|
var REFERENCE_NUMBER_INTENT = "SampleRecord360Activity.REF_NUM_INTENT"
|
|
39
|
-
var
|
|
40
|
-
var
|
|
51
|
+
var DEPARTMENT_INTENT = "SampleRecord360Activity.DEPARTMENT_INTENT"
|
|
52
|
+
var SEQUENCE_INTENT = "SampleRecord360Activity.SEQUENCE_INTENT"
|
|
53
|
+
var FIELD_DATA_INTENT = "SampleRecord360Activity.FIELD_DATA_INTENT"
|
|
41
54
|
var USER_ID_INTENT = "SampleRecord360Activity.USER_ID"
|
|
42
55
|
var USER_TOKEN_INTENT = "SampleRecord360Activity.USER_TOKEN"
|
|
43
56
|
var USER_NAME_INTENT = "SampleRecord360Activity.USER_NAME"
|
package/dist/docs.json
CHANGED
|
@@ -25,25 +25,26 @@
|
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"name": "launchReferenceCapture",
|
|
28
|
-
"signature": "(options: { referenceNumber: string;
|
|
28
|
+
"signature": "(options: { referenceNumber: string; department?: string; sequence?: string; fieldData?: Record360FieldData; identity?: Record360Identity; }) => Promise<void>",
|
|
29
29
|
"parameters": [
|
|
30
30
|
{
|
|
31
31
|
"name": "options",
|
|
32
32
|
"docs": "",
|
|
33
|
-
"type": "{ referenceNumber: string;
|
|
33
|
+
"type": "{ referenceNumber: string; department?: string | undefined; sequence?: string | undefined; fieldData?: Record360FieldData | undefined; identity?: Record360Identity | undefined; }"
|
|
34
34
|
}
|
|
35
35
|
],
|
|
36
36
|
"returns": "Promise<void>",
|
|
37
37
|
"tags": [],
|
|
38
38
|
"docs": "",
|
|
39
39
|
"complexTypes": [
|
|
40
|
+
"Record360FieldData",
|
|
40
41
|
"Record360Identity"
|
|
41
42
|
],
|
|
42
43
|
"slug": "launchreferencecapture"
|
|
43
44
|
},
|
|
44
45
|
{
|
|
45
46
|
"name": "addListener",
|
|
46
|
-
"signature": "(eventName: 'Record360Event', listenerFunc: (data: { type: 'onFailedToAuthenticate' | 'onInspectionCancelled' | 'onInspectionComplete' | 'onInspectionUploadFailed' | 'onInspectionUploadProgress' | 'onInspectionUploaded' | 'onInspectionStarted' | 'onUserAuthenticated'; referenceNumber?: string;
|
|
47
|
+
"signature": "(eventName: 'Record360Event', listenerFunc: (data: { type: 'onFailedToAuthenticate' | 'onInspectionCancelled' | 'onInspectionComplete' | 'onInspectionUploadFailed' | 'onInspectionUploadProgress' | 'onInspectionUploaded' | 'onInspectionUploadDeleted' | 'onInspectionStarted' | 'onUserAuthenticated' | 'onSDKShouldRelaunch' | 'onSDKShouldExit'; referenceNumber?: string; inspectionNonce?: string; percentComplete?: number; error?: string; userId?: string; inspectionJSON?: string; }) => void) => Promise<PluginListenerHandle>",
|
|
47
48
|
"parameters": [
|
|
48
49
|
{
|
|
49
50
|
"name": "eventName",
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
{
|
|
54
55
|
"name": "listenerFunc",
|
|
55
56
|
"docs": "",
|
|
56
|
-
"type": "(data: { type: 'onFailedToAuthenticate' | 'onInspectionCancelled' | 'onInspectionComplete' | 'onInspectionUploadFailed' | 'onInspectionUploadProgress' | 'onInspectionUploaded' | 'onInspectionStarted' | 'onUserAuthenticated'; referenceNumber?: string | undefined;
|
|
57
|
+
"type": "(data: { type: 'onFailedToAuthenticate' | 'onInspectionCancelled' | 'onInspectionComplete' | 'onInspectionUploadFailed' | 'onInspectionUploadProgress' | 'onInspectionUploaded' | 'onInspectionUploadDeleted' | 'onInspectionStarted' | 'onUserAuthenticated' | 'onSDKShouldRelaunch' | 'onSDKShouldExit'; referenceNumber?: string | undefined; inspectionNonce?: string | undefined; percentComplete?: number | undefined; error?: string | undefined; userId?: string | undefined; inspectionJSON?: string | undefined; }) => void"
|
|
57
58
|
}
|
|
58
59
|
],
|
|
59
60
|
"returns": "Promise<PluginListenerHandle>",
|
|
@@ -151,6 +152,17 @@
|
|
|
151
152
|
]
|
|
152
153
|
}
|
|
153
154
|
]
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"name": "Record360FieldData",
|
|
158
|
+
"slug": "record360fielddata",
|
|
159
|
+
"docs": "",
|
|
160
|
+
"types": [
|
|
161
|
+
{
|
|
162
|
+
"text": "{ [key: string]: unknown }",
|
|
163
|
+
"complexTypes": []
|
|
164
|
+
}
|
|
165
|
+
]
|
|
154
166
|
}
|
|
155
167
|
],
|
|
156
168
|
"pluginConfigs": []
|
|
@@ -8,22 +8,27 @@ export interface R360UserTokenIdentity {
|
|
|
8
8
|
userId: string;
|
|
9
9
|
userToken: string;
|
|
10
10
|
}
|
|
11
|
+
export declare type Record360FieldData = {
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
};
|
|
11
14
|
export interface CapacitorRecord360SDKPlugin {
|
|
12
15
|
launchRecord360(identity?: Record360Identity): Promise<void>;
|
|
13
16
|
launchReferenceCapture(options: {
|
|
14
17
|
referenceNumber: string;
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
department?: string;
|
|
19
|
+
sequence?: string;
|
|
20
|
+
fieldData?: Record360FieldData;
|
|
17
21
|
identity?: Record360Identity;
|
|
18
22
|
}): Promise<void>;
|
|
19
23
|
addListener(eventName: 'Record360Event', listenerFunc: (data: {
|
|
20
|
-
type: 'onFailedToAuthenticate' | 'onInspectionCancelled' | 'onInspectionComplete' | 'onInspectionUploadFailed' | 'onInspectionUploadProgress' | 'onInspectionUploaded' | 'onInspectionStarted' | 'onUserAuthenticated';
|
|
24
|
+
type: 'onFailedToAuthenticate' | 'onInspectionCancelled' | 'onInspectionComplete' | 'onInspectionUploadFailed' | 'onInspectionUploadProgress' | 'onInspectionUploaded' | 'onInspectionUploadDeleted' | 'onInspectionStarted' | 'onUserAuthenticated' | 'onSDKShouldRelaunch' | 'onSDKShouldExit';
|
|
21
25
|
referenceNumber?: string;
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
/** Unique per inspection; correlates every event for the same inspection. */
|
|
27
|
+
inspectionNonce?: string;
|
|
28
|
+
/** Fraction uploaded, 0 to 1. */
|
|
29
|
+
percentComplete?: number;
|
|
24
30
|
error?: string;
|
|
25
31
|
userId?: string;
|
|
26
|
-
username?: string;
|
|
27
32
|
inspectionJSON?: string;
|
|
28
33
|
}) => void): Promise<PluginListenerHandle>;
|
|
29
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from \"@capacitor/core\"\nexport type Record360Identity = R360PasswordIdentity | R360UserTokenIdentity\n\nexport interface R360PasswordIdentity {\n username: string,\n password: string\n}\n\nexport interface R360UserTokenIdentity {\n userId: string,\n userToken: string\n}\n\nexport interface CapacitorRecord360SDKPlugin {\n launchRecord360(identity?: Record360Identity): Promise<void>\n\n launchReferenceCapture(options: {\n referenceNumber: string,\n
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from \"@capacitor/core\"\nexport type Record360Identity = R360PasswordIdentity | R360UserTokenIdentity\n\nexport interface R360PasswordIdentity {\n username: string,\n password: string\n}\n\nexport interface R360UserTokenIdentity {\n userId: string,\n userToken: string\n}\n\nexport type Record360FieldData = { [key: string]: unknown }\n\nexport interface CapacitorRecord360SDKPlugin {\n launchRecord360(identity?: Record360Identity): Promise<void>\n\n launchReferenceCapture(options: {\n referenceNumber: string,\n department?: string,\n sequence?: string,\n fieldData?: Record360FieldData,\n identity?: Record360Identity\n }): Promise<void>\n\n addListener(\n eventName: 'Record360Event',\n listenerFunc: (\n data: {\n type: 'onFailedToAuthenticate' | 'onInspectionCancelled' | 'onInspectionComplete' | 'onInspectionUploadFailed' | 'onInspectionUploadProgress' | 'onInspectionUploaded' | 'onInspectionUploadDeleted' | 'onInspectionStarted' | 'onUserAuthenticated' | 'onSDKShouldRelaunch' | 'onSDKShouldExit',\n referenceNumber?: string,\n /** Unique per inspection; correlates every event for the same inspection. */\n inspectionNonce?: string,\n /** Fraction uploaded, 0 to 1. */\n percentComplete?: number,\n error?: string,\n userId?: string,\n inspectionJSON?: string\n }\n ) => void,\n ): Promise<PluginListenerHandle>;\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ListenerCallback, PluginListenerHandle, WebPlugin } from '@capacitor/core';
|
|
2
|
-
import type { CapacitorRecord360SDKPlugin, Record360Identity } from './definitions';
|
|
2
|
+
import type { CapacitorRecord360SDKPlugin, Record360FieldData, Record360Identity } from './definitions';
|
|
3
3
|
export declare class CapacitorRecord360SDKWeb extends WebPlugin implements CapacitorRecord360SDKPlugin {
|
|
4
4
|
launchRecord360(_?: Record360Identity): Promise<void>;
|
|
5
5
|
launchReferenceCapture(_: {
|
|
6
6
|
referenceNumber: string;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
department?: string;
|
|
8
|
+
sequence?: string;
|
|
9
|
+
fieldData?: Record360FieldData;
|
|
9
10
|
identity?: Record360Identity;
|
|
10
11
|
}): Promise<void>;
|
|
11
12
|
addListener(_eventName: string, _listenerFunc: ListenerCallback): Promise<PluginListenerHandle>;
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIpF,MAAM,OAAO,wBAAyB,SAAQ,SAAS;IACrD,eAAe,CAAC,CAAqB;QACnC,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,sBAAsB,CAAC,
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIpF,MAAM,OAAO,wBAAyB,SAAQ,SAAS;IACrD,eAAe,CAAC,CAAqB;QACnC,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,sBAAsB,CAAC,CAAqI;QACxJ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC5C,CAAC;IAED,WAAW,CAAC,UAAkB,EAAE,aAA+B;QAC3D,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC5C,CAAC;CACF","sourcesContent":["import { ListenerCallback, PluginListenerHandle, WebPlugin } from '@capacitor/core';\n\nimport type { CapacitorRecord360SDKPlugin, Record360FieldData, Record360Identity } from './definitions';\n\nexport class CapacitorRecord360SDKWeb extends WebPlugin implements CapacitorRecord360SDKPlugin {\n launchRecord360(_?: Record360Identity): Promise<void> {\n throw new Error(\"Not available on web.\");\n }\n\n launchReferenceCapture(_: { referenceNumber: string; department?: string; sequence?: string; fieldData?: Record360FieldData; identity?: Record360Identity; }): Promise<void> {\n throw new Error(\"Not available on web\");\n }\n \n addListener(_eventName: string, _listenerFunc: ListenerCallback): Promise<PluginListenerHandle> {\n throw new Error(\"Not available on web\");\n }\n}"]}
|
|
@@ -14,10 +14,11 @@ public class CapacitorRecord360SDKPlugin: CAPPlugin, CAPBridgedPlugin, Record360
|
|
|
14
14
|
public var record360: Record360?
|
|
15
15
|
public var record360ViewController: Record360ViewController?
|
|
16
16
|
public var hostingSDKViewController = false
|
|
17
|
+
private var lastLaunch: (() -> Void)?
|
|
17
18
|
|
|
18
19
|
public override init() {
|
|
19
20
|
super.init()
|
|
20
|
-
self.record360 = Record360(delegate: self, allowUserToExitRecord360: true);
|
|
21
|
+
self.record360 = Record360(delegate: self, allowUserToExitRecord360: true, error: nil);
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
private func applySettings() {
|
|
@@ -53,7 +54,7 @@ public class CapacitorRecord360SDKPlugin: CAPPlugin, CAPBridgedPlugin, Record360
|
|
|
53
54
|
let identity = Record360Identity(userID: userId!, userToken: userToken!)
|
|
54
55
|
loadR360SDK(identity: identity, presentingVC: presentingVC)
|
|
55
56
|
} else {
|
|
56
|
-
loadR360SDKLogin(referenceNumber: nil,
|
|
57
|
+
loadR360SDKLogin(referenceNumber: nil, department: nil, sequence: nil, fieldData: nil, presentingVC: presentingVC)
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
|
|
@@ -69,8 +70,9 @@ public class CapacitorRecord360SDKPlugin: CAPPlugin, CAPBridgedPlugin, Record360
|
|
|
69
70
|
call.reject("Reference number is required")
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
let
|
|
73
|
-
let
|
|
73
|
+
let department = call.getString("department")
|
|
74
|
+
let sequence = call.getString("sequence")
|
|
75
|
+
let fieldData = call.getObject("fieldData")
|
|
74
76
|
let identityObj = call.getObject("identity")
|
|
75
77
|
let username = identityObj?["username"] as? String
|
|
76
78
|
let password = identityObj?["password"] as? String
|
|
@@ -79,21 +81,22 @@ public class CapacitorRecord360SDKPlugin: CAPPlugin, CAPBridgedPlugin, Record360
|
|
|
79
81
|
|
|
80
82
|
if (username != nil && password != nil) {
|
|
81
83
|
let identity = Record360Identity(userName: username!, password: password!)
|
|
82
|
-
loadR360SDKForInspection(identity: identity, referenceNumber: referenceNumber!,
|
|
84
|
+
loadR360SDKForInspection(identity: identity, referenceNumber: referenceNumber!, department: department, sequence: sequence, fieldData: fieldData, presentingVC: presentingVC)
|
|
83
85
|
} else if (userId != nil && userToken != nil) {
|
|
84
86
|
let identity = Record360Identity(userID: userId!, userToken: userToken!)
|
|
85
|
-
loadR360SDKForInspection(identity: identity, referenceNumber: referenceNumber!,
|
|
87
|
+
loadR360SDKForInspection(identity: identity, referenceNumber: referenceNumber!, department: department, sequence: sequence, fieldData: fieldData, presentingVC: presentingVC)
|
|
86
88
|
} else {
|
|
87
|
-
loadR360SDKLogin(referenceNumber: referenceNumber,
|
|
89
|
+
loadR360SDKLogin(referenceNumber: referenceNumber, department: department, sequence: sequence, fieldData: fieldData, presentingVC: presentingVC)
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
92
|
|
|
91
|
-
private func loadR360SDKLogin(referenceNumber: String?,
|
|
93
|
+
private func loadR360SDKLogin(referenceNumber: String?, department: String?, sequence: String?, fieldData: JSObject?, presentingVC: UIViewController) {
|
|
94
|
+
lastLaunch = { self.loadR360SDKLogin(referenceNumber: referenceNumber, department: department, sequence: sequence, fieldData: fieldData, presentingVC: presentingVC) }
|
|
92
95
|
DispatchQueue.main.async {
|
|
93
96
|
self.hostSDKViewController {
|
|
94
97
|
let identity = Record360Identity(userName: "", password: nil)
|
|
95
98
|
if (referenceNumber != nil) {
|
|
96
|
-
self.record360?.launchReferenceCapture(referenceNumber,
|
|
99
|
+
self.record360?.launchReferenceCapture(referenceNumber, departmentReference: department, sequenceReference: sequence, fieldData: fieldData, identity: identity)
|
|
97
100
|
} else {
|
|
98
101
|
self.record360?.launch(identity)
|
|
99
102
|
}
|
|
@@ -103,6 +106,7 @@ public class CapacitorRecord360SDKPlugin: CAPPlugin, CAPBridgedPlugin, Record360
|
|
|
103
106
|
}
|
|
104
107
|
|
|
105
108
|
private func loadR360SDK(identity: Record360Identity, presentingVC: UIViewController) {
|
|
109
|
+
lastLaunch = { self.loadR360SDK(identity: identity, presentingVC: presentingVC) }
|
|
106
110
|
DispatchQueue.main.async {
|
|
107
111
|
self.hostSDKViewController {
|
|
108
112
|
self.record360?.launch(identity)
|
|
@@ -111,10 +115,11 @@ public class CapacitorRecord360SDKPlugin: CAPPlugin, CAPBridgedPlugin, Record360
|
|
|
111
115
|
}
|
|
112
116
|
}
|
|
113
117
|
|
|
114
|
-
private func loadR360SDKForInspection(identity: Record360Identity, referenceNumber: String,
|
|
118
|
+
private func loadR360SDKForInspection(identity: Record360Identity, referenceNumber: String, department: String?, sequence: String?, fieldData: JSObject?, presentingVC: UIViewController) {
|
|
119
|
+
lastLaunch = { self.loadR360SDKForInspection(identity: identity, referenceNumber: referenceNumber, department: department, sequence: sequence, fieldData: fieldData, presentingVC: presentingVC) }
|
|
115
120
|
DispatchQueue.main.async {
|
|
116
121
|
self.hostSDKViewController {
|
|
117
|
-
self.record360?.launchReferenceCapture(referenceNumber,
|
|
122
|
+
self.record360?.launchReferenceCapture(referenceNumber, departmentReference: department, sequenceReference: sequence, fieldData: fieldData, identity: identity)
|
|
118
123
|
self.applySettings()
|
|
119
124
|
}
|
|
120
125
|
}
|
|
@@ -125,54 +130,83 @@ public class CapacitorRecord360SDKPlugin: CAPPlugin, CAPBridgedPlugin, Record360
|
|
|
125
130
|
data["type"] = "onUserAuthenticated"
|
|
126
131
|
data["userId"] = userId
|
|
127
132
|
|
|
128
|
-
|
|
133
|
+
emit(data)
|
|
129
134
|
}
|
|
130
135
|
|
|
131
136
|
public func onFailedAuthentication(_ error: any Error) {
|
|
132
137
|
var data = JSObject()
|
|
133
138
|
data["type"] = "onFailedToAuthenticate"
|
|
134
|
-
|
|
139
|
+
emit(data)
|
|
135
140
|
}
|
|
136
141
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
142
|
+
private func emit(_ data: JSObject) {
|
|
143
|
+
let fields = data.keys.sorted().filter { $0 != "type" && $0 != "inspectionJSON" }
|
|
144
|
+
.map { "\($0)=\(data[$0] ?? "")" }.joined(separator: " ")
|
|
145
|
+
print("Record360Event \(data["type"] ?? "") \(fields)")
|
|
140
146
|
notifyListeners("Record360Event", data: data)
|
|
141
|
-
self.dismissSDKViewController(animated: true, completion: {})
|
|
142
147
|
}
|
|
143
|
-
|
|
144
|
-
|
|
148
|
+
|
|
149
|
+
private func inspectionEvent(_ type: String, _ refNum: String, _ nonce: String) -> JSObject {
|
|
145
150
|
var data = JSObject()
|
|
146
|
-
data["type"] =
|
|
147
|
-
|
|
148
|
-
|
|
151
|
+
data["type"] = type
|
|
152
|
+
data["referenceNumber"] = refNum
|
|
153
|
+
data["inspectionNonce"] = nonce
|
|
154
|
+
return data
|
|
149
155
|
}
|
|
150
|
-
|
|
151
|
-
public func
|
|
152
|
-
|
|
156
|
+
|
|
157
|
+
public func onInspectionStarted(forReferenceNumber refNum: String, inspectionNonce nonce: String) {
|
|
158
|
+
emit(inspectionEvent("onInspectionStarted", refNum, nonce))
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
public func onInspectionComplete(forReferenceNumber refNum: String, inspectionNonce nonce: String) {
|
|
162
|
+
emit(inspectionEvent("onInspectionComplete", refNum, nonce))
|
|
153
163
|
}
|
|
154
164
|
|
|
155
|
-
public func
|
|
165
|
+
public func onInspectionCancelled(forReferenceNumber refNum: String, inspectionNonce nonce: String) {
|
|
166
|
+
emit(inspectionEvent("onInspectionCancelled", refNum, nonce))
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
public func onSDKShouldExit() {
|
|
170
|
+
var data = JSObject()
|
|
171
|
+
data["type"] = "onSDKShouldExit"
|
|
172
|
+
emit(data)
|
|
156
173
|
self.dismissSDKViewController(animated: true, completion: {})
|
|
157
174
|
}
|
|
158
|
-
|
|
159
|
-
public func
|
|
175
|
+
|
|
176
|
+
public func onSDKShouldRelaunch() {
|
|
160
177
|
var data = JSObject()
|
|
161
|
-
|
|
162
|
-
|
|
178
|
+
data["type"] = "onSDKShouldRelaunch"
|
|
179
|
+
emit(data)
|
|
180
|
+
let relaunch = self.lastLaunch
|
|
181
|
+
self.dismissSDKViewController(animated: true) {
|
|
182
|
+
relaunch?()
|
|
163
183
|
}
|
|
164
|
-
data["type"] = "onInspectionUploaded"
|
|
165
|
-
data["referenceNumber"] = referenceNumber
|
|
166
|
-
notifyListeners("Record360Event", data: data)
|
|
167
184
|
}
|
|
168
185
|
|
|
169
|
-
public func
|
|
170
|
-
|
|
171
|
-
data["type"] = "onInspectionUploadFailed"
|
|
172
|
-
data["referenceNumber"] = referenceNumber
|
|
173
|
-
notifyListeners("Record360Event", data: data)
|
|
186
|
+
public func onInspectionUploadDeleted(forReferenceNumber refNum: String, inspectionNonce nonce: String) {
|
|
187
|
+
emit(inspectionEvent("onInspectionUploadDeleted", refNum, nonce))
|
|
174
188
|
}
|
|
175
189
|
|
|
190
|
+
public func onInspectionUploaded(forReferenceNumber refNum: String, inspectionNonce nonce: String, inspectionJSON: [AnyHashable : Any]) {
|
|
191
|
+
var data = inspectionEvent("onInspectionUploaded", refNum, nonce)
|
|
192
|
+
if let json = self.dictionaryToJSONString(inspectionJSON) {
|
|
193
|
+
data["inspectionJSON"] = json
|
|
194
|
+
}
|
|
195
|
+
emit(data)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
public func onInspectionUploadFailed(forReferenceNumber refNum: String, inspectionNonce nonce: String, error: any Error) {
|
|
199
|
+
var data = inspectionEvent("onInspectionUploadFailed", refNum, nonce)
|
|
200
|
+
data["error"] = error.localizedDescription
|
|
201
|
+
emit(data)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
public func onInspectionUploadProgress(forReferenceNumber refNum: String, inspectionNonce nonce: String, percentComplete: CGFloat) {
|
|
205
|
+
var data = inspectionEvent("onInspectionUploadProgress", refNum, nonce)
|
|
206
|
+
data["percentComplete"] = Double(percentComplete)
|
|
207
|
+
emit(data)
|
|
208
|
+
}
|
|
209
|
+
|
|
176
210
|
func dictionaryToJSONString(_ dict: [AnyHashable: Any]) -> String? {
|
|
177
211
|
do {
|
|
178
212
|
// Check if the dictionary is valid for JSON serialization
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "capacitor-record360sdk",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.30.1",
|
|
4
4
|
"description": "Capacitor wrapper for Record360SDK",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"license": "Apache-2.0",
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
22
|
-
"url": "git+https://github.com/Record360/record360-capacitor-plugin.git
|
|
22
|
+
"url": "git+https://github.com/Record360/record360-capacitor-plugin.git"
|
|
23
23
|
},
|
|
24
24
|
"bugs": {
|
|
25
|
-
"url": "https://github.com/Record360/record360-capacitor-plugin
|
|
25
|
+
"url": "https://github.com/Record360/record360-capacitor-plugin/issues"
|
|
26
26
|
},
|
|
27
27
|
"keywords": [
|
|
28
28
|
"capacitor",
|