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

View File

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