@exodus/react-native-wallet 0.1.17 → 0.1.18
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/ios/RNWallet.mm +42 -5
- package/package.json +1 -1
package/ios/RNWallet.mm
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
#import <react_native_wallet-Swift.h>
|
|
8
8
|
#endif
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
@interface RNWallet () <WalletDelegate>
|
|
12
11
|
@end
|
|
13
12
|
|
|
@@ -34,17 +33,33 @@ RCT_REMAP_METHOD(checkWalletAvailability,
|
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
RCT_REMAP_METHOD(IOSPresentAddPaymentPassView,
|
|
36
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
37
37
|
IOSPresentAddPaymentPassView:(JS::NativeWallet::IOSCardData &)cardData
|
|
38
|
+
#else
|
|
39
|
+
IOSPresentAddPaymentPassView:(NSDictionary *)cardData
|
|
40
|
+
#endif
|
|
38
41
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
39
42
|
reject:(RCTPromiseRejectBlock)reject)
|
|
40
43
|
{
|
|
41
44
|
@try {
|
|
42
|
-
NSDictionary *cardDataDict =
|
|
45
|
+
NSDictionary *cardDataDict = nil;
|
|
46
|
+
|
|
47
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
48
|
+
cardDataDict = @{
|
|
43
49
|
@"network": [self safeString:cardData.network()],
|
|
44
50
|
@"cardHolderName": [self safeString:cardData.cardHolderName()],
|
|
45
51
|
@"lastDigits": [self safeString:cardData.lastDigits()],
|
|
46
52
|
@"cardDescription": [self safeString:cardData.cardDescription()],
|
|
47
53
|
};
|
|
54
|
+
#else
|
|
55
|
+
cardDataDict = @{
|
|
56
|
+
@"network": [self safeString:cardData[@"network"]],
|
|
57
|
+
@"cardHolderName": [self safeString:cardData[@"cardHolderName"]],
|
|
58
|
+
@"lastDigits": [self safeString:cardData[@"lastDigits"]],
|
|
59
|
+
@"cardDescription": [self safeString:cardData[@"cardDescription"]],
|
|
60
|
+
};
|
|
61
|
+
#endif
|
|
62
|
+
|
|
48
63
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
49
64
|
[self->walletManager IOSPresentAddPaymentPassViewWithCardData:cardDataDict completion:^(OperationResult result, NSDictionary* data) {
|
|
50
65
|
[self handleWalletResponse:result data:data completedBlock:resolve errorPrefix:@"present_payment_pass_view_failed" defaultErrorMessage:@"Failed to present the payment pass view" rejecter:reject];
|
|
@@ -56,16 +71,31 @@ RCT_REMAP_METHOD(IOSPresentAddPaymentPassView,
|
|
|
56
71
|
}
|
|
57
72
|
|
|
58
73
|
RCT_REMAP_METHOD(IOSHandleAddPaymentPassResponse,
|
|
74
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
59
75
|
IOSHandleAddPaymentPassResponse:(JS::NativeWallet::IOSEncryptPayload &)payload
|
|
76
|
+
#else
|
|
77
|
+
IOSHandleAddPaymentPassResponse:(NSDictionary *)payload
|
|
78
|
+
#endif
|
|
60
79
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
61
80
|
reject:(RCTPromiseRejectBlock)reject)
|
|
62
81
|
{
|
|
63
82
|
@try {
|
|
64
|
-
NSDictionary *payloadDict =
|
|
83
|
+
NSDictionary *payloadDict = nil;
|
|
84
|
+
|
|
85
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
86
|
+
payloadDict = @{
|
|
65
87
|
@"encryptedPassData": [self safeString:payload.encryptedPassData()],
|
|
66
88
|
@"activationData": [self safeString:payload.activationData()],
|
|
67
89
|
@"ephemeralPublicKey": [self safeString:payload.ephemeralPublicKey()],
|
|
68
90
|
};
|
|
91
|
+
#else
|
|
92
|
+
payloadDict = @{
|
|
93
|
+
@"encryptedPassData": [self safeString:payload[@"encryptedPassData"]],
|
|
94
|
+
@"activationData": [self safeString:payload[@"activationData"]],
|
|
95
|
+
@"ephemeralPublicKey": [self safeString:payload[@"ephemeralPublicKey"]],
|
|
96
|
+
};
|
|
97
|
+
#endif
|
|
98
|
+
|
|
69
99
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
70
100
|
[self->walletManager IOSHandleAddPaymentPassResponseWithPayload:payloadDict completion:^(OperationResult result, NSDictionary* data) {
|
|
71
101
|
[self handleWalletResponse:result data:data completedBlock:resolve errorPrefix:@"add_card_failed" defaultErrorMessage:@"Failed to add the card to the wallet" rejecter:reject];
|
|
@@ -93,7 +123,15 @@ RCT_REMAP_METHOD(getCardStatusByIdentifier,
|
|
|
93
123
|
resolve([walletManager getCardStatusByIdentifierWithIdentifier:identifier]);
|
|
94
124
|
}
|
|
95
125
|
|
|
96
|
-
- (void)addCardToGoogleWallet:
|
|
126
|
+
- (void)addCardToGoogleWallet:
|
|
127
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
128
|
+
(JS::NativeWallet::AndroidCardData &)cardData
|
|
129
|
+
#else
|
|
130
|
+
(NSDictionary *)cardData
|
|
131
|
+
#endif
|
|
132
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
133
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
134
|
+
{
|
|
97
135
|
// no-op
|
|
98
136
|
}
|
|
99
137
|
|
|
@@ -149,5 +187,4 @@ RCT_REMAP_METHOD(getCardStatusByIdentifier,
|
|
|
149
187
|
}
|
|
150
188
|
#endif
|
|
151
189
|
|
|
152
|
-
|
|
153
190
|
@end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/react-native-wallet",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"description": "A React Native module designed for seamless integration of Card Push Provisioning into Apple Wallet and Google Wallet, enabling easy and secure addition of payment cards directly from your application.",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "lib/commonjs/index",
|