Skip to content

Instantly share code, notes, and snippets.

@Houserqu
Created July 23, 2025 00:45
Show Gist options
  • Save Houserqu/728a41953cd760978502aec8639d9fdc to your computer and use it in GitHub Desktop.
Save Houserqu/728a41953cd760978502aec8639d9fdc to your computer and use it in GitHub Desktop.
expo-native-wechat 修复
diff --git a/node_modules/expo-native-wechat/android/src/main/java/expo/modules/nativewechat/ExpoNativeWechatModule.kt b/node_modules/expo-native-wechat/android/src/main/java/expo/modules/nativewechat/ExpoNativeWechatModule.kt
index a5de5da..47eec52 100644
--- a/node_modules/expo-native-wechat/android/src/main/java/expo/modules/nativewechat/ExpoNativeWechatModule.kt
+++ b/node_modules/expo-native-wechat/android/src/main/java/expo/modules/nativewechat/ExpoNativeWechatModule.kt
@@ -8,13 +8,16 @@ import android.graphics.Bitmap
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.core.os.bundleOf
+import com.tencent.mm.opensdk.constants.ConstantsAPI
import com.tencent.mm.opensdk.modelbase.BaseReq
import com.tencent.mm.opensdk.modelbase.BaseResp
import com.tencent.mm.opensdk.modelbiz.SubscribeMessage
import com.tencent.mm.opensdk.modelbiz.WXLaunchMiniProgram
import com.tencent.mm.opensdk.modelbiz.WXOpenCustomerServiceChat
+import com.tencent.mm.opensdk.modelbiz.WXOpenBusinessView
import com.tencent.mm.opensdk.modelmsg.SendAuth
import com.tencent.mm.opensdk.modelmsg.SendMessageToWX
+import com.tencent.mm.opensdk.modelmsg.ShowMessageFromWX
import com.tencent.mm.opensdk.modelmsg.WXImageObject
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage
import com.tencent.mm.opensdk.modelmsg.WXMiniProgramObject
@@ -30,7 +33,7 @@ import expo.modules.kotlin.modules.ModuleDefinition
import expo.modules.nativewechat.ExpoNativeWechatUtils.DownloadBitmapCallback
import okhttp3.Call
import java.io.IOException
-
+import android.util.Log
class ExpoNativeWechatModule : Module(), IWXAPIEventHandler {
private var appid: String? = null
@@ -55,7 +58,7 @@ class ExpoNativeWechatModule : Module(), IWXAPIEventHandler {
)
}
- Events("ResponseData", "ResponseFromNotification")
+ Events("ResponseData", "ResponseFromNotification", "OnReq")
Function("registerApp") { params: RegisterAppParams ->
appid = params.appid
@@ -411,13 +414,38 @@ class ExpoNativeWechatModule : Module(), IWXAPIEventHandler {
)
}
+ Function("openBusinessView") { params: OpenBusinessViewParams ->
+ val query = params.query
+
+ val req = WXOpenBusinessView.Req()
+ req.businessType = "requestMerchantTransfer"
+ req.query = query
+
+ sendEvent(
+ "ResponseData", bundleOf(
+ "id" to params.id,
+ "success" to wxApi?.sendReq(req)
+ )
+ )
+ }
}
fun handleIntent(intent: Intent?) {
wxApi!!.handleIntent(intent, this)
}
- override fun onReq(req: BaseReq?) {}
+ override fun onReq(req: BaseReq?) {
+ if (req!!.type === ConstantsAPI.COMMAND_SHOWMESSAGE_FROM_WX && req is ShowMessageFromWX.Req) {
+ val mediaMsg = req.message
+ val extInfo = mediaMsg.messageExt
+
+ [email protected](
+ "OnReq", bundleOf(
+ "ext_info" to extInfo
+ )
+ )
+ }
+ }
override fun onResp(baseResp: BaseResp?) {
val convertedData = NativeWechatRespDataHelper.downcastResp(baseResp)
diff --git a/node_modules/expo-native-wechat/android/src/main/java/expo/modules/nativewechat/ExpoNativeWechatModuleParams.kt b/node_modules/expo-native-wechat/android/src/main/java/expo/modules/nativewechat/ExpoNativeWechatModuleParams.kt
index 08ecbce..ef07170 100644
--- a/node_modules/expo-native-wechat/android/src/main/java/expo/modules/nativewechat/ExpoNativeWechatModuleParams.kt
+++ b/node_modules/expo-native-wechat/android/src/main/java/expo/modules/nativewechat/ExpoNativeWechatModuleParams.kt
@@ -196,3 +196,11 @@ class OpenCustomerServiceParams : Record {
@Field
val url: String = ""
}
+
+class OpenBusinessViewParams : Record {
+ @Field
+ val id: String = ""
+
+ @Field
+ val query: String = ""
+}
diff --git a/node_modules/expo-native-wechat/android/src/main/java/expo/modules/nativewechat/NativeWechatRespDataHelper.kt b/node_modules/expo-native-wechat/android/src/main/java/expo/modules/nativewechat/NativeWechatRespDataHelper.kt
index 19defd3..3565fac 100644
--- a/node_modules/expo-native-wechat/android/src/main/java/expo/modules/nativewechat/NativeWechatRespDataHelper.kt
+++ b/node_modules/expo-native-wechat/android/src/main/java/expo/modules/nativewechat/NativeWechatRespDataHelper.kt
@@ -5,6 +5,8 @@ import androidx.core.os.bundleOf
import com.tencent.mm.opensdk.constants.ConstantsAPI
import com.tencent.mm.opensdk.modelbase.BaseResp
import com.tencent.mm.opensdk.modelbiz.WXLaunchMiniProgram
+import com.tencent.mm.opensdk.modelbiz.SubscribeMessage
+import com.tencent.mm.opensdk.modelbiz.WXOpenBusinessView
import com.tencent.mm.opensdk.modelmsg.SendAuth
@@ -27,6 +29,25 @@ object NativeWechatRespDataHelper {
argument.putString("country", resp.country)
}
+ if (baseResp.type == ConstantsAPI.COMMAND_SUBSCRIBE_MESSAGE) {
+ type = "WXSubscribeMsgResp"
+ val resp = baseResp as SubscribeMessage.Resp
+
+ argument.putString("open_id", resp.openId)
+ argument.putString("template_id", resp.templateID)
+ argument.putString("action", resp.action)
+ argument.putString("scene", resp.scene.toString())
+ argument.putString("reserved", resp.reserved)
+ }
+
+ if (baseResp.type == ConstantsAPI.COMMAND_OPEN_BUSINESS_VIEW) {
+ type = "WXOpenBusinessViewResp"
+ val resp = baseResp as WXOpenBusinessView.Resp
+
+ argument.putString("ext_msg", resp.extMsg)
+ argument.putString("business_type", resp.businessType)
+ }
+
if (baseResp.type == ConstantsAPI.COMMAND_LAUNCH_WX_MINIPROGRAM) {
type = "WXLaunchMiniProgramResp"
val resp = baseResp as WXLaunchMiniProgram.Resp
diff --git a/node_modules/expo-native-wechat/build/index.d.ts b/node_modules/expo-native-wechat/build/index.d.ts
index 9a41d4a..add018f 100644
--- a/node_modules/expo-native-wechat/build/index.d.ts
+++ b/node_modules/expo-native-wechat/build/index.d.ts
@@ -1,4 +1,5 @@
-import { NativeWechatModuleConstants, SendAuthRequestResponse, LaunchMiniProgramResponse, UniversalLinkCheckingResponse } from "./typing";
+import { EventSubscription } from "expo-modules-core";
+import { NativeWechatModuleConstants, SendAuthRequestResponse, LaunchMiniProgramResponse, UniversalLinkCheckingResponse, RequestSubscribeMessageResponse, OpenBusinessViewResponse } from "./typing";
export * from "./hooks";
export declare const checkUniversalLinkReady: () => Promise<UniversalLinkCheckingResponse>;
export declare const registerApp: (request: {
@@ -7,6 +8,7 @@ export declare const registerApp: (request: {
log?: boolean;
logPrefix?: string;
}) => Promise<boolean> | undefined;
+export declare function addOnReqListener(listener: (event: any) => void): EventSubscription;
export declare const isWechatInstalled: () => Promise<boolean>;
export declare const sendAuthRequest: (request?: {
scope: string;
@@ -56,7 +58,7 @@ export declare const requestSubscribeMessage: (request: {
scene: number;
templateId: string;
reserved?: string;
-}) => Promise<boolean>;
+}) => Promise<RequestSubscribeMessageResponse>;
export declare const openCustomerService: (request: {
corpid: string;
url: string;
@@ -65,8 +67,11 @@ export declare const launchMiniProgram: (request: {
userName: string;
path: string;
miniProgramType: number;
- onNavBack?: ((res: LaunchMiniProgramResponse) => void) | undefined;
+ onNavBack?: (res: LaunchMiniProgramResponse) => void;
}) => Promise<boolean>;
+export declare const openBusinessView: (request: {
+ query: string;
+}) => Promise<OpenBusinessViewResponse>;
export declare const NativeWechatConstants: NativeWechatModuleConstants;
export declare const NativeWechatShareScene: {
WXSceneSession: number;
diff --git a/node_modules/expo-native-wechat/build/index.d.ts.map b/node_modules/expo-native-wechat/build/index.d.ts.map
index f1d0f8e..3c13918 100644
--- a/node_modules/expo-native-wechat/build/index.d.ts.map
+++ b/node_modules/expo-native-wechat/build/index.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,2BAA2B,EAE3B,uBAAuB,EACvB,yBAAyB,EACzB,6BAA6B,EAC9B,MAAM,UAAU,CAAC;AAElB,cAAc,SAAS,CAAC;AAiBxB,eAAO,MAAM,uBAAuB,8CAU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,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,qBAYA,CAAC;AAEF,eAAO,MAAM,cAAc,YAAa;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,qCAoBA,CAAC;AAEF,eAAO,MAAM,uBAAuB,YAAa;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,6CAsBA,CAAC;AAEF,eAAO,MAAM,mBAAmB,YAAa;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb,qBAYA,CAAC;AAEF,eAAO,MAAM,iBAAiB,YAAa;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,yBAAyB,KAAK,IAAI,CAAC;CACtD,qBAYA,CAAC;AAEF,eAAO,MAAM,gBAAgB,YAAa;IACxC,KAAK,EAAE,MAAM,CAAC;CACf,sCAkBA,CAAC;AAEF,eAAO,MAAM,qBAAqB,EACD,2BAA2B,CAAC;AAE7D,eAAO,MAAM,sBAAsB;;;;CAIlC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;CAIvC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/expo-native-wechat/build/index.js b/node_modules/expo-native-wechat/build/index.js
index afe958c..793374d 100644
--- a/node_modules/expo-native-wechat/build/index.js
+++ b/node_modules/expo-native-wechat/build/index.js
@@ -44,6 +44,9 @@ export const registerApp = (request) => {
});
});
};
+export function addOnReqListener(listener) {
+ return emitter.addListener('OnReq', listener);
+}
export const isWechatInstalled = () => {
return new Promise((resolve, reject) => {
const id = executeNativeFunction(NativeModule.isWechatInstalled)();
@@ -150,10 +153,16 @@ export const requestSubscribeMessage = (request) => {
assertRegisteration("requestSubscribeMessage");
return new Promise((resolve, reject) => {
const id = executeNativeFunction(NativeModule.requestSubscribeMessage)(request);
- notification.once(id, (error, data) => {
- if (error)
- reject(error);
- resolve(data);
+ notification.once(id, (error) => {
+ if (error) {
+ return reject(error);
+ }
+ notification.once("WXSubscribeMsgResp", (error, data) => {
+ if (error) {
+ return reject(error);
+ }
+ return resolve(data);
+ });
});
});
};
@@ -179,6 +188,22 @@ export const launchMiniProgram = (request) => {
});
});
};
+export const openBusinessView = (request) => {
+ assertRegisteration("openBusinessView");
+ return new Promise((resolve, reject) => {
+ const id = executeNativeFunction(NativeModule.openBusinessView)(request);
+ notification.once(id, (error, data) => {
+ if (error)
+ reject(error);
+ notification.once("WXOpenBusinessViewResp", (error, data) => {
+ if (error) {
+ return reject(error);
+ }
+ return resolve(data);
+ });
+ });
+ });
+};
export const NativeWechatConstants = NativeModule.getConstants();
export const NativeWechatShareScene = {
WXSceneSession: NativeWechatConstants.WXSceneSession,
diff --git a/node_modules/expo-native-wechat/build/index.js.map b/node_modules/expo-native-wechat/build/index.js.map
index b63af43..610fb2f 100644
--- a/node_modules/expo-native-wechat/build/index.js.map
+++ b/node_modules/expo-native-wechat/build/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEvE,OAAO,YAAY,MAAM,UAAU,CAAC;AACpC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAQ1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAChD,cAAc,SAAS,CAAC;AAExB,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,YAAY,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,CAAC,mBAAmB,CAAC,CAAC;IAEzC,OAAO,IAAI,OAAO,CAAU,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC9C,MAAM,EAAE,GAAG,qBAAqB,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC;QAE1E,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YACpC,IAAI,KAAK;gBAAE,MAAM,CAAC,KAAK,CAAC,CAAC;YAEzB,OAAO,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAChC,YAAY,CAAC,YAAY,EAAiC,CAAC;AAE7D,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,cAAc,EAAE,qBAAqB,CAAC,cAAc;IACpD,eAAe,EAAE,qBAAqB,CAAC,eAAe;IACtD,eAAe,EAAE,qBAAqB,CAAC,eAAe;CACvD,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,wBAAwB,EAAE,qBAAqB,CAAC,wBAAwB;IACxE,qBAAqB,EAAE,qBAAqB,CAAC,qBAAqB;IAClE,wBAAwB,EAAE,qBAAqB,CAAC,wBAAwB;CACzE,CAAC","sourcesContent":["import { LegacyEventEmitter as EventEmitter } from \"expo-modules-core\";\n\nimport NativeModule from \"./module\";\nimport Notification from \"./notification\";\nimport {\n NativeWechatModuleConstants,\n NativeWechatResponse,\n SendAuthRequestResponse,\n LaunchMiniProgramResponse,\n UniversalLinkCheckingResponse,\n} from \"./typing\";\nimport { executeNativeFunction } from \"./utils\";\nexport * from \"./hooks\";\n\nconst emitter = new EventEmitter(NativeModule);\n\nconst notification = new Notification();\n\nlet registered = false;\n\nconst generateError = (response: NativeWechatResponse) =>\n new Error(`[Native Wechat]: (${response.errorCode}) ${response.errorStr}`);\n\nconst assertRegisteration = (name: string) => {\n if (!registered) {\n throw new Error(`Please register SDK before invoking ${name}`);\n }\n};\n\nexport const checkUniversalLinkReady = () => {\n return new Promise<UniversalLinkCheckingResponse>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.checkUniversalLinkReady)();\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n resolve(data);\n });\n });\n};\n\nexport const registerApp = (request: {\n appid: string;\n universalLink?: string;\n log?: boolean;\n logPrefix?: string;\n}) => {\n if (registered) {\n return;\n }\n\n emitter.addListener(\"ResponseData\", (response: NativeWechatResponse) => {\n const error = response.errorCode ? generateError(response) : null;\n\n notification.dispatch(response.id!, error, response);\n });\n\n emitter.addListener(\n \"ResponseFromNotification\",\n (response: NativeWechatResponse) => {\n const error = response.errorCode ? generateError(response) : null;\n\n notification.dispatch(response.type!, error, response);\n },\n );\n\n return new Promise<boolean>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.registerApp)(request);\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n registered = true;\n\n resolve(data);\n });\n });\n};\n\nexport const isWechatInstalled = () => {\n return new Promise<boolean>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.isWechatInstalled)();\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n resolve(data);\n });\n });\n};\n\nexport const sendAuthRequest = (\n request: { scope: string; state?: string } = {\n scope: \"snsapi_userinfo\",\n state: \"\",\n },\n) => {\n assertRegisteration(\"sendAuthRequest\");\n\n return new Promise<SendAuthRequestResponse>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.sendAuthRequest)(request);\n\n notification.once(id, (error) => {\n if (error) {\n return reject(error);\n }\n\n notification.once(\"SendAuthResp\", (error, data) => {\n if (error) {\n return reject(error);\n }\n\n return resolve(data);\n });\n });\n });\n};\n\nexport const shareText = (request: { text: string; scene: number }) => {\n assertRegisteration(\"shareText\");\n\n return new Promise<boolean>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.shareText)(request);\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n resolve(data);\n });\n });\n};\n\nexport const shareImage = (request: { src: string; scene: number }) => {\n assertRegisteration(\"shareImage\");\n\n return new Promise<boolean>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.shareImage)(request);\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n resolve(data);\n });\n });\n};\n\nexport const shareVideo = (request: {\n title?: string;\n description?: string;\n scene: number;\n videoUrl: string;\n videoLowBandUrl?: string;\n coverUrl?: string;\n}) => {\n assertRegisteration(\"shareVideo\");\n\n return new Promise<boolean>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.shareVideo)(request);\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n resolve(data);\n });\n });\n};\n\nexport const shareWebpage = (request: {\n title?: string;\n description?: string;\n scene: number;\n webpageUrl: string;\n coverUrl?: string;\n}) => {\n assertRegisteration(\"shareWebpage\");\n\n return new Promise<boolean>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.shareWebpage)(request);\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n resolve(data);\n });\n });\n};\n\nexport const shareMiniProgram = (request: {\n userName: string;\n path: string;\n miniprogramType: number;\n webpageUrl: string;\n withShareTicket?: boolean;\n title?: string;\n description?: string;\n coverUrl?: string;\n}) => {\n assertRegisteration(\"shareMiniProgram\");\n\n return new Promise<boolean>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.shareMiniProgram)(request);\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n resolve(data);\n });\n });\n};\n\nexport const requestPayment = (request: {\n partnerId: string;\n prepayId: string;\n nonceStr: string;\n timeStamp: string;\n sign: string;\n}) => {\n assertRegisteration(\"requestPayment\");\n\n return new Promise<SendAuthRequestResponse>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.requestPayment)(request);\n\n notification.once(id, (error) => {\n if (error) {\n return reject(error);\n }\n\n notification.once(\"PayResp\", (error, data) => {\n if (error) {\n return reject(error);\n }\n\n return resolve(data);\n });\n });\n });\n};\n\nexport const requestSubscribeMessage = (request: {\n scene: number;\n templateId: string;\n reserved?: string;\n}) => {\n assertRegisteration(\"requestSubscribeMessage\");\n\n return new Promise<boolean>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.requestSubscribeMessage)(\n request,\n );\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n resolve(data);\n });\n });\n};\n\nexport const openCustomerService = (request: {\n corpid: string;\n url: string;\n}) => {\n assertRegisteration(\"openCustomerService\");\n\n return new Promise<boolean>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.openCustomerService)(request);\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n resolve(data);\n });\n });\n};\n\nexport const launchMiniProgram = (request: {\n userName: string;\n path: string;\n miniProgramType: number;\n onNavBack?: (res: LaunchMiniProgramResponse) => void;\n}) => {\n assertRegisteration(\"launchMiniProgram\");\n\n return new Promise<boolean>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.launchMiniProgram)(request);\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n resolve(data);\n });\n });\n};\n\nexport const NativeWechatConstants =\n NativeModule.getConstants() as NativeWechatModuleConstants;\n\nexport const NativeWechatShareScene = {\n WXSceneSession: NativeWechatConstants.WXSceneSession,\n WXSceneTimeline: NativeWechatConstants.WXSceneTimeline,\n WXSceneFavorite: NativeWechatConstants.WXSceneFavorite,\n};\n\nexport const NativeWechatMiniprogramType = {\n WXMiniProgramTypeRelease: NativeWechatConstants.WXMiniProgramTypeRelease,\n WXMiniProgramTypeTest: NativeWechatConstants.WXMiniProgramTypeTest,\n WXMiniProgramTypePreview: NativeWechatConstants.WXMiniProgramTypePreview,\n};\n"]}
\ No newline at end of file
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,IAAI,YAAY,EAAqB,MAAM,mBAAmB,CAAC;AAE1F,OAAO,YAAY,MAAM,UAAU,CAAC;A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AE,IAAI,EAAE,EAAE;YACpC,IAAI,KAAK;gBAAE,MAAM,CAAC,KAAK,CAAC,CAAC;YAEzB,YAAY,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;gBAC1D,IAAI,KAAK,EAAE,CAAC;oBACV,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;gBACvB,CAAC;gBAED,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;YACvB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAChC,YAAY,CAAC,YAAY,EAAiC,CAAC;AAE7D,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,cAAc,EAAE,qBAAqB,CAAC,cAAc;IACpD,eAAe,EAAE,qBAAqB,CAAC,eAAe;IACtD,eAAe,EAAE,qBAAqB,CAAC,eAAe;CACvD,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,wBAAwB,EAAE,qBAAqB,CAAC,wBAAwB;IACxE,qBAAqB,EAAE,qBAAqB,CAAC,qBAAqB;IAClE,wBAAwB,EAAE,qBAAqB,CAAC,wBAAwB;CACzE,CAAC","sourcesContent":["import { LegacyEventEmitter as EventEmitter, EventSubscription } from \"expo-modules-core\";\n\nimport NativeModule from \"./module\";\nimport Notification from \"./notification\";\nimport {\n NativeWechatModuleConstants,\n NativeWechatResponse,\n SendAuthRequestResponse,\n LaunchMiniProgramResponse,\n UniversalLinkCheckingResponse,\n RequestSubscribeMessageResponse,\n OpenBusinessViewResponse,\n} from \"./typing\";\nimport { executeNativeFunction } from \"./utils\";\nexport * from \"./hooks\";\n\nconst emitter = new EventEmitter(NativeModule);\n\nconst notification = new Notification();\n\nlet registered = false;\n\nconst generateError = (response: NativeWechatResponse) =>\n new Error(`[Native Wechat]: (${response.errorCode}) ${response.errorStr}`);\n\nconst assertRegisteration = (name: string) => {\n if (!registered) {\n throw new Error(`Please register SDK before invoking ${name}`);\n }\n};\n\nexport const checkUniversalLinkReady = () => {\n return new Promise<UniversalLinkCheckingResponse>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.checkUniversalLinkReady)();\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n resolve(data);\n });\n });\n};\n\nexport const registerApp = (request: {\n appid: string;\n universalLink?: string;\n log?: boolean;\n logPrefix?: string;\n}) => {\n if (registered) {\n return;\n }\n\n emitter.addListener(\"ResponseData\", (response: NativeWechatResponse) => {\n const error = response.errorCode ? generateError(response) : null;\n\n notification.dispatch(response.id!, error, response);\n });\n\n emitter.addListener(\n \"ResponseFromNotification\",\n (response: NativeWechatResponse) => {\n const error = response.errorCode ? generateError(response) : null;\n\n notification.dispatch(response.type!, error, response);\n },\n );\n\n return new Promise<boolean>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.registerApp)(request);\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n registered = true;\n\n resolve(data);\n });\n });\n};\n\nexport function addOnReqListener(listener: (event: any) => void): EventSubscription {\n return emitter.addListener('OnReq', listener);\n}\n\nexport const isWechatInstalled = () => {\n return new Promise<boolean>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.isWechatInstalled)();\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n resolve(data);\n });\n });\n};\n\nexport const sendAuthRequest = (\n request: { scope: string; state?: string } = {\n scope: \"snsapi_userinfo\",\n state: \"\",\n },\n) => {\n assertRegisteration(\"sendAuthRequest\");\n\n return new Promise<SendAuthRequestResponse>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.sendAuthRequest)(request);\n\n notification.once(id, (error) => {\n if (error) {\n return reject(error);\n }\n\n notification.once(\"SendAuthResp\", (error, data) => {\n if (error) {\n return reject(error);\n }\n\n return resolve(data);\n });\n });\n });\n};\n\nexport const shareText = (request: { text: string; scene: number }) => {\n assertRegisteration(\"shareText\");\n\n return new Promise<boolean>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.shareText)(request);\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n resolve(data);\n });\n });\n};\n\nexport const shareImage = (request: { src: string; scene: number }) => {\n assertRegisteration(\"shareImage\");\n\n return new Promise<boolean>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.shareImage)(request);\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n resolve(data);\n });\n });\n};\n\nexport const shareVideo = (request: {\n title?: string;\n description?: string;\n scene: number;\n videoUrl: string;\n videoLowBandUrl?: string;\n coverUrl?: string;\n}) => {\n assertRegisteration(\"shareVideo\");\n\n return new Promise<boolean>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.shareVideo)(request);\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n resolve(data);\n });\n });\n};\n\nexport const shareWebpage = (request: {\n title?: string;\n description?: string;\n scene: number;\n webpageUrl: string;\n coverUrl?: string;\n}) => {\n assertRegisteration(\"shareWebpage\");\n\n return new Promise<boolean>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.shareWebpage)(request);\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n resolve(data);\n });\n });\n};\n\nexport const shareMiniProgram = (request: {\n userName: string;\n path: string;\n miniprogramType: number;\n webpageUrl: string;\n withShareTicket?: boolean;\n title?: string;\n description?: string;\n coverUrl?: string;\n}) => {\n assertRegisteration(\"shareMiniProgram\");\n\n return new Promise<boolean>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.shareMiniProgram)(request);\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n resolve(data);\n });\n });\n};\n\nexport const requestPayment = (request: {\n partnerId: string;\n prepayId: string;\n nonceStr: string;\n timeStamp: string;\n sign: string;\n}) => {\n assertRegisteration(\"requestPayment\");\n\n return new Promise<SendAuthRequestResponse>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.requestPayment)(request);\n\n notification.once(id, (error) => {\n if (error) {\n return reject(error);\n }\n\n notification.once(\"PayResp\", (error, data) => {\n if (error) {\n return reject(error);\n }\n\n return resolve(data);\n });\n });\n });\n};\n\nexport const requestSubscribeMessage = (request: {\n scene: number;\n templateId: string;\n reserved?: string;\n}) => {\n assertRegisteration(\"requestSubscribeMessage\");\n\n return new Promise<RequestSubscribeMessageResponse>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.requestSubscribeMessage)(\n request,\n );\n\n notification.once(id, (error) => {\n if (error) {\n return reject(error);\n }\n\n notification.once(\"WXSubscribeMsgResp\", (error, data) => {\n if (error) {\n return reject(error);\n }\n\n return resolve(data);\n });\n });\n });\n};\n\nexport const openCustomerService = (request: {\n corpid: string;\n url: string;\n}) => {\n assertRegisteration(\"openCustomerService\");\n\n return new Promise<boolean>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.openCustomerService)(request);\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n resolve(data);\n });\n });\n};\n\nexport const launchMiniProgram = (request: {\n userName: string;\n path: string;\n miniProgramType: number;\n onNavBack?: (res: LaunchMiniProgramResponse) => void;\n}) => {\n assertRegisteration(\"launchMiniProgram\");\n\n return new Promise<boolean>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.launchMiniProgram)(request);\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n resolve(data);\n });\n });\n};\n\nexport const openBusinessView = (request: {\n query: string;\n}) => {\n assertRegisteration(\"openBusinessView\");\n\n return new Promise<OpenBusinessViewResponse>((resolve, reject) => {\n const id = executeNativeFunction(NativeModule.openBusinessView)(request);\n\n notification.once(id, (error, data) => {\n if (error) reject(error);\n\n notification.once(\"WXOpenBusinessViewResp\", (error, data) => {\n if (error) {\n return reject(error);\n }\n\n return resolve(data);\n });\n });\n });\n};\n\nexport const NativeWechatConstants =\n NativeModule.getConstants() as NativeWechatModuleConstants;\n\nexport const NativeWechatShareScene = {\n WXSceneSession: NativeWechatConstants.WXSceneSession,\n WXSceneTimeline: NativeWechatConstants.WXSceneTimeline,\n WXSceneFavorite: NativeWechatConstants.WXSceneFavorite,\n};\n\nexport const NativeWechatMiniprogramType = {\n WXMiniProgramTypeRelease: NativeWechatConstants.WXMiniProgramTypeRelease,\n WXMiniProgramTypeTest: NativeWechatConstants.WXMiniProgramTypeTest,\n WXMiniProgramTypePreview: NativeWechatConstants.WXMiniProgramTypePreview,\n};\n"]}
\ No newline at end of file
diff --git a/node_modules/expo-native-wechat/build/typing.d.ts b/node_modules/expo-native-wechat/build/typing.d.ts
index 7274e95..3ea7be6 100644
--- a/node_modules/expo-native-wechat/build/typing.d.ts
+++ b/node_modules/expo-native-wechat/build/typing.d.ts
@@ -30,4 +30,15 @@ export type WechatMiniprogramType = {
WXMiniProgramTypePreview: number;
};
export type NativeWechatModuleConstants = WechatShareScene & WechatMiniprogramType;
+export type RequestSubscribeMessageResponse = NativeWechatResponse<{
+ action: string;
+ open_id: string;
+ template_id: string;
+ reserved?: string;
+ scene: number;
+}>;
+export type OpenBusinessViewResponse = NativeWechatResponse<{
+ business_type: string;
+ ext_msg: string;
+}>;
//# sourceMappingURL=typing.d.ts.map
\ No newline at end of file
diff --git a/node_modules/expo-native-wechat/build/typing.d.ts.map b/node_modules/expo-native-wechat/build/typing.d.ts.map
index c002980..79beb71 100644
--- a/node_modules/expo-native-wechat/build/typing.d.ts.map
+++ b/node_modules/expo-native-wechat/build/typing.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"typing.d.ts","sourceRoot":"","sources":["../src/typing.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAEpD,MAAM,MAAM,oBAAoB,CAAC,CAAC,GAAG,UAAU,IAAI;IACjD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,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C,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,oBAAoB,CAAC;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,wBAAwB,EAAE,MAAM,CAAC;IACjC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,gBAAgB,GACxD,qBAAqB,CAAC;AAExB,MAAM,MAAM,+BAA+B,GAAG,oBAAoB,CAAC;IACjE,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;IAC1D,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/expo-native-wechat/build/typing.js.map b/node_modules/expo-native-wechat/build/typing.js.map
index b4da4b0..9afdb5c 100644
--- a/node_modules/expo-native-wechat/build/typing.js.map
+++ b/node_modules/expo-native-wechat/build/typing.js.map
@@ -1 +1 @@
-{"version":3,"file":"typing.js","sourceRoot":"","sources":["../src/typing.ts"],"names":[],"mappings":"","sourcesContent":["export type Recordable<T = any> = Record<string, T>;\n\nexport type NativeWechatResponse<T = Recordable> = {\n id?: string;\n type?: string;\n errorCode: number;\n errorStr: string | null;\n data: T;\n};\n\nexport type UniversalLinkCheckingResponse = {\n suggestion: string;\n errorInfo: string;\n};\n\nexport type SendAuthRequestResponse = NativeWechatResponse<{\n code: string;\n country: string;\n lang: string;\n state: string;\n}>;\n\nexport type LaunchMiniProgramResponse = NativeWechatResponse<{\n extMsg?: string;\n}>;\n\nexport type WechatShareScene = {\n WXSceneSession: number;\n WXSceneTimeline: number;\n WXSceneFavorite: number;\n};\n\nexport type WechatMiniprogramType = {\n WXMiniProgramTypeRelease: number;\n WXMiniProgramTypeTest: number;\n WXMiniProgramTypePreview: number;\n};\n\nexport type NativeWechatModuleConstants = WechatShareScene &\n WechatMiniprogramType;\n"]}
\ No newline at end of file
+{"version":3,"file":"typing.js","sourceRoot":"","sources":["../src/typing.ts"],"names":[],"mappings":"","sourcesContent":["export type Recordable<T = any> = Record<string, T>;\n\nexport type NativeWechatResponse<T = Recordable> = {\n id?: string;\n type?: string;\n errorCode: number;\n errorStr: string | null;\n data: T;\n};\n\nexport type UniversalLinkCheckingResponse = {\n suggestion: string;\n errorInfo: string;\n};\n\nexport type SendAuthRequestResponse = NativeWechatResponse<{\n code: string;\n country: string;\n lang: string;\n state: string;\n}>;\n\nexport type LaunchMiniProgramResponse = NativeWechatResponse<{\n extMsg?: string;\n}>;\n\nexport type WechatShareScene = {\n WXSceneSession: number;\n WXSceneTimeline: number;\n WXSceneFavorite: number;\n};\n\nexport type WechatMiniprogramType = {\n WXMiniProgramTypeRelease: number;\n WXMiniProgramTypeTest: number;\n WXMiniProgramTypePreview: number;\n};\n\nexport type NativeWechatModuleConstants = WechatShareScene &\n WechatMiniprogramType;\n\nexport type RequestSubscribeMessageResponse = NativeWechatResponse<{\n action: string;\n open_id: string;\n template_id: string;\n reserved?: string;\n scene: number;\n}>;\n\nexport type OpenBusinessViewResponse = NativeWechatResponse<{\n business_type: string;\n ext_msg: string\n}>;"]}
\ No newline at end of file
diff --git a/node_modules/expo-native-wechat/ios/ExpoNativeWechatModule.swift b/node_modules/expo-native-wechat/ios/ExpoNativeWechatModule.swift
index e148b65..e588807 100644
--- a/node_modules/expo-native-wechat/ios/ExpoNativeWechatModule.swift
+++ b/node_modules/expo-native-wechat/ios/ExpoNativeWechatModule.swift
@@ -12,6 +12,13 @@ public class ExpoNativeWechatModule: Module {
name: Notification.Name("ResponseData"),
object: nil
)
+
+ NotificationCenter.default.addObserver(
+ self,
+ selector: #selector(handleReq),
+ name: Notification.Name("OnReq"),
+ object: nil
+ )
}
@objc func handleResponse(_ notification: Notification) {
@@ -20,6 +27,12 @@ public class ExpoNativeWechatModule: Module {
sendEvent("ResponseFromNotification", data)
}
+ @objc func handleReq(_ notification: Notification) {
+ let data = notification.object as! [String : Any]
+
+ sendEvent("OnReq", data)
+ }
+
public func definition() -> ModuleDefinition {
Name("ExpoNativeWechat")
@@ -29,6 +42,7 @@ public class ExpoNativeWechatModule: Module {
Events("ResponseData")
Events("ResponseFromNotification")
+ Events("OnReq")
Function("getConstants") {
return [
@@ -171,7 +185,7 @@ public class ExpoNativeWechatModule: Module {
let url = URL(string: params.coverUrl!)
ExpoWechatUtils.downloadFile(url: url!) { data in
- if data == nil {
+ if data != nil {
let compressed = ExpoWechatUtils.compressImage(data: data!, limit: 32000)
onCoverDownloaded(compressed)
@@ -217,7 +231,7 @@ public class ExpoNativeWechatModule: Module {
let url = URL(string: params.coverUrl!)
ExpoWechatUtils.downloadFile(url: url!) { data in
- if data == nil {
+ if data != nil {
let compressed = ExpoWechatUtils.compressImage(data: data!, limit: 32000)
onCoverDownloaded(compressed)
@@ -267,7 +281,7 @@ public class ExpoNativeWechatModule: Module {
let url = URL(string: params.coverUrl!)
ExpoWechatUtils.downloadFile(url: url!) { data in
- if data == nil {
+ if data != nil {
let compressed = ExpoWechatUtils.compressImage(data: data!, limit: 32000)
onCoverDownloaded(compressed)
@@ -333,5 +347,16 @@ public class ExpoNativeWechatModule: Module {
self.sendEvent("ResponseData", ["id": params.id, "success": success])
}
}
+
+ Function("openBusinessView") { (params: OpenBusinessViewParams) -> Void in
+ var req = WXOpenBusinessViewReq()
+
+ req.businessType = "requestMerchantTransfer"
+ req.query = params.query
+
+ WXApi.send(req) { success in
+ self.sendEvent("ResponseData", ["id": params.id, "success": success])
+ }
+ }
}
}
diff --git a/node_modules/expo-native-wechat/ios/ExpoNativeWechatModuleParams.swift b/node_modules/expo-native-wechat/ios/ExpoNativeWechatModuleParams.swift
index 72c09f2..fe1cf61 100644
--- a/node_modules/expo-native-wechat/ios/ExpoNativeWechatModuleParams.swift
+++ b/node_modules/expo-native-wechat/ios/ExpoNativeWechatModuleParams.swift
@@ -194,3 +194,11 @@ struct OpenCustomerServiceParams: Record {
@Field
var url: String
}
+
+struct OpenBusinessViewParams: Record {
+ @Field
+ var id: String
+
+ @Field
+ var query: String
+}
\ No newline at end of file
diff --git a/node_modules/expo-native-wechat/ios/ExpoWechatDelegate.swift b/node_modules/expo-native-wechat/ios/ExpoWechatDelegate.swift
index a243543..f8ba101 100644
--- a/node_modules/expo-native-wechat/ios/ExpoWechatDelegate.swift
+++ b/node_modules/expo-native-wechat/ios/ExpoWechatDelegate.swift
@@ -20,6 +20,22 @@ public class ExpoWechatDelegate: ExpoAppDelegateSubscriber, WXApiDelegate {
return WXApi.handleOpen(url, delegate: self);
}
+ public func onReq(_ req: BaseReq) {
+ if let launchReq = req as? LaunchFromWXReq {
+ let msg = launchReq.message
+ let openID = launchReq.openID
+ let extInfo = msg.messageExt
+
+ let data = ExpoWechatUtils.convertToSwiftDictionary(data: [
+ "ext_info": extInfo,
+ "open_id": openID
+ ])
+ let notificationName = Notification.Name("OnReq")
+
+ NotificationCenter.default.post(Notification(name: notificationName, object: nil, userInfo: data))
+ }
+ }
+
public func onResp(_ resp: BaseResp) {
let convertedData = RespDataHelper.downcastResp(resp)
let data = ExpoWechatUtils.convertToSwiftDictionary(data: convertedData! as NSDictionary)
diff --git a/node_modules/expo-native-wechat/ios/RespDataHelper.m b/node_modules/expo-native-wechat/ios/RespDataHelper.m
index 0d51ba6..52434d4 100644
--- a/node_modules/expo-native-wechat/ios/RespDataHelper.m
+++ b/node_modules/expo-native-wechat/ios/RespDataHelper.m
@@ -20,6 +20,23 @@ + (NSDictionary *)downcastResp: (BaseResp *)baseResp
[argument setObject:resp.country forKey:@"country"];
}
+ if([baseResp isKindOfClass: [WXSubscribeMsgResp class]]){
+ WXSubscribeMsgResp *resp = (WXSubscribeMsgResp*) baseResp;
+
+ [argument setObject:resp.templateId forKey:@"template_id"];
+ [argument setObject:resp.action forKey:@"action"];
+ [argument setObject:resp.reserved forKey:@"reserved"];
+ [argument setObject:resp.openId forKey:@"open_id"];
+ [argument setObject:[NSNumber numberWithUnsignedInt:resp.scene] forKey:@"scene"];
+ }
+
+ if([baseResp isKindOfClass: [WXOpenBusinessViewResp class]]){
+ WXOpenBusinessViewResp *resp = (WXOpenBusinessViewResp*) baseResp;
+
+ [argument setObject:resp.businessType forKey:@"business_type"];
+ [argument setObject:resp.extMsg forKey:@"ext_msg"];
+ }
+
if([baseResp isKindOfClass: [WXLaunchMiniProgramResp class]]){
WXLaunchMiniProgramResp *resp = (WXLaunchMiniProgramResp*) baseResp;
diff --git a/node_modules/expo-native-wechat/src/index.ts b/node_modules/expo-native-wechat/src/index.ts
index 655cf97..d41ac4f 100644
--- a/node_modules/expo-native-wechat/src/index.ts
+++ b/node_modules/expo-native-wechat/src/index.ts
@@ -1,4 +1,4 @@
-import { LegacyEventEmitter as EventEmitter } from "expo-modules-core";
+import { LegacyEventEmitter as EventEmitter, EventSubscription } from "expo-modules-core";
import NativeModule from "./module";
import Notification from "./notification";
@@ -8,6 +8,8 @@ import {
SendAuthRequestResponse,
LaunchMiniProgramResponse,
UniversalLinkCheckingResponse,
+ RequestSubscribeMessageResponse,
+ OpenBusinessViewResponse,
} from "./typing";
import { executeNativeFunction } from "./utils";
export * from "./hooks";
@@ -77,6 +79,10 @@ export const registerApp = (request: {
});
};
+export function addOnReqListener(listener: (event: any) => void): EventSubscription {
+ return emitter.addListener('OnReq', listener);
+}
+
export const isWechatInstalled = () => {
return new Promise<boolean>((resolve, reject) => {
const id = executeNativeFunction(NativeModule.isWechatInstalled)();
@@ -243,15 +249,23 @@ export const requestSubscribeMessage = (request: {
}) => {
assertRegisteration("requestSubscribeMessage");
- return new Promise<boolean>((resolve, reject) => {
+ return new Promise<RequestSubscribeMessageResponse>((resolve, reject) => {
const id = executeNativeFunction(NativeModule.requestSubscribeMessage)(
request,
);
- notification.once(id, (error, data) => {
- if (error) reject(error);
+ notification.once(id, (error) => {
+ if (error) {
+ return reject(error);
+ }
- resolve(data);
+ notification.once("WXSubscribeMsgResp", (error, data) => {
+ if (error) {
+ return reject(error);
+ }
+
+ return resolve(data);
+ });
});
});
};
@@ -292,6 +306,28 @@ export const launchMiniProgram = (request: {
});
};
+export const openBusinessView = (request: {
+ query: string;
+}) => {
+ assertRegisteration("openBusinessView");
+
+ return new Promise<OpenBusinessViewResponse>((resolve, reject) => {
+ const id = executeNativeFunction(NativeModule.openBusinessView)(request);
+
+ notification.once(id, (error, data) => {
+ if (error) reject(error);
+
+ notification.once("WXOpenBusinessViewResp", (error, data) => {
+ if (error) {
+ return reject(error);
+ }
+
+ return resolve(data);
+ });
+ });
+ });
+};
+
export const NativeWechatConstants =
NativeModule.getConstants() as NativeWechatModuleConstants;
diff --git a/node_modules/expo-native-wechat/src/typing.ts b/node_modules/expo-native-wechat/src/typing.ts
index 6f6024a..bdbac6c 100644
--- a/node_modules/expo-native-wechat/src/typing.ts
+++ b/node_modules/expo-native-wechat/src/typing.ts
@@ -38,3 +38,16 @@ export type WechatMiniprogramType = {
export type NativeWechatModuleConstants = WechatShareScene &
WechatMiniprogramType;
+
+export type RequestSubscribeMessageResponse = NativeWechatResponse<{
+ action: string;
+ open_id: string;
+ template_id: string;
+ reserved?: string;
+ scene: number;
+}>;
+
+export type OpenBusinessViewResponse = NativeWechatResponse<{
+ business_type: string;
+ ext_msg: string
+}>;
\ No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment