|
|
|
@ -2,8 +2,6 @@ import 'dart:async'; |
|
|
|
import 'dart:convert'; |
|
|
|
import 'dart:io'; |
|
|
|
|
|
|
|
import 'package:firebase_auth/firebase_auth.dart'; |
|
|
|
import 'package:flutter_dotenv/flutter_dotenv.dart'; |
|
|
|
import 'package:get_storage/get_storage.dart'; |
|
|
|
import 'package:get/get.dart'; |
|
|
|
import 'package:ble_service/ble_service.dart'; |
|
|
|
@ -882,7 +880,7 @@ class BleManager extends GetxService { |
|
|
|
AppConfig.env('XUNFEI_ASR_ACCESS_KEY_SECRET') ?? ''; |
|
|
|
// 从Flutter资源包中加载.mcp.json |
|
|
|
final jsonData = AppConfig.mcpConfig(); |
|
|
|
Logger.info('启动BLE服务,musicServiceType: ${musicServiceType}'); |
|
|
|
Logger.info('启动BLE服务,musicServiceType: $musicServiceType'); |
|
|
|
final isTtsInterruptEnabled = await _loadTtsInterrupe(); |
|
|
|
|
|
|
|
final vipExpiryTime = userInfo.User.instance.vipexptime; |
|
|
|
@ -901,26 +899,24 @@ class BleManager extends GetxService { |
|
|
|
// 用户设置了特定语言 |
|
|
|
final parts = savedLanguage.split('_'); |
|
|
|
if (parts.length == 2) { |
|
|
|
final lang = parts[0]; |
|
|
|
final lang = parts[0].toLowerCase(); |
|
|
|
final country = parts[1].toUpperCase(); |
|
|
|
|
|
|
|
if (lang == 'zh' && |
|
|
|
(country == 'HK' || country == 'TW' || country == 'CN')) { |
|
|
|
supportedLanguages.add('zh-$country'); |
|
|
|
} else if (lang == 'tl' && country == 'PH') { |
|
|
|
// 菲律宾语特殊处理,映射为azure语言码 |
|
|
|
supportedLanguages.add('fil-PH'); |
|
|
|
} else { |
|
|
|
final asrCode = languageManager.getAsrCodeByShortCode(lang); |
|
|
|
if (asrCode != null) { |
|
|
|
supportedLanguages.add(asrCode); |
|
|
|
} else { |
|
|
|
supportedLanguages.add('$lang-$country'); |
|
|
|
} |
|
|
|
supportedLanguages.add('$lang-$country'); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 跟随系统语言或未设置 |
|
|
|
final appLocale = Get.locale ?? AppTranslations.deviceLocale(); |
|
|
|
if (appLocale != null) { |
|
|
|
final lang = appLocale.languageCode; |
|
|
|
final lang = appLocale.languageCode.toLowerCase(); |
|
|
|
final country = appLocale.countryCode; |
|
|
|
|
|
|
|
if (lang.toLowerCase() == 'zh' && |
|
|
|
@ -931,13 +927,20 @@ class BleManager extends GetxService { |
|
|
|
country.toUpperCase() == 'CN')) { |
|
|
|
supportedLanguages.add('zh-${country.toUpperCase()}'); |
|
|
|
} else { |
|
|
|
final asrCode = languageManager.getAsrCodeByShortCode(lang); |
|
|
|
if (asrCode != null) { |
|
|
|
supportedLanguages.add(asrCode); |
|
|
|
} else if (country != null && country.isNotEmpty) { |
|
|
|
supportedLanguages.add('$lang-$country'); |
|
|
|
if (country != null && country.isNotEmpty) { |
|
|
|
final normalizedCountry = country.toUpperCase(); |
|
|
|
if (lang == 'tl' && normalizedCountry == 'PH') { |
|
|
|
supportedLanguages.add('fil-PH'); |
|
|
|
} else { |
|
|
|
supportedLanguages.add('$lang-$normalizedCountry'); |
|
|
|
} |
|
|
|
} else { |
|
|
|
supportedLanguages.add('en-US'); |
|
|
|
final asrCode = languageManager.getAsrCodeByShortCode(lang); |
|
|
|
if (asrCode != null) { |
|
|
|
supportedLanguages.add(asrCode); |
|
|
|
} else { |
|
|
|
supportedLanguages.add('en-US'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|