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.
- package/.eslintrc.js +5 -0
- package/LICENSE +21 -0
- package/README.md +2 -0
- package/android/build.gradle +91 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/expo/modules/geetestonelogin/DTO.kt +378 -0
- package/android/src/main/java/expo/modules/geetestonelogin/ExpoGeetestOneloginModule.kt +271 -0
- package/android/src/main/java/expo/modules/geetestonelogin/ExpoGeetestOneloginView.kt +7 -0
- package/build/ExpoGeetestOnelogin.types.d.ts +770 -0
- package/build/ExpoGeetestOnelogin.types.d.ts.map +1 -0
- package/build/ExpoGeetestOnelogin.types.js +2 -0
- package/build/ExpoGeetestOnelogin.types.js.map +1 -0
- package/build/ExpoGeetestOneloginModule.d.ts +3 -0
- package/build/ExpoGeetestOneloginModule.d.ts.map +1 -0
- package/build/ExpoGeetestOneloginModule.js +5 -0
- package/build/ExpoGeetestOneloginModule.js.map +1 -0
- package/build/ExpoGeetestOneloginModule.web.d.ts +7 -0
- package/build/ExpoGeetestOneloginModule.web.d.ts.map +1 -0
- package/build/ExpoGeetestOneloginModule.web.js +12 -0
- package/build/ExpoGeetestOneloginModule.web.js.map +1 -0
- package/build/ExpoGeetestOneloginView.d.ts +4 -0
- package/build/ExpoGeetestOneloginView.d.ts.map +1 -0
- package/build/ExpoGeetestOneloginView.js +7 -0
- package/build/ExpoGeetestOneloginView.js.map +1 -0
- package/build/ExpoGeetestOneloginView.web.d.ts +4 -0
- package/build/ExpoGeetestOneloginView.web.d.ts.map +1 -0
- package/build/ExpoGeetestOneloginView.web.js +6 -0
- package/build/ExpoGeetestOneloginView.web.js.map +1 -0
- package/build/index.d.ts +40 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +132 -0
- package/build/index.js.map +1 -0
- package/expo-module.config.json +9 -0
- package/ios/Bridging-Header.h +13 -0
- package/ios/DTO.swift +1031 -0
- package/ios/ExpoGeetestOnelogin.podspec +29 -0
- package/ios/ExpoGeetestOneloginModule.swift +342 -0
- package/ios/ExpoGeetestOneloginView.swift +7 -0
- package/package.json +67 -0
- package/src/ExpoGeetestOnelogin.types.ts +939 -0
- package/src/ExpoGeetestOneloginModule.ts +5 -0
- package/src/ExpoGeetestOneloginModule.web.ts +13 -0
- package/src/ExpoGeetestOneloginView.tsx +11 -0
- package/src/ExpoGeetestOneloginView.web.tsx +11 -0
- package/src/index.ts +174 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,29 @@
|
|
|
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 = 'ExpoGeetestOnelogin'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.description = package['description']
|
|
10
|
+
s.license = package['license']
|
|
11
|
+
s.author = package['author']
|
|
12
|
+
s.homepage = package['homepage']
|
|
13
|
+
s.platform = :ios, '12.0'
|
|
14
|
+
s.swift_version = '5.4'
|
|
15
|
+
s.source = { git: 'https://github.com/Flickering-AI/expo-geetest-onelogin' }
|
|
16
|
+
s.static_framework = true
|
|
17
|
+
|
|
18
|
+
s.dependency 'ExpoModulesCore'
|
|
19
|
+
s.dependency 'OneLoginSDK-iOS', '~> 2.8.3'
|
|
20
|
+
|
|
21
|
+
# Swift/Objective-C compatibility
|
|
22
|
+
s.pod_target_xcconfig = {
|
|
23
|
+
'DEFINES_MODULE' => 'YES',
|
|
24
|
+
'SWIFT_COMPILATION_MODE' => 'wholemodule',
|
|
25
|
+
"SWIFT_OBJC_BRIDGING_HEADER" => "${PODS_TARGET_SRCROOT}/Bridging-Header.h"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
s.source_files = "**/*.{h,m,swift}"
|
|
29
|
+
end
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import ExpoModulesCore
|
|
2
|
+
|
|
3
|
+
public class ExpoGeetestOneloginModule: Module {
|
|
4
|
+
// Each module class must implement the definition function. The definition consists of components
|
|
5
|
+
// that describes the module's functionality and behavior.
|
|
6
|
+
// See https://docs.expo.dev/modules/module-api for more details about available components.
|
|
7
|
+
public func definition() -> ModuleDefinition {
|
|
8
|
+
// Sets the name of the module that JavaScript code will use to refer to the module. Takes a string as an argument.
|
|
9
|
+
// Can be inferred from module's class name, but it's recommended to set it explicitly for clarity.
|
|
10
|
+
// The module will be accessible from `requireNativeModule('ExpoGeetestOnelogin')` in JavaScript.
|
|
11
|
+
Name("ExpoGeetestOnelogin")
|
|
12
|
+
|
|
13
|
+
// Sets constant properties on the module. Can take a dictionary or a closure that returns a dictionary.
|
|
14
|
+
Constants([
|
|
15
|
+
"PI": Double.pi
|
|
16
|
+
])
|
|
17
|
+
|
|
18
|
+
// Defines event names that the module can send to JavaScript.
|
|
19
|
+
Events("onChange")
|
|
20
|
+
|
|
21
|
+
// Defines a JavaScript synchronous function that runs the native code on the JavaScript thread.
|
|
22
|
+
Function("hello") {
|
|
23
|
+
return "Hello world! 👋"
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Defines a JavaScript function that always returns a Promise and whose native code
|
|
27
|
+
// is by default dispatched on the different thread than the JavaScript runtime runs on.
|
|
28
|
+
AsyncFunction("setValueAsync") { (value: String) in
|
|
29
|
+
// Send an event to JavaScript.
|
|
30
|
+
self.sendEvent("onChange", [
|
|
31
|
+
"value": value
|
|
32
|
+
])
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
Function("setLogEnable") { (isLogEnable: Bool) in
|
|
36
|
+
OneLoginPro.setLogEnabled(isLogEnable)
|
|
37
|
+
}
|
|
38
|
+
Function("setRequestTimeout") { (preGetTokenTimeout: Int, requestTokenTimeout: Int) in
|
|
39
|
+
OneLoginPro.setRequestTimeout(TimeInterval(preGetTokenTimeout),requestTokenTimeout: TimeInterval(requestTokenTimeout))
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
Function("register") { (appId: String) in
|
|
43
|
+
return OneLoginPro.register(withAppID: appId)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
Function("isPreGetTokenResultValidate") { () in
|
|
47
|
+
return OneLoginPro.isPreGetTokenResultValidate()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
Function("requestTokenWithViewController") { (viewModelRN: RNOLAuthViewModel, callbackId: Int) in
|
|
51
|
+
DispatchQueue.main.async {
|
|
52
|
+
// Find the nearest view controller
|
|
53
|
+
var controller = UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController;
|
|
54
|
+
var presentedController = controller?.presentedViewController;
|
|
55
|
+
while (presentedController != nil && !presentedController!.isBeingDismissed) {
|
|
56
|
+
controller = presentedController;
|
|
57
|
+
presentedController = controller?.presentedViewController;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let viewModel = OLAuthViewModel()
|
|
61
|
+
if (viewModelRN.statusBarStyle != nil) {
|
|
62
|
+
switch viewModelRN.statusBarStyle {
|
|
63
|
+
case "UIStatusBarStyle.darkContent":
|
|
64
|
+
viewModel.statusBarStyle = UIStatusBarStyle.darkContent
|
|
65
|
+
case "UIStatusBarStyle.lightContent":
|
|
66
|
+
viewModel.statusBarStyle = UIStatusBarStyle.lightContent
|
|
67
|
+
default:
|
|
68
|
+
viewModel.statusBarStyle = UIStatusBarStyle.default
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (viewModelRN.navTextMargin != nil) {
|
|
72
|
+
viewModel.navTextMargin = viewModelRN.navTextMargin!
|
|
73
|
+
}
|
|
74
|
+
if (viewModelRN.naviTitle != nil) {
|
|
75
|
+
viewModel.naviTitle = viewModelRN.naviTitle!.build()
|
|
76
|
+
}
|
|
77
|
+
if (viewModelRN.naviBgColor != nil) {
|
|
78
|
+
viewModel.naviBgColor = viewModelRN.naviBgColor
|
|
79
|
+
}
|
|
80
|
+
if (viewModelRN.naviBackImage != nil) {
|
|
81
|
+
viewModel.naviBackImage = viewModelRN.naviBackImage!.build()
|
|
82
|
+
}
|
|
83
|
+
if (viewModelRN.naviRightControl != nil) {
|
|
84
|
+
// viewModel.naviRightControl = viewModelRN.naviRightControl!.build()
|
|
85
|
+
}
|
|
86
|
+
if (viewModelRN.naviHidden != nil) {
|
|
87
|
+
viewModel.naviHidden = viewModelRN.naviHidden!
|
|
88
|
+
}
|
|
89
|
+
if (viewModelRN.backButtonRect != nil) {
|
|
90
|
+
viewModel.backButtonRect = viewModelRN.backButtonRect!.build()
|
|
91
|
+
}
|
|
92
|
+
if (viewModelRN.backButtonHidden != nil) {
|
|
93
|
+
viewModel.backButtonHidden = viewModelRN.backButtonHidden!
|
|
94
|
+
}
|
|
95
|
+
if (viewModelRN.backgroundColor != nil) {
|
|
96
|
+
viewModel.backgroundColor = viewModelRN.backgroundColor!
|
|
97
|
+
}
|
|
98
|
+
if (viewModelRN.logoHidden != nil) {
|
|
99
|
+
viewModel.logoHidden = viewModelRN.logoHidden!
|
|
100
|
+
}
|
|
101
|
+
if (viewModelRN.phoneNumFont != nil) {
|
|
102
|
+
viewModel.phoneNumFont = viewModelRN.phoneNumFont!.build()
|
|
103
|
+
}
|
|
104
|
+
if (viewModelRN.phoneNumColor != nil) {
|
|
105
|
+
viewModel.phoneNumColor = viewModelRN.phoneNumColor!
|
|
106
|
+
}
|
|
107
|
+
if (viewModelRN.backgroundImage != nil) {
|
|
108
|
+
let contentView = OneLoginPro.currentAuthViewController()?.view
|
|
109
|
+
viewModel.backgroundImage = viewModelRN.backgroundImage!.build()
|
|
110
|
+
}
|
|
111
|
+
if (viewModelRN.auxiliaryPrivacyWords != nil) {
|
|
112
|
+
viewModel.auxiliaryPrivacyWords = viewModelRN.auxiliaryPrivacyWords
|
|
113
|
+
}
|
|
114
|
+
if (viewModelRN.notCheckProtocolHint != nil) {
|
|
115
|
+
viewModel.notCheckProtocolHint = viewModelRN.notCheckProtocolHint!
|
|
116
|
+
}
|
|
117
|
+
if (viewModelRN.additionalPrivacyTerms != nil) {
|
|
118
|
+
viewModel.additionalPrivacyTerms = viewModelRN.additionalPrivacyTerms!.map({ e in
|
|
119
|
+
return e.build()
|
|
120
|
+
})
|
|
121
|
+
}
|
|
122
|
+
if (viewModelRN.termTextColor != nil) {
|
|
123
|
+
viewModel.termTextColor = viewModelRN.termTextColor!
|
|
124
|
+
}
|
|
125
|
+
if (viewModelRN.defaultCheckBoxState != nil) {
|
|
126
|
+
viewModel.defaultCheckBoxState = viewModelRN.defaultCheckBoxState!
|
|
127
|
+
}
|
|
128
|
+
if (viewModelRN.termsRect != nil) {
|
|
129
|
+
viewModel.termsRect = viewModelRN.termsRect!.build()
|
|
130
|
+
}
|
|
131
|
+
if (viewModelRN.privacyTermsAttributes != nil) {
|
|
132
|
+
viewModel.privacyTermsAttributes = viewModelRN.privacyTermsAttributes!.build()
|
|
133
|
+
}
|
|
134
|
+
if (viewModelRN.switchButtonText != nil) {
|
|
135
|
+
viewModel.switchButtonText = viewModelRN.switchButtonText!
|
|
136
|
+
}
|
|
137
|
+
if (viewModelRN.switchButtonFont != nil) {
|
|
138
|
+
viewModel.switchButtonFont = viewModelRN.switchButtonFont!.build()
|
|
139
|
+
}
|
|
140
|
+
if (viewModelRN.switchButtonColor != nil) {
|
|
141
|
+
viewModel.switchButtonColor = viewModelRN.switchButtonColor!
|
|
142
|
+
}
|
|
143
|
+
if (viewModelRN.switchButtonRect != nil) {
|
|
144
|
+
viewModel.switchButtonRect = viewModelRN.switchButtonRect!.build()
|
|
145
|
+
}
|
|
146
|
+
if (viewModelRN.sloganTextColor != nil) {
|
|
147
|
+
viewModel.sloganTextColor = viewModelRN.sloganTextColor!
|
|
148
|
+
}
|
|
149
|
+
if (viewModelRN.switchButtonRect != nil) {
|
|
150
|
+
viewModel.sloganTextFont = viewModelRN.sloganTextFont!.build()
|
|
151
|
+
}
|
|
152
|
+
if (viewModelRN.checkedImage != nil) {
|
|
153
|
+
viewModel.checkedImage = viewModelRN.checkedImage!.build()
|
|
154
|
+
}
|
|
155
|
+
if (viewModelRN.uncheckedImage != nil) {
|
|
156
|
+
viewModel.uncheckedImage = viewModelRN.uncheckedImage!.build()
|
|
157
|
+
}
|
|
158
|
+
if (viewModelRN.checkBoxRect != nil) {
|
|
159
|
+
viewModel.checkBoxRect = viewModelRN.checkBoxRect!.build()
|
|
160
|
+
}
|
|
161
|
+
if (viewModelRN.authButtonImages != nil) {
|
|
162
|
+
viewModel.authButtonImages = viewModelRN.authButtonImages!.map({ e in
|
|
163
|
+
return e.build()
|
|
164
|
+
})
|
|
165
|
+
}
|
|
166
|
+
if (viewModelRN.authButtonTitle != nil) {
|
|
167
|
+
viewModel.authButtonTitle = viewModelRN.authButtonTitle!.build()
|
|
168
|
+
}
|
|
169
|
+
if (viewModelRN.authButtonRect != nil) {
|
|
170
|
+
viewModel.authButtonRect = viewModelRN.authButtonRect!.build()
|
|
171
|
+
}
|
|
172
|
+
if (viewModelRN.naviBackImage != nil) {
|
|
173
|
+
viewModel.naviBackImage = viewModelRN.naviBackImage!.build()
|
|
174
|
+
}
|
|
175
|
+
if (viewModelRN.naviBackImage != nil) {
|
|
176
|
+
viewModel.naviBackImage = viewModelRN.naviBackImage!.build()
|
|
177
|
+
}
|
|
178
|
+
if (viewModelRN.logoRect != nil) {
|
|
179
|
+
viewModel.logoRect = viewModelRN.logoRect!.build()
|
|
180
|
+
}
|
|
181
|
+
if (viewModelRN.logoCornerRadius != nil) {
|
|
182
|
+
viewModel.logoCornerRadius = viewModelRN.logoCornerRadius!
|
|
183
|
+
}
|
|
184
|
+
if (viewModelRN.appLogo != nil) {
|
|
185
|
+
viewModel.appLogo = viewModelRN.appLogo!.build()
|
|
186
|
+
}
|
|
187
|
+
if (viewModelRN.switchButtonRect != nil) {
|
|
188
|
+
viewModel.switchButtonRect = viewModelRN.switchButtonRect!.build()
|
|
189
|
+
}
|
|
190
|
+
if (viewModelRN.switchButtonRect != nil) {
|
|
191
|
+
viewModel.switchButtonRect = viewModelRN.switchButtonRect!.build()
|
|
192
|
+
}
|
|
193
|
+
if (viewModelRN.sloganRect != nil) {
|
|
194
|
+
viewModel.sloganRect = viewModelRN.sloganRect!.build()
|
|
195
|
+
}
|
|
196
|
+
if (viewModelRN.phoneNumRect != nil) {
|
|
197
|
+
viewModel.phoneNumRect = viewModelRN.phoneNumRect!.build()
|
|
198
|
+
}
|
|
199
|
+
if (viewModelRN.webNaviTitle != nil) {
|
|
200
|
+
viewModel.webNaviTitle = viewModelRN.webNaviTitle!.build()
|
|
201
|
+
}
|
|
202
|
+
if (viewModelRN.webNaviHidden != nil) {
|
|
203
|
+
viewModel.webNaviHidden = viewModelRN.webNaviHidden!
|
|
204
|
+
}
|
|
205
|
+
if (viewModelRN.webNaviBgColor != nil) {
|
|
206
|
+
viewModel.webNaviBgColor = viewModelRN.webNaviBgColor!
|
|
207
|
+
}
|
|
208
|
+
if (viewModelRN.hasQuotationMarkOnCarrierProtocol != nil) {
|
|
209
|
+
viewModel.hasQuotationMarkOnCarrierProtocol = viewModelRN.hasQuotationMarkOnCarrierProtocol!
|
|
210
|
+
}
|
|
211
|
+
if (viewModelRN.disableAuthButtonWhenUnchecked != nil) {
|
|
212
|
+
viewModel.disableAuthButtonWhenUnchecked = viewModelRN.disableAuthButtonWhenUnchecked!
|
|
213
|
+
}
|
|
214
|
+
viewModel.customUIHandler = { (customAreaView: UIView) in
|
|
215
|
+
if (viewModelRN.backgroundImageView != nil) {
|
|
216
|
+
// let backgroundImage = UIImageView.init(frame: CGRectMake(0, -40, 418, 359 * 418 / 375))
|
|
217
|
+
// backgroundImage.image = UIImage.init(named: "onelogin_bg");
|
|
218
|
+
// customAreaView.addSubview(backgroundImage)
|
|
219
|
+
|
|
220
|
+
let backgroundImage = viewModelRN.backgroundImageView!.build()
|
|
221
|
+
customAreaView.addSubview(backgroundImage)
|
|
222
|
+
}
|
|
223
|
+
// if (viewModelRN.naviHidden != nil && viewModelRN.naviHidden == true && viewModelRN.backButtonHidden != nil && viewModelRN.backButtonHidden == false) {
|
|
224
|
+
//
|
|
225
|
+
// }
|
|
226
|
+
if (viewModelRN.floatGoBackImageViewButton != nil) {
|
|
227
|
+
let imageButton = viewModelRN.floatGoBackImageViewButton!.build()
|
|
228
|
+
if (viewModelRN.floatGoBackImageViewButton!.callbackId != nil) {
|
|
229
|
+
imageButton.addTarget(self, action: #selector(self.onClicked), for: UIControl.Event.touchDown)
|
|
230
|
+
}
|
|
231
|
+
customAreaView.addSubview(imageButton)
|
|
232
|
+
}
|
|
233
|
+
if (viewModelRN.customViews != nil) {
|
|
234
|
+
viewModelRN.customViews?.forEach({ e in
|
|
235
|
+
let button = e.build()
|
|
236
|
+
if (e.callbackId != nil) {
|
|
237
|
+
button.addTarget(self, action: #selector(self.onClicked), for: UIControl.Event.touchDown)
|
|
238
|
+
}
|
|
239
|
+
customAreaView.addSubview(button)
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
if (viewModelRN.clickSwitchButtonBlock != nil) {
|
|
245
|
+
viewModel.clickSwitchButtonBlock = {
|
|
246
|
+
self.callback(callbackId: viewModelRN.clickSwitchButtonBlock!.callbackId, params: nil)
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (viewModelRN.clickAuthButtonBlock != nil) {
|
|
250
|
+
viewModel.clickAuthButtonBlock = {
|
|
251
|
+
self.callback(callbackId: viewModelRN.clickAuthButtonBlock!.callbackId, params: nil)
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
// viewModel.autolayoutBlock = { [weak self] (authView: UIView, authContentView: UIView, authBackgroundImageView: UIView?, authNavigationView: UIView, authNavigationContainerView: UIView, authBackButton: UIView, authNavigationTitleView: UIView, authLogoView: UIView, authPhoneView: UIView, authSwitchButton: UIView, authLoginButton: UIView, authSloganView: UIView, authAgreementView: UIView, authCheckbox: UIView, authProtocolView: UIView, authClosePopupButton: UIView?) in
|
|
255
|
+
// background
|
|
256
|
+
// authBackgroundImageView?.bounds.size.width = 0
|
|
257
|
+
// authBackgroundImageView?.bounds.size.height = 0
|
|
258
|
+
// let subviews = authBackgroundImageView?.subviews
|
|
259
|
+
// let imageView = authContentView.subviews.first { e in
|
|
260
|
+
// return e is UIImageView
|
|
261
|
+
// }
|
|
262
|
+
// imageView?.bounds.size = CGSize(width: 100, height: 100)
|
|
263
|
+
// authNavigationView.layer.zPosition = 2
|
|
264
|
+
// }
|
|
265
|
+
viewModel.viewLifeCycleBlock = { (viewLifeCycle: String, animated: Bool) in
|
|
266
|
+
self.sendEvent("onChange", [viewLifeCycle: viewLifeCycle])
|
|
267
|
+
}
|
|
268
|
+
// -------------- 授权页面点击登录按钮之后的loading设置 -------------------
|
|
269
|
+
let mask = UIView(frame: CGRect(x: 0, y: 0, width: controller!.view.bounds.width, height: controller!.view.bounds.height))
|
|
270
|
+
mask.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5)
|
|
271
|
+
let indicatorView = UIActivityIndicatorView.init(style: UIActivityIndicatorView.Style.large)
|
|
272
|
+
indicatorView.color = UIColor.white
|
|
273
|
+
let loadingContainer = UIView(frame: CGRect(x: 0, y: 0, width: 120, height: 120))
|
|
274
|
+
loadingContainer.center = CGPoint.init(x: mask.bounds.size.width/2, y: mask.bounds.size.height/2)
|
|
275
|
+
loadingContainer.layer.cornerRadius = 15
|
|
276
|
+
loadingContainer.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.9)
|
|
277
|
+
loadingContainer.addSubview(indicatorView)
|
|
278
|
+
mask.addSubview(loadingContainer)
|
|
279
|
+
viewModel.loadingViewBlock = { (containerView: UIView) in
|
|
280
|
+
if OneLogin.isProtocolCheckboxChecked() {
|
|
281
|
+
containerView.addSubview(mask)
|
|
282
|
+
indicatorView.center = CGPoint.init(x: loadingContainer.bounds.size.width/2, y: loadingContainer.bounds.size.height/2)
|
|
283
|
+
indicatorView.startAnimating()
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
viewModel.stopLoadingViewBlock = { (containerView: UIView) in
|
|
288
|
+
for subview in containerView.subviews {
|
|
289
|
+
if subview == mask {
|
|
290
|
+
subview.removeFromSuperview()
|
|
291
|
+
break
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
// if ((oneLoginThemeConfig.statusBar) != nil) {
|
|
296
|
+
// switch oneLoginThemeConfig.statusBar?.statusBarStyle {
|
|
297
|
+
// case "UserInterfaceStyle.LIGHT":
|
|
298
|
+
// viewModel.statusBarStyle = UIStatusBarStyle.lightContent
|
|
299
|
+
// case "UserInterfaceStyle.DARK":
|
|
300
|
+
// viewModel.statusBarStyle = UIStatusBarStyle.darkContent
|
|
301
|
+
// default:
|
|
302
|
+
// viewModel.statusBarStyle = UIStatusBarStyle.default
|
|
303
|
+
// }
|
|
304
|
+
// }
|
|
305
|
+
|
|
306
|
+
if (controller != nil) {
|
|
307
|
+
OneLoginPro.requestToken(with: controller!, viewModel: viewModel, completion: { result in
|
|
308
|
+
self.callback(callbackId: callbackId, params: ["result": result])
|
|
309
|
+
})
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
AsyncFunction("dismissAuthViewController") { (animated: Bool, promise: Promise) in
|
|
315
|
+
OneLoginPro.dismissAuthViewController(animated, completion: {
|
|
316
|
+
promise.resolve(true)
|
|
317
|
+
})
|
|
318
|
+
}
|
|
319
|
+
Function("stopLoading") { () in
|
|
320
|
+
OneLoginPro.stopLoading()
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// Enables the module to be used as a native view. Definition components that are accepted as part of the
|
|
324
|
+
// view definition: Prop, Events.
|
|
325
|
+
View(ExpoGeetestOneloginView.self) {
|
|
326
|
+
// Defines a setter for the `name` prop.
|
|
327
|
+
Prop("name") { (view: ExpoGeetestOneloginView, prop: String) in
|
|
328
|
+
print(prop)
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
@objc func onClicked(sender: UIButton) {
|
|
334
|
+
self.callback(callbackId: sender.tag, params: ["type": "callback"])
|
|
335
|
+
}
|
|
336
|
+
func callback(callbackId: Int) {
|
|
337
|
+
self.callback(callbackId: callbackId, params: nil)
|
|
338
|
+
}
|
|
339
|
+
func callback(callbackId: Int, params: Dictionary<String, Any>?) {
|
|
340
|
+
self.sendEvent("onChange", ["callbackId": callbackId, "type": "callback"].merging(params ?? [:], uniquingKeysWith: { (_, new) in new }))
|
|
341
|
+
}
|
|
342
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "expo-geetest-onelogin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "react native plugin for https://docs.geetest.com/onelogin/overview/prodes",
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"types": "build/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "expo-module build",
|
|
9
|
+
"clean": "expo-module clean",
|
|
10
|
+
"lint": "expo-module lint",
|
|
11
|
+
"test": "expo-module test",
|
|
12
|
+
"prepare": "expo-module prepare",
|
|
13
|
+
"prepublishOnly": "expo-module prepublishOnly",
|
|
14
|
+
"expo-module": "expo-module",
|
|
15
|
+
"open:ios": "open -a \"Xcode\" example/ios",
|
|
16
|
+
"open:android": "open -a \"Android Studio\" example/android",
|
|
17
|
+
"release": "release-it"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"react-native",
|
|
21
|
+
"expo",
|
|
22
|
+
"expo-geetest-onelogin",
|
|
23
|
+
"ExpoGeetestOnelogin"
|
|
24
|
+
],
|
|
25
|
+
"repository": "https://github.com/Flickering-AI/expo-geetest-onelogin",
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/Flickering-AI/expo-geetest-onelogin/issues"
|
|
28
|
+
},
|
|
29
|
+
"author": "Xuanping <a845326948@gmail.com> (https://github.com/lxp-git)",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"homepage": "https://github.com/Flickering-AI/expo-geetest-onelogin#readme",
|
|
32
|
+
"dependencies": {},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@release-it/conventional-changelog": "^7.0.0",
|
|
35
|
+
"@types/react": "^18.0.25",
|
|
36
|
+
"@types/react-native": "^0.72.2",
|
|
37
|
+
"expo-module-scripts": "^3.0.11",
|
|
38
|
+
"expo-modules-core": "^1.5.6",
|
|
39
|
+
"release-it": "^16.1.3"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"expo": "*",
|
|
43
|
+
"react": "*",
|
|
44
|
+
"react-native": "*"
|
|
45
|
+
},
|
|
46
|
+
"release-it": {
|
|
47
|
+
"git": {
|
|
48
|
+
"commitMessage": "chore: release ${version}",
|
|
49
|
+
"tagName": "v${version}",
|
|
50
|
+
"requireCleanWorkingDir": false,
|
|
51
|
+
"addFiles": [
|
|
52
|
+
"package.json"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"npm": {
|
|
56
|
+
"publish": true
|
|
57
|
+
},
|
|
58
|
+
"github": {
|
|
59
|
+
"release": true
|
|
60
|
+
},
|
|
61
|
+
"plugins": {
|
|
62
|
+
"@release-it/conventional-changelog": {
|
|
63
|
+
"preset": "angular"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|