Browse Source

Merge branch 'new_dev' of https://github.com/deepcloud2048/deep_voice into new_dev

newdev_shunjiawei
liwei1dao 1 year ago
parent
commit
24d1e1ded0
  1. 4
      lib/core/translations/app_translations.dart
  2. 4
      lib/data/services/bluetooth_manager.dart
  3. 2
      lib/modules/permissions/controllers/permissions_controller.dart
  4. 8
      lib/modules/settings/controllers/settings_controller.dart
  5. 46
      lib/modules/splash/views/splash_view.dart
  6. 17
      local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/AzureAsrHelper.kt

4
lib/core/translations/app_translations.dart

@ -186,11 +186,11 @@ class AppTranslations extends Translations {
return fallbackLocale;
}
return _getMatchedLocale(systemLocale);
return getMatchedLocale(systemLocale);
}
/// 智能匹配系统语言到支持的语言
static Locale _getMatchedLocale(Locale systemLocale) {
static Locale getMatchedLocale(Locale systemLocale) {
String languageCode = systemLocale.languageCode.toLowerCase();
String? countryCode = systemLocale.countryCode?.toUpperCase();
String? scriptCode = systemLocale.scriptCode;

4
lib/data/services/bluetooth_manager.dart

@ -76,7 +76,9 @@ class BluetoothManager extends GetxService {
currentDeviceRx.value = newDevice;
// 检查当前是否在OTA升级界面,如果是则不跳转
if (!_isInOtaUpgradePage() && !_bleManager.isConnected) {
if (!_isInOtaUpgradePage() &&
!_bleManager.isConnected &&
Get.currentRoute != Routes.pairing) {
Get.toNamed(Routes.pairing, arguments: newDevice);
} else {
Logger.info('当前在OTA升级界面,跳过配对页面跳转');

2
lib/modules/permissions/controllers/permissions_controller.dart

@ -184,7 +184,7 @@ class PermissionsController extends GetxController {
);
if (hasPermission) {
_showSuccessMessage();
// _showSuccessMessage();
if (Platform.isIOS && permission == Permission.calendarFullAccess) {
if (_isCalendarFullAccess == null) {
_storage.write('record_permission_calendar', true);

8
lib/modules/settings/controllers/settings_controller.dart

@ -301,9 +301,11 @@ class SettingsController extends GetxController {
}
}
/// 设置语言
Future<void> setLanguage(LanguageModel data) async {
try {
Locale? targetLocale;
// print('lxm--设置语言: ${data.value}');
if (data.value != 'system') {
// 用户手动选择的语言
@ -311,7 +313,11 @@ class SettingsController extends GetxController {
targetLocale = Locale(languageList[0], languageList[1]);
} else {
// 跟随系统语言,使用智能匹配
targetLocale = AppTranslations.deviceLocale();
targetLocale = Get.deviceLocale;
if (targetLocale != null) {
// 智能匹配系统语言到支持的语言
targetLocale = AppTranslations.getMatchedLocale(targetLocale);
}
}
if (targetLocale != null) {

46
lib/modules/splash/views/splash_view.dart

@ -225,7 +225,7 @@ class SplashView extends GetView<SplashController> {
children: [
// 将勾选框和文本包装在 GestureDetector 中
GestureDetector(
onTap: () => controller.togglePrivacyAcceptance(),
//onTap: () => controller.togglePrivacyAcceptance(),
behavior: HitTestBehavior.opaque, // 确保透明区域也能响应点击
child: Row(
children: [
@ -267,17 +267,17 @@ class SplashView extends GetView<SplashController> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
GestureDetector(
onTap: () {
String url = 'https://www.voitrans.net/doc/yhxy.html'; // 用户协议链接
if (Get.locale?.languageCode != 'zh' ||
Get.locale?.countryCode != 'CN') {
url = 'https://www.voitrans.net/doc/yhxy_en.html'; // 用户协议英文链接
}
Get.to(() => WebViewPage(
url: url,
title: 'userAgreement'.tr,
));
},
// onTap: () {
// String url = 'https://www.voitrans.net/doc/yhxy.html'; // 用户协议链接
// if (Get.locale?.languageCode != 'zh' ||
// Get.locale?.countryCode != 'CN') {
// url = 'https://www.voitrans.net/doc/yhxy_en.html'; // 用户协议英文链接
// }
// Get.to(() => WebViewPage(
// url: url,
// title: 'userAgreement'.tr,
// ));
// },
child: Text(
'userAgreement'.tr, // 《用户协议》
style: TextStyle(
@ -294,19 +294,19 @@ class SplashView extends GetView<SplashController> {
),
),
GestureDetector(
onTap: () {
String url = 'https://www.voitrans.net/doc/ysxy.html'; // 隐私政策链接
// onTap: () {
// String url = 'https://www.voitrans.net/doc/ysxy.html'; // 隐私政策链接
if (Get.locale?.languageCode != 'zh' ||
Get.locale?.countryCode != 'CN') {
url = 'https://www.voitrans.net/doc/ysxy_en.html'; // 隐私政策英文链接
}
// if (Get.locale?.languageCode != 'zh' ||
// Get.locale?.countryCode != 'CN') {
// url = 'https://www.voitrans.net/doc/ysxy_en.html'; // 隐私政策英文链接
// }
Get.to(() => WebViewPage(
url: url,
title: 'privacyPolicy'.tr,
));
},
// Get.to(() => WebViewPage(
// url: url,
// title: 'privacyPolicy'.tr,
// ));
// },
child: Text(
'privacyPolicy'.tr, // 《隐私政策》
style: TextStyle(

17
local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/AzureAsrHelper.kt

@ -547,19 +547,20 @@ class AzureAsrHelper(private val context: Context) {
Log.e(tag, "启动录音前台服务失败: ${e.message}")
}
}
// Initialize if not already done
if (!audioStream.isInitialized()) {
audioStream.initAudioRecord()
}
audioStream.setupStream()
if (audioStream.recordfile == null) {
audioStream.recordfile = RecordFile()
}
if (!audioStream.isContinuousRecognitionActive) {
// 启动音频处理
Log.i(tag, "开启录音:audioSourceType${audioSourceType}")
// Initialize if not already done
if (!audioStream.isInitialized()) {
audioStream.initAudioRecord()
}
audioStream.setupStream()
audioStream.startAudioRecord( when (audioSourceType) {
AudioSourceType.MICROPHONE -> SimpleAudioReceiver.AudioSourceType.MICROPHONE
AudioSourceType.EXTERNAL -> SimpleAudioReceiver.AudioSourceType.EXTERNAL
@ -635,7 +636,7 @@ class AzureAsrHelper(private val context: Context) {
}
Log.i(tag, "关闭录音:")
audioStream.recordfile ?: return
if (!audioStream.isContinuousRecognitionActive) {
audioStream.stopMicrophoneCapture()

Loading…
Cancel
Save