|
|
@ -10,4 +10,34 @@ import UIKit |
|
|
GeneratedPluginRegistrant.register(with: self) |
|
|
GeneratedPluginRegistrant.register(with: self) |
|
|
return super.application(application, didFinishLaunchingWithOptions: launchOptions) |
|
|
return super.application(application, didFinishLaunchingWithOptions: launchOptions) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 添加URL回调监听 |
|
|
|
|
|
override func application( |
|
|
|
|
|
_ app: UIApplication, |
|
|
|
|
|
open url: URL, |
|
|
|
|
|
options: [UIApplication.OpenURLOptionsKey : Any] = [:] |
|
|
|
|
|
) -> Bool { |
|
|
|
|
|
print("AppDelegate收到URL回调: \(url.absoluteString)") |
|
|
|
|
|
|
|
|
|
|
|
// 首先尝试让父类处理 |
|
|
|
|
|
if super.application(app, open: url, options: options) { |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 检查是否是VoiTrans相关的URL |
|
|
|
|
|
if url.scheme == "voitrans" { |
|
|
|
|
|
print("处理 voitrans URL: \(url.absoluteString)") |
|
|
|
|
|
|
|
|
|
|
|
// 通过Flutter的方法通道通知QQ音乐插件处理这个URL |
|
|
|
|
|
if let flutterViewController = window?.rootViewController as? FlutterViewController { |
|
|
|
|
|
let channel = FlutterMethodChannel(name: "qq_music", binaryMessenger: flutterViewController.binaryMessenger) |
|
|
|
|
|
channel.invokeMethod("openUrl", arguments: ["url": url.absoluteString]) { result in |
|
|
|
|
|
print("QQ音乐插件处理URL结果: \(String(describing: result))") |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|