From 2b0df05c0dda7db11af17b7f3f6f24611ce9383a Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Sun, 28 Sep 2025 12:11:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0pid=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/pairing_controller.dart | 6 ++++- .../agent_service/AgentServiceImpl.swift | 12 +++++++++ .../chat_api/SystemFunctionHandler.kt | 25 +++++-------------- .../qq_music/QQMusicSingleton.kt | 15 +++++------ 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/lib/modules/pairing/controllers/pairing_controller.dart b/lib/modules/pairing/controllers/pairing_controller.dart index d3f13b636..6a53441b2 100644 --- a/lib/modules/pairing/controllers/pairing_controller.dart +++ b/lib/modules/pairing/controllers/pairing_controller.dart @@ -862,11 +862,13 @@ class PairingController extends GetxController with WidgetsBindingObserver { String macFromHex = extractMacFromHex(hexData, device.address); if (macFromHex.isNotEmpty) { String code = ""; - _verifiedDevicePid = extractAndReverseBytesToInt(hexData, 6, 7); + // 找到匹配的设备,提取授权码 if (Platform.isIOS) { // iOS设备,提取13-22字节的授权码 code = extractAndReverseBytes(hexData, 13, 22); + _verifiedDevicePid = + extractAndReverseBytesToInt(hexData, 4, 5); print('找到匹配设备,获取到 code: $code'); if (code != "") { _bleManager.stopScan(); @@ -901,6 +903,8 @@ class PairingController extends GetxController with WidgetsBindingObserver { } else if (Platform.isAndroid) { // Android设备,提取15-24字节的授权码 code = extractAndReverseBytes(hexData, 15, 24); + _verifiedDevicePid = + extractAndReverseBytesToInt(hexData, 6, 7); print('找到匹配设备,获取到 code: $code'); if (code != "") { _bleManager.stopScan(); diff --git a/local_plugins/agent_service/ios/agent_service/Sources/agent_service/AgentServiceImpl.swift b/local_plugins/agent_service/ios/agent_service/Sources/agent_service/AgentServiceImpl.swift index caabbed76..65f63bf07 100644 --- a/local_plugins/agent_service/ios/agent_service/Sources/agent_service/AgentServiceImpl.swift +++ b/local_plugins/agent_service/ios/agent_service/Sources/agent_service/AgentServiceImpl.swift @@ -993,6 +993,18 @@ private func jsonToString(_ json: [String: Any]) -> String? { print("启动导航: 从 \(start) 到 \(destination), 坐标: \(endlatitude),\(endlongitude), 模式: \(mode)") + // 检查应用状态 + let appState = UIApplication.shared.applicationState + + // 如果应用在后台,直接使用内置导航 + if appState == .background || appState == .inactive { + print("应用在后台,直接启动内置导航模式") + // startInternalNavigation(start: start, destination: destination, + // latitude: endlatitude, longitude: endlongitude, mode: mode) + return true + } + + // 应用在前台时的原有逻辑 // 根据导航模式选择不同的导航方式 switch mode { case "internal_gaode": diff --git a/local_plugins/chat_api/android/src/main/kotlin/com/yunqiinnovation/chat_api/SystemFunctionHandler.kt b/local_plugins/chat_api/android/src/main/kotlin/com/yunqiinnovation/chat_api/SystemFunctionHandler.kt index 6da97f176..1cc996d38 100644 --- a/local_plugins/chat_api/android/src/main/kotlin/com/yunqiinnovation/chat_api/SystemFunctionHandler.kt +++ b/local_plugins/chat_api/android/src/main/kotlin/com/yunqiinnovation/chat_api/SystemFunctionHandler.kt @@ -69,7 +69,7 @@ class SystemFunctionHandler(private val context: Context? = null) { "properties" to mapOf( "contact" to mapOf( "type" to "string", - "description" to "联系人姓名或电话号码" + "description" to "电话号码" ), "message" to mapOf( "type" to "string", @@ -112,7 +112,7 @@ class SystemFunctionHandler(private val context: Context? = null) { "properties" to mapOf( "contact" to mapOf( "type" to "string", - "description" to "联系人姓名或电话号码" + "description" to "电话号码" ) ), "required" to listOf("contact") @@ -1412,33 +1412,20 @@ private class GetContactsListHandler(private val context: Context?) : FunctionHa try { val contentResolver = context.contentResolver - // 构建查询条件 - val selection = if (!searchKeyword.isNullOrBlank()) { - "${ContactsContract.Contacts.DISPLAY_NAME} LIKE ?" - } else { - null - } - - val selectionArgs = if (!searchKeyword.isNullOrBlank()) { - arrayOf("%$searchKeyword%") - } else { - null - } - val projection = arrayOf( ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME, ContactsContract.Contacts.HAS_PHONE_NUMBER ) - // 按姓名排序,限制数量 - val sortOrder = "${ContactsContract.Contacts.DISPLAY_NAME} ASC LIMIT $limit" + // 按姓名排序 + val sortOrder = "${ContactsContract.Contacts.DISPLAY_NAME} ASC" contentResolver.query( ContactsContract.Contacts.CONTENT_URI, projection, - selection, - selectionArgs, + null, // 不使用任何筛选条件 + null, // 不使用任何筛选参数 sortOrder )?.use { cursor -> diff --git a/local_plugins/qq_music/android/src/main/kotlin/com/yunqiinnovation/qq_music/QQMusicSingleton.kt b/local_plugins/qq_music/android/src/main/kotlin/com/yunqiinnovation/qq_music/QQMusicSingleton.kt index f0fee9144..82117e361 100644 --- a/local_plugins/qq_music/android/src/main/kotlin/com/yunqiinnovation/qq_music/QQMusicSingleton.kt +++ b/local_plugins/qq_music/android/src/main/kotlin/com/yunqiinnovation/qq_music/QQMusicSingleton.kt @@ -558,19 +558,20 @@ class QQMusicSingleton private constructor() { action(musicManager!!, object : QQMusicManager.PlayCallback { override fun onSuccess() { Log.d(TAG, "${actionName}成功") - handler.post { - callback(Result.success(Unit)) - } + checkPlaybackStateOnError(actionName, 0, "Success", callback) +// handler.post { +// callback(Result.success(Unit)) +// } } override fun onError(errorCode: Int, errorMessage: String) { - if (allagain > 0 && curragain < allagain){ //重试机制 - executePlaybackAction(actionName,curragain+1,allagain,action)(callback) - }else{ +// if (allagain > 0 && curragain < allagain){ //重试机制 +// executePlaybackAction(actionName,curragain+1,allagain,action)(callback) +// }else{ //播放失败时,检查当前播放状态 Log.d(TAG, "${actionName}失败,检查当前播放状态: $errorCode $errorMessage") checkPlaybackStateOnError(actionName, errorCode, errorMessage, callback) - } +// } } }) }