Merge branch 'develop_sky' into 'canary_release'

fix:恢复原有ci

See merge request StarlockTeam/app-starlock!96
This commit is contained in:
李仪 2025-05-19 02:16:11 +00:00
commit 0fffc2c4b2
2 changed files with 44 additions and 34 deletions

View File

@ -1,4 +1,3 @@
import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
@ -17,31 +16,36 @@ import '../../../../tools/eventBusEventManage.dart';
import '../../../../tools/storage.dart';
import 'burglarAlarm_state.dart';
class BurglarAlarmLogic extends BaseGetXController{
class BurglarAlarmLogic extends BaseGetXController {
BurglarAlarmState state = BurglarAlarmState();
// ->
Future<void> _setLockSetGeneralSetting() async{
Future<void> _setLockSetGeneralSetting() async {
final LoginEntity entity = await ApiRepository.to.setBurglarAlarmData(
lockId: state.lockSetInfoData.value.lockId!,
antiPrySwitch:state.burglarAlarmEnable.value == 1 ? 0 : 1, // 1-2-;
antiPrySwitch: state.burglarAlarmEnable.value == 1 ? 0 : 1, // 1-2-;
);
if(entity.errorCode!.codeIsSuccessful){
// eventBus.fire(RefreshLockListInfoDataEvent());
if (entity.errorCode!.codeIsSuccessful) {
eventBus.fire(RefreshLockListInfoDataEvent());
state.burglarAlarmEnable.value = state.burglarAlarmEnable.value == 1 ? 0 : 1;
state.lockSetInfoData.value.lockSettingInfo!.antiPrySwitch = state.burglarAlarmEnable.value;
showToast('操作成功'.tr, something: (){
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
state.burglarAlarmEnable.value =
state.burglarAlarmEnable.value == 1 ? 0 : 1;
state.lockSetInfoData.value.lockSettingInfo!.antiPrySwitch =
state.burglarAlarmEnable.value;
showToast('操作成功'.tr, something: () {
eventBus
.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
});
}
}
//
late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
if(reply is SetSupportFunctionsNoParametersReply) {
_replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
if (reply is SetSupportFunctionsNoParametersReply) {
_replySetSupportFunctionsWithParameters(reply);
}
@ -71,7 +75,7 @@ class BurglarAlarmLogic extends BaseGetXController{
//
Future<void> _replySetSupportFunctionsWithParameters(Reply reply) async {
final int status = reply.data[2];
switch(status){
switch (status) {
case 0x00:
//
state.sureBtnState.value = 0;
@ -91,41 +95,47 @@ class BurglarAlarmLogic extends BaseGetXController{
// ()
Future<void> sendBurglarAlarm() async {
if(state.sureBtnState.value == 1){
if (state.sureBtnState.value == 1) {
return;
}
state.sureBtnState.value = 1;
EasyLoading.show();
showBlueConnetctToastTimer(action: (){
showBlueConnetctToastTimer(action: () {
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
final List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
final List<String>? publicKey =
await Storage.getStringList(saveBluePublicKey);
final List<int> getPublicKeyList =
changeStringListToIntList(publicKey!);
IoSenderManage.setSupportFunctionsNoParametersCommand(
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(),
featureBit: 30,
featureEnable: state.burglarAlarmEnable.value == 1 ? 0 : 1,
token: getTokenList,
needAuthor: 1,
publicKey: getPublicKeyList,
privateKey: getPrivateKeyList);
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(),
featureBit: 30,
featureEnable: state.burglarAlarmEnable.value == 1 ? 0 : 1,
token: getTokenList,
needAuthor: 1,
publicKey: getPublicKeyList,
privateKey: getPrivateKeyList,
);
} else if (connectionState == BluetoothConnectionState.disconnected) {
dismissEasyLoading();
cancelBlueConnetctToastTimer();
state.sureBtnState.value = 0;
if(state.ifCurrentScreen.value == true){
if (state.ifCurrentScreen.value == true) {
showBlueConnetctToast();
}
}
@ -152,5 +162,4 @@ class BurglarAlarmLogic extends BaseGetXController{
_replySubscription.cancel();
}
}

View File

@ -21,9 +21,10 @@ class RemoteUnlockingLogic extends BaseGetXController {
RemoteUnlockingState state = RemoteUnlockingState();
void remoteUnlockingOpenOrClose() async {
final LoginEntity entity = await ApiRepository.to.remoteUnlockingOpenOrClose(
lockId: state.lockSetInfoData.value.lockId!,
remoteUnlock: state.remoteEnable.value == 1 ? 0 : 1);
final LoginEntity entity = await ApiRepository.to
.remoteUnlockingOpenOrClose(
lockId: state.lockSetInfoData.value.lockId!,
remoteUnlock: state.remoteEnable.value == 1 ? 0 : 1);
if (entity.errorCode!.codeIsSuccessful) {
showToast('操作成功'.tr, something: () {
eventBus.fire(RefreshLockListInfoDataEvent());
@ -32,7 +33,6 @@ class RemoteUnlockingLogic extends BaseGetXController {
state.remoteEnable.value;
eventBus
.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
eventBus.fire(RefreshLockListInfoDataEvent());
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(
5,
state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock!
@ -44,6 +44,7 @@ class RemoteUnlockingLogic extends BaseGetXController {
//
late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() {
_replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((reply) {