This commit is contained in:
魏少阳 2024-05-14 18:12:42 +08:00
commit 66a27c00b2
12 changed files with 195 additions and 148 deletions

View File

@ -322,7 +322,7 @@ SPEC CHECKSUMS:
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907 flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e
flutter_voice_processor: 2b89b93d69b02227ae3fd58589ee0bcfa3ca2a82 flutter_voice_processor: 2b89b93d69b02227ae3fd58589ee0bcfa3ca2a82
fluttertoast: 9f2f8e81bb5ce18facb9748d7855bf5a756fe3db fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
fluwx: daa284756ce53442b3d0417ceeda66e981906811 fluwx: daa284756ce53442b3d0417ceeda66e981906811
google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458 google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458
GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4 GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4
@ -351,4 +351,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 317f9473a5705c6fe4d79d95e81676f248048fdc PODFILE CHECKSUM: 317f9473a5705c6fe4d79d95e81676f248048fdc
COCOAPODS: 1.15.2 COCOAPODS: 1.14.3

View File

@ -282,14 +282,17 @@ class BlueManage {
} }
// String listStr = scanDevices // String listStr = scanDevices
// // .where((element) => // .where((element) =>
// // element.advertisementData.advName == 'TMH_dc8f928369ed') // element.advertisementData.advName == 'TMH_dc8f928369ed' ||
// element.device.platformName == 'TMH_dc8f928369ed')
// .map((e) => 'advName:${e.advertisementData.advName} ' // .map((e) => 'advName:${e.advertisementData.advName} '
// 'serviceUuids:${e.advertisementData.serviceUuids} ' // 'serviceUuids:${e.advertisementData.serviceUuids} '
// '是否被重置:${e.advertisementData.serviceUuids[0].toString()[31]}') // '是否被重置:${e.advertisementData.serviceUuids[0].toString()[31]}')
// .join(',') // .join(',')
// .toString(); // .toString();
// if (listStr.trim() != '') {
// AppLog.log('--->扫描到的设备 ${listStr} '); // AppLog.log('--->扫描到的设备 ${listStr} ');
// }
scanDevicesCallBack(scanDevices); scanDevicesCallBack(scanDevices);
// EventBusManager().eventBusFir(scanDevices); // EventBusManager().eventBusFir(scanDevices);
@ -354,9 +357,14 @@ class BlueManage {
{bool isAddEquipment = false}) async { {bool isAddEquipment = false}) async {
connectDeviceName = deviceName; connectDeviceName = deviceName;
List<ScanResult> devicesList = scanDevices; List<ScanResult> devicesList = scanDevices;
if (isAddEquipment == false) {
bool isExistDevice = scanDevices.any((element) =>
element.device.platformName == connectDeviceName ||
element.advertisementData.advName == connectDeviceName);
if (isAddEquipment == false || isExistDevice == false) {
//使 //使
startScan(10, (List<ScanResult> scanDevices) { startScanSingle(deviceName, 10, (List<ScanResult> scanDevices) {
_connectDevice(scanDevices, deviceName, connectStateCallBack, _connectDevice(scanDevices, deviceName, connectStateCallBack,
isAddEquipment: isAddEquipment); isAddEquipment: isAddEquipment);
}); });

View File

@ -228,20 +228,23 @@ class AuthorizedAdminLogic extends BaseGetXController {
// //
Future<void> keyCheckFace() async { Future<void> keyCheckFace() async {
AdvancedFunctionRecordEntity entity = await ApiRepository.to.keyCheckFace( AdvancedFunctionRecordEntity entity = await ApiRepository.to.keyCheckFace(
countryCode: int.parse(state.countryCode.value), lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
account: state.emailOrPhoneController.text); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
// //
state.isRequireAuth.value = true; state.isRequireAuth.value = true;
state.isAuthentication.value = true; state.isAuthentication.value = true;
} else { } else if (entity.errorCode == 432) {
//432-- //432--
ShowTipView().showBuyTipWithContentAlert( ShowCupertinoAlertView().showBuyTipWithContentAlert(
titleStr: '实名认证为付费功能,请购买后再使用'.tr, titleStr: '实名认证为付费功能,请购买后再使用'.tr,
sureClick: () { sureClick: () {
Get.toNamed(Routers.advancedFeaturesWebPage, Get.toNamed(Routers.advancedFeaturesWebPage,
arguments: {'isShop': false}); arguments: {'isShop': false});
}); });
} else if (entity.errorCode == 433) {
//
ShowCupertinoAlertView().showContactAdministratorBuyAlert();
} }
} }

View File

@ -185,20 +185,23 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
// //
Future<void> keyCheckFace() async { Future<void> keyCheckFace() async {
AdvancedFunctionRecordEntity entity = await ApiRepository.to.keyCheckFace( AdvancedFunctionRecordEntity entity = await ApiRepository.to.keyCheckFace(
countryCode: int.parse(state.countryCode), lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
account: state.emailOrPhoneController.text); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
// //
state.isRequireAuth.value = true; state.isRequireAuth.value = true;
state.isAuthentication.value = true; state.isAuthentication.value = true;
} else { } else if (entity.errorCode == 432) {
//432-- //432--
ShowTipView().showBuyTipWithContentAlert( ShowCupertinoAlertView().showBuyTipWithContentAlert(
titleStr: '实名认证为付费功能,请购买后再使用'.tr, titleStr: '实名认证为付费功能,请购买后再使用'.tr,
sureClick: () { sureClick: () {
Get.toNamed(Routers.advancedFeaturesWebPage, Get.toNamed(Routers.advancedFeaturesWebPage,
arguments: {'isShop': false}); arguments: {'isShop': false});
}); });
} else if (entity.errorCode == 433) {
//
ShowCupertinoAlertView().showContactAdministratorBuyAlert();
} }
} }

View File

@ -643,8 +643,8 @@ class _LockDetailPageState extends State<LockDetailPage>
: false, : false,
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
ShowCupertinoAlertView() ShowCupertinoAlertView().isToRemoteUnLockAlert(
.isToRemoteUnLockAlert((idCard, name) { remoteUnlockAction: () {
if (state.keyInfos.value.hasGateway != 1) { if (state.keyInfos.value.hasGateway != 1) {
logic.showToast('附近没有可用网关'); logic.showToast('附近没有可用网关');
} }
@ -1316,7 +1316,9 @@ class _LockDetailPageState extends State<LockDetailPage>
// //
isNeedRealNameAuthThenOpenLock() { isNeedRealNameAuthThenOpenLock() {
state.nextAuthTime.value = state.keyInfos.value.nextFaceValidateTime ?? 0; state.nextAuthTime.value = state.keyInfos.value.nextFaceValidateTime ?? 0;
if (state.keyInfos.value.faceAuthentication == 1 && state.nextAuthTime.value > 0 && DateTool().compareTimeIsOvertime(state.nextAuthTime.value) == true) { if (state.keyInfos.value.faceAuthentication == 1 &&
state.nextAuthTime.value > 0 &&
DateTool().compareTimeIsOvertime(state.nextAuthTime.value) == true) {
AliyunRealNameAuthProvider( AliyunRealNameAuthProvider(
getLockInfo: state.keyInfos.value, getLockInfo: state.keyInfos.value,
onCertifyResultWithTime: ((bool isSuccess, int getNextAuthTime) { onCertifyResultWithTime: ((bool isSuccess, int getNextAuthTime) {

View File

@ -4,6 +4,7 @@ import 'package:flutter/scheduler.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/blue/blue_manage.dart';
import 'package:star_lock/main/lockMian/lockList/lockList_xhj_page.dart'; import 'package:star_lock/main/lockMian/lockList/lockList_xhj_page.dart';
import 'package:star_lock/tools/noData.dart'; import 'package:star_lock/tools/noData.dart';
import 'package:star_lock/tools/submitBtn.dart'; import 'package:star_lock/tools/submitBtn.dart';
@ -36,22 +37,21 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
final logic = Get.put(LockMainLogic()); final logic = Get.put(LockMainLogic());
final state = Get.find<LockMainLogic>().state; final state = Get.find<LockMainLogic>().state;
Future<void> getHttpData() async { Future<void> getHttpData({bool clearScanDevices = false}) async {
LockListInfoGroupEntity? lockListInfoGroupEntity = LockListInfoGroupEntity? lockListInfoGroupEntity =
await Storage.getLockMainListData(); await Storage.getLockMainListData();
if (lockListInfoGroupEntity != null) { if (lockListInfoGroupEntity != null) {
var localLockListInfoGroupEntity = lockListInfoGroupEntity; var localLockListInfoGroupEntity = lockListInfoGroupEntity;
logic.loadMainDataLogic(localLockListInfoGroupEntity).then((value) { await logic.loadMainDataLogic(localLockListInfoGroupEntity);
}
await logic.getStarLockInfo();
await Future.delayed(const Duration(milliseconds: 200));
if (clearScanDevices) {
BlueManage().scanDevices.clear();
}
if (mounted) { if (mounted) {
setState(() {}); setState(() {});
} }
});
}
logic.getStarLockInfo().then((LockListInfoEntity value) {
if (mounted) {
setState(() {});
}
});
} }
@override @override
@ -237,7 +237,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
void _initLoadDataAction() { void _initLoadDataAction() {
_teamEvent = eventBus.on<RefreshLockListInfoDataEvent>().listen((event) { _teamEvent = eventBus.on<RefreshLockListInfoDataEvent>().listen((event) {
logic.pageNo = 1; logic.pageNo = 1;
getHttpData(); getHttpData(clearScanDevices: event.clearScanDevices);
}); });
} }

View File

@ -1,4 +1,3 @@
import 'dart:async'; import 'dart:async';
import 'dart:math'; import 'dart:math';
@ -31,8 +30,10 @@ class SaveLockLogic extends BaseGetXController {
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) { _replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((reply) {
if (reply is AddUserReply && state.ifCurrentScreen.value == true) { if (reply is AddUserReply && state.ifCurrentScreen.value == true) {
_replyAddUserKey(reply); _replyAddUserKey(reply);
} }
@ -210,7 +211,8 @@ class SaveLockLogic extends BaseGetXController {
showBlueConnetctToast(); showBlueConnetctToast();
} }
}); });
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { BlueManage().bludSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) { if (deviceConnectionState == BluetoothConnectionState.connected) {
// //
var privateKey = await Storage.getStringList(saveBluePrivateKey); var privateKey = await Storage.getStringList(saveBluePrivateKey);
@ -246,9 +248,9 @@ class SaveLockLogic extends BaseGetXController {
publicKey: publicKeyDataList, publicKey: publicKeyDataList,
privateKey: getPrivateKeyList, privateKey: getPrivateKeyList,
token: getTokenList, token: getTokenList,
isBeforeAddUser: true isBeforeAddUser: true);
); } else if (deviceConnectionState ==
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) { BluetoothConnectionState.disconnected) {
dismissEasyLoading(); dismissEasyLoading();
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
@ -458,7 +460,7 @@ class SaveLockLogic extends BaseGetXController {
// } // }
void backAction() { void backAction() {
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent(clearScanDevices: true));
BlueManage().disconnect(); BlueManage().disconnect();
Get.close(state.isFromMap == 1 ? 5 : 6); Get.close(state.isFromMap == 1 ? 5 : 6);
} }
@ -475,7 +477,6 @@ class SaveLockLogic extends BaseGetXController {
void onInit() { void onInit() {
// TODO: implement onInit // TODO: implement onInit
super.onInit(); super.onInit();
} }
@override @override
@ -484,5 +485,4 @@ class SaveLockLogic extends BaseGetXController {
_replySubscription.cancel(); _replySubscription.cancel();
super.onClose(); super.onClose();
} }
} }

View File

@ -184,8 +184,7 @@ class ApiProvider extends BaseProvider {
'electricQuantityStandby': electricQuantityStandby, 'electricQuantityStandby': electricQuantityStandby,
'lockId': lockId, 'lockId': lockId,
}), }),
isUnShowLoading: isUnShowLoading isUnShowLoading: isUnShowLoading);
);
Future<Response> modifyKeyName( Future<Response> modifyKeyName(
String keyId, String keyId,
@ -809,10 +808,8 @@ class ApiProvider extends BaseProvider {
})); }));
// //
Future<Response> getServerDatetimeLoadData() => post( Future<Response> getServerDatetimeLoadData() =>
getServerDatetimeUrl.toUrl, post(getServerDatetimeUrl.toUrl, jsonEncode({}), isUnShowLoading: true);
jsonEncode({}),
isUnShowLoading: true);
// //
Future<Response> setLockDiagnoseData( Future<Response> setLockDiagnoseData(
@ -1611,8 +1608,8 @@ class ApiProvider extends BaseProvider {
post(getUserInfoURL.toUrl, jsonEncode({'operatorUid': operatorUid})); post(getUserInfoURL.toUrl, jsonEncode({'operatorUid': operatorUid}));
// //
Future<Response> keyboardPwdReset(String lockId, List passwordKey) => Future<Response> keyboardPwdReset(String lockId, List passwordKey) => post(
post(keyboardPwdResetURL.toUrl, keyboardPwdResetURL.toUrl,
jsonEncode({ jsonEncode({
'lockId': lockId, 'lockId': lockId,
'passwordKey': passwordKey, 'passwordKey': passwordKey,
@ -2042,14 +2039,12 @@ class ApiProvider extends BaseProvider {
// //
Future<Response> keyCheckFace( Future<Response> keyCheckFace(
int countryCode, int lockId,
String account,
) => ) =>
post( post(
isFaceAuthenticationURL.toUrl, isFaceAuthenticationURL.toUrl,
jsonEncode({ jsonEncode({
'countryCode': countryCode, 'lockId': lockId,
'account': account,
})); }));
// certifyId // certifyId

View File

@ -2075,10 +2075,9 @@ class ApiRepository {
// //
Future<AdvancedFunctionRecordEntity> keyCheckFace({ Future<AdvancedFunctionRecordEntity> keyCheckFace({
required int countryCode, required int lockId,
required String account,
}) async { }) async {
final res = await apiProvider.keyCheckFace(countryCode, account); final res = await apiProvider.keyCheckFace(lockId);
return AdvancedFunctionRecordEntity.fromJson(res.body); return AdvancedFunctionRecordEntity.fromJson(res.body);
} }

View File

@ -7,13 +7,17 @@ EventBus eventBus = EventBus();
/// ///
class RefreshLockListInfoDataEvent { class RefreshLockListInfoDataEvent {
RefreshLockListInfoDataEvent(); //
bool clearScanDevices;
RefreshLockListInfoDataEvent({this.clearScanDevices = false});
} }
/// ///
class LockAddUserSucceedEvent { class LockAddUserSucceedEvent {
int type; // 0 1token失效 int type; // 0 1token失效
List<int> dataList; List<int> dataList;
LockAddUserSucceedEvent(this.dataList, this.type); LockAddUserSucceedEvent(this.dataList, this.type);
} }
@ -40,6 +44,7 @@ class RefreshCheckInListEvent {
/// ///
class PassCurrentLockInformationEvent { class PassCurrentLockInformationEvent {
LockSetInfoData lockSetInfoData; LockSetInfoData lockSetInfoData;
PassCurrentLockInformationEvent(this.lockSetInfoData); PassCurrentLockInformationEvent(this.lockSetInfoData);
} }
@ -51,12 +56,14 @@ class OtherTypeRefreshListEvent {
/// number /// number
class ChickInAddStaffCardAndFingerprintBlockNumberEvent { class ChickInAddStaffCardAndFingerprintBlockNumberEvent {
String number; String number;
ChickInAddStaffCardAndFingerprintBlockNumberEvent(this.number); ChickInAddStaffCardAndFingerprintBlockNumberEvent(this.number);
} }
/// ///
class ChangeLanguageBlockLastLanguageEvent { class ChangeLanguageBlockLastLanguageEvent {
String languageTitle; String languageTitle;
ChangeLanguageBlockLastLanguageEvent(this.languageTitle); ChangeLanguageBlockLastLanguageEvent(this.languageTitle);
} }
@ -69,36 +76,42 @@ class LockGroupEditGroupLockRefreshEvent {
class LockSetChangeSetRefreshLockDetailWithType { class LockSetChangeSetRefreshLockDetailWithType {
int type; // 0 1 2 3 4 5 int type; // 0 1 2 3 4 5
String setResult; String setResult;
LockSetChangeSetRefreshLockDetailWithType(this.type, this.setResult); LockSetChangeSetRefreshLockDetailWithType(this.type, this.setResult);
} }
/// ///
class GetTVDataRefreshUI { class GetTVDataRefreshUI {
List<int> tvList; List<int> tvList;
GetTVDataRefreshUI(this.tvList); GetTVDataRefreshUI(this.tvList);
} }
/// UDP接收状态然后刷新界面 /// UDP接收状态然后刷新界面
class GetUDPStatusRefreshUI { class GetUDPStatusRefreshUI {
int udpStatus; int udpStatus;
GetUDPStatusRefreshUI(this.udpStatus); GetUDPStatusRefreshUI(this.udpStatus);
} }
/// UDP接收状态然后刷新监控界面 /// UDP接收状态然后刷新监控界面
class GetUDPStatusMonitorUI { class GetUDPStatusMonitorUI {
int udpStatus; int udpStatus;
GetUDPStatusMonitorUI(this.udpStatus); GetUDPStatusMonitorUI(this.udpStatus);
} }
/// ///
class GetFirstFrameGoPush { class GetFirstFrameGoPush {
bool isFirstFrame; bool isFirstFrame;
GetFirstFrameGoPush(this.isFirstFrame); GetFirstFrameGoPush(this.isFirstFrame);
} }
/// typeIndex /// typeIndex
class GetPasswordTypeUpdateIndex { class GetPasswordTypeUpdateIndex {
int passwordType; int passwordType;
GetPasswordTypeUpdateIndex(this.passwordType); GetPasswordTypeUpdateIndex(this.passwordType);
} }
@ -125,6 +138,7 @@ class AuthorizedAdminPageRefreshUI {
/// ///
class DoorLockLogListRefreshUI { class DoorLockLogListRefreshUI {
DateTime getDoorLockLogTime; DateTime getDoorLockLogTime;
DoorLockLogListRefreshUI(this.getDoorLockLogTime); DoorLockLogListRefreshUI(this.getDoorLockLogTime);
} }

View File

@ -276,7 +276,7 @@ class ShowCupertinoAlertView {
} }
// //
void isToRemoteUnLockAlert(AuthInfoCallback callback) { void isToRemoteUnLockAlert({required Function remoteUnlockAction}) {
showCupertinoDialog( showCupertinoDialog(
context: Get.context!, context: Get.context!,
builder: (BuildContext context) { builder: (BuildContext context) {
@ -296,7 +296,7 @@ class ShowCupertinoAlertView {
CupertinoDialogAction( CupertinoDialogAction(
onPressed: () { onPressed: () {
// //
callback(null, null); remoteUnlockAction();
Get.back(); Get.back();
}, },
child: Text( child: Text(
@ -309,4 +309,59 @@ class ShowCupertinoAlertView {
}, },
); );
} }
//
void showBuyTipWithContentAlert(
{required String titleStr, required Function sureClick}) {
showCupertinoDialog(
context: Get.context!,
builder: (context) {
return CupertinoAlertDialog(
title: Text(titleStr),
actions: [
CupertinoDialogAction(
child: Text(
'取消'.tr,
style: TextStyle(color: AppColors.mainColor),
),
onPressed: () {
Get.back();
},
),
CupertinoDialogAction(
child:
Text('购买'.tr, style: TextStyle(color: AppColors.mainColor)),
onPressed: () {
Get.back();
sureClick();
},
),
],
);
},
);
}
//
void showContactAdministratorBuyAlert() {
showCupertinoDialog(
context: Get.context!,
builder: (context) {
return CupertinoAlertDialog(
title: const Text('实名认证为付费功能,请联系锁的管理员购买后再使用'),
actions: [
CupertinoDialogAction(
child: Text(
'确定'.tr,
style: TextStyle(color: AppColors.mainColor),
),
onPressed: () {
Get.back();
},
),
],
);
},
);
}
} }

View File

@ -122,36 +122,4 @@ class ShowTipView {
}, },
); );
} }
//
void showBuyTipWithContentAlert(
{required String titleStr, required Function sureClick}) {
showCupertinoDialog(
context: Get.context!,
builder: (context) {
return CupertinoAlertDialog(
title: Text(titleStr),
actions: [
CupertinoDialogAction(
child: Text(
'取消'.tr,
style: TextStyle(color: AppColors.mainColor),
),
onPressed: () {
Get.back();
},
),
CupertinoDialogAction(
child:
Text('购买'.tr, style: TextStyle(color: AppColors.mainColor)),
onPressed: () {
Get.back();
sureClick();
},
),
],
);
},
);
}
} }