From c648698e977a3d15c12998206d91b6d49c60bd8f Mon Sep 17 00:00:00 2001 From: lxm <1274844347@qq.com> Date: Fri, 5 Sep 2025 16:35:31 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=E8=B0=83=E6=95=B4=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E5=A4=A7=E5=B0=8F=E5=B9=B6=E4=BC=98=E5=8C=96=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E4=BF=A1=E6=81=AF=E5=88=B7=E6=96=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改设置和探索页面的标题字体大小 - 在设备连接时主动刷新设备信息 - 为路由添加页面切换动画 - 清理调试日志和注释代码 - 为翻译统计页面添加返回按钮 --- lib/data/services/ble_manager.dart | 9 +- lib/data/services/version_update_service.dart | 12 +- lib/modules/explore/views/explore_view.dart | 2 +- .../home/controllers/home_controller.dart | 11 +- lib/modules/settings/views/settings_view.dart | 2 +- .../views/translation_stats_view.dart | 492 ++++++++++-------- lib/routes/app_pages.dart | 4 + 7 files changed, 289 insertions(+), 243 deletions(-) diff --git a/lib/data/services/ble_manager.dart b/lib/data/services/ble_manager.dart index 963f22c25..954c2b61c 100644 --- a/lib/data/services/ble_manager.dart +++ b/lib/data/services/ble_manager.dart @@ -156,7 +156,7 @@ class BleManager extends GetxService { /// 设置BLE事件监听 void _setupBleListener() { - Logger.info('lxm--_setupBleListener被调用,开始设置BLE事件监听'); + //Logger.info('lxm--_setupBleListener被调用,开始设置BLE事件监听'); _statusSubscription?.cancel(); _dataSubscription?.cancel(); @@ -394,6 +394,7 @@ class BleManager extends GetxService { Logger.info('lxm-- overallBattery: $overallBattery'); Logger.info('lxm--准备调用_updateDeviceInfoIfNeeded'); + // 更新设备信息 _updateDeviceInfoIfNeeded( batteryLevel: overallBattery, @@ -796,12 +797,12 @@ class BleManager extends GetxService { /// 主动获取电池信息 Future fetchBatteryInfo() async { try { - Logger.info('lxm--fetchBatteryInfo被调用,准备向设备发送获取电池信息指令'); + //Logger.info('lxm--fetchBatteryInfo被调用,准备向设备发送获取电池信息指令'); final result = await _bleService.getBatteryInfo(); - Logger.info('lxm--getBatteryInfo指令发送结果: $result'); + //Logger.info('lxm--getBatteryInfo指令发送结果: $result'); return result; } catch (e) { - Logger.error('lxm--获取电池信息失败: ${e.toString()}'); + //Logger.error('lxm--获取电池信息失败: ${e.toString()}'); return false; } } diff --git a/lib/data/services/version_update_service.dart b/lib/data/services/version_update_service.dart index 23be2291b..b6822c17f 100644 --- a/lib/data/services/version_update_service.dart +++ b/lib/data/services/version_update_service.dart @@ -353,12 +353,12 @@ class VersionUpdateService extends GetxService { /// 执行更新操作 Future performUpdate(VersionUpdateInfo updateInfo) async { - print('lxm---updateInfo详情:'); - print('lxm---hasUpdate: ${updateInfo.hasUpdate}'); - print('lxm---currentVersion: ${updateInfo.currentVersion}'); - print('lxm---latestVersion: ${updateInfo.latestVersion}'); - print('lxm---updateType: ${updateInfo.updateType}'); - print('lxm---appInfo: ${updateInfo.appInfo?.toJson()}'); + //print('lxm---updateInfo详情:'); + //print('lxm---hasUpdate: ${updateInfo.hasUpdate}'); + //print('lxm---currentVersion: ${updateInfo.currentVersion}'); + //print('lxm---latestVersion: ${updateInfo.latestVersion}'); + //print('lxm---updateType: ${updateInfo.updateType}'); + //print('lxm---appInfo: ${updateInfo.appInfo?.toJson()}'); if (!updateInfo.hasUpdate || updateInfo.appInfo == null) { return false; } diff --git a/lib/modules/explore/views/explore_view.dart b/lib/modules/explore/views/explore_view.dart index 0f373dbf1..2c9c076ee 100644 --- a/lib/modules/explore/views/explore_view.dart +++ b/lib/modules/explore/views/explore_view.dart @@ -99,7 +99,7 @@ class ExploreView extends GetView { Text( 'explore'.tr, // 发现 style: TextStyle( - fontSize: 24.sp, + fontSize: 20.sp, fontWeight: FontWeight.bold, color: isDarkMode ? Colors.white : Colors.grey[800], ), diff --git a/lib/modules/home/controllers/home_controller.dart b/lib/modules/home/controllers/home_controller.dart index ebf33cd74..c0434e6e1 100644 --- a/lib/modules/home/controllers/home_controller.dart +++ b/lib/modules/home/controllers/home_controller.dart @@ -140,7 +140,16 @@ class HomeController extends GetxController { Future refreshDeviceConnection() async { await _checkConnectionStatus(); - // 移除了立即刷新电池信息的逻辑 + + // 如果设备已连接,主动刷新设备信息 + if (_isFullyConnected.value) { + try { + Logger.d(_tag, '刷新设备信息'); + await _bleManager.fetchDeviceInfo(); + } catch (e) { + Logger.e(_tag, '刷新设备信息失败: $e'); + } + } } void rescanDevices() { diff --git a/lib/modules/settings/views/settings_view.dart b/lib/modules/settings/views/settings_view.dart index 4220460bd..c538aac0d 100644 --- a/lib/modules/settings/views/settings_view.dart +++ b/lib/modules/settings/views/settings_view.dart @@ -29,7 +29,7 @@ class SettingsView extends GetView { title: Text( 'settings'.tr, // 设置 style: TextStyle( - fontSize: 17.sp, + fontSize: 18.sp, fontWeight: FontWeight.w600, color: isDarkMode ? Colors.white : Colors.black, ), diff --git a/lib/modules/translation/views/translation_stats_view.dart b/lib/modules/translation/views/translation_stats_view.dart index 22773ddcb..271bdeb31 100644 --- a/lib/modules/translation/views/translation_stats_view.dart +++ b/lib/modules/translation/views/translation_stats_view.dart @@ -24,6 +24,14 @@ class TranslationStatsView extends GetView { /// 构建应用栏 PreferredSizeWidget _buildAppBar(bool isDarkMode) { return AppBar( + leading: IconButton( + icon: Icon( + Icons.arrow_back_ios, + color: isDarkMode ? Colors.white : Colors.black, + size: 20.sp, + ), + onPressed: () => Get.back(), + ), backgroundColor: isDarkMode ? AppColors.darkBackground : Colors.white, elevation: 0.5, title: Text( @@ -136,20 +144,20 @@ class TranslationStatsView extends GetView { ], ), child: Obx(() => Row( - children: [ - _buildTimeRangeTab('今日', 0, isDarkMode), - _buildTimeRangeTab('本周', 1, isDarkMode), - _buildTimeRangeTab('本月', 2, isDarkMode), - _buildTimeRangeTab('历史', 3, isDarkMode), - ], - )), + children: [ + _buildTimeRangeTab('今日', 0, isDarkMode), + _buildTimeRangeTab('本周', 1, isDarkMode), + _buildTimeRangeTab('本月', 2, isDarkMode), + _buildTimeRangeTab('历史', 3, isDarkMode), + ], + )), ); } /// 构建时间范围标签 Widget _buildTimeRangeTab(String title, int index, bool isDarkMode) { final isSelected = controller.selectedTabIndex.value == index; - + return Expanded( child: GestureDetector( onTap: () => controller.switchTimeRange(index), @@ -215,49 +223,50 @@ class TranslationStatsView extends GetView { ), SizedBox(height: 16.h), Obx(() => Row( - children: [ - Expanded( - child: _buildStatItem( - '翻译次数', - controller.realtimeStats.translationCount.toString(), - Icons.translate, - isDarkMode, - ), - ), - Expanded( - child: _buildStatItem( - '会话时长', - '${controller.realtimeStats.sessionDurationMinutes}分钟', - Icons.timer, - isDarkMode, - ), - ), - ], - )), + children: [ + Expanded( + child: _buildStatItem( + '翻译次数', + controller.realtimeStats.translationCount.toString(), + Icons.translate, + isDarkMode, + ), + ), + Expanded( + child: _buildStatItem( + '会话时长', + '${controller.realtimeStats.sessionDurationMinutes}分钟', + Icons.timer, + isDarkMode, + ), + ), + ], + )), SizedBox(height: 12.h), Obx(() => Row( - children: [ - Expanded( - child: _buildStatItem( - '字符数', - controller.formatNumber( - controller.realtimeStats.sourceCharacters + - controller.realtimeStats.targetCharacters, + children: [ + Expanded( + child: _buildStatItem( + '字符数', + controller.formatNumber( + controller.realtimeStats.sourceCharacters + + controller.realtimeStats.targetCharacters, + ), + Icons.text_fields, + isDarkMode, + ), ), - Icons.text_fields, - isDarkMode, - ), - ), - Expanded( - child: _buildStatItem( - '录音时长', - controller.formatDuration(controller.realtimeStats.recordingDuration), - Icons.mic, - isDarkMode, - ), - ), - ], - )), + Expanded( + child: _buildStatItem( + '录音时长', + controller.formatDuration( + controller.realtimeStats.recordingDuration), + Icons.mic, + isDarkMode, + ), + ), + ], + )), ], ), ); @@ -290,64 +299,68 @@ class TranslationStatsView extends GetView { ), SizedBox(width: 8.w), Obx(() => Text( - '${controller.selectedTimeRange.value}概览', - style: TextStyle( - fontSize: 16.sp, - fontWeight: FontWeight.w600, - color: isDarkMode ? Colors.white : Colors.black, - ), - )), + '${controller.selectedTimeRange.value}概览', + style: TextStyle( + fontSize: 16.sp, + fontWeight: FontWeight.w600, + color: isDarkMode ? Colors.white : Colors.black, + ), + )), ], ), SizedBox(height: 16.h), Obx(() => Row( - children: [ - Expanded( - child: _buildStatItem( - '总调用次数', - controller.formatNumber(controller.currentStats.totalApiCalls), - Icons.api, - isDarkMode, - ), - ), - Expanded( - child: _buildStatItem( - '预估成本', - controller.formatCost(controller.currentStats.estimatedCost), - Icons.attach_money, - isDarkMode, - ), - ), - ], - )), + children: [ + Expanded( + child: _buildStatItem( + '总调用次数', + controller + .formatNumber(controller.currentStats.totalApiCalls), + Icons.api, + isDarkMode, + ), + ), + Expanded( + child: _buildStatItem( + '预估成本', + controller + .formatCost(controller.currentStats.estimatedCost), + Icons.attach_money, + isDarkMode, + ), + ), + ], + )), SizedBox(height: 12.h), Obx(() => Row( - children: [ - Expanded( - child: _buildStatItem( - '会话数量', - controller.currentStats.sessionCount.toString(), - Icons.chat, - isDarkMode, - ), - ), - Expanded( - child: _buildStatItem( - '总字符数', - controller.formatNumber(controller.currentStats.totalCharacterCount), - Icons.text_snippet, - isDarkMode, - ), - ), - ], - )), + children: [ + Expanded( + child: _buildStatItem( + '会话数量', + controller.currentStats.sessionCount.toString(), + Icons.chat, + isDarkMode, + ), + ), + Expanded( + child: _buildStatItem( + '总字符数', + controller.formatNumber( + controller.currentStats.totalCharacterCount), + Icons.text_snippet, + isDarkMode, + ), + ), + ], + )), ], ), ); } /// 构建统计项 - Widget _buildStatItem(String label, String value, IconData icon, bool isDarkMode) { + Widget _buildStatItem( + String label, String value, IconData icon, bool isDarkMode) { return Column( children: [ Icon( @@ -414,23 +427,34 @@ class TranslationStatsView extends GetView { ), SizedBox(height: 16.h), Obx(() => Column( - children: [ - _buildApiCallRow('翻译API', controller.currentStats.translationApiCalls, Icons.translate, isDarkMode), - SizedBox(height: 12.h), - _buildApiCallRow('语音识别', controller.currentStats.asrApiCalls, Icons.mic, isDarkMode), - SizedBox(height: 12.h), - _buildApiCallRow('语音合成', controller.currentStats.ttsApiCalls, Icons.volume_up, isDarkMode), - SizedBox(height: 12.h), - _buildApiCallRow('AI摘要', controller.currentStats.aiSummaryApiCalls, Icons.summarize, isDarkMode), - ], - )), + children: [ + _buildApiCallRow( + '翻译API', + controller.currentStats.translationApiCalls, + Icons.translate, + isDarkMode), + SizedBox(height: 12.h), + _buildApiCallRow('语音识别', controller.currentStats.asrApiCalls, + Icons.mic, isDarkMode), + SizedBox(height: 12.h), + _buildApiCallRow('语音合成', controller.currentStats.ttsApiCalls, + Icons.volume_up, isDarkMode), + SizedBox(height: 12.h), + _buildApiCallRow( + 'AI摘要', + controller.currentStats.aiSummaryApiCalls, + Icons.summarize, + isDarkMode), + ], + )), ], ), ); } /// 构建API调用行 - Widget _buildApiCallRow(String label, int count, IconData icon, bool isDarkMode) { + Widget _buildApiCallRow( + String label, int count, IconData icon, bool isDarkMode) { return Row( children: [ Icon( @@ -498,50 +522,54 @@ class TranslationStatsView extends GetView { ), SizedBox(height: 16.h), Obx(() => Column( - children: [ - Row( - children: [ - Expanded( - child: _buildStatItem( - '源文本字符', - controller.formatNumber(controller.currentStats.sourceTextCharacters), - Icons.text_fields, - isDarkMode, - ), - ), - Expanded( - child: _buildStatItem( - 'TTS文本字符', - controller.formatNumber(controller.currentStats.ttsTextCharacters), - Icons.translate, - isDarkMode, - ), - ), - ], - ), - SizedBox(height: 16.h), - Row( children: [ - Expanded( - child: _buildStatItem( - '有效音频时长', - controller.formatDuration(controller.currentStats.effectiveAudioDuration), - Icons.mic, - isDarkMode, - ), + Row( + children: [ + Expanded( + child: _buildStatItem( + '源文本字符', + controller.formatNumber( + controller.currentStats.sourceTextCharacters), + Icons.text_fields, + isDarkMode, + ), + ), + Expanded( + child: _buildStatItem( + 'TTS文本字符', + controller.formatNumber( + controller.currentStats.ttsTextCharacters), + Icons.translate, + isDarkMode, + ), + ), + ], ), - Expanded( - child: _buildStatItem( - '总会话时长', - controller.formatDuration(controller.currentStats.totalSessionDuration), - Icons.volume_up, - isDarkMode, - ), + SizedBox(height: 16.h), + Row( + children: [ + Expanded( + child: _buildStatItem( + '有效音频时长', + controller.formatDuration( + controller.currentStats.effectiveAudioDuration), + Icons.mic, + isDarkMode, + ), + ), + Expanded( + child: _buildStatItem( + '总会话时长', + controller.formatDuration( + controller.currentStats.totalSessionDuration), + Icons.volume_up, + isDarkMode, + ), + ), + ], ), ], - ), - ], - )), + )), ], ), ); @@ -585,79 +613,82 @@ class TranslationStatsView extends GetView { ), SizedBox(height: 16.h), Obx(() => Column( - children: [ - // 当前成本 - Container( - padding: EdgeInsets.all(12.w), - decoration: BoxDecoration( - color: AppColors.primary.withOpacity(0.1), - borderRadius: BorderRadius.circular(8.r), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - '${controller.selectedTimeRange.value}预估成本', - style: TextStyle( - fontSize: 14.sp, - fontWeight: FontWeight.w500, - color: isDarkMode ? Colors.white : Colors.black, - ), - ), - Text( - controller.formatCost(controller.currentStats.estimatedCost), - style: TextStyle( - fontSize: 18.sp, - fontWeight: FontWeight.bold, - color: AppColors.primary, - ), - ), - ], - ), - ), - SizedBox(height: 12.h), - // 预警阈值 - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - '日成本预警阈值', - style: TextStyle( - fontSize: 12.sp, - color: isDarkMode ? Colors.white70 : Colors.black54, + // 当前成本 + Container( + padding: EdgeInsets.all(12.w), + decoration: BoxDecoration( + color: AppColors.primary.withOpacity(0.1), + borderRadius: BorderRadius.circular(8.r), ), - ), - Text( - controller.formatCost(controller.dailyCostThreshold.value), - style: TextStyle( - fontSize: 12.sp, - color: isDarkMode ? Colors.white70 : Colors.black54, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + '${controller.selectedTimeRange.value}预估成本', + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.w500, + color: isDarkMode ? Colors.white : Colors.black, + ), + ), + Text( + controller.formatCost( + controller.currentStats.estimatedCost), + style: TextStyle( + fontSize: 18.sp, + fontWeight: FontWeight.bold, + color: AppColors.primary, + ), + ), + ], ), ), - ], - ), - SizedBox(height: 4.h), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - '月成本预警阈值', - style: TextStyle( - fontSize: 12.sp, - color: isDarkMode ? Colors.white70 : Colors.black54, - ), + SizedBox(height: 12.h), + // 预警阈值 + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + '日成本预警阈值', + style: TextStyle( + fontSize: 12.sp, + color: isDarkMode ? Colors.white70 : Colors.black54, + ), + ), + Text( + controller + .formatCost(controller.dailyCostThreshold.value), + style: TextStyle( + fontSize: 12.sp, + color: isDarkMode ? Colors.white70 : Colors.black54, + ), + ), + ], ), - Text( - controller.formatCost(controller.monthlyCostThreshold.value), - style: TextStyle( - fontSize: 12.sp, - color: isDarkMode ? Colors.white70 : Colors.black54, - ), + SizedBox(height: 4.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + '月成本预警阈值', + style: TextStyle( + fontSize: 12.sp, + color: isDarkMode ? Colors.white70 : Colors.black54, + ), + ), + Text( + controller + .formatCost(controller.monthlyCostThreshold.value), + style: TextStyle( + fontSize: 12.sp, + color: isDarkMode ? Colors.white70 : Colors.black54, + ), + ), + ], ), ], - ), - ], - )), + )), ], ), ); @@ -701,31 +732,32 @@ class TranslationStatsView extends GetView { ), SizedBox(height: 16.h), Obx(() => Column( - children: [ - // 最常用语言对 - _buildUsageBehaviorRow( - '最常用语言对', - controller.currentStats.mostUsedLanguagePair, - Icons.language, - isDarkMode, - ), - SizedBox(height: 12.h), - // 最常用翻译模式 - _buildUsageBehaviorRow( - '最常用模式', - controller.currentStats.mostUsedMode, - Icons.settings, - isDarkMode, - ), - ], - )), + children: [ + // 最常用语言对 + _buildUsageBehaviorRow( + '最常用语言对', + controller.currentStats.mostUsedLanguagePair, + Icons.language, + isDarkMode, + ), + SizedBox(height: 12.h), + // 最常用翻译模式 + _buildUsageBehaviorRow( + '最常用模式', + controller.currentStats.mostUsedMode, + Icons.settings, + isDarkMode, + ), + ], + )), ], ), ); } /// 构建使用行为行 - Widget _buildUsageBehaviorRow(String label, String value, IconData icon, bool isDarkMode) { + Widget _buildUsageBehaviorRow( + String label, String value, IconData icon, bool isDarkMode) { return Row( children: [ Icon( diff --git a/lib/routes/app_pages.dart b/lib/routes/app_pages.dart index 864c9b320..7b8c533f2 100644 --- a/lib/routes/app_pages.dart +++ b/lib/routes/app_pages.dart @@ -122,6 +122,8 @@ abstract class AppPages { name: Routes.OTA_UPGRADE, page: () => const OtaUpgradeView(), binding: OtaUpgradeBinding(), + transition: Transition.rightToLeft, + transitionDuration: Duration(milliseconds: 250), ), // GetPage( // name: Routes.profile, @@ -273,6 +275,8 @@ abstract class AppPages { name: Routes.devices, page: () => const DevicesView(), binding: DevicesBinding(), + transition: Transition.rightToLeft, + transitionDuration: Duration(milliseconds: 250), ), GetPage( name: Routes.ble, From a2944c1e26730e1ca6d4c7571eee28e2ce490ae2 Mon Sep 17 00:00:00 2001 From: lxm <1274844347@qq.com> Date: Fri, 5 Sep 2025 17:53:08 +0800 Subject: [PATCH 2/4] =?UTF-8?q?build(android):=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=9B=AE=E6=A0=87SDK=E7=89=88=E6=9C=AC=E8=87=B335=E4=BB=A5?= =?UTF-8?q?=E9=80=82=E9=85=8D=E5=B8=82=E5=9C=BA=E8=A6=81=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将各模块的targetSdk和compileSdk统一升级至35,并添加Android 15所需的前台服务数据同步权限,以满足应用市场最新要求 --- android/app/build.gradle.kts | 2 +- android/app/src/main/AndroidManifest.xml | 2 ++ local_plugins/ble_service/android/build.gradle.kts | 6 +++--- local_plugins/bytedance_speech/android/build.gradle.kts | 4 ++-- local_plugins/chat_api/android/build.gradle.kts | 2 +- local_plugins/chat_storage/android/build.gradle.kts | 4 ++-- local_plugins/classic_bluetooth/android/build.gradle.kts | 2 +- local_plugins/jl_opus/android/build.gradle.kts | 4 ++-- local_plugins/open_ai_service/android/build.gradle.kts | 2 +- local_plugins/realtime/android/build.gradle.kts | 4 ++-- local_plugins/speech/android/build.gradle.kts | 2 +- 11 files changed, 18 insertions(+), 16 deletions(-) diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index d26cbc350..0b53e4a8f 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -69,7 +69,7 @@ android { // You can update the following values to match your application needs. // For more information, see: https://flutter.dev/to/review-gradle-config. minSdk = 26 // 更新为26以满足ble_service库的要求 - targetSdk = 34 // 设置为 Android 13 (API 33),以匹配 FOREGROUND_SERVICE_MEDIA_PLAYBACK 权限的要求 + targetSdk = 35 // 设置为 Android 15 (API 35),以满足应用市场要求 versionCode = flutter.versionCode // 对应构建号,自动同步flutter构建号 versionName = flutter.versionName // 对应版本号,自动同步flutter版本号 } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 441e2cafc..ed16a8811 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -9,6 +9,8 @@ + + diff --git a/local_plugins/ble_service/android/build.gradle.kts b/local_plugins/ble_service/android/build.gradle.kts index 398f8afa7..66a4892b9 100644 --- a/local_plugins/ble_service/android/build.gradle.kts +++ b/local_plugins/ble_service/android/build.gradle.kts @@ -9,11 +9,11 @@ plugins { android { namespace = "com.yunqiinnovation.ble_service" - compileSdk = 34 + compileSdk = 35 defaultConfig { minSdk = 26 - targetSdk = 34 + targetSdk = 35 } compileOptions { @@ -31,4 +31,4 @@ dependencies { // 使用从本地Maven仓库引用的AAR依赖 implementation("com.jieli.audio:jl_audio_decode:2.0.0") implementation("com.jieli.jl_bt_ota:jl_bt_ota:1.9.2") -} \ No newline at end of file +} \ No newline at end of file diff --git a/local_plugins/bytedance_speech/android/build.gradle.kts b/local_plugins/bytedance_speech/android/build.gradle.kts index afd104ba2..402e0b7bd 100644 --- a/local_plugins/bytedance_speech/android/build.gradle.kts +++ b/local_plugins/bytedance_speech/android/build.gradle.kts @@ -29,7 +29,7 @@ android { defaultConfig { minSdk = 26 - targetSdk = 34 + targetSdk = 35 } compileOptions { @@ -53,4 +53,4 @@ dependencies { implementation(project(":speech")) -} \ No newline at end of file +} \ No newline at end of file diff --git a/local_plugins/chat_api/android/build.gradle.kts b/local_plugins/chat_api/android/build.gradle.kts index 0f564abce..44bb954b1 100644 --- a/local_plugins/chat_api/android/build.gradle.kts +++ b/local_plugins/chat_api/android/build.gradle.kts @@ -10,7 +10,7 @@ android { defaultConfig { minSdk = 21 - targetSdk = 33 + targetSdk = 35 } compileOptions { diff --git a/local_plugins/chat_storage/android/build.gradle.kts b/local_plugins/chat_storage/android/build.gradle.kts index 842b98276..f72c52b68 100644 --- a/local_plugins/chat_storage/android/build.gradle.kts +++ b/local_plugins/chat_storage/android/build.gradle.kts @@ -11,12 +11,12 @@ android { namespace = "com.yunqiinnovation.chat_storage" // 目标 SDK 版本 - compileSdk = 33 + compileSdk = 35 defaultConfig { // 最低 SDK 版本 minSdk = 21 - targetSdk = 33 + targetSdk = 35 } // Java 语言级别兼容配置 diff --git a/local_plugins/classic_bluetooth/android/build.gradle.kts b/local_plugins/classic_bluetooth/android/build.gradle.kts index fa40cf9fa..3c6531e8c 100644 --- a/local_plugins/classic_bluetooth/android/build.gradle.kts +++ b/local_plugins/classic_bluetooth/android/build.gradle.kts @@ -16,7 +16,7 @@ android { defaultConfig { // 最低 SDK 版本 minSdk = 21 - targetSdk = 33 + targetSdk = 35 } // Java 语言级别兼容配置 diff --git a/local_plugins/jl_opus/android/build.gradle.kts b/local_plugins/jl_opus/android/build.gradle.kts index 3c0b820e2..9eae80a05 100644 --- a/local_plugins/jl_opus/android/build.gradle.kts +++ b/local_plugins/jl_opus/android/build.gradle.kts @@ -18,12 +18,12 @@ android { namespace = "com.yunqiinnovation.jl_opus" // 目标 SDK 版本 - compileSdk = 33 + compileSdk = 35 defaultConfig { // 最低 SDK 版本 minSdk = 21 - targetSdk = 33 + targetSdk = 35 } // Java 语言级别兼容配置 diff --git a/local_plugins/open_ai_service/android/build.gradle.kts b/local_plugins/open_ai_service/android/build.gradle.kts index f5bbc9337..a93b5d5a7 100644 --- a/local_plugins/open_ai_service/android/build.gradle.kts +++ b/local_plugins/open_ai_service/android/build.gradle.kts @@ -17,7 +17,7 @@ android { defaultConfig { // 最低 SDK 版本 minSdk = 21 - targetSdk = 33 + targetSdk = 35 } // Java 语言级别兼容配置 diff --git a/local_plugins/realtime/android/build.gradle.kts b/local_plugins/realtime/android/build.gradle.kts index b787e4124..10c4dad20 100644 --- a/local_plugins/realtime/android/build.gradle.kts +++ b/local_plugins/realtime/android/build.gradle.kts @@ -10,7 +10,7 @@ android { defaultConfig { minSdk = 21 - targetSdk = 33 + targetSdk = 35 } compileOptions { @@ -44,4 +44,4 @@ dependencies { // OkHttp for WebSocket implementation(platform("com.squareup.okhttp3:okhttp-bom:4.12.0")) implementation("com.squareup.okhttp3:okhttp") -} \ No newline at end of file +} \ No newline at end of file diff --git a/local_plugins/speech/android/build.gradle.kts b/local_plugins/speech/android/build.gradle.kts index 4e5186a27..532e74759 100644 --- a/local_plugins/speech/android/build.gradle.kts +++ b/local_plugins/speech/android/build.gradle.kts @@ -17,7 +17,7 @@ android { defaultConfig { // 最低 SDK 版本 minSdk = 21 - targetSdk = 33 + targetSdk = 35 } // Java 语言级别兼容配置 From c0e27be1d3d4cc8c6829709e2982c71b26281803 Mon Sep 17 00:00:00 2001 From: lxm <1274844347@qq.com> Date: Fri, 5 Sep 2025 19:19:22 +0800 Subject: [PATCH 3/4] =?UTF-8?q?feat(AndroidManifest):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?16KB=E5=86=85=E5=AD=98=E9=A1=B5=E9=9D=A2=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=BB=A5=E6=BB=A1=E8=B6=B3Android=2015?= =?UTF-8?q?=E8=A6=81=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在AndroidManifest.xml中添加android.allow_16kb_memory_page属性,确保应用符合Android 15的新内存页面大小要求 --- android/app/src/main/AndroidManifest.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index ed16a8811..a2c7bb84e 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -72,6 +72,9 @@ android:enableOnBackInvokedCallback="true" tools:replace="android:label"> + + + From c61eb38edaa94c7f495692716f0419740d5df9f3 Mon Sep 17 00:00:00 2001 From: lxm <1274844347@qq.com> Date: Fri, 5 Sep 2025 21:47:59 +0800 Subject: [PATCH 4/4] =?UTF-8?q?refactor(=E6=96=B0=E6=89=8B=E5=BC=95?= =?UTF-8?q?=E5=AF=BC):=20-=20=E5=B0=86=E6=96=B0=E6=89=8B=E5=BC=95=E5=AF=BC?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E7=8A=B6=E6=80=81=E6=94=B9=E4=B8=BAfalse=20-?= =?UTF-8?q?=20=E6=B7=BB=E5=8A=A0GetStorage=E7=94=A8=E4=BA=8E=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E5=BC=95=E5=AF=BC=E5=AE=8C=E6=88=90=E7=8A=B6=E6=80=81?= =?UTF-8?q?=20-=20=E7=A7=BB=E9=99=A4=E5=86=97=E4=BD=99=E7=9A=84=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E8=BE=93=E5=87=BA=20-=20=E4=BB=85=E5=9C=A8=E5=BC=95?= =?UTF-8?q?=E5=AF=BC=E5=AE=8C=E6=88=90=E5=90=8E=E6=A3=80=E6=9F=A5OTA?= =?UTF-8?q?=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/data/services/novice_guide_service.dart | 4 +- .../home/controllers/home_controller.dart | 42 +++++++++++-------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/lib/data/services/novice_guide_service.dart b/lib/data/services/novice_guide_service.dart index 485004914..17d9f0a35 100644 --- a/lib/data/services/novice_guide_service.dart +++ b/lib/data/services/novice_guide_service.dart @@ -14,8 +14,8 @@ class NoviceGuideService extends GetxService { final BleService _bleService = BleService(); StreamSubscription? _statusSubscription; - bool isHomeGuide = true; - bool isAIGuide = true; + bool isHomeGuide = false; + bool isAIGuide = false; RxBool isWakeup = false.obs; diff --git a/lib/modules/home/controllers/home_controller.dart b/lib/modules/home/controllers/home_controller.dart index c0434e6e1..378dfc6ea 100644 --- a/lib/modules/home/controllers/home_controller.dart +++ b/lib/modules/home/controllers/home_controller.dart @@ -1,4 +1,5 @@ import 'package:get/get.dart'; +import 'package:get_storage/get_storage.dart'; // 移除了dart:async导入,因为不再使用Timer import '../../../data/services/novice_guide_service.dart'; import '../../../routes/app_routes.dart'; @@ -20,6 +21,7 @@ enum ConnectionStatus { class HomeController extends GetxController { static const String _tag = 'HomeCtrl'; static HomeController get to => Get.find(); + final GetStorage _storage = GetStorage(); final _isFullyConnected = false.obs; String? _lastConnectedDeviceName; @@ -46,13 +48,13 @@ class HomeController extends GetxController { Logger.d(_tag, 'lxm--接收到的DeviceInfo: $newDeviceInfo'); if (newDeviceInfo != null) { - Logger.d(_tag, 'lxm--原始数据 - 左耳电量: ${newDeviceInfo.leftEarBattery}'); - Logger.d(_tag, 'lxm--原始数据 - 右耳电量: ${newDeviceInfo.rightEarBattery}'); - Logger.d(_tag, 'lxm--原始数据 - 充电仓电量: ${newDeviceInfo.caseBattery}'); - Logger.d(_tag, 'lxm--原始数据 - 左耳充电: ${newDeviceInfo.leftEarCharging}'); - Logger.d(_tag, 'lxm--原始数据 - 右耳充电: ${newDeviceInfo.rightEarCharging}'); - Logger.d(_tag, 'lxm--原始数据 - 充电仓充电: ${newDeviceInfo.caseCharging}'); - Logger.d(_tag, 'lxm--原始数据 - 固件版本: ${newDeviceInfo.firmwareVersion}'); + // Logger.d(_tag, 'lxm--原始数据 - 左耳电量: ${newDeviceInfo.leftEarBattery}'); + // Logger.d(_tag, 'lxm--原始数据 - 右耳电量: ${newDeviceInfo.rightEarBattery}'); + // Logger.d(_tag, 'lxm--原始数据 - 充电仓电量: ${newDeviceInfo.caseBattery}'); + // Logger.d(_tag, 'lxm--原始数据 - 左耳充电: ${newDeviceInfo.leftEarCharging}'); + // Logger.d(_tag, 'lxm--原始数据 - 右耳充电: ${newDeviceInfo.rightEarCharging}'); + // Logger.d(_tag, 'lxm--原始数据 - 充电仓充电: ${newDeviceInfo.caseCharging}'); + // Logger.d(_tag, 'lxm--原始数据 - 固件版本: ${newDeviceInfo.firmwareVersion}'); } else { Logger.d(_tag, 'lxm--接收到的DeviceInfo为null'); } @@ -72,13 +74,13 @@ class HomeController extends GetxController { caseCharging.value = newDeviceInfo?.caseCharging ?? false; firmwareVersion.value = newDeviceInfo?.firmwareVersion ?? ''; - Logger.d(_tag, 'lxm--更新后的值 - 左耳电量: ${leftEarBattery.value}'); - Logger.d(_tag, 'lxm--更新后的值 - 右耳电量: ${rightEarBattery.value}'); - Logger.d(_tag, 'lxm--更新后的值 - 充电仓电量: ${caseBattery.value}'); - Logger.d(_tag, 'lxm--更新后的值 - 左耳充电: ${leftEarCharging.value}'); - Logger.d(_tag, 'lxm--更新后的值 - 右耳充电: ${rightEarCharging.value}'); - Logger.d(_tag, 'lxm--更新后的值 - 充电仓充电: ${caseCharging.value}'); - Logger.d(_tag, 'lxm--更新后的值 - 固件版本: ${firmwareVersion.value}'); + // Logger.d(_tag, 'lxm--更新后的值 - 左耳电量: ${leftEarBattery.value}'); + // Logger.d(_tag, 'lxm--更新后的值 - 右耳电量: ${rightEarBattery.value}'); + // Logger.d(_tag, 'lxm--更新后的值 - 充电仓电量: ${caseBattery.value}'); + // Logger.d(_tag, 'lxm--更新后的值 - 左耳充电: ${leftEarCharging.value}'); + // Logger.d(_tag, 'lxm--更新后的值 - 右耳充电: ${rightEarCharging.value}'); + // Logger.d(_tag, 'lxm--更新后的值 - 充电仓充电: ${caseCharging.value}'); + // Logger.d(_tag, 'lxm--更新后的值 - 固件版本: ${firmwareVersion.value}'); } Worker? _deviceInfoWorker; @@ -140,7 +142,7 @@ class HomeController extends GetxController { Future refreshDeviceConnection() async { await _checkConnectionStatus(); - + // 如果设备已连接,主动刷新设备信息 if (_isFullyConnected.value) { try { @@ -173,6 +175,8 @@ class HomeController extends GetxController { bool wasConnected = _isFullyConnected.value; bool isNowConnected = hasClassicBluetooth && hasBleConnection; + bool isGuideCompleted = _storage.read('home_guide') ?? false; + if (isNowConnected && currentDevice == null) { isNowConnected = false; } @@ -191,9 +195,11 @@ class HomeController extends GetxController { // 移除了连接成功后的电池信息刷新 // 连接成功后检查OTA升级 - Future.delayed(const Duration(seconds: 2), () { - _checkOtaUpgrade(); - }); + if (isGuideCompleted) { + Future.delayed(const Duration(seconds: 2), () { + _checkOtaUpgrade(); + }); + } } // 移除了根据连接状态控制定时器的逻辑 }