Skip to content

Commit a1070e7

Browse files
committed
Add onSessionError event and upgrade to XS2AiOS 1.2.0
1 parent 215a429 commit a1070e7

8 files changed

+69
-11
lines changed

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ import Xs2aReactNativeViewManager from "@fintecsystems/xs2a-react-native";
3939
// e.g. redirect to error screen
4040
console.log('Network error');
4141
}}
42+
onSessionError={({ nativeEvent: { errorCode, recoverable } }) => {
43+
/**
44+
Session errors occur during a session.
45+
Implementation of the different cases below is optional.
46+
No action needs to be taken for them, in fact we recommend
47+
to let the user handle the completion of the session until one of the above .success or .failure cases is called.
48+
You can however use below cases for measuring purposes.
49+
NOTE: Should you decide to do navigation to different screens based on below cases, you should only do so
50+
in case of the recoverable parameter being false, otherwise the user can still finish the session.
51+
*/
52+
// Detailed error descriptions can be found here: https://github.com/FinTecSystems/xs2a-ios#configure-and-present-the-view
53+
console.log(errorCode, recoverable);
54+
}}
4255
// All styles are optional
4356
styleProvider={{
4457
font: 'Helvetica Neue',

example/ios/Podfile.lock

+5-5
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,10 @@ PODS:
249249
- React-cxxreact (= 0.63.4)
250250
- React-jsi (= 0.63.4)
251251
- SwiftyJSON (5.0.1)
252-
- xs2a-react-native (0.0.5):
252+
- xs2a-react-native (0.1.0):
253253
- React-Core
254-
- XS2AiOS (= 1.1.6)
255-
- XS2AiOS (1.1.6):
254+
- XS2AiOS (= 1.2.0)
255+
- XS2AiOS (1.2.0):
256256
- NVActivityIndicatorView (= 5.1.1)
257257
- SwiftyJSON (= 5.0.1)
258258
- XS2AiOSNetService (= 1.0.5)
@@ -383,8 +383,8 @@ SPEC CHECKSUMS:
383383
React-RCTVibration: ae4f914cfe8de7d4de95ae1ea6cc8f6315d73d9d
384384
ReactCommon: 73d79c7039f473b76db6ff7c6b159c478acbbb3b
385385
SwiftyJSON: 2f33a42c6fbc52764d96f13368585094bfd8aa5e
386-
xs2a-react-native: 89a095f8a4918ea801b614d99d84e0a454cb7d8e
387-
XS2AiOS: f62454fe1be138923ed12ba7174c4d4d0f9e3aef
386+
xs2a-react-native: 77a20a11482f5903d7ae8a786f58e99c17f7f1a6
387+
XS2AiOS: eef23dcf1a86446decfd74ae7ab84651acab5574
388388
XS2AiOSNetService: bf704662e3fd79c3a35ca6ee23c08e494368c6db
389389
Yoga: 4bd86afe9883422a7c4028c00e34790f560923d6
390390

example/src/App.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ export default function App() {
1919
onNetworkError={() => {
2020
console.log('Network error');
2121
}}
22+
onSessionError={({ nativeEvent: { errorCode, recoverable } }) => {
23+
console.log(errorCode, recoverable);
24+
}}
2225
styleProvider={{
2326
font: 'Helvetica Neue',
2427
tintColor: '#ff0000',

ios/Xs2aReactNativeViewManager.m

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ @interface RCT_EXTERN_MODULE(Xs2aReactNativeViewManager, RCTViewManager)
77
RCT_EXPORT_VIEW_PROPERTY(onSuccess, RCTDirectEventBlock)
88
RCT_EXPORT_VIEW_PROPERTY(onAbort, RCTDirectEventBlock)
99
RCT_EXPORT_VIEW_PROPERTY(onNetworkError, RCTDirectEventBlock)
10+
RCT_EXPORT_VIEW_PROPERTY(onSessionError, RCTDirectEventBlock)
1011

1112

1213
@end

ios/Xs2aReactNativeViewManager.swift

+44-4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class Xs2aReactNativeView: UIView {
1919
@objc var onSuccess: RCTDirectEventBlock?
2020
@objc var onAbort: RCTDirectEventBlock?
2121
@objc var onNetworkError: RCTDirectEventBlock?
22+
@objc var onSessionError: RCTDirectEventBlock?
2223

2324
var xs2aViewController: XS2AViewController?
2425
var xs2aConfig: XS2AiOS.Configuration?
@@ -300,18 +301,57 @@ class Xs2aReactNativeView: UIView {
300301
switch result {
301302
case .success(.finish):
302303
self.onSuccess?([:])
303-
break
304304
case .success(.finishWithCredentials(let credentials)):
305305
self.onSuccess?(["credentials": credentials])
306-
break
307306
case .failure(let error):
308307
switch error {
309308
case .userAborted:
310309
self.onAbort?([:])
311-
break
312310
case .networkError:
313311
self.onNetworkError?([:])
314-
break
312+
}
313+
case .sessionError(let sessionError):
314+
switch sessionError {
315+
case .loginFailed(recoverable: let recoverable):
316+
self.onSessionError?([
317+
"errorCode": "login_failed",
318+
"recoverable": recoverable
319+
])
320+
case .sessionTimeout(recoverable: let recoverable):
321+
self.onSessionError?([
322+
"errorCode": "session_timeout",
323+
"recoverable": recoverable
324+
])
325+
case .tanFailed(recoverable: let recoverable):
326+
self.onSessionError?([
327+
"errorCode": "tan_failed",
328+
"recoverable": recoverable
329+
])
330+
case .techError(recoverable: let recoverable):
331+
self.onSessionError?([
332+
"errorCode": "tech_error",
333+
"recoverable": recoverable
334+
])
335+
case .testmodeError(recoverable: let recoverable):
336+
self.onSessionError?([
337+
"errorCode": "testmode_error",
338+
"recoverable": recoverable
339+
])
340+
case .transNotPossible(recoverable: let recoverable):
341+
self.onSessionError?([
342+
"errorCode": "trans_not_possible",
343+
"recoverable": recoverable
344+
])
345+
case .validationFailed(recoverable: let recoverable):
346+
self.onSessionError?([
347+
"errorCode": "validation_failed",
348+
"recoverable": recoverable
349+
])
350+
case .other(errorCode: let errorCode, recoverable: let recoverable):
351+
self.onSessionError?([
352+
"errorCode": errorCode,
353+
"recoverable": recoverable
354+
])
315355
}
316356
}
317357
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fintecsystems/xs2a-react-native",
3-
"version": "0.0.5",
3+
"version": "0.1.0",
44
"description": "Integrate FinTecSystems' XS2A into your React Native App.",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",

src/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type Xs2aReactNativeProps = {
1515
onSuccess: Function;
1616
onAbort: Function;
1717
onNetworkError: Function;
18+
onSessionError: Function;
1819
styleProvider?: {
1920
font?: String;
2021
tintColor?: String;

xs2a-react-native.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Pod::Spec.new do |s|
1313
s.platforms = { :ios => "11.0" }
1414
s.source = { :git => "https://github.com/FinTecSystems/xs2a-react-native.git", :tag => "#{s.version}" }
1515

16-
s.dependency 'XS2AiOS', '1.1.6'
16+
s.dependency 'XS2AiOS', '1.2.0'
1717

1818
s.source_files = "ios/**/*.{h,m,mm,swift}"
1919

0 commit comments

Comments
 (0)