Merge branch 'release' of gitee.com:starlock-cn/app-starlock into release
This commit is contained in:
commit
fdc183def9
@ -189,6 +189,8 @@ class BlueManage {
|
|||||||
FlutterBluePlus.startScan(
|
FlutterBluePlus.startScan(
|
||||||
continuousDivisor: divisor,
|
continuousDivisor: divisor,
|
||||||
continuousUpdates: true,
|
continuousUpdates: true,
|
||||||
|
// withServiceData:[ServiceDataFilter()],
|
||||||
|
withKeywords: <String>[deviceName],
|
||||||
timeout: Duration(seconds: timeout));
|
timeout: Duration(seconds: timeout));
|
||||||
final Completer<dynamic> completer = Completer<dynamic>();
|
final Completer<dynamic> completer = Completer<dynamic>();
|
||||||
final StreamSubscription<List<ScanResult>> subscription =
|
final StreamSubscription<List<ScanResult>> subscription =
|
||||||
@ -374,9 +376,7 @@ class BlueManage {
|
|||||||
connectDeviceName = deviceName;
|
connectDeviceName = deviceName;
|
||||||
final List<ScanResult> devicesList = scanDevices;
|
final List<ScanResult> devicesList = scanDevices;
|
||||||
|
|
||||||
final bool isExistDevice = scanDevices.any((ScanResult element) =>
|
final bool isExistDevice = isExistScanDevices(connectDeviceName);
|
||||||
element.device.platformName == connectDeviceName ||
|
|
||||||
element.advertisementData.advName == connectDeviceName);
|
|
||||||
|
|
||||||
if (isAddEquipment == false && isExistDevice == false) {
|
if (isAddEquipment == false && isExistDevice == false) {
|
||||||
//取消缓存直接使用,存在配对场景设备信息会更变
|
//取消缓存直接使用,存在配对场景设备信息会更变
|
||||||
@ -390,6 +390,15 @@ class BlueManage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//查找缓存里面是否有设备
|
||||||
|
bool isExistScanDevices(String connectDeviceName){
|
||||||
|
final bool isExistDevice = scanDevices.any((ScanResult element) =>
|
||||||
|
element.device.platformName == connectDeviceName ||
|
||||||
|
element.advertisementData.advName == connectDeviceName);
|
||||||
|
return isExistDevice;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Future<void> _connectDevice(List<ScanResult> devicesList, String deviceName,
|
Future<void> _connectDevice(List<ScanResult> devicesList, String deviceName,
|
||||||
ConnectStateCallBack connectStateCallBack,
|
ConnectStateCallBack connectStateCallBack,
|
||||||
{bool isAddEquipment = false}) async {
|
{bool isAddEquipment = false}) async {
|
||||||
|
|||||||
@ -314,7 +314,8 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
final List<int> getPrivateKeyList =
|
final List<int> getPrivateKeyList =
|
||||||
changeStringListToIntList(privateKey!);
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(
|
||||||
|
saveBlueToken);
|
||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
final List<String>? publicKey =
|
final List<String>? publicKey =
|
||||||
@ -343,13 +344,17 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
await ApiRepository.to.getServerDatetimeData();
|
await ApiRepository.to.getServerDatetimeData();
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.differentialTime = entity.data!.date! ~/ 1000 -
|
state.differentialTime = entity.data!.date! ~/ 1000 -
|
||||||
DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
DateTime
|
||||||
|
.now()
|
||||||
|
.millisecondsSinceEpoch ~/ 1000;
|
||||||
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
|
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int getUTCNetTime() {
|
int getUTCNetTime() {
|
||||||
return DateTime.now().millisecondsSinceEpoch ~/ 1000 +
|
return DateTime
|
||||||
|
.now()
|
||||||
|
.millisecondsSinceEpoch ~/ 1000 +
|
||||||
state.differentialTime;
|
state.differentialTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,7 +483,8 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted ||
|
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted ||
|
||||||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) {
|
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) {
|
||||||
text =
|
text =
|
||||||
"${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}";
|
"${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(
|
||||||
|
state.keyInfos.value.keyStatus!)}";
|
||||||
} else {
|
} else {
|
||||||
text = state.isOpenPassageMode.value == 1
|
text = state.isOpenPassageMode.value == 1
|
||||||
? '常开模式启动!长按闭锁'.tr
|
? '常开模式启动!长按闭锁'.tr
|
||||||
@ -510,5 +516,18 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
await PermissionDialog.request(Permission.location);
|
await PermissionDialog.request(Permission.location);
|
||||||
await PermissionDialog.requestBluetooth();
|
await PermissionDialog.requestBluetooth();
|
||||||
|
|
||||||
|
final String connectDeviceName = state.keyInfos.value.bluetooth!
|
||||||
|
.bluetoothDeviceName!;
|
||||||
|
if (!BlueManage().isExistScanDevices(connectDeviceName)) {
|
||||||
|
BlueManage().startScanSingle(
|
||||||
|
connectDeviceName, 15, (List<ScanResult> p0) => null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,8 +53,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# 1.0.43+2024052001:打包给公司测试
|
# 1.0.43+2024052001:打包给公司测试
|
||||||
# 1.0.44+2024052002:打包给公司测试
|
# 1.0.44+2024052002:打包给公司测试
|
||||||
# 1.0.45+2024052003:打包给公司测试
|
# 1.0.45+2024052003:打包给公司测试
|
||||||
|
# 1.0.46+2024052004:打包给公司测试
|
||||||
|
|
||||||
version: 1.0.45+2024052003
|
version: 1.0.46+2024052004
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user