fix: 优化设备断开后的状态清理逻辑;增加文件上传检查
This commit is contained in:
parent
08b8495b3d
commit
5b721ae274
|
|
@ -439,10 +439,10 @@ class BleManager {
|
|||
setTimeout(() => {
|
||||
this.protocolService.disconnect()
|
||||
|
||||
// 清理设备相关状态(保持连接状态由监听器处理)
|
||||
// 只清理业务相关状态,连接状态由监听器处理
|
||||
bleStore.setState((prev) => ({
|
||||
...prev,
|
||||
// 不手动设置 isConnected 和 connectedDevice,让监听器处理
|
||||
// discoveredDevices: [], // 清空设备发现列表,断开后需要重新扫描
|
||||
deviceInfo: null,
|
||||
version: '',
|
||||
isActivated: false,
|
||||
|
|
@ -538,6 +538,13 @@ class BleManager {
|
|||
return Promise.reject('No device connected')
|
||||
}
|
||||
|
||||
// 检查是否已经有文件在上传
|
||||
if (state.loading.transferring) {
|
||||
const errorMsg = '已有文件正在上传中,请等待当前文件上传完成'
|
||||
this.setError(errorMsg)
|
||||
return Promise.reject(errorMsg)
|
||||
}
|
||||
|
||||
const tempDir = new Directory(Paths.cache, 'anis')
|
||||
if (!tempDir.exists) tempDir.create()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue