@gyjshow/react-native-wechat 1.0.3 → 1.0.5

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.
@@ -21,10 +21,20 @@ class RNWeChatModule(private val reactContext: ReactApplicationContext) :
21
21
  wxApi?.registerApp(appId)
22
22
  }
23
23
 
24
- @ReactMethod
25
- fun getVersion(promise: Promise) {
26
- promise.resolve(wxApi?.WXAppSupportAPI?.toString() ?: "unknown")
27
- }
24
+ @ReactMethod
25
+ fun getVersion(promise: Promise) {
26
+ if (wxApi == null) {
27
+ promise.reject("NOT_REGISTERED", "微信未注册")
28
+ return
29
+ }
30
+ try {
31
+ val version = wxApi!!.wxAppSupportAPI // int
32
+ promise.resolve(version.toString())
33
+ } catch (e: Exception) {
34
+ promise.reject("ERROR", e.message)
35
+ }
36
+ }
37
+
28
38
 
29
39
  @ReactMethod
30
40
  fun pay(payInfo: ReadableMap, promise: Promise) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gyjshow/react-native-wechat",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "private": false,
5
5
  "description": "待测试验证!!! React Native WeChat plugin for WeChat Pay and Share (iOS & Android)",
6
6
  "main": "lib/index.js",
@@ -24,6 +24,7 @@
24
24
  ],
25
25
  "author": "Allen.ge",
26
26
  "license": "MIT",
27
+ "homepage": "https://github.com/gyjshow/react-native-wechat.git",
27
28
  "peerDependencies": {
28
29
  "react": "*",
29
30
  "react-native": ">=0.60.0"