chore: Modify the class name: Alipay => RNAlipay
This commit is contained in:
parent
56d9e86d9e
commit
b7ea3c0318
@ -17,6 +17,7 @@
|
|||||||
4. 调试请注意 支付宝接入应用必须 `已审核通过` 状态。
|
4. 调试请注意 支付宝接入应用必须 `已审核通过` 状态。
|
||||||
5. 支付宝开放平台-管理中心,签约 `APP支付` 和 `APP支付宝登录` 功能。
|
5. 支付宝开放平台-管理中心,签约 `APP支付` 和 `APP支付宝登录` 功能。
|
||||||
6. 适用于 `react-native >= 0.60+` 低版本未测试。
|
6. 适用于 `react-native >= 0.60+` 低版本未测试。
|
||||||
|
7. AlipaySDK 15.7.7 已更新到最新的支付宝 SDK 版本。
|
||||||
|
|
||||||
## 安装依赖
|
## 安装依赖
|
||||||
|
|
||||||
@ -203,7 +204,7 @@ Alipay.alipay(payInfo, (res)=>console.log(res))
|
|||||||
当前工程基于 [@brodybits/create-react-native-module](https://github.com/brodybits/create-react-native-module) 初始化。
|
当前工程基于 [@brodybits/create-react-native-module](https://github.com/brodybits/create-react-native-module) 初始化。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx create-react-native-module --package-identifier com.uiwjs --generate-example Alipay --example-react-native-version 0.62.2 --module-name react-native-uiwjs-alipay --github-account uiwjs --author-name "Kenny Wong" --author-email "wowohoo@qq.com"
|
npx create-react-native-module --package-identifier com.uiwjs --object-class-name RNAlipay --generate-example Alipay --example-react-native-version 0.63.0 --module-name @uiw/react-native-alipay --github-account uiwjs --author-name "Kenny Wong" --author-email "wowohoo@qq.com"
|
||||||
```
|
```
|
||||||
|
|
||||||
## 相关连接
|
## 相关连接
|
||||||
|
10
index.js
10
index.js
@ -7,7 +7,7 @@ export default class Alipay {
|
|||||||
* @returns result 支付宝回调结果 https://docs.open.alipay.com/204/105301
|
* @returns result 支付宝回调结果 https://docs.open.alipay.com/204/105301
|
||||||
*/
|
*/
|
||||||
static alipay(orderInfo) {
|
static alipay(orderInfo) {
|
||||||
return NativeModules.Alipay.alipay(orderInfo);
|
return NativeModules.RNAlipay.alipay(orderInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -16,7 +16,7 @@ export default class Alipay {
|
|||||||
* @returns result 支付宝回调结果 详情见 https://opendocs.alipay.com/open/218/105325
|
* @returns result 支付宝回调结果 详情见 https://opendocs.alipay.com/open/218/105325
|
||||||
*/
|
*/
|
||||||
static authInfo(authInfoStr) {
|
static authInfo(authInfoStr) {
|
||||||
return NativeModules.Alipay.authInfo(authInfoStr)
|
return NativeModules.RNAlipay.authInfo(authInfoStr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,7 +24,7 @@ export default class Alipay {
|
|||||||
* @return 当前版本字符串
|
* @return 当前版本字符串
|
||||||
*/
|
*/
|
||||||
static getVersion() {
|
static getVersion() {
|
||||||
return NativeModules.Alipay.getVersion()
|
return NativeModules.RNAlipay.getVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,7 +33,7 @@ export default class Alipay {
|
|||||||
*/
|
*/
|
||||||
static setAlipayScheme(scheme) {
|
static setAlipayScheme(scheme) {
|
||||||
if (Platform.OS === 'ios') {
|
if (Platform.OS === 'ios') {
|
||||||
NativeModules.Alipay.setAlipayScheme(scheme);
|
NativeModules.RNAlipay.setAlipayScheme(scheme);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ export default class Alipay {
|
|||||||
*/
|
*/
|
||||||
static setAlipaySandbox(isSandBox) {
|
static setAlipaySandbox(isSandBox) {
|
||||||
if (Platform.OS === 'android') {
|
if (Platform.OS === 'android') {
|
||||||
NativeModules.Alipay.setAlipaySandbox(isSandBox);
|
NativeModules.RNAlipay.setAlipaySandbox(isSandBox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#import <React/RCTBridgeModule.h>
|
|
||||||
|
|
||||||
@interface Alipay : NSObject <RCTBridgeModule>
|
|
||||||
|
|
||||||
@end
|
|
9
ios/RNAlipay.h
Normal file
9
ios/RNAlipay.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#if __has_include("RCTBridgeModule.h")
|
||||||
|
#import "RCTBridgeModule.h"
|
||||||
|
#else
|
||||||
|
#import <React/RCTBridgeModule.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@interface RNAlipay : NSObject <RCTBridgeModule>
|
||||||
|
|
||||||
|
@end
|
@ -1,16 +1,15 @@
|
|||||||
#import "Alipay.h"
|
#import "RNAlipay.h"
|
||||||
#import <AlipaySDK/AlipaySDK.h>
|
#import <AlipaySDK/AlipaySDK.h>
|
||||||
|
|
||||||
|
|
||||||
@interface Alipay ()
|
@interface RNAlipay ()
|
||||||
@property (nonatomic, copy) RCTPromiseResolveBlock payOrderResolve;
|
@property (nonatomic, copy) RCTPromiseResolveBlock payOrderResolve;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
@implementation Alipay
|
@implementation RNAlipay
|
||||||
{
|
{
|
||||||
NSString *alipayScheme;
|
NSString *alipayScheme;
|
||||||
RCTResponseSenderBlock alipayCallBack;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RCT_EXPORT_MODULE()
|
RCT_EXPORT_MODULE()
|
||||||
@ -84,6 +83,7 @@ RCT_EXPORT_MODULE()
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RCT_EXPORT_METHOD(setAlipayScheme:(NSString *)scheme) {
|
RCT_EXPORT_METHOD(setAlipayScheme:(NSString *)scheme) {
|
||||||
alipayScheme = scheme;
|
alipayScheme = scheme;
|
||||||
}
|
}
|
@ -1,24 +1,25 @@
|
|||||||
require "json"
|
require "json"
|
||||||
|
|
||||||
package = JSON.parse(File.read(File.join(__dir__, "..", "package.json")))
|
package = JSON.parse(File.read(File.join(__dir__, '..', "package.json")))
|
||||||
|
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = "Alipay"
|
s.name = "RNAlipay"
|
||||||
s.version = package["version"]
|
s.version = package["version"]
|
||||||
s.summary = package["description"]
|
s.summary = package["description"]
|
||||||
s.description = <<-DESC
|
s.description = <<-DESC
|
||||||
Alipay SDK for React Native
|
Alipay SDK for React Native
|
||||||
DESC
|
DESC
|
||||||
s.homepage = "https://github.com/uiwjs/react-native-alipay"
|
s.homepage = package['repository']['url']
|
||||||
# brief license entry:
|
# brief license entry:
|
||||||
s.license = "MIT"
|
s.license = package["license"]
|
||||||
|
s.author = { package["author"]["name"] => package["author"]["email"] }
|
||||||
# optional - use expanded license entry instead:
|
# optional - use expanded license entry instead:
|
||||||
# s.license = { :type => "MIT", :file => "LICENSE" }
|
# s.license = { :type => "MIT", :file => "LICENSE" }
|
||||||
s.authors = { "Kenny Wong" => "wowohoo@qq.com" }
|
|
||||||
s.platforms = { :ios => "9.0" }
|
s.platforms = { :ios => "9.0" }
|
||||||
s.source = { :git => "https://github.com/uiwjs/react-native-alipay.git", :tag => "#{s.version}" }
|
s.source = { :git => "https://github.com/uiwjs/react-native-alipay.git", :tag => "#{s.version}" }
|
||||||
|
|
||||||
s.source_files = "ios/**/*.{h,c,m,swift}"
|
s.source_files = "**/*.{h,c,m,swift}"
|
||||||
|
# s.source_files = "**/*.{h,m}"
|
||||||
s.requires_arc = true
|
s.requires_arc = true
|
||||||
|
|
||||||
s.dependency "React"
|
s.dependency "React"
|
@ -7,7 +7,7 @@
|
|||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
B954DB6F24B48377005C7268 /* AlipaySDK in Frameworks */ = {isa = PBXBuildFile; fileRef = B954DB6E24B48377005C7268 /* AlipaySDK */; };
|
B9EB6BD424BDF5E6001A2514 /* AlipaySDK in Frameworks */ = {isa = PBXBuildFile; fileRef = B9EB6BCF24BDF342001A2514 /* AlipaySDK */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXCopyFilesBuildPhase section */
|
/* Begin PBXCopyFilesBuildPhase section */
|
||||||
@ -23,9 +23,10 @@
|
|||||||
/* End PBXCopyFilesBuildPhase section */
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
134814201AA4EA6300B7C361 /* libAlipay.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libAlipay.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
134814201AA4EA6300B7C361 /* libRNAlipay.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNAlipay.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
B954DB6C24B48352005C7268 /* AlipaySDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = AlipaySDK.bundle; sourceTree = "<group>"; };
|
B9EB6BCD24BDF163001A2514 /* AlipaySDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = AlipaySDK.framework; sourceTree = "<group>"; };
|
||||||
B954DB6E24B48377005C7268 /* AlipaySDK */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; name = AlipaySDK; path = AlipaySDK.framework/AlipaySDK; sourceTree = "<group>"; };
|
B9EB6BCF24BDF342001A2514 /* AlipaySDK */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; name = AlipaySDK; path = AlipaySDK.framework/AlipaySDK; sourceTree = "<group>"; };
|
||||||
|
B9EB6BD524BDF691001A2514 /* AlipaySDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = AlipaySDK.bundle; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@ -33,7 +34,7 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
B954DB6F24B48377005C7268 /* AlipaySDK in Frameworks */,
|
B9EB6BD424BDF5E6001A2514 /* AlipaySDK in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -43,7 +44,7 @@
|
|||||||
134814211AA4EA7D00B7C361 /* Products */ = {
|
134814211AA4EA7D00B7C361 /* Products */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
134814201AA4EA6300B7C361 /* libAlipay.a */,
|
134814201AA4EA6300B7C361 /* libRNAlipay.a */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -52,15 +53,16 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
134814211AA4EA7D00B7C361 /* Products */,
|
134814211AA4EA7D00B7C361 /* Products */,
|
||||||
B954DB6B24B48352005C7268 /* Frameworks */,
|
B9EB6BCC24BDF163001A2514 /* Frameworks */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
B954DB6B24B48352005C7268 /* Frameworks */ = {
|
B9EB6BCC24BDF163001A2514 /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
B954DB6E24B48377005C7268 /* AlipaySDK */,
|
B9EB6BD524BDF691001A2514 /* AlipaySDK.bundle */,
|
||||||
B954DB6C24B48352005C7268 /* AlipaySDK.bundle */,
|
B9EB6BCF24BDF342001A2514 /* AlipaySDK */,
|
||||||
|
B9EB6BCD24BDF163001A2514 /* AlipaySDK.framework */,
|
||||||
);
|
);
|
||||||
name = Frameworks;
|
name = Frameworks;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -68,9 +70,9 @@
|
|||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
/* Begin PBXNativeTarget section */
|
||||||
58B511DA1A9E6C8500147676 /* Alipay */ = {
|
58B511DA1A9E6C8500147676 /* RNAlipay */ = {
|
||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "Alipay" */;
|
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNAlipay" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
58B511D71A9E6C8500147676 /* Sources */,
|
58B511D71A9E6C8500147676 /* Sources */,
|
||||||
58B511D81A9E6C8500147676 /* Frameworks */,
|
58B511D81A9E6C8500147676 /* Frameworks */,
|
||||||
@ -80,9 +82,9 @@
|
|||||||
);
|
);
|
||||||
dependencies = (
|
dependencies = (
|
||||||
);
|
);
|
||||||
name = Alipay;
|
name = RNAlipay;
|
||||||
productName = RCTDataManager;
|
productName = RCTDataManager;
|
||||||
productReference = 134814201AA4EA6300B7C361 /* libAlipay.a */;
|
productReference = 134814201AA4EA6300B7C361 /* libRNAlipay.a */;
|
||||||
productType = "com.apple.product-type.library.static";
|
productType = "com.apple.product-type.library.static";
|
||||||
};
|
};
|
||||||
/* End PBXNativeTarget section */
|
/* End PBXNativeTarget section */
|
||||||
@ -99,7 +101,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "Alipay" */;
|
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNAlipay" */;
|
||||||
compatibilityVersion = "Xcode 3.2";
|
compatibilityVersion = "Xcode 3.2";
|
||||||
developmentRegion = en;
|
developmentRegion = en;
|
||||||
hasScannedForEncodings = 0;
|
hasScannedForEncodings = 0;
|
||||||
@ -112,7 +114,7 @@
|
|||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
projectRoot = "";
|
projectRoot = "";
|
||||||
targets = (
|
targets = (
|
||||||
58B511DA1A9E6C8500147676 /* Alipay */,
|
58B511DA1A9E6C8500147676 /* RNAlipay */,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
/* End PBXProject section */
|
/* End PBXProject section */
|
||||||
@ -242,6 +244,10 @@
|
|||||||
58B511F01A9E6C8500147676 /* Debug */ = {
|
58B511F01A9E6C8500147676 /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"$(PROJECT_DIR)",
|
||||||
|
);
|
||||||
HEADER_SEARCH_PATHS = (
|
HEADER_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||||
@ -250,7 +256,7 @@
|
|||||||
);
|
);
|
||||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||||
OTHER_LDFLAGS = "-ObjC";
|
OTHER_LDFLAGS = "-ObjC";
|
||||||
PRODUCT_NAME = Alipay;
|
PRODUCT_NAME = RNAlipay;
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
@ -258,6 +264,10 @@
|
|||||||
58B511F11A9E6C8500147676 /* Release */ = {
|
58B511F11A9E6C8500147676 /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"$(PROJECT_DIR)",
|
||||||
|
);
|
||||||
HEADER_SEARCH_PATHS = (
|
HEADER_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||||
@ -266,7 +276,7 @@
|
|||||||
);
|
);
|
||||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||||
OTHER_LDFLAGS = "-ObjC";
|
OTHER_LDFLAGS = "-ObjC";
|
||||||
PRODUCT_NAME = Alipay;
|
PRODUCT_NAME = RNAlipay;
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
@ -274,7 +284,7 @@
|
|||||||
/* End XCBuildConfiguration section */
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
/* Begin XCConfigurationList section */
|
/* Begin XCConfigurationList section */
|
||||||
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "Alipay" */ = {
|
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNAlipay" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
58B511ED1A9E6C8500147676 /* Debug */,
|
58B511ED1A9E6C8500147676 /* Debug */,
|
||||||
@ -283,7 +293,7 @@
|
|||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
defaultConfigurationName = Release;
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "Alipay" */ = {
|
58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNAlipay" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
58B511F01A9E6C8500147676 /* Debug */,
|
58B511F01A9E6C8500147676 /* Debug */,
|
@ -2,6 +2,6 @@
|
|||||||
<Workspace
|
<Workspace
|
||||||
version = "1.0">
|
version = "1.0">
|
||||||
<FileRef
|
<FileRef
|
||||||
location = "group:Alipay.xcodeproj">
|
location = "group:RNAlipay.xcodeproj">
|
||||||
</FileRef>
|
</FileRef>
|
||||||
</Workspace>
|
</Workspace>
|
@ -1,12 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "@uiw/react-native-alipay",
|
"name": "@uiw/react-native-alipay",
|
||||||
"version": "2.0.6",
|
"version": "2.0.6",
|
||||||
"description": "基于 React Native 的宝支付插件,支持Android/iOS。",
|
"description": "基于 React Native 的支付宝插件,支持Android/iOS。",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"files": [
|
"files": [
|
||||||
"README.md",
|
"README.md",
|
||||||
"android",
|
"android",
|
||||||
"index.js",
|
"index.js",
|
||||||
|
"index.d.ts",
|
||||||
"ios",
|
"ios",
|
||||||
"react-native-alipay.podspec"
|
"react-native-alipay.podspec"
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user