1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

fix(Android): Fix registerApp param issue.

This commit is contained in:
jaywcjlove
2020-08-01 21:29:37 +08:00
parent f1d0bc8c0d
commit 56ceded9b8
2 changed files with 9 additions and 4 deletions

2
index.d.ts vendored
View File

@@ -3,7 +3,7 @@
* 向微信注册应用 * 向微信注册应用
* 必须先注册应用,在 Android 后面的调用才会起作用 * 必须先注册应用,在 Android 后面的调用才会起作用
* @param appid 通过微信开放平台,[获取appid](https://open.weixin.qq.com/) * @param appid 通过微信开放平台,[获取appid](https://open.weixin.qq.com/)
* @param universalLink Universal Link(通用链接)是苹果在 iOS9 推出的,一种能够方便的通过传统 HTTPS 链接来启动 APP 的功能,可以使用相同的网址打开网址和 APP。 * @param universalLink 参数在 iOS 中有效,Universal Link(通用链接)是苹果在 iOS9 推出的,一种能够方便的通过传统 HTTPS 链接来启动 APP 的功能,可以使用相同的网址打开网址和 APP。
*/ */
export function registerApp(appid: string, universalLink: string): void; export function registerApp(appid: string, universalLink: string): void;
/** /**

View File

@@ -1,4 +1,4 @@
import { NativeModules } from 'react-native'; import { NativeModules, Platform } from 'react-native';
// const { RNWechat } = NativeModules; // const { RNWechat } = NativeModules;
@@ -6,10 +6,15 @@ export default class Wechat {
/** /**
* 向微信注册应用 * 向微信注册应用
* @param appid 通过微信开放平台,[获取appid](https://open.weixin.qq.com/) * @param appid 通过微信开放平台,[获取appid](https://open.weixin.qq.com/)
* @param universalLink Universal Link(通用链接)是苹果在 iOS9 推出的,一种能够方便的通过传统 HTTPS 链接来启动 APP 的功能,可以使用相同的网址打开网址和 APP。 * @param universalLink 参数在 iOS 中有效,Universal Link(通用链接)是苹果在 iOS9 推出的,一种能够方便的通过传统 HTTPS 链接来启动 APP 的功能,可以使用相同的网址打开网址和 APP。
*/ */
static registerApp(appid, universalLink) { static registerApp(appid, universalLink) {
return NativeModules.RNWechat.registerApp(appid, universalLink); if (Platform.OS === 'ios') {
return NativeModules.RNWechat.registerApp(appid, universalLink);
}
if (Platform.OS === 'android') {
return NativeModules.RNWechat.registerApp(appid);
}
} }
/** /**
* 检查微信是否已被用户安装 * 检查微信是否已被用户安装