From 213a6f8552999ff50ff82888691ffbe9e31abf8c Mon Sep 17 00:00:00 2001
From: lxm <1274844347@qq.com>
Date: Tue, 26 Aug 2025 20:51:25 +0800
Subject: [PATCH 1/3] =?UTF-8?q?fix(=E9=9F=B3=E9=A2=91=E5=A4=84=E7=90=86):?=
=?UTF-8?q?=20=E6=96=B0=E5=A2=9E=E8=8D=A3=E8=80=80=E8=AE=BE=E5=A4=87?=
=?UTF-8?q?=E6=A3=80=E6=B5=8B=E6=96=B9=E6=B3=95=EF=BC=8C=E4=BB=85=E5=9C=A8?=
=?UTF-8?q?=E6=A3=80=E6=B5=8B=E5=88=B0=E8=8D=A3=E8=80=80=E8=AE=BE=E5=A4=87?=
=?UTF-8?q?=E6=97=B6=E5=90=AF=E7=94=A8=E9=80=9A=E8=AF=9D=E9=9F=B3=E9=A2=91?=
=?UTF-8?q?=E6=A8=A1=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../azure_speech/tools/SimpleAudioReceiver.kt | 27 +++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/tools/SimpleAudioReceiver.kt b/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/tools/SimpleAudioReceiver.kt
index 0505ff46d..bec452ee3 100644
--- a/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/tools/SimpleAudioReceiver.kt
+++ b/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/tools/SimpleAudioReceiver.kt
@@ -16,6 +16,7 @@ import android.media.AudioManager
import android.media.AudioFocusRequest
import android.media.AudioAttributes
import com.yunqiinnovation.azure_speech.tools.RecordFile
+import android.os.Build // 新增:用于获取设备信息
/**
* 简单音频接收器类,用于处理音频录制和流传输
@@ -232,13 +233,35 @@ class SimpleAudioReceiver(private val context: Context) {
}
}
+ /**
+ * 判断是否为荣耀手机
+ * @return true 如果是荣耀手机,false 否则
+ */
+ private fun isHonorDevice(): Boolean {
+ val brand = Build.BRAND?.lowercase() ?: ""
+ val manufacturer = Build.MANUFACTURER?.lowercase() ?: ""
+ val model = Build.MODEL?.lowercase() ?: ""
+
+ // 检查品牌、制造商或型号中是否包含荣耀相关标识
+ return brand.contains("honor") ||
+ manufacturer.contains("honor") ||
+ model.contains("honor") ||
+ brand.contains("荣耀") ||
+ manufacturer.contains("荣耀")
+ }
+
/**
* 运行麦克风捕获
*/
private fun runMicrophoneCapture() {
try {
- // 首先设置通话音频模式
- //setupCommunicationAudioMode()
+ // 根据手机品牌决定是否设置通话音频模式
+ if (isHonorDevice()) {
+ Log.d(TAG, "检测到荣耀设备,启用通话音频模式")
+ setupCommunicationAudioMode()
+ } else {
+ Log.d(TAG, "非荣耀设备,跳过通话音频模式设置")
+ }
val supportedSampleRates = intArrayOf(16000, 8000, 11025, 22050, 44100)
val sampleRate = supportedSampleRates.firstOrNull { rate ->
val bufferSize = AudioRecord.getMinBufferSize(rate, channelConfig, audioFormat)
From f214d73e43684d3c4cedfebdc73047af1927991b Mon Sep 17 00:00:00 2001
From: lxm <1274844347@qq.com>
Date: Tue, 26 Aug 2025 21:47:56 +0800
Subject: [PATCH 2/3] =?UTF-8?q?fix(ble=5Fmanager):=20=E4=BF=AE=E5=A4=8D?=
=?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=9C=B0=E5=8C=BA=E4=BB=A3=E7=A0=81=E5=88=A4?=
=?UTF-8?q?=E6=96=AD=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
将Get.locale改为Get.deviceLocale以正确获取设备地区代码
同时在version_update_service中统一使用设备地区代码判断服务器地址
---
lib/data/services/ble_manager.dart | 2 +-
lib/data/services/version_update_service.dart | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/data/services/ble_manager.dart b/lib/data/services/ble_manager.dart
index b9f48be6e..a835a5e39 100644
--- a/lib/data/services/ble_manager.dart
+++ b/lib/data/services/ble_manager.dart
@@ -532,7 +532,7 @@ class BleManager extends GetxService {
try {
// 从.env文件直接读取环境变量
var serverurl = dotenv.env['SERVER_URL'] ?? '';
- if (Get.locale?.countryCode != 'CN') {
+ if (Get.deviceLocale?.countryCode != 'CN') {
serverurl = dotenv.env['HW_SERVER_URL'] ?? '';
}
diff --git a/lib/data/services/version_update_service.dart b/lib/data/services/version_update_service.dart
index e959227ce..a15251857 100644
--- a/lib/data/services/version_update_service.dart
+++ b/lib/data/services/version_update_service.dart
@@ -30,7 +30,9 @@ class VersionUpdateService extends GetxService {
static final String? _countryCode = Get.deviceLocale?.countryCode; //国家地区编码
static final String? _languageCode = Get.deviceLocale?.languageCode; //语言编码
// ignore: non_constant_identifier_names
- static final String? _SERVER_URL = dotenv.env['SERVER_URL']; //服务器地址
+ static final String? _SERVER_URL = (_countryCode == 'CN')
+ ? dotenv.env['SERVER_URL']
+ : dotenv.env['HW_SERVER_URL']; //服务器地址
// 添加 getter 方法来访问缓存的静态数据
/// 获取缓存的应用版本
From a54bcb3a7d213873eba99efad5098ce58ff8d9bf Mon Sep 17 00:00:00 2001
From: lxm <1274844347@qq.com>
Date: Wed, 27 Aug 2025 11:06:40 +0800
Subject: [PATCH 3/3] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E7=89=88?=
=?UTF-8?q?=E6=9C=AC=E5=8F=B7=E5=B9=B6=E7=A7=BB=E9=99=A4=E9=83=A8=E5=88=86?=
=?UTF-8?q?Android=E5=AA=92=E4=BD=93=E6=9D=83=E9=99=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
更新pubspec.yaml中的版本号至1.0.10+25
移除AndroidManifest.xml中不再需要的媒体权限
---
android/app/src/main/AndroidManifest.xml | 4 ++--
pubspec.yaml | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 7d244c60a..441e2cafc 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -29,9 +29,9 @@
-
+
diff --git a/pubspec.yaml b/pubspec.yaml
index d63c9b133..5906aa5ea 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,7 +1,7 @@
name: voitrans
description: "Voitrans - AI Voice Assistant."
publish_to: "none"
-version: 1.0.10+20
+version: 1.0.10+25
environment:
sdk: ">=3.3.0 <4.0.0"