2025-07-21 15:46:30 +08:00
|
|
|
|
import UIKit
|
2025-08-21 10:50:38 +08:00
|
|
|
|
import Flutter
|
|
|
|
|
|
|
|
|
|
|
|
// Add these two import lines
|
|
|
|
|
|
import TIMPush
|
|
|
|
|
|
import tencent_cloud_chat_push
|
|
|
|
|
|
|
2025-09-29 02:34:41 +08:00
|
|
|
|
// 官方微信 SDK
|
|
|
|
|
|
import WechatOpenSDK
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-21 10:50:38 +08:00
|
|
|
|
// Add `, TIMPushDelegate` to the following line
|
|
|
|
|
|
@UIApplicationMain
|
|
|
|
|
|
@objc class AppDelegate: FlutterAppDelegate, TIMPushDelegate {
|
2025-09-29 02:34:41 +08:00
|
|
|
|
private let CHANNEL = "wechat_business_view"
|
|
|
|
|
|
|
2025-08-21 10:50:38 +08:00
|
|
|
|
override func application(
|
|
|
|
|
|
_ application: UIApplication,
|
|
|
|
|
|
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
|
|
|
|
|
) -> Bool {
|
2025-10-10 11:27:26 +08:00
|
|
|
|
// 集成微信商家转账用户确认收款
|
2025-09-29 02:34:41 +08:00
|
|
|
|
let controller: FlutterViewController = window?.rootViewController as! FlutterViewController
|
|
|
|
|
|
let methodChannel = FlutterMethodChannel(name: CHANNEL, binaryMessenger: controller.binaryMessenger)
|
|
|
|
|
|
|
|
|
|
|
|
methodChannel.setMethodCallHandler { [weak self] (call, result) in
|
|
|
|
|
|
if call.method == "openBusinessView" {
|
|
|
|
|
|
if let args = call.arguments as? [String: Any],
|
|
|
|
|
|
let packageInfo = args["package"] as? String {
|
|
|
|
|
|
self?.openBusinessView(packageInfo: packageInfo)
|
|
|
|
|
|
result(true)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
result(FlutterError(code: "BAD_ARGS", message: "Missing package info", details: nil))
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
result(FlutterMethodNotImplemented)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//end
|
2025-08-21 10:50:38 +08:00
|
|
|
|
GeneratedPluginRegistrant.register(with: self)
|
|
|
|
|
|
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
|
|
|
|
|
}
|
2025-09-29 02:34:41 +08:00
|
|
|
|
|
|
|
|
|
|
private func openBusinessView(packageInfo: String) {
|
|
|
|
|
|
let req = WXOpenBusinessViewReq()
|
|
|
|
|
|
req.businessType = "requestMerchantTransfer"
|
|
|
|
|
|
req.query = packageInfo
|
|
|
|
|
|
WXApi.send(req) { success in
|
|
|
|
|
|
print("WXOpenBusinessViewReq send result: \(success)")
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-08-21 10:50:38 +08:00
|
|
|
|
|
|
|
|
|
|
// To be deprecated,please use the new field businessID below.
|
|
|
|
|
|
@objc func offlinePushCertificateID() -> Int32 {
|
|
|
|
|
|
return TencentCloudChatPushFlutterModal.shared.offlinePushCertificateID();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Add this function
|
|
|
|
|
|
@objc func businessID() -> Int32 {
|
|
|
|
|
|
return TencentCloudChatPushFlutterModal.shared.businessID();
|
|
|
|
|
|
}
|
2025-07-21 15:46:30 +08:00
|
|
|
|
|
2025-08-21 10:50:38 +08:00
|
|
|
|
// Add this function
|
|
|
|
|
|
@objc func applicationGroupID() -> String {
|
|
|
|
|
|
return TencentCloudChatPushFlutterModal.shared.applicationGroupID()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Add this function
|
|
|
|
|
|
@objc func onRemoteNotificationReceived(_ notice: String?) -> Bool {
|
|
|
|
|
|
TencentCloudChatPushPlugin.shared.tryNotifyDartOnNotificationClickEvent(notice)
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|