boxpay-checkout-reactnative-sdk 2.0.2-beta2 → 2.0.2
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/android/build.gradle
CHANGED
|
@@ -41,5 +41,5 @@ repositories {
|
|
|
41
41
|
dependencies {
|
|
42
42
|
implementation 'com.facebook.react:react-android:0.74.0'
|
|
43
43
|
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.9.0'
|
|
44
|
-
implementation 'com.github.BoxPay-SDKs.cross-platform-sdk:cross-platform-sdk:1.0.3
|
|
44
|
+
implementation 'com.github.BoxPay-SDKs.cross-platform-sdk:cross-platform-sdk:1.0.3'
|
|
45
45
|
}
|
|
@@ -7,6 +7,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
|
7
7
|
import com.crossplatform.BoxPayActivity
|
|
8
8
|
import com.crossplatform.sdk.data.handler.SDKPaymentResponseHandler
|
|
9
9
|
import com.crossplatform.sdk.data.model.SDKPaymentResponse
|
|
10
|
+
import com.crossplatform.sdk.presentation.theme.BoxPayThemeMode
|
|
10
11
|
|
|
11
12
|
class CrossPlatform(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
|
|
12
13
|
private val context: Context = reactContext
|
|
@@ -46,7 +47,8 @@ class CrossPlatform(reactContext: ReactApplicationContext) : ReactContextBaseJav
|
|
|
46
47
|
ctaBorderRadius = ctaBorderRadius,
|
|
47
48
|
focusedTextInputBorderColor = focusedColor,
|
|
48
49
|
unfocusedTextInputBorderColor = unfocusedColor,
|
|
49
|
-
fontFamily = fontFamily
|
|
50
|
+
fontFamily = fontFamily,
|
|
51
|
+
themeMode = BoxPayThemeMode.DEFAULT
|
|
50
52
|
)
|
|
51
53
|
activity.startActivity(intent)
|
|
52
54
|
}
|
|
@@ -14,7 +14,7 @@ Pod::Spec.new do |s|
|
|
|
14
14
|
s.source = { :git => "https://github.com/Ishika1601-boxpay/react_native_module.git", :tag => "#{s.version}" }
|
|
15
15
|
|
|
16
16
|
s.source_files = "ios/**/*.{h,m,swift}"
|
|
17
|
-
s.dependency "CrossPlatformSDK", "1.0.3
|
|
17
|
+
s.dependency "CrossPlatformSDK", "1.0.3"
|
|
18
18
|
s.private_header_files = "ios/**/*.h"
|
|
19
19
|
s.dependency "React-Core"
|
|
20
20
|
|
package/ios/CrossPlatform.swift
CHANGED
|
@@ -43,9 +43,12 @@ class CrossPlatform: RCTEventEmitter {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
let ui = options["uiConfiguration"] as? NSDictionary
|
|
46
|
-
var vc: UIViewController!
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
// Container that pins KMP content below the safe area top (status bar / notch)
|
|
48
|
+
let container = UIViewController()
|
|
49
|
+
container.modalPresentationStyle = .fullScreen
|
|
50
|
+
|
|
51
|
+
let kmpVC = BoxPayViewControllerKt.BoxPayViewController(
|
|
49
52
|
token: token,
|
|
50
53
|
isTestEnv: (options["enableSandboxEnv"] as? Bool) ?? false,
|
|
51
54
|
shopperToken: options["shopperToken"] as? String,
|
|
@@ -57,16 +60,29 @@ class CrossPlatform: RCTEventEmitter {
|
|
|
57
60
|
isSICheckBoxEnabled: (options["isSICheckBoxEnabled"] as? Bool) ?? false,
|
|
58
61
|
focusedTextInputBorderColor: (ui?["focusedTextInputBorderColor"] as? String) ?? "#2D2B32",
|
|
59
62
|
unfocusedTextInputBorderColor: (ui?["unfocusedTextInputBorderColor"] as? String) ?? "#ADACB0",
|
|
60
|
-
onDismiss: { [weak self, weak
|
|
63
|
+
onDismiss: { [weak self, weak container] in
|
|
61
64
|
DispatchQueue.main.async {
|
|
62
|
-
|
|
65
|
+
container?.dismiss(animated: true)
|
|
63
66
|
}
|
|
64
67
|
guard let self = self, self.hasObservers else { return }
|
|
65
68
|
self.sendEvent(withName: "BoxPayDismiss", body: nil)
|
|
66
69
|
},
|
|
67
|
-
fontFamily: ui?["fontFamily"] as? String
|
|
70
|
+
fontFamily: ui?["fontFamily"] as? String,
|
|
71
|
+
themeMode: BoxPayThemeMode.default_
|
|
68
72
|
)
|
|
69
73
|
|
|
74
|
+
// Embed kmpVC inside container, constrained to safe area top
|
|
75
|
+
container.addChild(kmpVC)
|
|
76
|
+
container.view.addSubview(kmpVC.view)
|
|
77
|
+
kmpVC.view.translatesAutoresizingMaskIntoConstraints = false
|
|
78
|
+
NSLayoutConstraint.activate([
|
|
79
|
+
kmpVC.view.topAnchor.constraint(equalTo: container.view.safeAreaLayoutGuide.topAnchor),
|
|
80
|
+
kmpVC.view.leadingAnchor.constraint(equalTo: container.view.leadingAnchor),
|
|
81
|
+
kmpVC.view.trailingAnchor.constraint(equalTo: container.view.trailingAnchor),
|
|
82
|
+
kmpVC.view.bottomAnchor.constraint(equalTo: container.view.bottomAnchor),
|
|
83
|
+
])
|
|
84
|
+
kmpVC.didMove(toParent: container)
|
|
85
|
+
|
|
70
86
|
SDKPaymentResponseHandler.shared.set { [weak self] result in
|
|
71
87
|
guard let self = self, self.hasObservers else { return }
|
|
72
88
|
|
|
@@ -79,8 +95,7 @@ class CrossPlatform: RCTEventEmitter {
|
|
|
79
95
|
self.sendEvent(withName: "BoxPayPaymentResult", body: map)
|
|
80
96
|
}
|
|
81
97
|
|
|
82
|
-
|
|
83
|
-
root.present(vc, animated: true)
|
|
98
|
+
root.present(container, animated: true)
|
|
84
99
|
resolve(true)
|
|
85
100
|
}
|
|
86
101
|
}
|