@rnw-community/react-native-payments 1.5.0 → 1.6.2

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.
Files changed (2) hide show
  1. package/ios/Payments.mm +25 -3
  2. package/package.json +2 -2
package/ios/Payments.mm CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  #import <React/RCTLog.h>
4
4
  #import <Foundation/Foundation.h>
5
+ #import <objc/runtime.h>
5
6
 
6
7
  // TODO: Add logs
7
8
  @implementation Payments
@@ -383,20 +384,41 @@ RCT_EXPORT_METHOD(canMakePayments: (NSString *)methodDataString
383
384
 
384
385
  if (@available(iOS 16.0, *)) {
385
386
  NSMutableDictionary *mutablePaymentNetworks = [paymentNetworks mutableCopy];
386
- mutablePaymentNetworks[@"PKPaymentNetworkBancontact"] = PKPaymentNetworkBancontact;
387
+ // Dynamically get PKPaymentNetworkBancontact to avoid linking issues
388
+ Class pkPaymentNetworkClass = NSClassFromString(@"PKPaymentNetwork");
389
+ if (pkPaymentNetworkClass) {
390
+ id bancontactNetwork = [pkPaymentNetworkClass performSelector:@selector(Bancontact)];
391
+ if (bancontactNetwork) {
392
+ mutablePaymentNetworks[@"PKPaymentNetworkBancontact"] = bancontactNetwork;
393
+ }
394
+ }
387
395
  paymentNetworks = [mutablePaymentNetworks copy];
388
396
  }
389
397
 
390
398
  if (@available(iOS 15.1, *)) {
391
399
  NSMutableDictionary *mutablePaymentNetworks = [paymentNetworks mutableCopy];
392
- mutablePaymentNetworks[@"PKPaymentNetworkDankort"] = PKPaymentNetworkDankort;
400
+ // Dynamically get PKPaymentNetworkDankort to avoid linking issues on iOS 15.1
401
+ Class pkPaymentNetworkClass = NSClassFromString(@"PKPaymentNetwork");
402
+ if (pkPaymentNetworkClass) {
403
+ id dankortNetwork = [pkPaymentNetworkClass performSelector:@selector(Dankort)];
404
+ if (dankortNetwork) {
405
+ mutablePaymentNetworks[@"PKPaymentNetworkDankort"] = dankortNetwork;
406
+ }
407
+ }
393
408
  paymentNetworks = [mutablePaymentNetworks copy];
394
409
  }
395
410
 
396
411
  if (@available(iOS 14.5, *)) {
397
412
  NSMutableDictionary *mutablePaymentNetworks = [paymentNetworks mutableCopy];
398
413
  // HINT: You should never work
399
- mutablePaymentNetworks[@"PKPaymentNetworkMIR"] = PKPaymentNetworkMir;
414
+ // Dynamically get PKPaymentNetworkMir to avoid linking issues
415
+ Class pkPaymentNetworkClass = NSClassFromString(@"PKPaymentNetwork");
416
+ if (pkPaymentNetworkClass) {
417
+ id mirNetwork = [pkPaymentNetworkClass performSelector:@selector(Mir)];
418
+ if (mirNetwork) {
419
+ mutablePaymentNetworks[@"PKPaymentNetworkMIR"] = mirNetwork;
420
+ }
421
+ }
400
422
  paymentNetworks = [mutablePaymentNetworks copy];
401
423
  }
402
424
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnw-community/react-native-payments",
3
- "version": "1.5.0",
3
+ "version": "1.6.2",
4
4
  "description": "Accept Payments with Apple Pay and Android Pay using the Payment Request API.",
5
5
  "keywords": [
6
6
  "react",
@@ -77,7 +77,7 @@
77
77
  "clear:deps": "rm -rf ./node_modules && rm -rf ./dist",
78
78
  "example": "yarn --cwd example"
79
79
  },
80
- "gitHead": "4e656c513dec54a987c20a02b62d3519aad5d12c",
80
+ "gitHead": "a9e7ae6f0ea84ecc5de670113ea16b1b4dbd1388",
81
81
  "dependencies": {
82
82
  "@expo/config-plugins": "^9.0.14",
83
83
  "@rnw-community/shared": "1.3.0",