@react-native-hero/alipay 0.0.3 → 0.0.4

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
@@ -38,6 +38,28 @@ run the following command to link the package:
38
38
  $ react-native link @react-native-hero/alipay
39
39
  ```
40
40
 
41
+ ## Setup
42
+
43
+ ### iOS
44
+
45
+ 修改 `AppDelegate.m`:
46
+
47
+ ```oc
48
+ // 导入库
49
+ #import <RNTAlipay.h>
50
+
51
+ // 添加此方法
52
+ - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
53
+ options:(NSDictionary<NSString*, id> *)options {
54
+ // 确保 alipay 最先执行
55
+ if ([RNTAlipay handleOpenURL:application openURL:url options:options]) {
56
+ return YES;
57
+ }
58
+ // 其他库要求实现的 openURL 代码放在 alipay 后面,如果没有用到其他库,直接返回 YES 即可
59
+ return YES;
60
+ }
61
+ ```
62
+
41
63
  ## Usage
42
64
 
43
65
  ```js
@@ -54,6 +76,7 @@ pay({
54
76
  })
55
77
  .then(response => {
56
78
  /**
79
+ * 支付成功
57
80
  * 示例 data 如下
58
81
  * {
59
82
  "alipay_trade_app_pay_response":{
@@ -2,4 +2,6 @@
2
2
 
3
3
  @interface RNTAlipay : NSObject <RCTBridgeModule>
4
4
 
5
+ + (BOOL)handleOpenURL:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options;
6
+
5
7
  @end
@@ -5,6 +5,11 @@
5
5
 
6
6
  @implementation RNTAlipay
7
7
 
8
+ + (BOOL)handleOpenURL:(UIApplication *)application openURL:(NSURL *)url
9
+ options:(NSDictionary<NSString*, id> *)options {
10
+ return [url.host isEqualToString:@"safepay"];
11
+ }
12
+
8
13
  + (BOOL)requiresMainQueueSetup {
9
14
  return YES;
10
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-hero/alipay",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "react native alipay",
5
5
  "main": "index.js",
6
6
  "scripts": {