Browse Source

fix(ota): 修复蓝牙配对状态及优化OTA升级流程

将蓝牙配对状态默认值改为未配对
将OTA升级初始化逻辑移至下载开始前执行
更新应用版本号至1.0.3+8
newdev_shunjiawei
lxm 1 year ago
parent
commit
c044a09344
  1. 9
      lib/modules/ota_upgrade/controllers/ota_upgrade_controller.dart
  2. 2
      local_plugins/ota/ios/Classes/BleManager/JLBleManager.m
  3. 2
      pubspec.yaml

9
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<void> startDownload() async {
await _bleManager.setEnterOta(true);
await Future.delayed(const Duration(seconds: 2));
jlota.init();
isDownloading.value = true;
showDetailedStatus.value = true;
detailedStatus.value = '准备下载固件包...';

2
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];

2
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"

Loading…
Cancel
Save