Skip to content

Commit ae9cf92

Browse files
committed
feat: Add isWXAppSupportApi props.
1 parent ec14cce commit ae9cf92

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

index.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@ export function registerApp(appid: string, universalLink: string): void;
99
* 检查微信是否已被用户安装
1010
* 微信已安装返回 `true`,未安装返回 `false`。
1111
*/
12-
export function isWXAppInstalled(): Promise<Boolean>;
12+
export function isWXAppInstalled(): Promise<Boolean>;
13+
/**
14+
* 判断当前微信的版本是否支持 OpenApi
15+
* 支持返回 true,不支持返回 false
16+
*/
17+
export function isWXAppSupportApi(): Promise<Boolean>;

index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,10 @@ export default class Wechat {
1717
static isWXAppInstalled() {
1818
return NativeModules.RNWechat.isWXAppInstalled();
1919
}
20+
/**
21+
* 判断当前微信的版本是否支持OpenApi,支持返回 true,不支持返回 false
22+
*/
23+
static isWXAppSupportApi() {
24+
return NativeModules.RNWechat.isWXAppSupportApi();
25+
}
2026
}

ios/RNWechat.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,14 @@ + (BOOL)requiresMainQueueSetup {
6161
resolve(@NO);
6262
}
6363
}
64+
65+
// 判断当前微信的版本是否支持OpenApi,支持返回YES,不支持返回NO。
66+
RCT_REMAP_METHOD(isWXAppSupportApi, resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
67+
if ([WXApi isWXAppSupportApi]) {
68+
resolve(@YES);
69+
} else {
70+
resolve(@NO);
71+
}
72+
}
73+
6474
@end

0 commit comments

Comments
 (0)