@sumsub/cordova-idensic-mobile-sdk-plugin 1.36.1 → 1.37.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/package.json +1 -1
- package/plugin.xml +2 -3
- package/src/android/build-extras.gradle +4 -5
- package/scripts/bump_version +0 -297
- package/src/android/build.gradle +0 -47
- package/src/android/gradlew +0 -172
- package/src/android/gradlew.bat +0 -84
- package/www/SNSMobileSDK.js +0 -302
package/package.json
CHANGED
package/plugin.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8" ?>
|
|
2
|
-
<plugin id="cordova-idensic-mobile-sdk-plugin" version="1.
|
|
2
|
+
<plugin id="cordova-idensic-mobile-sdk-plugin" version="1.37.1" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
|
|
3
3
|
|
|
4
4
|
<name>cordova-idensic-mobile-sdk-plugin</name>
|
|
5
5
|
<description>Cordova plugin exposing SumSub Mobile SDK</description>
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
<feature name="SNSMobileSdkCordovaPlugin">
|
|
21
21
|
<param name="android-package" value="com.sumsub.msdk.plugins.cordova.SNSMobileSdkCordovaPlugin" />
|
|
22
22
|
</feature>
|
|
23
|
-
<preference name="android-targetSdkVersion" value="34" />
|
|
24
23
|
<preference name="android-compileSdkVersion" value="35" />
|
|
25
24
|
<preference name="android-buildToolsVersion" value="35.0.0" />
|
|
26
25
|
</config-file>
|
|
@@ -82,7 +81,7 @@
|
|
|
82
81
|
<source url="https://cdn.cocoapods.org/"/>
|
|
83
82
|
</config>
|
|
84
83
|
<pods>
|
|
85
|
-
<pod name="IdensicMobileSDK" spec="=1.
|
|
84
|
+
<pod name="IdensicMobileSDK" spec="=1.37.1" />
|
|
86
85
|
</pods>
|
|
87
86
|
</podspec>
|
|
88
87
|
|
|
@@ -14,11 +14,10 @@ allprojects {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
dependencies {
|
|
17
|
-
implementation "com.sumsub.sns:idensic-mobile-sdk:1.
|
|
18
|
-
|
|
19
|
-
implementation "com.sumsub.sns:idensic-mobile-sdk-
|
|
20
|
-
implementation "com.sumsub.sns:idensic-mobile-sdk-
|
|
21
|
-
implementation "com.sumsub.sns:idensic-mobile-sdk-nfc:1.36.1"
|
|
17
|
+
implementation "com.sumsub.sns:idensic-mobile-sdk:1.37.1"
|
|
18
|
+
implementation "com.sumsub.sns:idensic-mobile-sdk-videoident:1.37.1"
|
|
19
|
+
implementation "com.sumsub.sns:idensic-mobile-sdk-eid:1.37.1"
|
|
20
|
+
implementation "com.sumsub.sns:idensic-mobile-sdk-nfc:1.37.1"
|
|
22
21
|
|
|
23
22
|
implementation 'com.google.android.material:material:1.8.0'
|
|
24
23
|
}
|
package/scripts/bump_version
DELETED
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
require 'optparse'
|
|
5
|
-
|
|
6
|
-
# Usage:
|
|
7
|
-
# scripts/bump_version <new_version> [--ios=IOS_VERSION] [--android=ANDROID_VERSION]
|
|
8
|
-
#
|
|
9
|
-
# Examples:
|
|
10
|
-
# scripts/bump_version 1.36.0
|
|
11
|
-
# scripts/bump_version 1.36.0 --ios=1.34.0
|
|
12
|
-
# scripts/bump_version 1.36.0 --android=1.35.0
|
|
13
|
-
# scripts/bump_version 1.36.0 --ios=1.34.0 --android=1.35.0
|
|
14
|
-
|
|
15
|
-
options = {}
|
|
16
|
-
parser = OptionParser.new do |opts|
|
|
17
|
-
opts.banner = "Usage: #{$PROGRAM_NAME} <new_version> [options]"
|
|
18
|
-
opts.on("--ios=VERSION", "Override iOS version") do |v|
|
|
19
|
-
options[:ios] = v
|
|
20
|
-
end
|
|
21
|
-
opts.on("--android=VERSION", "Override Android version") do |v|
|
|
22
|
-
options[:android] = v
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
parser.parse!
|
|
27
|
-
abort parser.help if ARGV.empty?
|
|
28
|
-
|
|
29
|
-
new_version = ARGV[0]
|
|
30
|
-
ios_version = options[:ios] || new_version
|
|
31
|
-
android_version = options[:android] || new_version
|
|
32
|
-
android_version_code = new_version.gsub(/\.(\d{1})(?!\d)/, '0$1').gsub(/\D/, '')
|
|
33
|
-
|
|
34
|
-
PATTERNS = [
|
|
35
|
-
{
|
|
36
|
-
file: "demo/plugins/cordova-idensic-mobile-sdk-plugin/src/android/build-extras.gradle",
|
|
37
|
-
platform: :android,
|
|
38
|
-
pattern: /(implementation "com\.sumsub\.sns:idensic-mobile-sdk(-videoident|-eid|-nfc)?:)([\d.]+)(")/,
|
|
39
|
-
replacement: ->(match, ver) {
|
|
40
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(4)}"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
file: "demo/platforms/android/cordova-idensic-mobile-sdk-plugin/SumSubCordova-build-extras.gradle",
|
|
45
|
-
platform: :android,
|
|
46
|
-
pattern: /(implementation "com\.sumsub\.sns:idensic-mobile-sdk(-videoident|-eid|-nfc)?:)([\d.]+)(")/,
|
|
47
|
-
replacement: ->(match, ver) {
|
|
48
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(4)}"
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
file: "src/android/build-extras.gradle",
|
|
53
|
-
platform: :android,
|
|
54
|
-
pattern: /(implementation "com\.sumsub\.sns:idensic-mobile-sdk(-videoident|-eid|-nfc)?:)([\d.]+)(")/,
|
|
55
|
-
replacement: ->(match, ver) {
|
|
56
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(4)}"
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
file: "demo/platforms/ios/SumSubCordova.xcodeproj/project.pbxproj",
|
|
61
|
-
platform: :all,
|
|
62
|
-
pattern: /(\s*MARKETING_VERSION\s*=\s*)([\d.]+)(;)/,
|
|
63
|
-
replacement: ->(match, ver) {
|
|
64
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(3)}"
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
file: "demo/platforms/ios/SumSubCordova.xcodeproj/project.pbxproj",
|
|
69
|
-
platform: :all,
|
|
70
|
-
pattern: /(\s*CURRENT_PROJECT_VERSION\s*=\s*)([\d.]+)(;)/,
|
|
71
|
-
replacement: ->(match, ver) {
|
|
72
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(3)}"
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
file: "demo/platforms/android/android.json",
|
|
77
|
-
platform: :all,
|
|
78
|
-
pattern: /(\s*"cordova-idensic-mobile-sdk-plugin"\s*:\s*")([\d.]+)(",?)/,
|
|
79
|
-
replacement: ->(match, ver) {
|
|
80
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(3)}"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
file: "demo/platforms/ios/platform_www/cordova_plugins.js",
|
|
85
|
-
platform: :all,
|
|
86
|
-
pattern: /(\s*"cordova-idensic-mobile-sdk-plugin"\s*:\s*")([\d.]+)(")/,
|
|
87
|
-
replacement: ->(match, ver) {
|
|
88
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(3)}"
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
file: "demo/platforms/android/platform_www/cordova_plugins.js",
|
|
93
|
-
platform: :all,
|
|
94
|
-
pattern: /(\s*"cordova-idensic-mobile-sdk-plugin"\s*:\s*")([\d.]+)(")/,
|
|
95
|
-
replacement: ->(match, ver) {
|
|
96
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(3)}"
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
file: "demo/plugins/cordova-idensic-mobile-sdk-plugin/package.json",
|
|
101
|
-
platform: :all,
|
|
102
|
-
pattern: /(\s*"version"\s*:\s*")([\d.]+)(")/,
|
|
103
|
-
replacement: ->(match, ver) {
|
|
104
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(3)}"
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
file: "demo/package.json",
|
|
109
|
-
platform: :all,
|
|
110
|
-
pattern: /(\s*"version"\s*:\s*")([\d.]+)(",)/,
|
|
111
|
-
replacement: ->(match, ver) {
|
|
112
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(3)}"
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
file: "package.json",
|
|
117
|
-
platform: :all,
|
|
118
|
-
pattern: /(\s*"version"\s*:\s*")([\d.]+)(",)/,
|
|
119
|
-
replacement: ->(match, ver) {
|
|
120
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(3)}"
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
file: "demo/platforms/ios/pods.json",
|
|
125
|
-
platform: :ios,
|
|
126
|
-
pattern: /(\s*"spec"\s*:\s*"=)([\d.]+)(",)/,
|
|
127
|
-
replacement: ->(match, ver) {
|
|
128
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(3)}"
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
file: "demo/platforms/ios/ios.json",
|
|
133
|
-
platform: :all,
|
|
134
|
-
pattern: /(\s*"cordova-idensic-mobile-sdk-plugin"\s*:\s*"=?)([\d.]+)(")/,
|
|
135
|
-
replacement: ->(match, ver) {
|
|
136
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(3)}"
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
file: "demo/platforms/ios/Podfile",
|
|
141
|
-
platform: :ios,
|
|
142
|
-
pattern: /(pod.*', '=)([\d.]+)(')/,
|
|
143
|
-
replacement: ->(match, ver) {
|
|
144
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(3)}"
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
file: "demo/config.xml",
|
|
149
|
-
platform: :all,
|
|
150
|
-
pattern: /(<widget .*version=")([\d.]+)(")/,
|
|
151
|
-
replacement: ->(match, ver) {
|
|
152
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(3)}"
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
file: "plugin.xml",
|
|
157
|
-
platform: :ios,
|
|
158
|
-
pattern: /(<pod name="IdensicMobileSDK" spec="=)([\d.]+)(")/,
|
|
159
|
-
replacement: ->(match, ver) {
|
|
160
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(3)}"
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
file: "demo/platforms/android/app/src/main/AndroidManifest.xml",
|
|
165
|
-
platform: :all,
|
|
166
|
-
pattern: /(android:versionName=")([\d.]+)(")/,
|
|
167
|
-
replacement: ->(match, ver) {
|
|
168
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(3)}"
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
file: "plugin.xml",
|
|
173
|
-
platform: :all,
|
|
174
|
-
pattern: /(<plugin.*?version=")([\d.]+)(")/,
|
|
175
|
-
replacement: ->(match, ver) {
|
|
176
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(3)}"
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
file: "demo/plugins/cordova-idensic-mobile-sdk-plugin/plugin.xml",
|
|
181
|
-
platform: :all,
|
|
182
|
-
pattern: /(plugin.*?version=")([\d.]+)(")/,
|
|
183
|
-
replacement: ->(match, ver) {
|
|
184
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(3)}"
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
file: "demo/plugins/cordova-idensic-mobile-sdk-plugin/plugin.xml",
|
|
189
|
-
platform: :ios,
|
|
190
|
-
pattern: /(<pod name="IdensicMobileSDK" spec="=)([\d.]+)(")/,
|
|
191
|
-
replacement: ->(match, ver) {
|
|
192
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(3)}"
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
file: "demo/platforms/ios/SumSubCordova/config.xml",
|
|
197
|
-
platform: :all,
|
|
198
|
-
pattern: /(widget.*?version=")([\d.]+)(")/,
|
|
199
|
-
replacement: ->(match, ver) {
|
|
200
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(3)}"
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
file: "demo/platforms/android/app/src/main/res/xml/config.xml",
|
|
205
|
-
platform: :all,
|
|
206
|
-
pattern: /(widget.*?version=")([\d.]+)(")/,
|
|
207
|
-
replacement: ->(match, ver) {
|
|
208
|
-
"#{Regexp.last_match(1)}#{ver}#{Regexp.last_match(3)}"
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
{
|
|
214
|
-
file: "demo/config.xml",
|
|
215
|
-
platform: :all,
|
|
216
|
-
pattern: /(widget.*?android-versionCode=")([\d.]+)(")/,
|
|
217
|
-
replacement: ->(match, ver) {
|
|
218
|
-
"#{Regexp.last_match(1)}#{android_version_code}#{Regexp.last_match(3)}"
|
|
219
|
-
}
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
file: "demo/platforms/android/app/src/main/AndroidManifest.xml",
|
|
223
|
-
platform: :all,
|
|
224
|
-
pattern: /(manifest.*?android:versionCode=")([\d.]+)(")/,
|
|
225
|
-
replacement: ->(match, ver) {
|
|
226
|
-
"#{Regexp.last_match(1)}#{android_version_code}#{Regexp.last_match(3)}"
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
file: "demo/platforms/android/app/src/main/res/xml/config.xml",
|
|
231
|
-
platform: :all,
|
|
232
|
-
pattern: /(widget.*?android-versionCode=")([\d.]+)(")/,
|
|
233
|
-
replacement: ->(match, ver) {
|
|
234
|
-
"#{Regexp.last_match(1)}#{android_version_code}#{Regexp.last_match(3)}"
|
|
235
|
-
}
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
file: "demo/platforms/ios/SumSubCordova/config.xml",
|
|
239
|
-
platform: :all,
|
|
240
|
-
pattern: /(widget.*?android-versionCode=")([\d.]+)(")/,
|
|
241
|
-
replacement: ->(match, ver) {
|
|
242
|
-
"#{Regexp.last_match(1)}#{android_version_code}#{Regexp.last_match(3)}"
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
]
|
|
246
|
-
|
|
247
|
-
PATTERNS.each do |entry|
|
|
248
|
-
file_path = entry[:file]
|
|
249
|
-
platform = entry[:platform]
|
|
250
|
-
|
|
251
|
-
unless File.exist?(file_path)
|
|
252
|
-
warn "Warning: File #{file_path} not found; skipping."
|
|
253
|
-
next
|
|
254
|
-
end
|
|
255
|
-
|
|
256
|
-
version_used =
|
|
257
|
-
case platform
|
|
258
|
-
when :ios then ios_version
|
|
259
|
-
when :android then android_version
|
|
260
|
-
else new_version
|
|
261
|
-
end
|
|
262
|
-
|
|
263
|
-
file_data = File.read(file_path)
|
|
264
|
-
updated_data = file_data.gsub(entry[:pattern]) do |match|
|
|
265
|
-
entry[:replacement].call(match, version_used)
|
|
266
|
-
end
|
|
267
|
-
|
|
268
|
-
if updated_data != file_data
|
|
269
|
-
File.write(file_path, updated_data)
|
|
270
|
-
puts "Updated #{file_path}"
|
|
271
|
-
end
|
|
272
|
-
end
|
|
273
|
-
|
|
274
|
-
unless system("/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion #{new_version}\" 'demo/platforms/ios/SumSubCordova/SumSubCordova-Info.plist'")
|
|
275
|
-
abort("Error: Failed to update plist.".red)
|
|
276
|
-
end
|
|
277
|
-
|
|
278
|
-
unless system("/usr/libexec/PlistBuddy -c \"Set :CFBundleShortVersionString #{new_version}\" 'demo/platforms/ios/SumSubCordova/SumSubCordova-Info.plist'")
|
|
279
|
-
abort("Error: Failed to update plist.".red)
|
|
280
|
-
end
|
|
281
|
-
|
|
282
|
-
system("npm install")
|
|
283
|
-
|
|
284
|
-
Dir.chdir("demo") do
|
|
285
|
-
system("bundle install")
|
|
286
|
-
system("npm install")
|
|
287
|
-
|
|
288
|
-
system("cd platforms/ios && bundle exec pod update IdensicMobileSDK")
|
|
289
|
-
end
|
|
290
|
-
|
|
291
|
-
changed_files = PATTERNS.map { |entry| entry[:file] }.uniq
|
|
292
|
-
changed_files << "demo/platform/ios/Podfile.lock"
|
|
293
|
-
|
|
294
|
-
system("git add #{changed_files.join(' ')}")
|
|
295
|
-
system("git commit -m 'Bump version to #{new_version}'")
|
|
296
|
-
|
|
297
|
-
puts "Done updating version to #{new_version}"
|
package/src/android/build.gradle
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
buildscript {
|
|
2
|
-
apply from: rootProject.file("dependencies.gradle")
|
|
3
|
-
repositories {
|
|
4
|
-
google()
|
|
5
|
-
mavelCentral()
|
|
6
|
-
}
|
|
7
|
-
dependencies {
|
|
8
|
-
classpath deps.build.androidPlugin
|
|
9
|
-
classpath deps.build.kotlinPlugin
|
|
10
|
-
classpath deps.build.butterknifePlugin
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
plugins {
|
|
15
|
-
id "maven"
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
apply plugin: 'com.android.library'
|
|
19
|
-
|
|
20
|
-
rootProject.allprojects {
|
|
21
|
-
repositories {
|
|
22
|
-
google()
|
|
23
|
-
maven { url "https://maven.sumsub.com/repository/maven-public/" }
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
android {
|
|
28
|
-
compileSdkVersion 35
|
|
29
|
-
defaultConfig {
|
|
30
|
-
minSdkVersion 23
|
|
31
|
-
targetSdkVersion 35
|
|
32
|
-
versionCode 1
|
|
33
|
-
versionName "1.0"
|
|
34
|
-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
|
35
|
-
}
|
|
36
|
-
buildTypes {
|
|
37
|
-
release {
|
|
38
|
-
minifyEnabled false
|
|
39
|
-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
dependencies {
|
|
45
|
-
implementation 'com.google.android.material:material:1.7.0'
|
|
46
|
-
implementation 'org.apache.cordova:framework:8.1.0'
|
|
47
|
-
}
|
package/src/android/gradlew
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env sh
|
|
2
|
-
|
|
3
|
-
##############################################################################
|
|
4
|
-
##
|
|
5
|
-
## Gradle start up script for UN*X
|
|
6
|
-
##
|
|
7
|
-
##############################################################################
|
|
8
|
-
|
|
9
|
-
# Attempt to set APP_HOME
|
|
10
|
-
# Resolve links: $0 may be a link
|
|
11
|
-
PRG="$0"
|
|
12
|
-
# Need this for relative symlinks.
|
|
13
|
-
while [ -h "$PRG" ] ; do
|
|
14
|
-
ls=`ls -ld "$PRG"`
|
|
15
|
-
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
16
|
-
if expr "$link" : '/.*' > /dev/null; then
|
|
17
|
-
PRG="$link"
|
|
18
|
-
else
|
|
19
|
-
PRG=`dirname "$PRG"`"/$link"
|
|
20
|
-
fi
|
|
21
|
-
done
|
|
22
|
-
SAVED="`pwd`"
|
|
23
|
-
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
24
|
-
APP_HOME="`pwd -P`"
|
|
25
|
-
cd "$SAVED" >/dev/null
|
|
26
|
-
|
|
27
|
-
APP_NAME="Gradle"
|
|
28
|
-
APP_BASE_NAME=`basename "$0"`
|
|
29
|
-
|
|
30
|
-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
31
|
-
DEFAULT_JVM_OPTS=""
|
|
32
|
-
|
|
33
|
-
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
34
|
-
MAX_FD="maximum"
|
|
35
|
-
|
|
36
|
-
warn () {
|
|
37
|
-
echo "$*"
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
die () {
|
|
41
|
-
echo
|
|
42
|
-
echo "$*"
|
|
43
|
-
echo
|
|
44
|
-
exit 1
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
# OS specific support (must be 'true' or 'false').
|
|
48
|
-
cygwin=false
|
|
49
|
-
msys=false
|
|
50
|
-
darwin=false
|
|
51
|
-
nonstop=false
|
|
52
|
-
case "`uname`" in
|
|
53
|
-
CYGWIN* )
|
|
54
|
-
cygwin=true
|
|
55
|
-
;;
|
|
56
|
-
Darwin* )
|
|
57
|
-
darwin=true
|
|
58
|
-
;;
|
|
59
|
-
MINGW* )
|
|
60
|
-
msys=true
|
|
61
|
-
;;
|
|
62
|
-
NONSTOP* )
|
|
63
|
-
nonstop=true
|
|
64
|
-
;;
|
|
65
|
-
esac
|
|
66
|
-
|
|
67
|
-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
68
|
-
|
|
69
|
-
# Determine the Java command to use to start the JVM.
|
|
70
|
-
if [ -n "$JAVA_HOME" ] ; then
|
|
71
|
-
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
72
|
-
# IBM's JDK on AIX uses strange locations for the executables
|
|
73
|
-
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
74
|
-
else
|
|
75
|
-
JAVACMD="$JAVA_HOME/bin/java"
|
|
76
|
-
fi
|
|
77
|
-
if [ ! -x "$JAVACMD" ] ; then
|
|
78
|
-
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
79
|
-
|
|
80
|
-
Please set the JAVA_HOME variable in your environment to match the
|
|
81
|
-
location of your Java installation."
|
|
82
|
-
fi
|
|
83
|
-
else
|
|
84
|
-
JAVACMD="java"
|
|
85
|
-
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
86
|
-
|
|
87
|
-
Please set the JAVA_HOME variable in your environment to match the
|
|
88
|
-
location of your Java installation."
|
|
89
|
-
fi
|
|
90
|
-
|
|
91
|
-
# Increase the maximum file descriptors if we can.
|
|
92
|
-
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
|
93
|
-
MAX_FD_LIMIT=`ulimit -H -n`
|
|
94
|
-
if [ $? -eq 0 ] ; then
|
|
95
|
-
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
|
96
|
-
MAX_FD="$MAX_FD_LIMIT"
|
|
97
|
-
fi
|
|
98
|
-
ulimit -n $MAX_FD
|
|
99
|
-
if [ $? -ne 0 ] ; then
|
|
100
|
-
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
|
101
|
-
fi
|
|
102
|
-
else
|
|
103
|
-
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
|
104
|
-
fi
|
|
105
|
-
fi
|
|
106
|
-
|
|
107
|
-
# For Darwin, add options to specify how the application appears in the dock
|
|
108
|
-
if $darwin; then
|
|
109
|
-
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
110
|
-
fi
|
|
111
|
-
|
|
112
|
-
# For Cygwin, switch paths to Windows format before running java
|
|
113
|
-
if $cygwin ; then
|
|
114
|
-
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
115
|
-
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
116
|
-
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
117
|
-
|
|
118
|
-
# We build the pattern for arguments to be converted via cygpath
|
|
119
|
-
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
120
|
-
SEP=""
|
|
121
|
-
for dir in $ROOTDIRSRAW ; do
|
|
122
|
-
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
123
|
-
SEP="|"
|
|
124
|
-
done
|
|
125
|
-
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
126
|
-
# Add a user-defined pattern to the cygpath arguments
|
|
127
|
-
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
128
|
-
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
129
|
-
fi
|
|
130
|
-
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
131
|
-
i=0
|
|
132
|
-
for arg in "$@" ; do
|
|
133
|
-
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
134
|
-
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
135
|
-
|
|
136
|
-
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
137
|
-
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
138
|
-
else
|
|
139
|
-
eval `echo args$i`="\"$arg\""
|
|
140
|
-
fi
|
|
141
|
-
i=$((i+1))
|
|
142
|
-
done
|
|
143
|
-
case $i in
|
|
144
|
-
(0) set -- ;;
|
|
145
|
-
(1) set -- "$args0" ;;
|
|
146
|
-
(2) set -- "$args0" "$args1" ;;
|
|
147
|
-
(3) set -- "$args0" "$args1" "$args2" ;;
|
|
148
|
-
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
149
|
-
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
150
|
-
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
151
|
-
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
152
|
-
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
153
|
-
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
154
|
-
esac
|
|
155
|
-
fi
|
|
156
|
-
|
|
157
|
-
# Escape application args
|
|
158
|
-
save () {
|
|
159
|
-
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
|
160
|
-
echo " "
|
|
161
|
-
}
|
|
162
|
-
APP_ARGS=$(save "$@")
|
|
163
|
-
|
|
164
|
-
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
|
165
|
-
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
|
166
|
-
|
|
167
|
-
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
|
168
|
-
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
169
|
-
cd "$(dirname "$0")"
|
|
170
|
-
fi
|
|
171
|
-
|
|
172
|
-
exec "$JAVACMD" "$@"
|
package/src/android/gradlew.bat
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
@if "%DEBUG%" == "" @echo off
|
|
2
|
-
@rem ##########################################################################
|
|
3
|
-
@rem
|
|
4
|
-
@rem Gradle startup script for Windows
|
|
5
|
-
@rem
|
|
6
|
-
@rem ##########################################################################
|
|
7
|
-
|
|
8
|
-
@rem Set local scope for the variables with windows NT shell
|
|
9
|
-
if "%OS%"=="Windows_NT" setlocal
|
|
10
|
-
|
|
11
|
-
set DIRNAME=%~dp0
|
|
12
|
-
if "%DIRNAME%" == "" set DIRNAME=.
|
|
13
|
-
set APP_BASE_NAME=%~n0
|
|
14
|
-
set APP_HOME=%DIRNAME%
|
|
15
|
-
|
|
16
|
-
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
17
|
-
set DEFAULT_JVM_OPTS=
|
|
18
|
-
|
|
19
|
-
@rem Find java.exe
|
|
20
|
-
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
21
|
-
|
|
22
|
-
set JAVA_EXE=java.exe
|
|
23
|
-
%JAVA_EXE% -version >NUL 2>&1
|
|
24
|
-
if "%ERRORLEVEL%" == "0" goto init
|
|
25
|
-
|
|
26
|
-
echo.
|
|
27
|
-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
28
|
-
echo.
|
|
29
|
-
echo Please set the JAVA_HOME variable in your environment to match the
|
|
30
|
-
echo location of your Java installation.
|
|
31
|
-
|
|
32
|
-
goto fail
|
|
33
|
-
|
|
34
|
-
:findJavaFromJavaHome
|
|
35
|
-
set JAVA_HOME=%JAVA_HOME:"=%
|
|
36
|
-
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
37
|
-
|
|
38
|
-
if exist "%JAVA_EXE%" goto init
|
|
39
|
-
|
|
40
|
-
echo.
|
|
41
|
-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
|
42
|
-
echo.
|
|
43
|
-
echo Please set the JAVA_HOME variable in your environment to match the
|
|
44
|
-
echo location of your Java installation.
|
|
45
|
-
|
|
46
|
-
goto fail
|
|
47
|
-
|
|
48
|
-
:init
|
|
49
|
-
@rem Get command-line arguments, handling Windows variants
|
|
50
|
-
|
|
51
|
-
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
52
|
-
|
|
53
|
-
:win9xME_args
|
|
54
|
-
@rem Slurp the command line arguments.
|
|
55
|
-
set CMD_LINE_ARGS=
|
|
56
|
-
set _SKIP=2
|
|
57
|
-
|
|
58
|
-
:win9xME_args_slurp
|
|
59
|
-
if "x%~1" == "x" goto execute
|
|
60
|
-
|
|
61
|
-
set CMD_LINE_ARGS=%*
|
|
62
|
-
|
|
63
|
-
:execute
|
|
64
|
-
@rem Setup the command line
|
|
65
|
-
|
|
66
|
-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
67
|
-
|
|
68
|
-
@rem Execute Gradle
|
|
69
|
-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
|
70
|
-
|
|
71
|
-
:end
|
|
72
|
-
@rem End local scope for the variables with windows NT shell
|
|
73
|
-
if "%ERRORLEVEL%"=="0" goto mainEnd
|
|
74
|
-
|
|
75
|
-
:fail
|
|
76
|
-
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
77
|
-
rem the _cmd.exe /c_ return code!
|
|
78
|
-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
|
79
|
-
exit /b 1
|
|
80
|
-
|
|
81
|
-
:mainEnd
|
|
82
|
-
if "%OS%"=="Windows_NT" endlocal
|
|
83
|
-
|
|
84
|
-
:omega
|
package/www/SNSMobileSDK.js
DELETED
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-unresolved
|
|
2
|
-
const exec = require('cordova/exec');
|
|
3
|
-
|
|
4
|
-
const PLUGIN_NAME = 'SNSMobileSdkCordovaPlugin';
|
|
5
|
-
|
|
6
|
-
const LAUNCH_SUMSUB_SDK_ACTION = 'launchSNSMobileSDK';
|
|
7
|
-
const SET_NEW_TOKEN_SUMSUB_SDK_ACTION = 'setNewAccessToken';
|
|
8
|
-
const DISMISS_ACTION = 'dismiss';
|
|
9
|
-
|
|
10
|
-
const SUMSUB_SDK_HANDLERS = {
|
|
11
|
-
'onStatusChanged': null,
|
|
12
|
-
'onEvent': null,
|
|
13
|
-
'onActionResult': 'onActionResultCompleted'
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/*
|
|
17
|
-
SNSMobileSDK.Builder(apiUrl)
|
|
18
|
-
.withAccessToken($token, () => { return new Promise((resolve, reject) => { resolve("..."); })
|
|
19
|
-
.withModules([..., ...])
|
|
20
|
-
.withDebug(true)
|
|
21
|
-
.withHandlers({
|
|
22
|
-
onCompleted: () => {},
|
|
23
|
-
onError: () => {}
|
|
24
|
-
}).launch()
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
var _currentInstance = null;
|
|
28
|
-
|
|
29
|
-
function SNSMobileSDK(sdkConf) {
|
|
30
|
-
this.sdkConf = sdkConf
|
|
31
|
-
|
|
32
|
-
this.sdkConf.settings["appFrameworkName"] = "cordova";
|
|
33
|
-
// this.sdkConf.settings["appFrameworkVersion"] = "...";
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
SNSMobileSDK.prototype.dismiss = function () {
|
|
37
|
-
exec(
|
|
38
|
-
(result) => {
|
|
39
|
-
},
|
|
40
|
-
(error) => {
|
|
41
|
-
},
|
|
42
|
-
PLUGIN_NAME,
|
|
43
|
-
DISMISS_ACTION,
|
|
44
|
-
[]
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
SNSMobileSDK.prototype.sendEvent = function (name, event) {
|
|
49
|
-
var handler = this.sdkConf.handlers[name];
|
|
50
|
-
|
|
51
|
-
if (!handler) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
var completionAction = SUMSUB_SDK_HANDLERS[name];
|
|
56
|
-
|
|
57
|
-
if (!completionAction) {
|
|
58
|
-
handler(event);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
var onComplete = function (error, result) {
|
|
63
|
-
exec(
|
|
64
|
-
(result) => {
|
|
65
|
-
},
|
|
66
|
-
(error) => {
|
|
67
|
-
},
|
|
68
|
-
PLUGIN_NAME,
|
|
69
|
-
completionAction,
|
|
70
|
-
[{
|
|
71
|
-
"error": error,
|
|
72
|
-
"result": result
|
|
73
|
-
}]
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
handler(event)
|
|
78
|
-
.then(result => {
|
|
79
|
-
onComplete(null, result)
|
|
80
|
-
})
|
|
81
|
-
.catch(error => {
|
|
82
|
-
onComplete(error || new Error("rejected"), null)
|
|
83
|
-
})
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
SNSMobileSDK.prototype.getNewAccessToken = function () {
|
|
87
|
-
var onComplete = function (newToken) {
|
|
88
|
-
exec(
|
|
89
|
-
(result) => {
|
|
90
|
-
},
|
|
91
|
-
(error) => {
|
|
92
|
-
},
|
|
93
|
-
PLUGIN_NAME,
|
|
94
|
-
SET_NEW_TOKEN_SUMSUB_SDK_ACTION,
|
|
95
|
-
[newToken]
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
this.sdkConf.tokenExpirationHandler()
|
|
100
|
-
.then(newToken => {
|
|
101
|
-
onComplete(newToken)
|
|
102
|
-
})
|
|
103
|
-
.catch(err => {
|
|
104
|
-
console.error(err instanceof Error ? err.message : err)
|
|
105
|
-
onComplete(null)
|
|
106
|
-
})
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
SNSMobileSDK.prototype.launch = function () {
|
|
110
|
-
let _that = this;
|
|
111
|
-
console.log("InSumSub", JSON.stringify(this.sdkConf));
|
|
112
|
-
return new Promise((resolve, reject) => {
|
|
113
|
-
if (_currentInstance) {
|
|
114
|
-
reject(new Error("Aborted since another instance is in use!"));
|
|
115
|
-
}
|
|
116
|
-
else if (!_that.sdkConf.accessToken) {
|
|
117
|
-
reject(new Error('Access token is required'));
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
_currentInstance = _that
|
|
121
|
-
exec(
|
|
122
|
-
(result) => {
|
|
123
|
-
_currentInstance = null
|
|
124
|
-
console.log("Promise SumSub Result", JSON.stringify(result));
|
|
125
|
-
resolve(result);
|
|
126
|
-
},
|
|
127
|
-
(error) => {
|
|
128
|
-
_currentInstance = null
|
|
129
|
-
console.log("Promise SumSub Error", JSON.stringify(error));
|
|
130
|
-
reject(error);
|
|
131
|
-
},
|
|
132
|
-
PLUGIN_NAME,
|
|
133
|
-
LAUNCH_SUMSUB_SDK_ACTION,
|
|
134
|
-
[_that.sdkConf],
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function Builder() {
|
|
141
|
-
this.debug = false;
|
|
142
|
-
this.handlers = {};
|
|
143
|
-
this.applicantConf = {};
|
|
144
|
-
this.preferredDocumentDefinitions = {};
|
|
145
|
-
this.autoCloseOnApprove = 3;
|
|
146
|
-
this.settings = {};
|
|
147
|
-
return this;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
Builder.prototype.withAccessToken = function (accessToken, expirationHandler) {
|
|
151
|
-
this.accessToken = accessToken
|
|
152
|
-
if (!expirationHandler || typeof expirationHandler !== 'function') {
|
|
153
|
-
throw new Error('Invalid parameter, "expirationHandler" must be a function')
|
|
154
|
-
}
|
|
155
|
-
this.tokenExpirationHandler = expirationHandler
|
|
156
|
-
return this
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
Builder.prototype.withHandlers = function (handlers) {
|
|
160
|
-
|
|
161
|
-
if (!handlers || typeof handlers !== 'object') {
|
|
162
|
-
throw new Error('Invalid parameter, "withHandlers" expects a hash')
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
Object.keys(SUMSUB_SDK_HANDLERS).forEach(name => {
|
|
166
|
-
var handler = handlers[name];
|
|
167
|
-
if (handler) {
|
|
168
|
-
if (typeof handler !== 'function') {
|
|
169
|
-
throw new Error('Invalid handler, "'+name+'" must be a function')
|
|
170
|
-
}
|
|
171
|
-
this.handlers[name] = handler;
|
|
172
|
-
}
|
|
173
|
-
})
|
|
174
|
-
|
|
175
|
-
return this
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
Builder.prototype.withDebug = function (flag) {
|
|
179
|
-
if (typeof flag !== 'boolean') {
|
|
180
|
-
throw new Error('Invalid parameter, "withDebug" expects a boolean');
|
|
181
|
-
}
|
|
182
|
-
this.debug = flag;
|
|
183
|
-
return this;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
Builder.prototype.withAnalyticsEnabled = function (flag) {
|
|
187
|
-
if (typeof flag !== 'boolean') {
|
|
188
|
-
throw new Error('Invalid parameter, "withAnalyticsEnabled" expects a boolean');
|
|
189
|
-
}
|
|
190
|
-
this.isAnalyticsEnabled = flag;
|
|
191
|
-
return this;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
Builder.prototype.withLocale = function (locale) {
|
|
195
|
-
if (typeof locale !== 'string') {
|
|
196
|
-
throw new Error('Invalid parameter, "locale" must be a string');
|
|
197
|
-
}
|
|
198
|
-
this.locale = locale;
|
|
199
|
-
return this;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
Builder.prototype.withApplicantConf = function (applicantConf) {
|
|
203
|
-
if (!applicantConf || typeof applicantConf !== 'object') {
|
|
204
|
-
throw new Error('Invalid parameter, "withApplicantConf" expects a hash');
|
|
205
|
-
}
|
|
206
|
-
this.applicantConf = applicantConf;
|
|
207
|
-
return this
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
Builder.prototype.withPreferredDocumentDefinitions = function (preferredDocumentDefinitions) {
|
|
211
|
-
if (!preferredDocumentDefinitions || typeof preferredDocumentDefinitions !== 'object') {
|
|
212
|
-
throw new Error('Invalid parameter, "withPreferredDocumentDefinitions" expects a hash');
|
|
213
|
-
}
|
|
214
|
-
this.preferredDocumentDefinitions = preferredDocumentDefinitions;
|
|
215
|
-
return this
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
Builder.prototype.withSettings = function (settings) {
|
|
219
|
-
if (!settings || typeof settings !== 'object') {
|
|
220
|
-
throw new Error('Invalid parameter, "withSettings" expects a hash');
|
|
221
|
-
}
|
|
222
|
-
this.settings = settings;
|
|
223
|
-
return this
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
Builder.prototype.withStrings = function (strings) {
|
|
227
|
-
|
|
228
|
-
if (!strings || typeof strings !== 'object') {
|
|
229
|
-
throw new Error('Invalid parameter, "withStrings" expects a hash')
|
|
230
|
-
}
|
|
231
|
-
this.strings = strings;
|
|
232
|
-
return this
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
Builder.prototype.withTheme = function (theme) {
|
|
236
|
-
if (!theme || typeof theme !== 'object') {
|
|
237
|
-
throw new Error('Invalid parameter, "withTheme" expects a hash')
|
|
238
|
-
}
|
|
239
|
-
this.theme = theme;
|
|
240
|
-
return this
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
Builder.prototype.withBaseUrl = function (apiUrl) {
|
|
244
|
-
if (typeof apiUrl !== 'string') {
|
|
245
|
-
throw new Error('Invalid parameter, "baseUrl" must be a string');
|
|
246
|
-
}
|
|
247
|
-
this.apiUrl = apiUrl;
|
|
248
|
-
return this;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
Builder.prototype.withAutoCloseOnApprove = function (autoCloseOnApprove) {
|
|
252
|
-
if (typeof autoCloseOnApprove !== 'number') {
|
|
253
|
-
throw new Error('Invalid parameter, "autoCloseOnApprove" expects a number')
|
|
254
|
-
}
|
|
255
|
-
this.autoCloseOnApprove = autoCloseOnApprove;
|
|
256
|
-
return this
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
Builder.prototype.build = function () {
|
|
260
|
-
|
|
261
|
-
var hasHandlers = {}
|
|
262
|
-
Object.keys(this.handlers).forEach(name => {
|
|
263
|
-
hasHandlers[name] = true;
|
|
264
|
-
})
|
|
265
|
-
|
|
266
|
-
return new SNSMobileSDK({
|
|
267
|
-
apiUrl: this.apiUrl,
|
|
268
|
-
accessToken: this.accessToken,
|
|
269
|
-
tokenExpirationHandler: this.tokenExpirationHandler,
|
|
270
|
-
handlers: this.handlers,
|
|
271
|
-
hasHandlers: hasHandlers,
|
|
272
|
-
locale: this.locale,
|
|
273
|
-
applicantConf: this.applicantConf,
|
|
274
|
-
preferredDocumentDefinitions: this.preferredDocumentDefinitions,
|
|
275
|
-
settings: this.settings,
|
|
276
|
-
theme: this.theme,
|
|
277
|
-
strings: this.strings,
|
|
278
|
-
isAnalyticsEnabled: this.isAnalyticsEnabled,
|
|
279
|
-
autoCloseOnApprove: this.autoCloseOnApprove,
|
|
280
|
-
debug: this.debug,
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
module.exports = {
|
|
286
|
-
init: function (accessToken, expirationHandler) {
|
|
287
|
-
return new Builder().withAccessToken(accessToken, expirationHandler)
|
|
288
|
-
},
|
|
289
|
-
getNewAccessToken: function () {
|
|
290
|
-
if (_currentInstance) {
|
|
291
|
-
_currentInstance.getNewAccessToken()
|
|
292
|
-
}
|
|
293
|
-
},
|
|
294
|
-
sendEvent: function (name, event) {
|
|
295
|
-
if (_currentInstance) {
|
|
296
|
-
_currentInstance.sendEvent(name, event)
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
|
-
reset: function() {
|
|
300
|
-
_currentInstance = null
|
|
301
|
-
}
|
|
302
|
-
};
|