@pinwheel/react-native-pinwheel 3.2.5 → 3.3.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/README.md +14 -3
- package/RNPinwheelSDK.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/rtnpinwheel/Pinwheel.kt +6 -1
- package/android/src/main/java/com/rtnpinwheel/PinwheelManager.kt +5 -0
- package/ios/RTNPinwheelManager.mm +3 -2
- package/ios/RTNPinwheelView.h +1 -0
- package/ios/RTNPinwheelView.mm +20 -3
- package/package.json +1 -1
- package/src/Pinwheel.d.ts +2 -1
- package/src/Pinwheel.tsx +3 -0
- package/src/RTNPinwheelNativeComponent.d.ts +1 -0
- package/src/RTNPinwheelNativeComponent.ts +1 -0
package/README.md
CHANGED
|
@@ -11,14 +11,17 @@ $ npm install --save @pinwheel/react-native-pinwheel
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Configuration
|
|
14
|
-
Some platform integrations may require camera access for verification purposes.
|
|
14
|
+
Some platform integrations may require camera access for verification purposes. On Android, storage access is also required to enable direct deposit form downloads on API level 28 (Android 9) and below.
|
|
15
|
+
Ensure the following permissions are configured in your project:
|
|
15
16
|
|
|
16
17
|
**Android:** Add the following permission to your `AndroidManifest.xml`:
|
|
17
18
|
```
|
|
18
19
|
<uses-permission android:name="android.permission.CAMERA" />
|
|
20
|
+
|
|
21
|
+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28" />
|
|
19
22
|
```
|
|
20
23
|
|
|
21
|
-
**iOS:** Add the following
|
|
24
|
+
**iOS:** Add the following entry to your `Info.plist`:
|
|
22
25
|
```
|
|
23
26
|
<key>NSCameraUsageDescription</key>
|
|
24
27
|
<string>We need access to your camera for verification purposes.</string>
|
|
@@ -71,7 +74,7 @@ Callback when a user successfully signs in to their payroll account.
|
|
|
71
74
|
|
|
72
75
|
### `onError`
|
|
73
76
|
|
|
74
|
-
Callback whenever an error occurs during the modal flow. This does not necessarily mean that the flow cannot still complete successfully. These include such retryable events as the user inputting an incorrect password or MFA code and needs to reattempt it. Error codes can be seen [here](https://docs.pinwheelapi.com/docs/link-
|
|
77
|
+
Callback whenever an error occurs during the modal flow. This does not necessarily mean that the flow cannot still complete successfully. These include such retryable events as the user inputting an incorrect password or MFA code and needs to reattempt it. Error codes can be seen [here](https://docs.pinwheelapi.com/public/docs/link-errors#error-codes).
|
|
75
78
|
|
|
76
79
|
| Type | Required |
|
|
77
80
|
| -------- | -------- |
|
|
@@ -109,6 +112,14 @@ Determines whether the SDK should respond to window insets on Android. This allo
|
|
|
109
112
|
| ------- | -------- | ------- |
|
|
110
113
|
| boolean | No | true |
|
|
111
114
|
|
|
115
|
+
### `useDarkMode`
|
|
116
|
+
|
|
117
|
+
Enables Link to run with a dark mode theme.
|
|
118
|
+
|
|
119
|
+
| Type | Required | Default |
|
|
120
|
+
| ------- | -------- |---------|
|
|
121
|
+
| boolean | No | false |
|
|
122
|
+
|
|
112
123
|
## Running The Example App Locally
|
|
113
124
|
|
|
114
125
|
You may want to run the example app locally to get started.
|
package/RNPinwheelSDK.podspec
CHANGED
package/android/build.gradle
CHANGED
|
@@ -20,6 +20,7 @@ class Pinwheel : FrameLayout {
|
|
|
20
20
|
private var pinwheelFragment: PinwheelFragment? = null
|
|
21
21
|
private var pinwheelEventListener: PinwheelEventListener? = null
|
|
22
22
|
private var handleInsets: Boolean = true
|
|
23
|
+
private var useDarkMode: Boolean = false
|
|
23
24
|
private var fragmentContainer: FrameLayout? = null
|
|
24
25
|
|
|
25
26
|
constructor(context: Context) : super(context) {
|
|
@@ -75,6 +76,10 @@ class Pinwheel : FrameLayout {
|
|
|
75
76
|
this.handleInsets = handleInsets
|
|
76
77
|
}
|
|
77
78
|
|
|
79
|
+
fun setUseDarkMode(useDarkMode: Boolean) {
|
|
80
|
+
this.useDarkMode = useDarkMode
|
|
81
|
+
}
|
|
82
|
+
|
|
78
83
|
fun getReactNativeVersion(): String {
|
|
79
84
|
val version = ReactNativeVersion.VERSION
|
|
80
85
|
return "${version["major"]}.${version["minor"]}.${version["patch"]}"
|
|
@@ -84,7 +89,7 @@ class Pinwheel : FrameLayout {
|
|
|
84
89
|
Handler(Looper.getMainLooper()).post {
|
|
85
90
|
if (this.pinwheelFragment == null) {
|
|
86
91
|
this.token?.let {
|
|
87
|
-
val pinwheelFragment = PinwheelFragment.
|
|
92
|
+
val pinwheelFragment = PinwheelFragment.newInstanceWithAdvancedOptions(it, "react native", "3.3.0", getReactNativeVersion(), this.handleInsets, this.useDarkMode)
|
|
88
93
|
pinwheelEventListener?.let { listener ->
|
|
89
94
|
pinwheelFragment.pinwheelEventListener = listener
|
|
90
95
|
}
|
|
@@ -43,6 +43,11 @@ class PinwheelManager(private val reactContext: ReactApplicationContext) :
|
|
|
43
43
|
view.setHandleInsets(handleInsets)
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
@ReactProp(name = "useDarkMode")
|
|
47
|
+
override fun setUseDarkMode(view: Pinwheel, useDarkMode: Boolean) {
|
|
48
|
+
view.setUseDarkMode(useDarkMode)
|
|
49
|
+
}
|
|
50
|
+
|
|
46
51
|
@ReactPropGroup(names = ["width", "height"], customType = "Style")
|
|
47
52
|
fun setStyle(view: Pinwheel, index: Int, value: Int) {
|
|
48
53
|
if (index == 0) propWidth = value
|
package/ios/RTNPinwheelView.h
CHANGED
|
@@ -23,6 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
23
23
|
|
|
24
24
|
@property (nonatomic, strong, nullable) PinwheelWrapperVC *pinwheelWrapperVC;
|
|
25
25
|
@property (nonatomic, strong) NSString *token;
|
|
26
|
+
@property (nonatomic, assign) BOOL useDarkMode;
|
|
26
27
|
|
|
27
28
|
- (instancetype)initWithFrame:(CGRect)frame token:(NSString *)token;
|
|
28
29
|
|
package/ios/RTNPinwheelView.mm
CHANGED
|
@@ -43,7 +43,7 @@ using namespace facebook::react;
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
if (self.token != nil) {
|
|
46
|
-
self.pinwheelWrapperVC = [[PinwheelWrapperVC alloc] initWithToken:self.token delegate:self sdk:@"react native" version
|
|
46
|
+
self.pinwheelWrapperVC = [[PinwheelWrapperVC alloc] initWithToken:self.token delegate:self sdk:@"react native" version:@"3.3.0" useDarkMode:self.useDarkMode];
|
|
47
47
|
[self addSubview:self.pinwheelWrapperVC.view];
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -63,6 +63,11 @@ using namespace facebook::react;
|
|
|
63
63
|
NSString* convertedToken = [NSString stringWithUTF8String:newViewProps.token.c_str()];
|
|
64
64
|
[self setToken:convertedToken];
|
|
65
65
|
}
|
|
66
|
+
|
|
67
|
+
if (oldViewProps.useDarkMode != newViewProps.useDarkMode) {
|
|
68
|
+
self.useDarkMode = newViewProps.useDarkMode;
|
|
69
|
+
}
|
|
70
|
+
|
|
66
71
|
// Ensures that the view is always re-initialized whenever the props change, or the React Native component is
|
|
67
72
|
// re-mounted. On the new architecture, there are optimizations which causes the view to be re-used in these
|
|
68
73
|
// scenarios, whereas the ideal functionality here is to have the Link modal reset to the starting state.
|
|
@@ -134,8 +139,13 @@ Class<RCTComponentViewProtocol> RTNPinwheelCls(void)
|
|
|
134
139
|
}
|
|
135
140
|
|
|
136
141
|
- (void)initPinwheelWrapperVC {
|
|
137
|
-
if (self.
|
|
138
|
-
self.pinwheelWrapperVC
|
|
142
|
+
if (self.pinwheelWrapperVC != nil) {
|
|
143
|
+
[self.pinwheelWrapperVC.view removeFromSuperview];
|
|
144
|
+
self.pinwheelWrapperVC = nil;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (self.token != nil) {
|
|
148
|
+
self.pinwheelWrapperVC = [[PinwheelWrapperVC alloc] initWithToken:self.token delegate:self sdk:@"react native" version:@"3.3.0" useDarkMode:self.useDarkMode];
|
|
139
149
|
[self addSubview:self.pinwheelWrapperVC.view];
|
|
140
150
|
}
|
|
141
151
|
}
|
|
@@ -147,6 +157,13 @@ Class<RCTComponentViewProtocol> RTNPinwheelCls(void)
|
|
|
147
157
|
}
|
|
148
158
|
}
|
|
149
159
|
|
|
160
|
+
- (void)setUseDarkMode:(BOOL)newUseDarkMode {
|
|
161
|
+
if (_useDarkMode != newUseDarkMode) {
|
|
162
|
+
_useDarkMode = newUseDarkMode;
|
|
163
|
+
[self initPinwheelWrapperVC];
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
150
167
|
- (void)layoutSubviews
|
|
151
168
|
{
|
|
152
169
|
[super layoutSubviews];
|
package/package.json
CHANGED
package/src/Pinwheel.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { LinkOptions } from './client-events/client';
|
|
3
|
-
declare const Pinwheel: ({ linkToken, onLogin, onLoginAttempt, onSuccess, onError, onExit, onEvent, handleInsets, }: LinkOptions & {
|
|
3
|
+
declare const Pinwheel: ({ linkToken, onLogin, onLoginAttempt, onSuccess, onError, onExit, onEvent, handleInsets, useDarkMode, }: LinkOptions & {
|
|
4
4
|
handleInsets?: boolean;
|
|
5
|
+
useDarkMode?: boolean;
|
|
5
6
|
}) => React.JSX.Element;
|
|
6
7
|
export default Pinwheel;
|
package/src/Pinwheel.tsx
CHANGED
|
@@ -18,8 +18,10 @@ const Pinwheel = ({
|
|
|
18
18
|
onExit,
|
|
19
19
|
onEvent,
|
|
20
20
|
handleInsets,
|
|
21
|
+
useDarkMode,
|
|
21
22
|
}: LinkOptions & {
|
|
22
23
|
handleInsets?: boolean;
|
|
24
|
+
useDarkMode?: boolean;
|
|
23
25
|
}) => {
|
|
24
26
|
const eventsListener = useCallback(
|
|
25
27
|
(event: any) => {
|
|
@@ -80,6 +82,7 @@ const Pinwheel = ({
|
|
|
80
82
|
style={{ flex: 1 }}
|
|
81
83
|
token={linkToken}
|
|
82
84
|
handleInsets={handleInsets ?? true}
|
|
85
|
+
useDarkMode={useDarkMode ?? false}
|
|
83
86
|
/>
|
|
84
87
|
)}
|
|
85
88
|
</SafeAreaView>
|