capacitor-record360sdk 7.0.0 → 7.1.0
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 +1 -1
- package/README.md +24 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/record360/plugins/CapacitorRecord360SDKPlugin.kt +2 -4
- package/dist/docs.json +39 -0
- package/dist/esm/definitions.d.ts +11 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +2 -1
- package/dist/esm/web.js +3 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +3 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +3 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapacitorRecord360SDKPlugin/CapacitorRecord360SDKPlugin.swift +115 -54
- package/package.json +2 -2
|
@@ -13,6 +13,6 @@ Pod::Spec.new do |s|
|
|
|
13
13
|
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
14
|
s.ios.deployment_target = '14.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
|
-
s.dependency 'Record360SDK', '4.
|
|
16
|
+
s.dependency 'Record360SDK', '4.19.8'
|
|
17
17
|
s.swift_version = '5.1'
|
|
18
18
|
end
|
package/README.md
CHANGED
|
@@ -15,6 +15,7 @@ npx cap sync
|
|
|
15
15
|
|
|
16
16
|
* [`launchRecord360(...)`](#launchrecord360)
|
|
17
17
|
* [`launchReferenceCapture(...)`](#launchreferencecapture)
|
|
18
|
+
* [`addListener('Record360Event', ...)`](#addlistenerrecord360event-)
|
|
18
19
|
* [Interfaces](#interfaces)
|
|
19
20
|
* [Type Aliases](#type-aliases)
|
|
20
21
|
|
|
@@ -49,6 +50,22 @@ launchReferenceCapture(options: { referenceNumber: string; workOrderId?: number;
|
|
|
49
50
|
--------------------
|
|
50
51
|
|
|
51
52
|
|
|
53
|
+
### addListener('Record360Event', ...)
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
addListener(eventName: 'Record360Event', listenerFunc: (data: { type: 'onFailedToAuthenticate' | 'onInspectionCancelled' | 'onInspectionComplete' | 'onInspectionUploadFailed' | 'onInspectionUploadProgress' | 'onInspectionUploaded' | 'onInspectionStarted' | 'onUserAuthenticated'; referenceNumber?: string; bytesComplete?: number; bytesTotal?: number; error?: string; userId?: string; username?: string; inspectionJSON?: string; }) => void) => Promise<PluginListenerHandle>
|
|
57
|
+
```
|
|
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; bytesComplete?: number; bytesTotal?: number; error?: string; userId?: string; username?: string; inspectionJSON?: string; }) => void</code> |
|
|
63
|
+
|
|
64
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
65
|
+
|
|
66
|
+
--------------------
|
|
67
|
+
|
|
68
|
+
|
|
52
69
|
### Interfaces
|
|
53
70
|
|
|
54
71
|
|
|
@@ -68,6 +85,13 @@ launchReferenceCapture(options: { referenceNumber: string; workOrderId?: number;
|
|
|
68
85
|
| **`userToken`** | <code>string</code> |
|
|
69
86
|
|
|
70
87
|
|
|
88
|
+
#### PluginListenerHandle
|
|
89
|
+
|
|
90
|
+
| Prop | Type |
|
|
91
|
+
| ------------ | ----------------------------------------- |
|
|
92
|
+
| **`remove`** | <code>() => Promise<void></code> |
|
|
93
|
+
|
|
94
|
+
|
|
71
95
|
### Type Aliases
|
|
72
96
|
|
|
73
97
|
|
package/android/build.gradle
CHANGED
|
@@ -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.19.
|
|
104
|
+
implementation 'com.record360.sdk:android-sdk:4.19.4'
|
|
105
105
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
|
|
106
106
|
}
|
|
@@ -159,11 +159,12 @@ open class CapacitorRecord360SDKPlugin : Plugin(), IRecord360Interface {
|
|
|
159
159
|
notifyListeners(EVENT_NAME, data)
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
override fun onInspectionUploaded(referenceNumber: String?) {
|
|
162
|
+
override fun onInspectionUploaded(referenceNumber: String?, inspectionJson: String?) {
|
|
163
163
|
Log.i(TAG, "onInspectionUploaded")
|
|
164
164
|
val data = JSObject().apply {
|
|
165
165
|
put("type", "onInspectionUploaded")
|
|
166
166
|
put("referenceNumber", referenceNumber)
|
|
167
|
+
put("inspectionJSON", inspectionJson)
|
|
167
168
|
}
|
|
168
169
|
notifyListeners(EVENT_NAME, data)
|
|
169
170
|
}
|
|
@@ -197,11 +198,8 @@ open class CapacitorRecord360SDKPlugin : Plugin(), IRecord360Interface {
|
|
|
197
198
|
var defaultSettings = arrayOf(
|
|
198
199
|
Record360Setting(Record360SDK.SETTING_UPLOAD_MODE, Record360SDK.UPLOAD_MODE_ONLINE, true),
|
|
199
200
|
Record360Setting(Record360SDK.SETTING_RESOLUTION, Record360SDK.RESOLUTION_MEDIUM, true),
|
|
200
|
-
Record360Setting(Record360SDK.SETTING_COMPRESS_MEDIA, true.toString(), true),
|
|
201
201
|
Record360Setting(Record360SDK.SETTING_NOTATIONS_ON_IMAGES, false.toString(), true),
|
|
202
|
-
Record360Setting(Record360SDK.SETTING_ENABLE_MULTIPLE_CAMERA, false.toString(), true),
|
|
203
202
|
Record360Setting(Record360SDK.SETTING_LEGACY_CAMERA, false.toString(), true),
|
|
204
|
-
Record360Setting(Record360SDK.SETTING_VIN_SCAN, false.toString(), true),
|
|
205
203
|
Record360Setting(Record360SDK.SETTING_RECORD_AUDIO, true.toString(), true),
|
|
206
204
|
Record360Setting(Record360SDK.SETTING_TIMESTAMP_MODE, true.toString(), true),
|
|
207
205
|
Record360Setting(Record360SDK.SETTING_NATIVE_RESOLUTION, false.toString(), true),
|
package/dist/docs.json
CHANGED
|
@@ -40,6 +40,29 @@
|
|
|
40
40
|
"Record360Identity"
|
|
41
41
|
],
|
|
42
42
|
"slug": "launchreferencecapture"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "addListener",
|
|
46
|
+
"signature": "(eventName: 'Record360Event', listenerFunc: (data: { type: 'onFailedToAuthenticate' | 'onInspectionCancelled' | 'onInspectionComplete' | 'onInspectionUploadFailed' | 'onInspectionUploadProgress' | 'onInspectionUploaded' | 'onInspectionStarted' | 'onUserAuthenticated'; referenceNumber?: string; bytesComplete?: number; bytesTotal?: number; error?: string; userId?: string; username?: string; inspectionJSON?: string; }) => void) => Promise<PluginListenerHandle>",
|
|
47
|
+
"parameters": [
|
|
48
|
+
{
|
|
49
|
+
"name": "eventName",
|
|
50
|
+
"docs": "",
|
|
51
|
+
"type": "'Record360Event'"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "listenerFunc",
|
|
55
|
+
"docs": "",
|
|
56
|
+
"type": "(data: { type: 'onFailedToAuthenticate' | 'onInspectionCancelled' | 'onInspectionComplete' | 'onInspectionUploadFailed' | 'onInspectionUploadProgress' | 'onInspectionUploaded' | 'onInspectionStarted' | 'onUserAuthenticated'; referenceNumber?: string | undefined; bytesComplete?: number | undefined; bytesTotal?: number | undefined; error?: string | undefined; userId?: string | undefined; username?: string | undefined; inspectionJSON?: string | undefined; }) => void"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
60
|
+
"tags": [],
|
|
61
|
+
"docs": "",
|
|
62
|
+
"complexTypes": [
|
|
63
|
+
"PluginListenerHandle"
|
|
64
|
+
],
|
|
65
|
+
"slug": "addlistenerrecord360event-"
|
|
43
66
|
}
|
|
44
67
|
],
|
|
45
68
|
"properties": []
|
|
@@ -90,6 +113,22 @@
|
|
|
90
113
|
"type": "string"
|
|
91
114
|
}
|
|
92
115
|
]
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"name": "PluginListenerHandle",
|
|
119
|
+
"slug": "pluginlistenerhandle",
|
|
120
|
+
"docs": "",
|
|
121
|
+
"tags": [],
|
|
122
|
+
"methods": [],
|
|
123
|
+
"properties": [
|
|
124
|
+
{
|
|
125
|
+
"name": "remove",
|
|
126
|
+
"tags": [],
|
|
127
|
+
"docs": "",
|
|
128
|
+
"complexTypes": [],
|
|
129
|
+
"type": "() => Promise<void>"
|
|
130
|
+
}
|
|
131
|
+
]
|
|
93
132
|
}
|
|
94
133
|
],
|
|
95
134
|
"enums": [],
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PluginListenerHandle } from "@capacitor/core";
|
|
1
2
|
export declare type Record360Identity = R360PasswordIdentity | R360UserTokenIdentity;
|
|
2
3
|
export interface R360PasswordIdentity {
|
|
3
4
|
username: string;
|
|
@@ -15,4 +16,14 @@ export interface CapacitorRecord360SDKPlugin {
|
|
|
15
16
|
workOrderLabel?: string;
|
|
16
17
|
identity?: Record360Identity;
|
|
17
18
|
}): Promise<void>;
|
|
19
|
+
addListener(eventName: 'Record360Event', listenerFunc: (data: {
|
|
20
|
+
type: 'onFailedToAuthenticate' | 'onInspectionCancelled' | 'onInspectionComplete' | 'onInspectionUploadFailed' | 'onInspectionUploadProgress' | 'onInspectionUploaded' | 'onInspectionStarted' | 'onUserAuthenticated';
|
|
21
|
+
referenceNumber?: string;
|
|
22
|
+
bytesComplete?: number;
|
|
23
|
+
bytesTotal?: number;
|
|
24
|
+
error?: string;
|
|
25
|
+
userId?: string;
|
|
26
|
+
username?: string;
|
|
27
|
+
inspectionJSON?: string;
|
|
28
|
+
}) => void): Promise<PluginListenerHandle>;
|
|
18
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["
|
|
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 workOrderId?: number,\n workOrderLabel?: string,\n identity?: Record360Identity\n }): Promise<void>\n\n addListener(\n eventName: 'Record360Event',\n listenerFunc: (\n data: { \n type: 'onFailedToAuthenticate' | 'onInspectionCancelled' | 'onInspectionComplete' | 'onInspectionUploadFailed' | 'onInspectionUploadProgress' | 'onInspectionUploaded' | 'onInspectionStarted' | 'onUserAuthenticated',\n referenceNumber?: string,\n bytesComplete?: number,\n bytesTotal?: number,\n error?: string,\n userId?: string,\n username?: string,\n inspectionJSON?: string\n }\n ) => void,\n ): Promise<PluginListenerHandle>;\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WebPlugin } from '@capacitor/core';
|
|
1
|
+
import { ListenerCallback, PluginListenerHandle, WebPlugin } from '@capacitor/core';
|
|
2
2
|
import type { CapacitorRecord360SDKPlugin, Record360Identity } from './definitions';
|
|
3
3
|
export declare class CapacitorRecord360SDKWeb extends WebPlugin implements CapacitorRecord360SDKPlugin {
|
|
4
4
|
launchRecord360(_?: Record360Identity): Promise<void>;
|
|
@@ -8,4 +8,5 @@ export declare class CapacitorRecord360SDKWeb extends WebPlugin implements Capac
|
|
|
8
8
|
workOrderLabel?: string;
|
|
9
9
|
identity?: Record360Identity;
|
|
10
10
|
}): Promise<void>;
|
|
11
|
+
addListener(_eventName: string, _listenerFunc: ListenerCallback): Promise<PluginListenerHandle>;
|
|
11
12
|
}
|
package/dist/esm/web.js
CHANGED
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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,CAA4G;QAC/H,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, 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; workOrderId?: number; workOrderLabel?: string; 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}"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -13,6 +13,9 @@ class CapacitorRecord360SDKWeb extends core.WebPlugin {
|
|
|
13
13
|
launchReferenceCapture(_) {
|
|
14
14
|
throw new Error("Not available on web");
|
|
15
15
|
}
|
|
16
|
+
addListener(_eventName, _listenerFunc) {
|
|
17
|
+
throw new Error("Not available on web");
|
|
18
|
+
}
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
var web = /*#__PURE__*/Object.freeze({
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorRecord360SDK = registerPlugin('CapacitorRecord360SDK', {\n web: () => import('./web').then(m => new m.CapacitorRecord360SDKWeb()),\n});\nexport * from './definitions';\nexport { CapacitorRecord360SDK };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorRecord360SDKWeb extends WebPlugin {\n launchRecord360(_) {\n throw new Error(\"Not available on web.\");\n }\n launchReferenceCapture(_) {\n throw new Error(\"Not available on web\");\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,qBAAqB,GAAGA,mBAAc,CAAC,uBAAuB,EAAE;AACtE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,wBAAwB,EAAE,CAAC;AAC1E,CAAC;;ACFM,MAAM,wBAAwB,SAASC,cAAS,CAAC;AACxD,IAAI,eAAe,CAAC,CAAC,EAAE;AACvB,QAAQ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC;AAChD;AACA,IAAI,sBAAsB,CAAC,CAAC,EAAE;AAC9B,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;AAC/C;AACA;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorRecord360SDK = registerPlugin('CapacitorRecord360SDK', {\n web: () => import('./web').then(m => new m.CapacitorRecord360SDKWeb()),\n});\nexport * from './definitions';\nexport { CapacitorRecord360SDK };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorRecord360SDKWeb extends WebPlugin {\n launchRecord360(_) {\n throw new Error(\"Not available on web.\");\n }\n launchReferenceCapture(_) {\n throw new Error(\"Not available on web\");\n }\n addListener(_eventName, _listenerFunc) {\n throw new Error(\"Not available on web\");\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,qBAAqB,GAAGA,mBAAc,CAAC,uBAAuB,EAAE;AACtE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,wBAAwB,EAAE,CAAC;AAC1E,CAAC;;ACFM,MAAM,wBAAwB,SAASC,cAAS,CAAC;AACxD,IAAI,eAAe,CAAC,CAAC,EAAE;AACvB,QAAQ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC;AAChD;AACA,IAAI,sBAAsB,CAAC,CAAC,EAAE;AAC9B,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;AAC/C;AACA,IAAI,WAAW,CAAC,UAAU,EAAE,aAAa,EAAE;AAC3C,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;AAC/C;AACA;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -12,6 +12,9 @@ var capacitorCapacitorRecord360SDK = (function (exports, core) {
|
|
|
12
12
|
launchReferenceCapture(_) {
|
|
13
13
|
throw new Error("Not available on web");
|
|
14
14
|
}
|
|
15
|
+
addListener(_eventName, _listenerFunc) {
|
|
16
|
+
throw new Error("Not available on web");
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
var web = /*#__PURE__*/Object.freeze({
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorRecord360SDK = registerPlugin('CapacitorRecord360SDK', {\n web: () => import('./web').then(m => new m.CapacitorRecord360SDKWeb()),\n});\nexport * from './definitions';\nexport { CapacitorRecord360SDK };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorRecord360SDKWeb extends WebPlugin {\n launchRecord360(_) {\n throw new Error(\"Not available on web.\");\n }\n launchReferenceCapture(_) {\n throw new Error(\"Not available on web\");\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,qBAAqB,GAAGA,mBAAc,CAAC,uBAAuB,EAAE;IACtE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,wBAAwB,EAAE,CAAC;IAC1E,CAAC;;ICFM,MAAM,wBAAwB,SAASC,cAAS,CAAC;IACxD,IAAI,eAAe,CAAC,CAAC,EAAE;IACvB,QAAQ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC;IAChD;IACA,IAAI,sBAAsB,CAAC,CAAC,EAAE;IAC9B,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;IAC/C;IACA;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorRecord360SDK = registerPlugin('CapacitorRecord360SDK', {\n web: () => import('./web').then(m => new m.CapacitorRecord360SDKWeb()),\n});\nexport * from './definitions';\nexport { CapacitorRecord360SDK };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorRecord360SDKWeb extends WebPlugin {\n launchRecord360(_) {\n throw new Error(\"Not available on web.\");\n }\n launchReferenceCapture(_) {\n throw new Error(\"Not available on web\");\n }\n addListener(_eventName, _listenerFunc) {\n throw new Error(\"Not available on web\");\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,qBAAqB,GAAGA,mBAAc,CAAC,uBAAuB,EAAE;IACtE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,wBAAwB,EAAE,CAAC;IAC1E,CAAC;;ICFM,MAAM,wBAAwB,SAASC,cAAS,CAAC;IACxD,IAAI,eAAe,CAAC,CAAC,EAAE;IACvB,QAAQ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC;IAChD;IACA,IAAI,sBAAsB,CAAC,CAAC,EAAE;IAC9B,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;IAC/C;IACA,IAAI,WAAW,CAAC,UAAU,EAAE,aAAa,EAAE;IAC3C,QAAQ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;IAC/C;IACA;;;;;;;;;;;;;;;"}
|
|
@@ -3,7 +3,7 @@ import Capacitor
|
|
|
3
3
|
import Record360SDK
|
|
4
4
|
|
|
5
5
|
@objc(CapacitorRecord360SDKPlugin)
|
|
6
|
-
public class CapacitorRecord360SDKPlugin: CAPPlugin, CAPBridgedPlugin, Record360Delegate
|
|
6
|
+
public class CapacitorRecord360SDKPlugin: CAPPlugin, CAPBridgedPlugin, Record360Delegate {
|
|
7
7
|
public let identifier = "CapacitorRecord360SDKPlugin"
|
|
8
8
|
public let jsName = "CapacitorRecord360SDK"
|
|
9
9
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
@@ -13,15 +13,15 @@ public class CapacitorRecord360SDKPlugin: CAPPlugin, CAPBridgedPlugin, Record360
|
|
|
13
13
|
|
|
14
14
|
public var record360: Record360?
|
|
15
15
|
public var record360ViewController: Record360ViewController?
|
|
16
|
+
public var hostingSDKViewController = false
|
|
16
17
|
|
|
17
18
|
public override init() {
|
|
18
19
|
super.init()
|
|
19
|
-
self.record360 = Record360(delegate: self);
|
|
20
|
-
|
|
20
|
+
self.record360 = Record360(delegate: self, allowUserToExitRecord360: true);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
private func applySettings() {
|
|
24
|
-
self.
|
|
24
|
+
self.record360?.applyDefaultSettings([
|
|
25
25
|
Record360Setting(switchSetting: SETTING_NOTATIONS_ON_IMAGES, canDisplay: true, value: false),
|
|
26
26
|
Record360Setting(switchSetting: SETTING_ADD_TIMESTAMP_TO_MEDIA, canDisplay: true, value: true),
|
|
27
27
|
Record360Setting(switchSetting: SETTING_NATIVE_PHOTO_MODE, canDisplay: true, value: false),
|
|
@@ -47,9 +47,11 @@ public class CapacitorRecord360SDKPlugin: CAPPlugin, CAPBridgedPlugin, Record360
|
|
|
47
47
|
let userToken = call.getString("userToken")
|
|
48
48
|
|
|
49
49
|
if (username != nil && password != nil) {
|
|
50
|
-
|
|
50
|
+
let identity = Record360Identity(userName: username!, password: password!)
|
|
51
|
+
loadR360SDK(identity: identity, presentingVC: presentingVC)
|
|
51
52
|
} else if (userId != nil && userToken != nil) {
|
|
52
|
-
|
|
53
|
+
let identity = Record360Identity(userID: userId!, userToken: userToken!)
|
|
54
|
+
loadR360SDK(identity: identity, presentingVC: presentingVC)
|
|
53
55
|
} else {
|
|
54
56
|
loadR360SDKLogin(referenceNumber: nil, workOrderId: nil, workOrderLabel: nil, presentingVC: presentingVC)
|
|
55
57
|
}
|
|
@@ -76,70 +78,45 @@ public class CapacitorRecord360SDKPlugin: CAPPlugin, CAPBridgedPlugin, Record360
|
|
|
76
78
|
let userToken = identityObj?["userToken"] as? String
|
|
77
79
|
|
|
78
80
|
if (username != nil && password != nil) {
|
|
79
|
-
|
|
81
|
+
let identity = Record360Identity(userName: username!, password: password!)
|
|
82
|
+
loadR360SDKForInspection(identity: identity, referenceNumber: referenceNumber!, workOrderId: workOrderId, workOrderLabel: workOrderLabel, presentingVC: presentingVC)
|
|
80
83
|
} else if (userId != nil && userToken != nil) {
|
|
81
|
-
|
|
84
|
+
let identity = Record360Identity(userID: userId!, userToken: userToken!)
|
|
85
|
+
loadR360SDKForInspection(identity: identity, referenceNumber: referenceNumber!, workOrderId: workOrderId, workOrderLabel: workOrderLabel, presentingVC: presentingVC)
|
|
82
86
|
} else {
|
|
83
87
|
loadR360SDKLogin(referenceNumber: referenceNumber, workOrderId: workOrderId, workOrderLabel: workOrderLabel, presentingVC: presentingVC)
|
|
84
88
|
}
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
private func loadR360SDKLogin(referenceNumber: String?, workOrderId: NSNumber?, workOrderLabel: String?, presentingVC: UIViewController) {
|
|
88
|
-
self.record360ViewController?.dismiss()
|
|
89
92
|
DispatchQueue.main.async {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
self.hostSDKViewController {
|
|
94
|
+
let identity = Record360Identity(userName: "", password: nil)
|
|
95
|
+
if (referenceNumber != nil) {
|
|
96
|
+
self.record360?.launchReferenceCapture(referenceNumber, workOrderID: workOrderId, workOrderLabel: workOrderLabel, identity: identity)
|
|
97
|
+
} else {
|
|
98
|
+
self.record360?.launch(identity)
|
|
99
|
+
}
|
|
100
|
+
self.applySettings()
|
|
94
101
|
}
|
|
95
|
-
self.record360ViewController?.delegate = self
|
|
96
|
-
self.applySettings()
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
private func loadR360SDK(username: String, password: String, presentingVC: UIViewController) {
|
|
101
|
-
self.record360ViewController?.dismiss()
|
|
102
|
-
DispatchQueue.main.async {
|
|
103
|
-
self.record360ViewController = Record360ViewController.load(withUserName: username, andPassword: password, sendTo: self.record360!, displayOn: presentingVC)
|
|
104
|
-
self.record360ViewController?.delegate = self
|
|
105
|
-
self.applySettings()
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
private func loadR360SDK(userID: String, userToken: String, presentingVC: UIViewController) {
|
|
110
|
-
self.record360ViewController?.dismiss()
|
|
111
|
-
DispatchQueue.main.async {
|
|
112
|
-
self.record360ViewController = Record360ViewController.load(withUserToken: userToken, andUserId: userID, sendTo: self.record360!, displayOn: presentingVC)
|
|
113
|
-
self.record360ViewController?.delegate = self
|
|
114
|
-
self.applySettings()
|
|
115
102
|
}
|
|
116
103
|
}
|
|
117
104
|
|
|
118
|
-
private func
|
|
119
|
-
self.record360ViewController?.dismiss()
|
|
105
|
+
private func loadR360SDK(identity: Record360Identity, presentingVC: UIViewController) {
|
|
120
106
|
DispatchQueue.main.async {
|
|
121
|
-
self.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
workOrderLabel: nil,
|
|
126
|
-
andIsOneTimeLink: false,
|
|
127
|
-
sendTo: self.record360!,
|
|
128
|
-
displayOn: presentingVC)
|
|
129
|
-
self.record360ViewController?.delegate = self
|
|
107
|
+
self.hostSDKViewController {
|
|
108
|
+
self.record360?.launch(identity)
|
|
109
|
+
self.applySettings()
|
|
110
|
+
}
|
|
130
111
|
}
|
|
131
112
|
}
|
|
132
113
|
|
|
133
|
-
private func loadR360SDKForInspection(
|
|
134
|
-
self.record360ViewController?.dismiss()
|
|
114
|
+
private func loadR360SDKForInspection(identity: Record360Identity, referenceNumber: String, workOrderId: NSNumber?, workOrderLabel: String?, presentingVC: UIViewController) {
|
|
135
115
|
DispatchQueue.main.async {
|
|
136
|
-
self.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
workOrderLabel: workOrderLabel,
|
|
141
|
-
sendTo: self.record360!, displayOn: presentingVC)
|
|
142
|
-
self.record360ViewController?.delegate = self
|
|
116
|
+
self.hostSDKViewController {
|
|
117
|
+
self.record360?.launchReferenceCapture(referenceNumber, workOrderID: workOrderId, workOrderLabel: workOrderLabel, identity: identity)
|
|
118
|
+
self.applySettings()
|
|
119
|
+
}
|
|
143
120
|
}
|
|
144
121
|
}
|
|
145
122
|
|
|
@@ -173,8 +150,15 @@ public class CapacitorRecord360SDKPlugin: CAPPlugin, CAPBridgedPlugin, Record360
|
|
|
173
150
|
|
|
174
151
|
}
|
|
175
152
|
|
|
176
|
-
public func
|
|
153
|
+
public func userHasRequestedToExitRecord360() {
|
|
154
|
+
self.dismissSDKViewController(animated: true, completion: {})
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
public func onInspectionUploaded(forReferenceNumber referenceNumber: String, inspectionJSON: [AnyHashable : Any]) {
|
|
177
158
|
var data = JSObject()
|
|
159
|
+
if let inspection = inspectionJSON["transaction"] as? [AnyHashable : Any] {
|
|
160
|
+
data["inspectionJSON"] = self.dictionaryToJSONString(inspection)!
|
|
161
|
+
}
|
|
178
162
|
data["type"] = "onInspectionUploaded"
|
|
179
163
|
data["referenceNumber"] = referenceNumber
|
|
180
164
|
notifyListeners("Record360Event", data: data)
|
|
@@ -186,4 +170,81 @@ public class CapacitorRecord360SDKPlugin: CAPPlugin, CAPBridgedPlugin, Record360
|
|
|
186
170
|
data["referenceNumber"] = referenceNumber
|
|
187
171
|
notifyListeners("Record360Event", data: data)
|
|
188
172
|
}
|
|
173
|
+
|
|
174
|
+
func dictionaryToJSONString(_ dict: [AnyHashable: Any]) -> String? {
|
|
175
|
+
do {
|
|
176
|
+
// Check if the dictionary is valid for JSON serialization
|
|
177
|
+
guard JSONSerialization.isValidJSONObject(dict) else {
|
|
178
|
+
print("Dictionary is not valid for JSON serialization")
|
|
179
|
+
return nil
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Convert to JSON Data
|
|
183
|
+
let jsonData = try JSONSerialization.data(withJSONObject: dict, options: [])
|
|
184
|
+
|
|
185
|
+
// Convert Data to String
|
|
186
|
+
let jsonString = String(data: jsonData, encoding: .utf8)
|
|
187
|
+
return jsonString
|
|
188
|
+
|
|
189
|
+
} catch {
|
|
190
|
+
print("Error converting dictionary to JSON: \(error)")
|
|
191
|
+
return nil
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
private func hostSDKViewController(completion: @escaping () -> Void) {
|
|
196
|
+
// ok, the sdk ui needs to be totally torn down before being reconstructed via
|
|
197
|
+
// one of the "launch" methods. Future revisions to the SDK should address this,
|
|
198
|
+
// but until then, this means that we must ensure the SDK VC is dismissed before
|
|
199
|
+
// we can safely host it in preparation for one of the launch methods. Basically,
|
|
200
|
+
// This effectively makes hostSDKViewController safely re-entrant
|
|
201
|
+
|
|
202
|
+
self.dismissSDKViewController(animated: true) {
|
|
203
|
+
self.record360?.sdkViewController.view.removeFromSuperview()
|
|
204
|
+
self.record360?.sdkViewController.removeFromParent()
|
|
205
|
+
|
|
206
|
+
guard let presentingVC: UIViewController = self.bridge?.viewController else {
|
|
207
|
+
return
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
guard let sdkVC = self.record360?.sdkViewController else {
|
|
211
|
+
return
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
presentingVC.addChild(sdkVC)
|
|
215
|
+
sdkVC.didMove(toParent: presentingVC)
|
|
216
|
+
presentingVC.view.addSubview(sdkVC.view)
|
|
217
|
+
sdkVC.view.topAnchor.constraint(equalTo: presentingVC.view.topAnchor).isActive = true
|
|
218
|
+
sdkVC.view.bottomAnchor.constraint(equalTo: presentingVC.view.bottomAnchor).isActive = true
|
|
219
|
+
sdkVC.view.leadingAnchor.constraint(equalTo: presentingVC.view.leadingAnchor).isActive = true
|
|
220
|
+
sdkVC.view.trailingAnchor.constraint(equalTo: presentingVC.view.trailingAnchor).isActive = true
|
|
221
|
+
self.hostingSDKViewController = true
|
|
222
|
+
|
|
223
|
+
completion()
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
private func dismissSDKViewController(animated: Bool, completion: @escaping () -> Void) {
|
|
228
|
+
if !hostingSDKViewController {
|
|
229
|
+
completion()
|
|
230
|
+
return
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// dismiss it via its nav controller, then take it out of the view hierarchy
|
|
234
|
+
|
|
235
|
+
let viewController = self.record360?.sdkViewController.navigationController ?? self.record360?.sdkViewController
|
|
236
|
+
|
|
237
|
+
guard let presentingVC = bridge?.viewController else {
|
|
238
|
+
return
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
viewController?.dismiss(animated: animated) {
|
|
242
|
+
self.record360?.sdkViewController.willMove(toParent: nil)
|
|
243
|
+
self.record360?.sdkViewController.view.removeFromSuperview()
|
|
244
|
+
self.record360?.sdkViewController.view.removeConstraints(presentingVC.view.constraints)
|
|
245
|
+
self.record360?.sdkViewController.removeFromParent()
|
|
246
|
+
self.hostingSDKViewController = false
|
|
247
|
+
completion()
|
|
248
|
+
}
|
|
249
|
+
}
|
|
189
250
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "capacitor-record360sdk",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "Capacitor wrapper for Record360SDK",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"typescript": "~4.1.5"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@capacitor/core": "^
|
|
66
|
+
"@capacitor/core": "^7.0.0"
|
|
67
67
|
},
|
|
68
68
|
"prettier": "@ionic/prettier-config",
|
|
69
69
|
"swiftlint": "@ionic/swiftlint-config",
|