From c044a09344bfc29f9c3557546292ab7420f53df0 Mon Sep 17 00:00:00 2001 From: lxm <1274844347@qq.com> Date: Sat, 26 Jul 2025 15:47:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(ota):=20=E4=BF=AE=E5=A4=8D=E8=93=9D?= =?UTF-8?q?=E7=89=99=E9=85=8D=E5=AF=B9=E7=8A=B6=E6=80=81=E5=8F=8A=E4=BC=98?= =?UTF-8?q?=E5=8C=96OTA=E5=8D=87=E7=BA=A7=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将蓝牙配对状态默认值改为未配对 将OTA升级初始化逻辑移至下载开始前执行 更新应用版本号至1.0.3+8 --- .../ota_upgrade/controllers/ota_upgrade_controller.dart | 9 ++++----- local_plugins/ota/ios/Classes/BleManager/JLBleManager.m | 2 +- pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/modules/ota_upgrade/controllers/ota_upgrade_controller.dart b/lib/modules/ota_upgrade/controllers/ota_upgrade_controller.dart index 3fe3f689c..7adfc296b 100644 --- a/lib/modules/ota_upgrade/controllers/ota_upgrade_controller.dart +++ b/lib/modules/ota_upgrade/controllers/ota_upgrade_controller.dart @@ -216,11 +216,6 @@ class OtaUpgradeController extends GetxController { // 版本检查 bool isUpdate = _isNewVersionAvailable(product.version!); - if (isUpdate) { - await _bleManager.setEnterOta(true); - await Future.delayed(const Duration(seconds: 2)); - jlota.init(); - } isUpdateAvailable.value = isUpdate; } catch (e) { @@ -337,6 +332,10 @@ class OtaUpgradeController extends GetxController { // 修改后的startDownload方法 Future startDownload() async { + await _bleManager.setEnterOta(true); + await Future.delayed(const Duration(seconds: 2)); + jlota.init(); + isDownloading.value = true; showDetailedStatus.value = true; detailedStatus.value = '准备下载固件包...'; diff --git a/local_plugins/ota/ios/Classes/BleManager/JLBleManager.m b/local_plugins/ota/ios/Classes/BleManager/JLBleManager.m index cb22ecfa8..08cd5b8c5 100644 --- a/local_plugins/ota/ios/Classes/BleManager/JLBleManager.m +++ b/local_plugins/ota/ios/Classes/BleManager/JLBleManager.m @@ -48,7 +48,7 @@ NSString *FLT_BLE_RCSP_R = @"AE02"; //命令“读”通道 - (instancetype)init { self = [super init]; if (self) { - _isPaired = YES; + _isPaired = NO; _pairStatus = NO; _bleManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil]; diff --git a/pubspec.yaml b/pubspec.yaml index db31dc5c8..2439e4cff 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: voitrans description: "Voitrans - AI Voice Assistant." publish_to: "none" -version: 1.0.2+7 +version: 1.0.3+8 environment: sdk: ">=3.3.0 <4.0.0"