capacitor-record360sdk 1.0.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 +18 -0
- package/Package.swift +28 -0
- package/README.md +129 -0
- package/android/build.gradle +106 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/record360/plugins/CapacitorRecord360SDKPlugin.kt +232 -0
- package/android/src/main/java/com/record360/plugins/SampleRecord360Activity.kt +45 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/android/src/main/res/layout/activity_record360_sample.xml +94 -0
- package/dist/docs.json +714 -0
- package/dist/esm/definitions.d.ts +15 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +11 -0
- package/dist/esm/web.js +10 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +24 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +27 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Sources/CapacitorRecord360SDKPlugin/CapacitorRecord360SDKPlugin.swift +170 -0
- package/ios/Tests/CapacitorRecord360SDKPluginTests/CapacitorRecord360SDKPluginTests.swift +15 -0
- package/package.json +80 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'CapacitorRecord360sdk'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.license = package['license']
|
|
10
|
+
s.homepage = package['repository']['url']
|
|
11
|
+
s.author = package['author']
|
|
12
|
+
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
|
+
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
+
s.ios.deployment_target = '14.0'
|
|
15
|
+
s.dependency 'Capacitor'
|
|
16
|
+
s.dependency 'Record360SDK', '4.17.2'
|
|
17
|
+
s.swift_version = '5.1'
|
|
18
|
+
end
|
package/Package.swift
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// swift-tools-version: 5.9
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
let package = Package(
|
|
5
|
+
name: "CapacitorRecord360sdk",
|
|
6
|
+
platforms: [.iOS(.v13)],
|
|
7
|
+
products: [
|
|
8
|
+
.library(
|
|
9
|
+
name: "CapacitorRecord360sdk",
|
|
10
|
+
targets: ["CapacitorRecord360SDKPlugin"])
|
|
11
|
+
],
|
|
12
|
+
dependencies: [
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", branch: "main")
|
|
14
|
+
],
|
|
15
|
+
targets: [
|
|
16
|
+
.target(
|
|
17
|
+
name: "CapacitorRecord360SDKPlugin",
|
|
18
|
+
dependencies: [
|
|
19
|
+
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
20
|
+
.product(name: "Cordova", package: "capacitor-swift-pm")
|
|
21
|
+
],
|
|
22
|
+
path: "ios/Sources/CapacitorRecord360SDKPlugin"),
|
|
23
|
+
.testTarget(
|
|
24
|
+
name: "CapacitorRecord360SDKPluginTests",
|
|
25
|
+
dependencies: ["CapacitorRecord360SDKPlugin"],
|
|
26
|
+
path: "ios/Tests/CapacitorRecord360SDKPluginTests")
|
|
27
|
+
]
|
|
28
|
+
)
|
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# capacitor-record360sdk
|
|
2
|
+
|
|
3
|
+
Capacitor wrapper for Record360SDK
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install capacitor-record360sdk
|
|
9
|
+
npx cap sync
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## API
|
|
13
|
+
|
|
14
|
+
<docgen-index>
|
|
15
|
+
|
|
16
|
+
* [`launchRecord360(...)`](#launchrecord360)
|
|
17
|
+
* [`launchReferenceCapture(...)`](#launchreferencecapture)
|
|
18
|
+
* [Interfaces](#interfaces)
|
|
19
|
+
|
|
20
|
+
</docgen-index>
|
|
21
|
+
|
|
22
|
+
<docgen-api>
|
|
23
|
+
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
24
|
+
|
|
25
|
+
### launchRecord360(...)
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
launchRecord360(identity: Record360Identity) => Promise<void>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
| Param | Type |
|
|
32
|
+
| -------------- | --------------------------------------------------------------- |
|
|
33
|
+
| **`identity`** | <code><a href="#record360identity">Record360Identity</a></code> |
|
|
34
|
+
|
|
35
|
+
--------------------
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### launchReferenceCapture(...)
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
launchReferenceCapture(options: { referenceNumber: string; workOrderId: number; workOrderLabel: string; identity: Record360Identity; }) => Promise<void>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
| Param | Type |
|
|
45
|
+
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
46
|
+
| **`options`** | <code>{ referenceNumber: string; workOrderId: number; workOrderLabel: string; identity: <a href="#record360identity">Record360Identity</a>; }</code> |
|
|
47
|
+
|
|
48
|
+
--------------------
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Interfaces
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
#### Record360Identity
|
|
55
|
+
|
|
56
|
+
| Prop | Type |
|
|
57
|
+
| --------------- | ----------------------------------------- |
|
|
58
|
+
| **`username`** | <code>string</code> |
|
|
59
|
+
| **`password`** | <code>string</code> |
|
|
60
|
+
| **`userId`** | <code><a href="#string">String</a></code> |
|
|
61
|
+
| **`userToken`** | <code><a href="#string">String</a></code> |
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
#### String
|
|
65
|
+
|
|
66
|
+
Allows manipulation and formatting of text strings and determination and location of substrings within strings.
|
|
67
|
+
|
|
68
|
+
| Prop | Type | Description |
|
|
69
|
+
| ------------ | ------------------- | ------------------------------------------------------------ |
|
|
70
|
+
| **`length`** | <code>number</code> | Returns the length of a <a href="#string">String</a> object. |
|
|
71
|
+
|
|
72
|
+
| Method | Signature | Description |
|
|
73
|
+
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
74
|
+
| **toString** | () => string | Returns a string representation of a string. |
|
|
75
|
+
| **charAt** | (pos: number) => string | Returns the character at the specified index. |
|
|
76
|
+
| **charCodeAt** | (index: number) => number | Returns the Unicode value of the character at the specified location. |
|
|
77
|
+
| **concat** | (...strings: string[]) => string | Returns a string that contains the concatenation of two or more strings. |
|
|
78
|
+
| **indexOf** | (searchString: string, position?: number \| undefined) => number | Returns the position of the first occurrence of a substring. |
|
|
79
|
+
| **lastIndexOf** | (searchString: string, position?: number \| undefined) => number | Returns the last occurrence of a substring in the string. |
|
|
80
|
+
| **localeCompare** | (that: string) => number | Determines whether two strings are equivalent in the current locale. |
|
|
81
|
+
| **match** | (regexp: string \| <a href="#regexp">RegExp</a>) => <a href="#regexpmatcharray">RegExpMatchArray</a> \| null | Matches a string with a regular expression, and returns an array containing the results of that search. |
|
|
82
|
+
| **replace** | (searchValue: string \| <a href="#regexp">RegExp</a>, replaceValue: string) => string | Replaces text in a string, using a regular expression or search string. |
|
|
83
|
+
| **replace** | (searchValue: string \| <a href="#regexp">RegExp</a>, replacer: (substring: string, ...args: any[]) => string) => string | Replaces text in a string, using a regular expression or search string. |
|
|
84
|
+
| **search** | (regexp: string \| <a href="#regexp">RegExp</a>) => number | Finds the first substring match in a regular expression search. |
|
|
85
|
+
| **slice** | (start?: number \| undefined, end?: number \| undefined) => string | Returns a section of a string. |
|
|
86
|
+
| **split** | (separator: string \| <a href="#regexp">RegExp</a>, limit?: number \| undefined) => string[] | Split a string into substrings using the specified separator and return them as an array. |
|
|
87
|
+
| **substring** | (start: number, end?: number \| undefined) => string | Returns the substring at the specified location within a <a href="#string">String</a> object. |
|
|
88
|
+
| **toLowerCase** | () => string | Converts all the alphabetic characters in a string to lowercase. |
|
|
89
|
+
| **toLocaleLowerCase** | (locales?: string \| string[] \| undefined) => string | Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. |
|
|
90
|
+
| **toUpperCase** | () => string | Converts all the alphabetic characters in a string to uppercase. |
|
|
91
|
+
| **toLocaleUpperCase** | (locales?: string \| string[] \| undefined) => string | Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. |
|
|
92
|
+
| **trim** | () => string | Removes the leading and trailing white space and line terminator characters from a string. |
|
|
93
|
+
| **substr** | (from: number, length?: number \| undefined) => string | Gets a substring beginning at the specified location and having the specified length. |
|
|
94
|
+
| **valueOf** | () => string | Returns the primitive value of the specified object. |
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
#### RegExpMatchArray
|
|
98
|
+
|
|
99
|
+
| Prop | Type |
|
|
100
|
+
| ----------- | ------------------- |
|
|
101
|
+
| **`index`** | <code>number</code> |
|
|
102
|
+
| **`input`** | <code>string</code> |
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
#### RegExp
|
|
106
|
+
|
|
107
|
+
| Prop | Type | Description |
|
|
108
|
+
| ---------------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
109
|
+
| **`source`** | <code>string</code> | Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. |
|
|
110
|
+
| **`global`** | <code>boolean</code> | Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. |
|
|
111
|
+
| **`ignoreCase`** | <code>boolean</code> | Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. |
|
|
112
|
+
| **`multiline`** | <code>boolean</code> | Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. |
|
|
113
|
+
| **`lastIndex`** | <code>number</code> | |
|
|
114
|
+
|
|
115
|
+
| Method | Signature | Description |
|
|
116
|
+
| ----------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
117
|
+
| **exec** | (string: string) => <a href="#regexpexecarray">RegExpExecArray</a> \| null | Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. |
|
|
118
|
+
| **test** | (string: string) => boolean | Returns a Boolean value that indicates whether or not a pattern exists in a searched string. |
|
|
119
|
+
| **compile** | () => this | |
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
#### RegExpExecArray
|
|
123
|
+
|
|
124
|
+
| Prop | Type |
|
|
125
|
+
| ----------- | ------------------- |
|
|
126
|
+
| **`index`** | <code>number</code> |
|
|
127
|
+
| **`input`** | <code>string</code> |
|
|
128
|
+
|
|
129
|
+
</docgen-api>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext {
|
|
3
|
+
junitVersion = '4.13.2'
|
|
4
|
+
androidxAppCompatVersion = '1.6.1'
|
|
5
|
+
androidxJunitVersion = '1.1.5'
|
|
6
|
+
androidxEspressoCoreVersion = '3.5.1'
|
|
7
|
+
androidXCore = '1.13.1'
|
|
8
|
+
compileSdk = 34
|
|
9
|
+
minSdkVersion = 24
|
|
10
|
+
targetSdkVersion = 34
|
|
11
|
+
kotlinVersion = '2.0.21'
|
|
12
|
+
androidxCoreVersion = '1.13.1'
|
|
13
|
+
androidxActivityVersion = '1.6.1'
|
|
14
|
+
androidxFragmentVersion = '1.6.2'
|
|
15
|
+
androidxCoordinatorLayoutVersion = '1.2.0'
|
|
16
|
+
androidxWebkitVersion = '1.9.0'
|
|
17
|
+
cordovaAndroidVersion = '10.1.1'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
repositories {
|
|
21
|
+
google()
|
|
22
|
+
mavenCentral()
|
|
23
|
+
maven { url 'https://maven.scijava.org/content/repositories/public/' }
|
|
24
|
+
maven { url 'https://raw.githubusercontent.com/Acuant/AndroidSdkMaven/main/maven/' }
|
|
25
|
+
maven { url 'https://raw.githubusercontent.com/iProov/android/master/maven/' }
|
|
26
|
+
maven { url 'https://jitpack.io'}
|
|
27
|
+
maven { url 'https://maven.google.com' }
|
|
28
|
+
maven { url 'https://customers.pspdfkit.com/maven/' }
|
|
29
|
+
maven { url 'https://maven.pkg.github.com/Record360/record360-sdk-android'
|
|
30
|
+
credentials {
|
|
31
|
+
username GITHUB_USERNAME
|
|
32
|
+
password GITHUB_PAT
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
dependencies {
|
|
37
|
+
classpath 'com.android.tools.build:gradle:8.5.2'
|
|
38
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
apply plugin: 'com.android.library'
|
|
43
|
+
apply plugin: 'org.jetbrains.kotlin.android'
|
|
44
|
+
|
|
45
|
+
android {
|
|
46
|
+
namespace "com.record360.plugins"
|
|
47
|
+
compileSdk project.compileSdk
|
|
48
|
+
defaultConfig {
|
|
49
|
+
minSdkVersion project.minSdkVersion
|
|
50
|
+
targetSdkVersion project.targetSdkVersion
|
|
51
|
+
versionCode 1
|
|
52
|
+
versionName "1.0"
|
|
53
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
54
|
+
}
|
|
55
|
+
buildTypes {
|
|
56
|
+
release {
|
|
57
|
+
minifyEnabled false
|
|
58
|
+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
buildFeatures {
|
|
63
|
+
viewBinding true
|
|
64
|
+
}
|
|
65
|
+
lintOptions {
|
|
66
|
+
abortOnError false
|
|
67
|
+
}
|
|
68
|
+
compileOptions {
|
|
69
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
70
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
71
|
+
coreLibraryDesugaringEnabled true
|
|
72
|
+
}
|
|
73
|
+
kotlinOptions {
|
|
74
|
+
jvmTarget = '17'
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
repositories {
|
|
79
|
+
google()
|
|
80
|
+
mavenCentral()
|
|
81
|
+
maven { url 'https://maven.scijava.org/content/repositories/public/' }
|
|
82
|
+
maven { url 'https://raw.githubusercontent.com/Acuant/AndroidSdkMaven/main/maven/' }
|
|
83
|
+
maven { url 'https://raw.githubusercontent.com/iProov/android/master/maven/' }
|
|
84
|
+
maven { url 'https://jitpack.io'}
|
|
85
|
+
maven { url 'https://maven.google.com' }
|
|
86
|
+
maven { url 'https://customers.pspdfkit.com/maven/' }
|
|
87
|
+
maven { url 'https://maven.pkg.github.com/Record360/record360-sdk-android'
|
|
88
|
+
credentials {
|
|
89
|
+
username GITHUB_USERNAME
|
|
90
|
+
password GITHUB_PAT
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
dependencies {
|
|
97
|
+
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
98
|
+
implementation project(':capacitor-android')
|
|
99
|
+
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
100
|
+
implementation "androidx.core:core-ktx:$androidXCore"
|
|
101
|
+
testImplementation "junit:junit:$junitVersion"
|
|
102
|
+
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
103
|
+
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
104
|
+
implementation 'com.record360.sdk:android-sdk:4.19.1'
|
|
105
|
+
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
|
|
106
|
+
}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
package com.record360.plugins
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.content.Intent
|
|
5
|
+
import android.util.Log
|
|
6
|
+
import com.getcapacitor.JSObject
|
|
7
|
+
import com.getcapacitor.Plugin
|
|
8
|
+
import com.getcapacitor.PluginCall
|
|
9
|
+
import com.getcapacitor.PluginMethod
|
|
10
|
+
import com.getcapacitor.annotation.CapacitorPlugin
|
|
11
|
+
import com.record360.plugins.SampleRecord360Activity.Companion.USER_ID_INTENT
|
|
12
|
+
import com.record360.plugins.SampleRecord360Activity.Companion.USER_NAME_INTENT
|
|
13
|
+
import com.record360.plugins.SampleRecord360Activity.Companion.USER_PASSWORD_INTENT
|
|
14
|
+
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
|
+
import com.record360.sdk.IRecord360Interface
|
|
18
|
+
import com.record360.sdk.R360Identity
|
|
19
|
+
import com.record360.sdk.Record360SDK
|
|
20
|
+
import com.record360.sdk.Record360Setting
|
|
21
|
+
|
|
22
|
+
@CapacitorPlugin(
|
|
23
|
+
name = "CapacitorRecord360SDK"
|
|
24
|
+
)
|
|
25
|
+
open class CapacitorRecord360SDKPlugin : Plugin(), IRecord360Interface {
|
|
26
|
+
override fun load() {
|
|
27
|
+
super.load()
|
|
28
|
+
initialize(bridge.context)
|
|
29
|
+
Log.i(TAG, "Initialize Record360 Plugin")
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private fun initialize(context: Context) {
|
|
33
|
+
Record360SDK.initialize(context, defaultSettings)
|
|
34
|
+
Record360SDK.r360Interface = this
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private fun startRecord360(identity: R360Identity?) {
|
|
38
|
+
val intent = Intent(bridge.context, SampleRecord360Activity::class.java)
|
|
39
|
+
identity?.let { intent.addIdentity(it) }
|
|
40
|
+
context.startActivity(intent)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private fun startRefCap(referenceNumber: String, data: JSObject?) {
|
|
44
|
+
val intent = Intent(bridge.context, SampleRecord360Activity::class.java)
|
|
45
|
+
intent.putExtra(SampleRecord360Activity.REFERENCE_NUMBER_INTENT, referenceNumber)
|
|
46
|
+
val identity = checkForIdentity(data?.getJSObject("identity"))
|
|
47
|
+
identity?.let { intent.addIdentity(it) }
|
|
48
|
+
intent.addWorkOrderInfo(data)
|
|
49
|
+
context.startActivity(intent)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private fun Intent.addIdentity(r360Identity: R360Identity) {
|
|
53
|
+
when (r360Identity) {
|
|
54
|
+
is R360Identity.PasswordIdentity -> {
|
|
55
|
+
putExtra(USER_NAME_INTENT, r360Identity.username)
|
|
56
|
+
putExtra(USER_PASSWORD_INTENT, r360Identity.password)
|
|
57
|
+
}
|
|
58
|
+
is R360Identity.UserTokenIdentity -> {
|
|
59
|
+
putExtra(USER_ID_INTENT, r360Identity.userId)
|
|
60
|
+
putExtra(USER_TOKEN_INTENT, r360Identity.userToken)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private fun Intent.addWorkOrderInfo(data: JSObject?) {
|
|
66
|
+
data?.let { dataObj ->
|
|
67
|
+
val workOrderId = dataObj.getInteger("workOrderId")
|
|
68
|
+
val workOrderLabel = dataObj.getString("workOrderLabel")
|
|
69
|
+
if (workOrderId != null && workOrderId > 0) {
|
|
70
|
+
putExtra(WORK_ORDER_ID_INTENT, workOrderId)
|
|
71
|
+
workOrderLabel?.let { putExtra(WORK_ORDER_LABEL_INTENT, it) }
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
private fun checkForIdentity(data: JSObject?): R360Identity? {
|
|
77
|
+
data?.let { identityObject ->
|
|
78
|
+
if (identityObject.has("password") && identityObject.has("username")) {
|
|
79
|
+
val username = identityObject.getString("username") ?: ""
|
|
80
|
+
val password = identityObject.getString("password") ?: ""
|
|
81
|
+
return R360Identity.PasswordIdentity(username, password)
|
|
82
|
+
} else if (identityObject.has("userId") && identityObject.has("userToken")) {
|
|
83
|
+
val userId = identityObject.getString("userId") ?: ""
|
|
84
|
+
val userToken = identityObject.getString("userToken") ?: ""
|
|
85
|
+
return R360Identity.UserTokenIdentity(userId, userToken)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return null
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@PluginMethod
|
|
93
|
+
fun launchRecord360(call: PluginCall) {
|
|
94
|
+
val data = call.data
|
|
95
|
+
val identity = checkForIdentity(data)
|
|
96
|
+
startRecord360(identity)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@PluginMethod
|
|
100
|
+
fun launchReferenceCapture(call: PluginCall) {
|
|
101
|
+
val data = call.data
|
|
102
|
+
val referenceNumber = data?.getString("referenceNumber", null)
|
|
103
|
+
if (referenceNumber.isNullOrEmpty()) {
|
|
104
|
+
call.reject("Did not pass in a reference number")
|
|
105
|
+
return
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
startRefCap(referenceNumber, data)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
override fun onContractFieldData(contractFieldData: Map<String?, String?>?): Map<String?, String?>? {
|
|
112
|
+
return contractFieldData
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
override fun onFailedToAuthenticate(credentialsAreValid: Boolean, error: String?) {
|
|
116
|
+
Log.i(TAG, "onFailedToAuthenticate")
|
|
117
|
+
val data = JSObject().apply {
|
|
118
|
+
put("type", "onFailedToAuthenticate")
|
|
119
|
+
}
|
|
120
|
+
notifyListeners(EVENT_NAME, data)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
override fun onInspectionCancelled(referenceNumber: String?) {
|
|
124
|
+
Log.i(TAG, "onInspectionCancelled")
|
|
125
|
+
val data = JSObject().apply {
|
|
126
|
+
put("type", "onInspectionCancelled")
|
|
127
|
+
put("referenceNumber", referenceNumber)
|
|
128
|
+
}
|
|
129
|
+
notifyListeners(EVENT_NAME, data)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
override fun onInspectionComplete(referenceNumber: String?) {
|
|
133
|
+
Log.i(TAG, "onInspectionComplete")
|
|
134
|
+
val data = JSObject().apply {
|
|
135
|
+
put("type", "onInspectionComplete")
|
|
136
|
+
put("referenceNumber", referenceNumber)
|
|
137
|
+
}
|
|
138
|
+
notifyListeners(EVENT_NAME, data)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
override fun onInspectionUploadFailed(referenceNumber: String?, error: String?) {
|
|
142
|
+
Log.i(TAG, "onInspectionUploadFailed")
|
|
143
|
+
val data = JSObject().apply {
|
|
144
|
+
put("type", "onInspectionUploadFailed")
|
|
145
|
+
put("referenceNumber", referenceNumber)
|
|
146
|
+
put("error", error)
|
|
147
|
+
}
|
|
148
|
+
notifyListeners(EVENT_NAME, data)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
override fun onInspectionUploadProgress(referenceNumber: String?, complete: Long, total: Long) {
|
|
152
|
+
Log.i(TAG, "onInspectionUploadProgress")
|
|
153
|
+
val data = JSObject().apply {
|
|
154
|
+
put("type", "onInspectionUploadProgress")
|
|
155
|
+
put("referenceNumber", referenceNumber)
|
|
156
|
+
put("bytesComplete", complete)
|
|
157
|
+
put("bytesTotal", total)
|
|
158
|
+
}
|
|
159
|
+
notifyListeners(EVENT_NAME, data)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
override fun onInspectionUploaded(referenceNumber: String?) {
|
|
163
|
+
Log.i(TAG, "onInspectionUploaded")
|
|
164
|
+
val data = JSObject().apply {
|
|
165
|
+
put("type", "onInspectionUploaded")
|
|
166
|
+
put("referenceNumber", referenceNumber)
|
|
167
|
+
}
|
|
168
|
+
notifyListeners(EVENT_NAME, data)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
override fun onReferenceNumberEnteredWithFieldData(
|
|
172
|
+
referenceNumber: String?,
|
|
173
|
+
fieldData: Map<String?, String?>?
|
|
174
|
+
): Map<String?, String?>? {
|
|
175
|
+
Log.i(TAG, "onRefNumEntered")
|
|
176
|
+
val data = JSObject().apply {
|
|
177
|
+
put("type", "onInspectionStarted")
|
|
178
|
+
put("referenceNumber", referenceNumber)
|
|
179
|
+
}
|
|
180
|
+
notifyListeners(EVENT_NAME, data)
|
|
181
|
+
return fieldData
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
override fun onUserAuthenticated(username: String?, userId: String?, token: String?) {
|
|
185
|
+
Log.i(TAG, "onUserAuthenticated")
|
|
186
|
+
val data = JSObject().apply {
|
|
187
|
+
put("type", "onUserAuthenticated")
|
|
188
|
+
put("userId", userId)
|
|
189
|
+
put("username", username)
|
|
190
|
+
}
|
|
191
|
+
notifyListeners(EVENT_NAME, data)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
companion object {
|
|
195
|
+
var EVENT_NAME = "Record360Event"
|
|
196
|
+
var TAG = "CapacitorRecord360SDKPlugin"
|
|
197
|
+
var defaultSettings = arrayOf(
|
|
198
|
+
Record360Setting(Record360SDK.SETTING_UPLOAD_MODE, Record360SDK.UPLOAD_MODE_ONLINE, true),
|
|
199
|
+
Record360Setting(Record360SDK.SETTING_RESOLUTION, Record360SDK.RESOLUTION_MEDIUM, true),
|
|
200
|
+
Record360Setting(Record360SDK.SETTING_COMPRESS_MEDIA, true.toString(), true),
|
|
201
|
+
Record360Setting(Record360SDK.SETTING_NOTATIONS_ON_IMAGES, false.toString(), true),
|
|
202
|
+
Record360Setting(Record360SDK.SETTING_ENABLE_MULTIPLE_CAMERA, false.toString(), true),
|
|
203
|
+
Record360Setting(Record360SDK.SETTING_LEGACY_CAMERA, false.toString(), true),
|
|
204
|
+
Record360Setting(Record360SDK.SETTING_VIN_SCAN, false.toString(), true),
|
|
205
|
+
Record360Setting(Record360SDK.SETTING_RECORD_AUDIO, true.toString(), true),
|
|
206
|
+
Record360Setting(Record360SDK.SETTING_TIMESTAMP_MODE, true.toString(), true),
|
|
207
|
+
Record360Setting(Record360SDK.SETTING_NATIVE_RESOLUTION, false.toString(), true),
|
|
208
|
+
Record360Setting(Record360SDK.SETTING_LICENSE_REGION, Record360SDK.REGION_UNITED_STATES, true),
|
|
209
|
+
Record360Setting(Record360SDK.SETTING_SHOW_INTRO_VIDEO),
|
|
210
|
+
Record360Setting(Record360SDK.SETTING_SEND_SUPPORT_LOG),
|
|
211
|
+
Record360Setting(Record360SDK.SETTING_ACCOUNT),
|
|
212
|
+
Record360Setting(Record360SDK.SETTING_LOGOUT),
|
|
213
|
+
Record360Setting(
|
|
214
|
+
Record360SDK.SETTING_LINKS,
|
|
215
|
+
"Access Records",
|
|
216
|
+
"https://www.record360.com"
|
|
217
|
+
),
|
|
218
|
+
Record360Setting(Record360SDK.SETTING_RATE_RECORD360),
|
|
219
|
+
Record360Setting(
|
|
220
|
+
Record360SDK.SETTING_LINKS,
|
|
221
|
+
"Terms of Service",
|
|
222
|
+
"https://www.record360.com/terms"
|
|
223
|
+
),
|
|
224
|
+
Record360Setting(
|
|
225
|
+
Record360SDK.SETTING_LINKS,
|
|
226
|
+
"Privacy Policy",
|
|
227
|
+
"https://www.record360.com/privacy"
|
|
228
|
+
),
|
|
229
|
+
Record360Setting(Record360SDK.SETTING_VERSION)
|
|
230
|
+
)
|
|
231
|
+
}
|
|
232
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
package com.record360.plugins
|
|
2
|
+
|
|
3
|
+
import android.os.Bundle
|
|
4
|
+
import com.record360.sdk.R360Identity
|
|
5
|
+
import com.record360.sdk.Record360Activity
|
|
6
|
+
|
|
7
|
+
class SampleRecord360Activity: Record360Activity() {
|
|
8
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
9
|
+
super.onCreate(savedInstanceState)
|
|
10
|
+
|
|
11
|
+
val userId = if (intent.hasExtra(USER_ID_INTENT)) intent.getStringExtra(USER_ID_INTENT) else null
|
|
12
|
+
val userToken = if (intent.hasExtra(USER_TOKEN_INTENT)) intent.getStringExtra(USER_TOKEN_INTENT) else null
|
|
13
|
+
val userName = if (intent.hasExtra(USER_NAME_INTENT)) intent.getStringExtra(USER_NAME_INTENT) else null
|
|
14
|
+
val password = if (intent.hasExtra(USER_PASSWORD_INTENT)) intent.getStringExtra(USER_PASSWORD_INTENT) else null
|
|
15
|
+
val workOrderId = if (intent.hasExtra(WORK_ORDER_ID_INTENT)) intent.getIntExtra(
|
|
16
|
+
WORK_ORDER_ID_INTENT, -1) else null
|
|
17
|
+
val workOrderLabel = if (intent.hasExtra(WORK_ORDER_LABEL_INTENT)) intent.getStringExtra(
|
|
18
|
+
WORK_ORDER_LABEL_INTENT) else null
|
|
19
|
+
val referenceNumber = if (intent.hasExtra(REFERENCE_NUMBER_INTENT)) {
|
|
20
|
+
intent.getStringExtra(REFERENCE_NUMBER_INTENT)
|
|
21
|
+
} else null
|
|
22
|
+
|
|
23
|
+
when {
|
|
24
|
+
userId != null && userToken != null -> {
|
|
25
|
+
val identity = R360Identity.UserTokenIdentity(userId, userToken)
|
|
26
|
+
startRecord360WithIdentity(this, identity, referenceNumber, workOrderId, workOrderLabel)
|
|
27
|
+
}
|
|
28
|
+
userName != null && password != null -> {
|
|
29
|
+
val identity = R360Identity.PasswordIdentity(userName, password)
|
|
30
|
+
startRecord360WithIdentity(this, identity, referenceNumber, workOrderId, workOrderLabel)
|
|
31
|
+
}
|
|
32
|
+
else -> startRecord360(this, referenceNumber, workOrderId, workOrderLabel, null)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
companion object {
|
|
37
|
+
var REFERENCE_NUMBER_INTENT = "SampleRecord360Activity.REF_NUM_INTENT"
|
|
38
|
+
var WORK_ORDER_ID_INTENT = "SampleRecord360Activity.WORK_ORDER_ID_INTENT"
|
|
39
|
+
var WORK_ORDER_LABEL_INTENT = "SampleRecord360Activity.WORK_ORDER_LABEL_INTENT"
|
|
40
|
+
var USER_ID_INTENT = "SampleRecord360Activity.USER_ID"
|
|
41
|
+
var USER_TOKEN_INTENT = "SampleRecord360Activity.USER_TOKEN"
|
|
42
|
+
var USER_NAME_INTENT = "SampleRecord360Activity.USER_NAME"
|
|
43
|
+
var USER_PASSWORD_INTENT = "SampleRecord360Activity.PASSWORD"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
android:layout_width="match_parent"
|
|
4
|
+
android:layout_height="match_parent"
|
|
5
|
+
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
6
|
+
android:background="@color/record360_primary">
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
<ImageView
|
|
10
|
+
android:id="@+id/logo"
|
|
11
|
+
android:layout_width="wrap_content"
|
|
12
|
+
android:layout_height="wrap_content"
|
|
13
|
+
android:layout_marginTop="16dp"
|
|
14
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
|
15
|
+
app:layout_constraintEnd_toEndOf="parent"
|
|
16
|
+
app:layout_constraintStart_toStartOf="parent"
|
|
17
|
+
app:layout_constraintTop_toTopOf="parent"
|
|
18
|
+
app:layout_constraintVertical_bias="0.0"
|
|
19
|
+
app:srcCompat="@drawable/record360_logo_white" />
|
|
20
|
+
|
|
21
|
+
<TextView
|
|
22
|
+
android:id="@+id/sub_title"
|
|
23
|
+
android:layout_width="match_parent"
|
|
24
|
+
android:layout_height="wrap_content"
|
|
25
|
+
android:layout_margin="16dp"
|
|
26
|
+
android:text="This is an example of the Record360 SDK"
|
|
27
|
+
android:textAppearance="@style/Record360.Text.H4"
|
|
28
|
+
android:textColor="@color/white"
|
|
29
|
+
android:gravity="center"
|
|
30
|
+
app:layout_constraintStart_toStartOf="parent"
|
|
31
|
+
app:layout_constraintEnd_toEndOf="parent"
|
|
32
|
+
app:layout_constraintTop_toBottomOf="@+id/logo"
|
|
33
|
+
/>
|
|
34
|
+
|
|
35
|
+
<TextView
|
|
36
|
+
android:id="@+id/interface_log"
|
|
37
|
+
android:layout_width="match_parent"
|
|
38
|
+
android:layout_height="0dp"
|
|
39
|
+
android:layout_margin="16dp"
|
|
40
|
+
android:padding="8dp"
|
|
41
|
+
android:scrollbars="vertical"
|
|
42
|
+
android:gravity="bottom"
|
|
43
|
+
android:textAppearance="@style/Record360.Text.Caption"
|
|
44
|
+
android:background="@color/white"
|
|
45
|
+
android:textColor="@color/black"
|
|
46
|
+
app:layout_constraintTop_toBottomOf="@+id/sub_title"
|
|
47
|
+
app:layout_constraintStart_toStartOf="parent"
|
|
48
|
+
app:layout_constraintEnd_toEndOf="parent"
|
|
49
|
+
app:layout_constraintBottom_toTopOf="@+id/unit_id_layout"
|
|
50
|
+
/>
|
|
51
|
+
|
|
52
|
+
<com.google.android.material.textfield.TextInputLayout
|
|
53
|
+
android:id="@+id/unit_id_layout"
|
|
54
|
+
android:layout_width="match_parent"
|
|
55
|
+
android:layout_height="wrap_content"
|
|
56
|
+
android:layout_marginEnd="16dp"
|
|
57
|
+
android:layout_marginStart="16dp"
|
|
58
|
+
android:layout_marginBottom="16dp"
|
|
59
|
+
android:hint="Unit ID"
|
|
60
|
+
android:textColorHint="@color/white"
|
|
61
|
+
app:layout_constraintStart_toStartOf="parent"
|
|
62
|
+
app:layout_constraintEnd_toEndOf="parent"
|
|
63
|
+
app:layout_constraintBottom_toTopOf="@+id/close_button">
|
|
64
|
+
<EditText
|
|
65
|
+
android:id="@+id/unit_id"
|
|
66
|
+
style="@style/Record360.EditText.Theme"
|
|
67
|
+
android:textColor="@color/white"
|
|
68
|
+
android:layout_width="match_parent"
|
|
69
|
+
android:layout_height="wrap_content"/>
|
|
70
|
+
</com.google.android.material.textfield.TextInputLayout>
|
|
71
|
+
|
|
72
|
+
<Button
|
|
73
|
+
android:id="@+id/close_button"
|
|
74
|
+
android:layout_width="match_parent"
|
|
75
|
+
android:layout_height="wrap_content"
|
|
76
|
+
android:layout_margin="16dp"
|
|
77
|
+
android:text="Exit SDK"
|
|
78
|
+
style="@style/Record360.Blue.ButtonStyle"
|
|
79
|
+
app:layout_constraintStart_toStartOf="parent"
|
|
80
|
+
app:layout_constraintEnd_toEndOf="parent"
|
|
81
|
+
app:layout_constraintBottom_toTopOf="@+id/open_sdk_button"/>
|
|
82
|
+
|
|
83
|
+
<Button
|
|
84
|
+
android:id="@+id/open_sdk_button"
|
|
85
|
+
android:layout_width="match_parent"
|
|
86
|
+
android:layout_height="wrap_content"
|
|
87
|
+
android:text="Open R360SDK"
|
|
88
|
+
android:layout_margin="16dp"
|
|
89
|
+
style="@style/Record360.Blue.ButtonStyle"
|
|
90
|
+
app:layout_constraintStart_toStartOf="parent"
|
|
91
|
+
app:layout_constraintEnd_toEndOf="parent"
|
|
92
|
+
app:layout_constraintBottom_toBottomOf="parent"/>
|
|
93
|
+
|
|
94
|
+
</androidx.constraintlayout.widget.ConstraintLayout>
|