@getvouch/react-native-sdk 0.0.3 → 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/android/.gradle/9.0.0/checksums/checksums.lock +0 -0
- package/android/.gradle/9.0.0/fileChanges/last-build.bin +0 -0
- package/android/.gradle/9.0.0/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/9.0.0/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build.gradle +1 -1
- package/ios/VouchRN.mm +44 -38
- package/package.json +1 -1
- package/vouch-rn.podspec +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
File without changes
|
package/android/build.gradle
CHANGED
package/ios/VouchRN.mm
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#import "VouchRN.h"
|
|
2
|
+
#import <React/RCTConvert.h>
|
|
2
3
|
#import <React/RCTLog.h>
|
|
3
4
|
#import <VouchSDK/VouchSDK-Swift.h>
|
|
4
5
|
|
|
@@ -31,7 +32,8 @@ RCT_EXPORT_METHOD(initialize : (NSString *)customerId) {
|
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
// VouchSDK uses WebKit components which must be initialized on the main
|
|
35
|
+
// VouchSDK uses WebKit components which must be initialized on the main
|
|
36
|
+
// thread
|
|
35
37
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
36
38
|
self.sdk = [[VouchSDKBridge alloc] initWithCustomerId:customerId];
|
|
37
39
|
self.initialized = YES;
|
|
@@ -44,12 +46,10 @@ RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSNumber *, isInitialized) {
|
|
|
44
46
|
return @(self.initialized);
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
RCT_EXPORT_METHOD(start
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
: (RCTResponseSenderBlock)onSuccess onError
|
|
52
|
-
: (RCTResponseSenderBlock)onError) {
|
|
49
|
+
RCT_EXPORT_METHOD(start : (NSString *)dataSourceId webhookUrl : (NSString *)
|
|
50
|
+
webhookUrl inputs : (NSDictionary *)inputs onSuccess : (
|
|
51
|
+
RCTResponseSenderBlock)
|
|
52
|
+
onSuccess onError : (RCTResponseSenderBlock)onError) {
|
|
53
53
|
if (!self.initialized) {
|
|
54
54
|
RCTLogError(@"VouchSDK must be initialized before calling start");
|
|
55
55
|
NSDictionary *errorDict = @{
|
|
@@ -74,41 +74,47 @@ RCT_EXPORT_METHOD(start
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
// Call the Swift start method to get the view controller
|
|
77
|
-
UIViewController *viewController =
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
77
|
+
UIViewController *viewController = [bridge
|
|
78
|
+
startWithDataSourceId:dataSourceId
|
|
79
|
+
webhookUrl:webhookUrl
|
|
80
|
+
inputs:inputsDict
|
|
81
|
+
completion:^(VouchSuccessObjC *success,
|
|
82
|
+
VouchErrorObjC *error) {
|
|
83
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
84
|
+
// Dismiss the view controller
|
|
85
|
+
UIViewController *presentedVC =
|
|
86
|
+
[self getRootViewController].presentedViewController;
|
|
87
|
+
if (presentedVC) {
|
|
88
|
+
[presentedVC
|
|
89
|
+
dismissViewControllerAnimated:YES
|
|
90
|
+
completion:^{
|
|
91
|
+
if (success) {
|
|
92
|
+
NSDictionary *successDict =
|
|
93
|
+
@{
|
|
94
|
+
@"proofId" :
|
|
95
|
+
success.proofId
|
|
96
|
+
};
|
|
97
|
+
onSuccess(@[ successDict ]);
|
|
98
|
+
} else if (error) {
|
|
99
|
+
NSDictionary *errorDict = @{
|
|
100
|
+
@"proofId" :
|
|
101
|
+
error.proofId,
|
|
102
|
+
@"reason" :
|
|
103
|
+
@(error.reason),
|
|
104
|
+
@"description" : error
|
|
105
|
+
.localizedDescription
|
|
106
|
+
};
|
|
107
|
+
onError(@[ errorDict ]);
|
|
108
|
+
}
|
|
109
|
+
}];
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}];
|
|
105
113
|
|
|
106
114
|
// Present the view controller modally
|
|
107
115
|
UIViewController *rootVC = [self getRootViewController];
|
|
108
116
|
if (rootVC) {
|
|
109
|
-
[rootVC presentViewController:viewController
|
|
110
|
-
animated:YES
|
|
111
|
-
completion:nil];
|
|
117
|
+
[rootVC presentViewController:viewController animated:YES completion:nil];
|
|
112
118
|
} else {
|
|
113
119
|
RCTLogError(@"Could not find root view controller to present VouchSDK");
|
|
114
120
|
NSDictionary *errorDict = @{
|
package/package.json
CHANGED
package/vouch-rn.podspec
CHANGED