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

feat: Add isWXAppSupportApi props.

This commit is contained in:
jaywcjlove
2020-08-01 19:47:56 +08:00
parent ec14ccee87
commit ae9cf92755
3 changed files with 22 additions and 1 deletions

5
index.d.ts vendored
View File

@@ -10,3 +10,8 @@ export function registerApp(appid: string, universalLink: string): void;
* 微信已安装返回 `true`,未安装返回 `false`。 * 微信已安装返回 `true`,未安装返回 `false`。
*/ */
export function isWXAppInstalled(): Promise<Boolean>; export function isWXAppInstalled(): Promise<Boolean>;
/**
* 判断当前微信的版本是否支持 OpenApi
* 支持返回 true不支持返回 false
*/
export function isWXAppSupportApi(): Promise<Boolean>;

View File

@@ -17,4 +17,10 @@ export default class Wechat {
static isWXAppInstalled() { static isWXAppInstalled() {
return NativeModules.RNWechat.isWXAppInstalled(); return NativeModules.RNWechat.isWXAppInstalled();
} }
/**
* 判断当前微信的版本是否支持OpenApi支持返回 true不支持返回 false
*/
static isWXAppSupportApi() {
return NativeModules.RNWechat.isWXAppSupportApi();
}
} }

View File

@@ -61,4 +61,14 @@ RCT_REMAP_METHOD(isWXAppInstalled, :(RCTPromiseResolveBlock)resolve :(RCTPromise
resolve(@NO); resolve(@NO);
} }
} }
// OpenApiYESNO
RCT_REMAP_METHOD(isWXAppSupportApi, resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
if ([WXApi isWXAppSupportApi]) {
resolve(@YES);
} else {
resolve(@NO);
}
}
@end @end