@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 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. Ensure the necessary permissions are configured in your project:
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 key and description to your `Info.plist`:
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-sdk-errors).
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.
@@ -17,5 +17,5 @@ Pod::Spec.new do |s|
17
17
 
18
18
  install_modules_dependencies(s)
19
19
 
20
- s.dependency 'PinwheelSDK', '3.1.1'
20
+ s.dependency 'PinwheelSDK', '3.2.1'
21
21
  end
@@ -32,7 +32,7 @@ repositories {
32
32
  google()
33
33
  }
34
34
 
35
- def PW_ANDROID_SDK_VERSION = '3.1.3'
35
+ def PW_ANDROID_SDK_VERSION = '3.2.0'
36
36
 
37
37
  dependencies {
38
38
  def pwVersion = rootProject.hasProperty('pwVersion') ? rootProject.pwVersion : PW_ANDROID_SDK_VERSION
@@ -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.newInstance(it, "react native", "3.2.5", getReactNativeVersion(), this.handleInsets)
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
@@ -15,10 +15,11 @@ RCT_EXPORT_MODULE(RTNPinwheel)
15
15
  #endif
16
16
 
17
17
  - (UIView *)view
18
- {
18
+ {
19
19
  return [[RTNPinwheelView alloc] init];
20
20
  }
21
21
 
22
22
  RCT_EXPORT_VIEW_PROPERTY(token, NSString);
23
+ RCT_EXPORT_VIEW_PROPERTY(useDarkMode, BOOL);
23
24
 
24
- @end
25
+ @end
@@ -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
 
@@ -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: @"3.2.5"];
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.token != nil && self.pinwheelWrapperVC == nil) {
138
- self.pinwheelWrapperVC = [[PinwheelWrapperVC alloc] initWithToken:self.token delegate:self sdk:@"react native" version: @"3.2.5"];
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinwheel/react-native-pinwheel",
3
- "version": "3.2.5",
3
+ "version": "3.3.0",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
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>
@@ -3,6 +3,7 @@ import type { HostComponent } from 'react-native';
3
3
  export interface NativeProps extends ViewProps {
4
4
  token: string;
5
5
  handleInsets: boolean;
6
+ useDarkMode: boolean;
6
7
  }
7
8
  declare const _default: HostComponent<NativeProps>;
8
9
  export default _default;
@@ -9,6 +9,7 @@ type Event = {
9
9
  export interface NativeProps extends ViewProps {
10
10
  token: string;
11
11
  handleInsets: boolean;
12
+ useDarkMode: boolean;
12
13
  }
13
14
 
14
15
  export default codegenNativeComponent<NativeProps>(