Browse Source

上传修复还原

weicu
liwei1dao 1 year ago
parent
commit
1be0de32d3
  1. 0
      android/.kotlin/sessions/kotlin-compiler-2007526241707140332.salive
  2. 2
      local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt
  3. 25
      local_plugins/chat_api/ios/chat_api/Sources/chat_api/SystemFunctionHandler.swift
  4. 15
      local_plugins/qq_music/android/src/main/kotlin/com/yunqiinnovation/qq_music/QQMusicSingleton.kt

0
android/.kotlin/sessions/kotlin-compiler-2007526241707140332.salive

2
local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt

@ -1965,7 +1965,7 @@ object AgentService : CoroutineScope {
) )
} }
if (playlist.isNotEmpty()) { if (playlist.isNotEmpty()) {
// processQQMusicPlayList(playlist) processQQMusicPlayList(playlist)
} else { } else {
Log.w(TAG, "qqmusic_searchandplay_songs 中没有有效的音乐条目") Log.w(TAG, "qqmusic_searchandplay_songs 中没有有效的音乐条目")
} }

25
local_plugins/chat_api/ios/chat_api/Sources/chat_api/SystemFunctionHandler.swift

@ -206,18 +206,18 @@ public class SystemFunctionHandler: NSObject {
let parameters: [String: Any] = [ let parameters: [String: Any] = [
"type": "object", "type": "object",
"properties": [ "properties": [
"phone_number": [ "contact": [
"type": "string", "type": "string",
"description": "要拨打的电话号码" "description": "联系人姓名或电话号码"
] ]
], ],
"required": ["phone_number"] "required": ["contact"]
] ]
let handler = MakePhoneCallHandler() let handler = MakePhoneCallHandler()
_ = client.registerLocalFunction( _ = client.registerLocalFunction(
name: "make_phone_call", name: "make_phone_call",
description: "拨打指定电话号码", description: "拨打电话",
parameters: parameters, parameters: parameters,
handler: handler handler: handler
) )
@ -693,25 +693,18 @@ private class SendTextMessageHandler: NSObject, FunctionHandler, MFMessageCompos
/// 拨打电话处理器 /// 拨打电话处理器
private class MakePhoneCallHandler: FunctionHandler { private class MakePhoneCallHandler: FunctionHandler {
func handle(arguments: [String: Any]) async throws -> String { func handle(arguments: [String: Any]) async throws -> String {
guard let phoneNumber = arguments["phone_number"] as? String else { guard let contact = arguments["contact"] as? String else {
throw ChatApiException("缺少电话号码参数") throw ChatApiException("缺少联系人参数")
} }
let result = await makePhoneCall(phoneNumber: phoneNumber) let result = await makePhoneCall(contact: contact)
return "{\"result\": \"\(result.message)\"}" return "{\"result\": \"\(result.message)\"}"
} }
private func makePhoneCall(phoneNumber: String) async -> Result { private func makePhoneCall(contact: String) async -> Result {
// 清理电话号码,移除空格和特殊字符 guard let url = URL(string: "tel:\(contact)") else {
let cleanedNumber = phoneNumber.replacingOccurrences(of: " ", with: "")
.replacingOccurrences(of: "-", with: "")
.replacingOccurrences(of: "(", with: "")
.replacingOccurrences(of: ")", with: "")
guard let url = URL(string: "tel:\(cleanedNumber)") else {
return Result(success: false, message: "无法创建电话URL") return Result(success: false, message: "无法创建电话URL")
} }
return await withCheckedContinuation { continuation in return await withCheckedContinuation { continuation in
DispatchQueue.main.async { DispatchQueue.main.async {
if UIApplication.shared.canOpenURL(url) { if UIApplication.shared.canOpenURL(url) {

15
local_plugins/qq_music/android/src/main/kotlin/com/yunqiinnovation/qq_music/QQMusicSingleton.kt

@ -558,20 +558,19 @@ class QQMusicSingleton private constructor() {
action(musicManager!!, object : QQMusicManager.PlayCallback { action(musicManager!!, object : QQMusicManager.PlayCallback {
override fun onSuccess() { override fun onSuccess() {
Log.d(TAG, "${actionName}成功") Log.d(TAG, "${actionName}成功")
checkPlaybackStateOnError(actionName, 0, "Success", callback) handler.post {
// handler.post { callback(Result.success(Unit))
// callback(Result.success(Unit)) }
// }
} }
override fun onError(errorCode: Int, errorMessage: String) { override fun onError(errorCode: Int, errorMessage: String) {
// if (allagain > 0 && curragain < allagain){ //重试机制 if (allagain > 0 && curragain < allagain){ //重试机制
// executePlaybackAction(actionName,curragain+1,allagain,action)(callback) executePlaybackAction(actionName,curragain+1,allagain,action)(callback)
// }else{ }else{
//播放失败时,检查当前播放状态 //播放失败时,检查当前播放状态
Log.d(TAG, "${actionName}失败,检查当前播放状态: $errorCode $errorMessage") Log.d(TAG, "${actionName}失败,检查当前播放状态: $errorCode $errorMessage")
checkPlaybackStateOnError(actionName, errorCode, errorMessage, callback) checkPlaybackStateOnError(actionName, errorCode, errorMessage, callback)
// } }
} }
}) })
} }

Loading…
Cancel
Save