expo-geetest-onelogin 0.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.
Files changed (46) hide show
  1. package/.eslintrc.js +5 -0
  2. package/LICENSE +21 -0
  3. package/README.md +2 -0
  4. package/android/build.gradle +91 -0
  5. package/android/src/main/AndroidManifest.xml +2 -0
  6. package/android/src/main/java/expo/modules/geetestonelogin/DTO.kt +378 -0
  7. package/android/src/main/java/expo/modules/geetestonelogin/ExpoGeetestOneloginModule.kt +271 -0
  8. package/android/src/main/java/expo/modules/geetestonelogin/ExpoGeetestOneloginView.kt +7 -0
  9. package/build/ExpoGeetestOnelogin.types.d.ts +770 -0
  10. package/build/ExpoGeetestOnelogin.types.d.ts.map +1 -0
  11. package/build/ExpoGeetestOnelogin.types.js +2 -0
  12. package/build/ExpoGeetestOnelogin.types.js.map +1 -0
  13. package/build/ExpoGeetestOneloginModule.d.ts +3 -0
  14. package/build/ExpoGeetestOneloginModule.d.ts.map +1 -0
  15. package/build/ExpoGeetestOneloginModule.js +5 -0
  16. package/build/ExpoGeetestOneloginModule.js.map +1 -0
  17. package/build/ExpoGeetestOneloginModule.web.d.ts +7 -0
  18. package/build/ExpoGeetestOneloginModule.web.d.ts.map +1 -0
  19. package/build/ExpoGeetestOneloginModule.web.js +12 -0
  20. package/build/ExpoGeetestOneloginModule.web.js.map +1 -0
  21. package/build/ExpoGeetestOneloginView.d.ts +4 -0
  22. package/build/ExpoGeetestOneloginView.d.ts.map +1 -0
  23. package/build/ExpoGeetestOneloginView.js +7 -0
  24. package/build/ExpoGeetestOneloginView.js.map +1 -0
  25. package/build/ExpoGeetestOneloginView.web.d.ts +4 -0
  26. package/build/ExpoGeetestOneloginView.web.d.ts.map +1 -0
  27. package/build/ExpoGeetestOneloginView.web.js +6 -0
  28. package/build/ExpoGeetestOneloginView.web.js.map +1 -0
  29. package/build/index.d.ts +40 -0
  30. package/build/index.d.ts.map +1 -0
  31. package/build/index.js +132 -0
  32. package/build/index.js.map +1 -0
  33. package/expo-module.config.json +9 -0
  34. package/ios/Bridging-Header.h +13 -0
  35. package/ios/DTO.swift +1031 -0
  36. package/ios/ExpoGeetestOnelogin.podspec +29 -0
  37. package/ios/ExpoGeetestOneloginModule.swift +342 -0
  38. package/ios/ExpoGeetestOneloginView.swift +7 -0
  39. package/package.json +67 -0
  40. package/src/ExpoGeetestOnelogin.types.ts +939 -0
  41. package/src/ExpoGeetestOneloginModule.ts +5 -0
  42. package/src/ExpoGeetestOneloginModule.web.ts +13 -0
  43. package/src/ExpoGeetestOneloginView.tsx +11 -0
  44. package/src/ExpoGeetestOneloginView.web.tsx +11 -0
  45. package/src/index.ts +174 -0
  46. package/tsconfig.json +9 -0
package/.eslintrc.js ADDED
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: ['universe/native', 'universe/web'],
4
+ ignorePatterns: ['build'],
5
+ };
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Flickering-AI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # expo-geetest-onelogin
2
+ react native plugin for https://docs.geetest.com/onelogin/overview/prodes
@@ -0,0 +1,91 @@
1
+ apply plugin: 'com.android.library'
2
+ apply plugin: 'kotlin-android'
3
+ apply plugin: 'maven-publish'
4
+
5
+ group = 'expo.modules.geetestonelogin'
6
+ version = '0.1.0'
7
+
8
+ buildscript {
9
+ def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
10
+ if (expoModulesCorePlugin.exists()) {
11
+ apply from: expoModulesCorePlugin
12
+ applyKotlinExpoModulesCorePlugin()
13
+ }
14
+
15
+ // Simple helper that allows the root project to override versions declared by this library.
16
+ ext.safeExtGet = { prop, fallback ->
17
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
18
+ }
19
+
20
+ // Ensures backward compatibility
21
+ ext.getKotlinVersion = {
22
+ if (ext.has("kotlinVersion")) {
23
+ ext.kotlinVersion()
24
+ } else {
25
+ ext.safeExtGet("kotlinVersion", "1.8.10")
26
+ }
27
+ }
28
+
29
+ repositories {
30
+ mavenCentral()
31
+ }
32
+
33
+ dependencies {
34
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
35
+ }
36
+ }
37
+
38
+ afterEvaluate {
39
+ publishing {
40
+ publications {
41
+ release(MavenPublication) {
42
+ from components.release
43
+ }
44
+ }
45
+ repositories {
46
+ maven {
47
+ url = mavenLocal().url
48
+ }
49
+ }
50
+ }
51
+ }
52
+
53
+ android {
54
+ compileSdkVersion safeExtGet("compileSdkVersion", 33)
55
+
56
+ compileOptions {
57
+ sourceCompatibility JavaVersion.VERSION_11
58
+ targetCompatibility JavaVersion.VERSION_11
59
+ }
60
+
61
+ kotlinOptions {
62
+ jvmTarget = JavaVersion.VERSION_11.majorVersion
63
+ }
64
+
65
+ namespace "expo.modules.geetestonelogin"
66
+ defaultConfig {
67
+ minSdkVersion safeExtGet("minSdkVersion", 21)
68
+ targetSdkVersion safeExtGet("targetSdkVersion", 33)
69
+ versionCode 1
70
+ versionName "0.1.0"
71
+ }
72
+ lintOptions {
73
+ abortOnError false
74
+ }
75
+ publishing {
76
+ singleVariant("release") {
77
+ withSourcesJar()
78
+ }
79
+ }
80
+ }
81
+
82
+ repositories {
83
+ mavenCentral()
84
+ }
85
+
86
+ dependencies {
87
+ implementation project(':expo-modules-core')
88
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
89
+
90
+ api 'com.geetest.android:onelogin:2.8.4'
91
+ }
@@ -0,0 +1,2 @@
1
+ <manifest>
2
+ </manifest>
@@ -0,0 +1,378 @@
1
+ package expo.modules.geetestonelogin
2
+
3
+ import android.content.Context
4
+ import android.graphics.Color
5
+ import android.widget.ImageView
6
+ import android.widget.RelativeLayout
7
+ import androidx.annotation.ColorInt
8
+ import expo.modules.kotlin.records.Field
9
+ import expo.modules.kotlin.records.Record
10
+ import org.json.JSONArray
11
+ import org.json.JSONObject
12
+
13
+ fun JSONObject.toMap(): Map<String, *> = keys().asSequence().associateWith {
14
+ when (val value = this[it]) {
15
+ is JSONArray -> {
16
+ val map = (0 until value.length()).associate { Pair(it.toString(), value[it]) }
17
+ JSONObject(map).toMap().values.toList()
18
+ }
19
+
20
+ is JSONObject -> value.toMap()
21
+ JSONObject.NULL -> null
22
+ else -> value
23
+ }
24
+ }
25
+
26
+ class RNOneLoginThemeConfigStatusBar : Record {
27
+ @Field @ColorInt
28
+ val statusBarColor: Int = 0
29
+ @Field
30
+ val statusBarStyle: String = "UserInterfaceStyle.UNSPECIFIED"
31
+ @Field
32
+ val bgLayoutInStatusBar: Boolean = false
33
+ }
34
+
35
+ class RNOneLoginThemeConfigDialogTheme : Record {
36
+ @Field
37
+ val isDialogTheme: Boolean = false
38
+ @Field
39
+ val dialogWidth: Int = 0
40
+ @Field
41
+ val dialogHeight: Int = 0
42
+ @Field
43
+ val dialogX: Int = 0
44
+ @Field
45
+ val dialogY: Int = 0
46
+ @Field
47
+ val isDialogBottom: Boolean = false
48
+ @Field
49
+ val isWebViewDialogTheme: Boolean = false
50
+ }
51
+
52
+ class RNOneLoginThemeConfigAuthNavLayout : Record {
53
+ @Field @ColorInt
54
+ val navColor: Int = 0
55
+ @Field
56
+ val authNavHeight: Int = 0
57
+ @Field
58
+ val authNavTransparent: Boolean = false
59
+ @Field
60
+ val authNavGone: Boolean = false
61
+ }
62
+
63
+ class RNOneLoginThemeConfigAuthNavTextView : Record {
64
+ @Field
65
+ val navText: String = ""
66
+ @Field @ColorInt
67
+ val navTextColor: Int = 0
68
+ @Field
69
+ val navTextSize: Int = 0
70
+ @Field
71
+ val navWebTextNormal: Boolean = false
72
+ @Field
73
+ val navWebText: String = ""
74
+ @Field @ColorInt
75
+ val navWebTextColor: Int = 0
76
+ @Field
77
+ val navWebTextSize: Int = 0
78
+ @Field
79
+ val navTextMargin: Int = 0
80
+ }
81
+
82
+ class RNOneLoginThemeConfigSwitchViewLayout : Record {
83
+ @Field
84
+ val switchImgPath: String = ""
85
+ @Field
86
+ val switchWidth: Int = 0
87
+ @Field
88
+ val switchHeight: Int = 0
89
+ }
90
+
91
+ class RNOneLoginThemeConfigLogBtnTextView : Record {
92
+ @Field
93
+ val logBtnText: String = ""
94
+ @Field @ColorInt
95
+ val logBtnColor: Int = 0
96
+ @Field
97
+ val logBtnTextSize: Int = 0
98
+ }
99
+
100
+ class RNOneLoginThemeConfigLogBtnLoadingView : Record {
101
+ @Field
102
+ val loadingView: String = ""
103
+ @Field
104
+ val loadingViewWidth: Int = 0
105
+ @Field
106
+ val loadingViewHeight: Int = 0
107
+ @Field
108
+ val loadingViewOffsetRight: Int = 0
109
+ }
110
+
111
+ class RNOneLoginThemeConfigPrivacyClauseText : Record {
112
+ @Field
113
+ val clauseNameOne: String = ""
114
+ @Field
115
+ val clauseUrlOne: String = ""
116
+ @Field
117
+ val clauseNameTwo: String = ""
118
+ @Field
119
+ val clauseUrlTwo: String = ""
120
+ @Field
121
+ val clauseNameThree: String = ""
122
+ @Field
123
+ val clauseUrlThree: String = ""
124
+ }
125
+
126
+ class RNOneLoginThemeConfigPrivacyClauseView: Record {
127
+ @Field @ColorInt
128
+ val baseClauseColor: Int = 0
129
+ @Field @ColorInt
130
+ val clauseColor: Int = 0
131
+ @Field
132
+ val privacyClauseTextSize: Int = 0
133
+ }
134
+
135
+ class RNOneLoginThemeConfigPrivacyTextView: Record {
136
+ @Field
137
+ val privacyTextViewTv1: String = ""
138
+ @Field
139
+ val privacyTextViewTv2: String = ""
140
+ @Field
141
+ val privacyTextViewTv3: String = ""
142
+ @Field
143
+ val privacyTextViewTv4: String = ""
144
+ }
145
+
146
+ class RNOneLoginThemeConfigAuthNavTextViewTypeface: Record {
147
+ @Field
148
+ val navTextTypeface: String = ""
149
+ @Field
150
+ val navWebTextTypeface: String = ""
151
+ }
152
+
153
+ class RNOneLoginThemeConfigLogoImgView: Record {
154
+ @Field
155
+ val logoImgPath: String = ""
156
+ @Field
157
+ val logoWidth: Int = 0
158
+ @Field
159
+ val logoHeight: Int = 0
160
+ @Field
161
+ val logoHidden: Boolean = false
162
+ @Field
163
+ val logoOffsetY: Int = 0
164
+ @Field
165
+ val logoOffsetY_B: Int = 0
166
+ @Field
167
+ val logoOffsetX: Int = 0
168
+ }
169
+
170
+ class RNOneLoginThemeConfigAuthNavReturnImgView: Record {
171
+ @Field
172
+ val returnImgPath: String = ""
173
+ @Field
174
+ val returnImgWidth: Int = 0
175
+ @Field
176
+ val returnImgHeight: Int = 0
177
+ @Field
178
+ val returnImgHidden: Boolean = false
179
+ @Field
180
+ val returnImgOffsetX: Int = 0
181
+ }
182
+
183
+ class RNOneLoginThemeConfigNumberView: Record {
184
+ @Field @ColorInt
185
+ val numberColor: Int = 0
186
+ @Field
187
+ val numberSize: Int = 0
188
+ @Field
189
+ val numberOffsetY: Int = 0
190
+ @Field
191
+ val numberOffsetY_B: Int = 0
192
+ @Field
193
+ val numberOffsetX: Int = 0
194
+ }
195
+
196
+ class RNOneLoginThemeConfigSloganView: Record {
197
+ @Field @ColorInt
198
+ val sloganColor: Int = 0
199
+ @Field
200
+ val sloganSize: Int = 0
201
+ @Field
202
+ val sloganOffsetY: Int = 0
203
+ @Field
204
+ val sloganOffsetY_B: Int = 0
205
+ @Field
206
+ val sloganOffsetX: Int = 0
207
+ }
208
+
209
+ class RNOneLoginThemeConfigLogBtnLayout: Record {
210
+ @Field
211
+ val logBtnImgPath: String = ""
212
+ @Field
213
+ val logBtnUncheckedImgPath: String = ""
214
+ @Field
215
+ val logBtnWidth: Int = 0
216
+ @Field
217
+ val logBtnHeight: Int = 0
218
+ @Field
219
+ val logBtnOffsetY: Int = 0
220
+ @Field
221
+ val logBtnOffsetY_B: Int = 0
222
+ @Field
223
+ val logBtnOffsetX: Int = 0
224
+ }
225
+
226
+ class RNOneLoginThemeConfigSwitchView: Record {
227
+ @Field
228
+ val switchText: String = ""
229
+ @Field @ColorInt
230
+ val switchColor: Int = 0
231
+ @Field
232
+ val switchSize: Int = 0
233
+ @Field
234
+ val switchHidden: Boolean = false
235
+ @Field
236
+ val switchOffsetY: Int = 0
237
+ @Field
238
+ val switchOffsetY_B: Int = 0
239
+ @Field
240
+ val switchOffsetX: Int = 0
241
+ }
242
+
243
+ class RNOneLoginThemeConfigPrivacyCheckBox: Record {
244
+ @Field
245
+ val unCheckedImgPath: String = ""
246
+ @Field
247
+ val checkedImgPath: String = ""
248
+ @Field
249
+ val privacyState: Boolean = false
250
+ @Field
251
+ val privacyCheckBoxWidth: Int = 0
252
+ @Field
253
+ val privacyCheckBoxHeight: Int = 0
254
+ @Field
255
+ val privacyCheckBoxOffsetY: Int = 0
256
+ @Field
257
+ val privacyCheckBoxMarginRight: Int = 0
258
+ }
259
+
260
+ class RNOneLoginThemeConfigPrivacyLayout: Record {
261
+ @Field
262
+ val isUseNormalWebActivity: Boolean = false
263
+ @Field
264
+ val privacyLayoutWidth: Int = 0
265
+ @Field
266
+ val privacyOffsetY: Int = 0
267
+ @Field
268
+ val privacyOffsetY_B: Int = 0
269
+ @Field
270
+ val privacyOffsetX: Int = 0
271
+ @Field
272
+ val gravity: Int = 0
273
+ }
274
+
275
+ class RNOneLoginThemeConfigPrivacyClauseViewTypeface: Record {
276
+ @Field
277
+ val privacyClauseBaseTypeface: String = ""
278
+ @Field
279
+ val privacyClauseTypeface: String = ""
280
+ }
281
+ class RNMargin: Record {
282
+ @Field
283
+ val left: Int = 0
284
+ @Field
285
+ val top: Int = 0
286
+ @Field
287
+ val right: Int = 0
288
+ @Field
289
+ val bottom: Int = 0
290
+ }
291
+ class RNImageView: Record {
292
+ @Field
293
+ val x: Float = 0f
294
+ @Field
295
+ val y: Float = 0f
296
+ @Field
297
+ val maxWidth: Int = 0
298
+ @Field
299
+ val maxHeight: Int = 0
300
+ @Field
301
+ val imageResourceName: String = ""
302
+ @Field
303
+ val margin: RNMargin? = null
304
+ fun build(context: Context): ImageView {
305
+ val imageView = ImageView(context)
306
+ imageView.maxWidth = maxWidth
307
+ imageView.maxHeight = maxHeight
308
+ imageView.x = x
309
+ imageView.y = y
310
+ imageView.setImageResource(context.resources.getIdentifier(imageResourceName, "drawable", context.packageName))
311
+ val layoutParams = RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT)
312
+ layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE)
313
+ if (margin != null) {
314
+ layoutParams.setMargins(margin.left, margin.bottom, margin.right, margin.bottom);
315
+ }
316
+ imageView.layoutParams = layoutParams
317
+ return imageView
318
+ }
319
+ }
320
+
321
+ class RNOneLoginThemeConfig : Record {
322
+ @Field
323
+ val statusBar: RNOneLoginThemeConfigStatusBar? = null
324
+ @Field
325
+ val authBGImgPath: String? = null
326
+ @Field
327
+ val dialogTheme: RNOneLoginThemeConfigDialogTheme? = null
328
+ @Field
329
+ val authNavLayout: RNOneLoginThemeConfigAuthNavLayout? = null
330
+ @Field
331
+ val authNavTextView: RNOneLoginThemeConfigAuthNavTextView? = null
332
+ @Field
333
+ val switchViewLayout: RNOneLoginThemeConfigSwitchViewLayout? = null
334
+ @Field
335
+ val logBtnTextView: RNOneLoginThemeConfigLogBtnTextView? = null
336
+ @Field
337
+ val logBtnLoadingView: RNOneLoginThemeConfigLogBtnLoadingView? = null
338
+ @Field
339
+ val privacyUnCheckedToastText: String? = null
340
+ @Field
341
+ val privacyClauseText: RNOneLoginThemeConfigPrivacyClauseText? = null
342
+ @Field
343
+ val privacyTextGravity: Int? = null
344
+ @Field
345
+ val privacyClauseView: RNOneLoginThemeConfigPrivacyClauseView? = null
346
+ @Field
347
+ val privacyTextView: RNOneLoginThemeConfigPrivacyTextView? = null
348
+ @Field
349
+ val authNavTextViewTypeface: RNOneLoginThemeConfigAuthNavTextViewTypeface? = null
350
+ @Field
351
+ val numberViewTypeface: String? = null
352
+ @Field
353
+ val switchViewTypeface: String? = null
354
+ @Field
355
+ val logBtnTextViewTypeface: String? = null
356
+ @Field
357
+ val logoImgView: RNOneLoginThemeConfigLogoImgView? = null
358
+ @Field
359
+ val authNavReturnImgView: RNOneLoginThemeConfigAuthNavReturnImgView? = null
360
+ @Field
361
+ val numberView: RNOneLoginThemeConfigNumberView? = null
362
+ @Field
363
+ val sloganView: RNOneLoginThemeConfigSloganView? = null
364
+ @Field
365
+ val logBtnLayout: RNOneLoginThemeConfigLogBtnLayout? = null
366
+ @Field
367
+ val switchView: RNOneLoginThemeConfigSwitchView? = null
368
+ @Field
369
+ val privacyCheckBox: RNOneLoginThemeConfigPrivacyCheckBox? = null
370
+ @Field
371
+ val privacyLayout: RNOneLoginThemeConfigPrivacyLayout? = null
372
+ @Field
373
+ val privacyClauseViewTypeface: RNOneLoginThemeConfigPrivacyClauseViewTypeface? = null
374
+ @Field
375
+ val sloganViewTypeface: String? = null
376
+ @Field
377
+ val customViews: Array<RNImageView>? = null
378
+ }