fix: “上传数据成功后,指纹列表没显示出来,必须下拉刷新才显示”问题修复完成
This commit is contained in:
parent
a106fe6bbf
commit
d6dba6e3dd
@ -405,6 +405,7 @@ class FingerprintListLogic extends BaseGetXController {
|
||||
_teamEvent = eventBus
|
||||
.on<OtherTypeRefreshListEvent>()
|
||||
.listen((OtherTypeRefreshListEvent event) async {
|
||||
// 立即刷新数据
|
||||
await getFingerprintsListData(isRefresh: true);
|
||||
});
|
||||
}
|
||||
@ -459,8 +460,10 @@ class FingerprintListLogic extends BaseGetXController {
|
||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
_initReplySubscription();
|
||||
_initRefreshAction();
|
||||
|
||||
// _initRefreshAction();
|
||||
// 初始加载数据
|
||||
await getFingerprintsListData(isRefresh: true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
@ -7,6 +6,8 @@ import 'package:star_lock/blue/io_protocol/io_updataLockRemoteControlList.dart';
|
||||
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.dart';
|
||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
import '../../../../app_settings/app_settings.dart';
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
@ -21,48 +22,56 @@ import '../../../../blue/io_tool/io_tool.dart';
|
||||
import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||
import '../../../../blue/sender_manage.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import 'uploadData_state.dart';
|
||||
|
||||
class UploadDataLogic extends BaseGetXController{
|
||||
UploadDataState state = UploadDataState();
|
||||
class UploadDataLogic extends BaseGetXController {
|
||||
final UploadDataState state = UploadDataState();
|
||||
|
||||
// 监听蓝牙协议返回结果
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||
_replySubscription =
|
||||
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||
// 上传数据获取锁密码列表
|
||||
if (reply is UpdataLockPasswordListReply && (state.ifCurrentScreen.value == true)) {
|
||||
if (reply is UpdataLockPasswordListReply &&
|
||||
(state.ifCurrentScreen.value == true)) {
|
||||
_replyUpdataLockPasswordListReply(reply);
|
||||
}
|
||||
|
||||
// 上传数据获取锁卡列表
|
||||
if (reply is UpdataLockCardListReply && (state.ifCurrentScreen.value == true)) {
|
||||
if (reply is UpdataLockCardListReply &&
|
||||
(state.ifCurrentScreen.value == true)) {
|
||||
_replyUpdataLockCardListReply(reply);
|
||||
}
|
||||
|
||||
// 上传数据获取锁指纹列表
|
||||
if (reply is UpdataLockFingerprintListReply && (state.ifCurrentScreen.value == true)) {
|
||||
if (reply is UpdataLockFingerprintListReply &&
|
||||
(state.ifCurrentScreen.value == true)) {
|
||||
_replyUpdataLockFingerprintListReply(reply);
|
||||
}
|
||||
|
||||
// 上传数据获取锁人脸列表
|
||||
if (reply is UpdataLockFaceListReply && (state.ifCurrentScreen.value == true)) {
|
||||
if (reply is UpdataLockFaceListReply &&
|
||||
(state.ifCurrentScreen.value == true)) {
|
||||
_replyUpdataLockFaceListReply(reply);
|
||||
}
|
||||
|
||||
// 上传数据获取锁掌静脉列表
|
||||
if (reply is UpdataLockPalmVeinListReply && (state.ifCurrentScreen.value == true)) {
|
||||
if (reply is UpdataLockPalmVeinListReply &&
|
||||
(state.ifCurrentScreen.value == true)) {
|
||||
_replyUpdataLockPalmVeinListReply(reply);
|
||||
}
|
||||
|
||||
// 上传数据获取锁遥控
|
||||
if (reply is UpdataLockRemoteControlListReply && (state.ifCurrentScreen.value == true)) {
|
||||
if (reply is UpdataLockRemoteControlListReply &&
|
||||
(state.ifCurrentScreen.value == true)) {
|
||||
_replyUpdataLockRemoteControlListReply(reply);
|
||||
}
|
||||
|
||||
// 上传数据获取锁设置
|
||||
if (reply is UpdataLockSetReply && (state.ifCurrentScreen.value == true) && (state.ifSeletUpdataBtnState == true)) {
|
||||
if (reply is UpdataLockSetReply &&
|
||||
(state.ifCurrentScreen.value == true) &&
|
||||
(state.ifSeletUpdataBtnState == true)) {
|
||||
_replyUpdataLockSetReply(reply);
|
||||
}
|
||||
});
|
||||
@ -71,21 +80,22 @@ class UploadDataLogic extends BaseGetXController{
|
||||
// 上传数据获取锁密码列表
|
||||
Future<void> _replyUpdataLockPasswordListReply(Reply reply) async {
|
||||
final int status = reply.data[2];
|
||||
switch(status){
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
//成功
|
||||
cancelBlueConnetctToastTimer();
|
||||
|
||||
final int dataLength = reply.data[8];
|
||||
state.uploadPasswordDataList.addAll(reply.data.sublist(9, reply.data.length));
|
||||
if(dataLength == 10){
|
||||
state.uploadPasswordDataList
|
||||
.addAll(reply.data.sublist(9, reply.data.length));
|
||||
if (dataLength == 10) {
|
||||
// 当数据是10的时候继续请求
|
||||
state.uploadPasswordPage = state.uploadPasswordPage + 1;
|
||||
|
||||
final List<int> token = reply.data.sublist(3, 7);
|
||||
showEasyLoading();
|
||||
updataLockPasswordList(token, state.uploadPasswordPage);
|
||||
}else{
|
||||
} else {
|
||||
// dismissEasyLoading();
|
||||
|
||||
// 当数据不是10的时候解析数据上传
|
||||
@ -95,12 +105,15 @@ class UploadDataLogic extends BaseGetXController{
|
||||
// }else{
|
||||
// // 如果不是空的解析数据上传
|
||||
state.indexCount.value = state.indexCount.value + 1;
|
||||
_lockDataUpload(uploadType:2, recordType:2, records:state.uploadPasswordDataList);
|
||||
_lockDataUpload(
|
||||
uploadType: 2,
|
||||
recordType: 2,
|
||||
records: state.uploadPasswordDataList);
|
||||
// }
|
||||
}
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
//无权限
|
||||
final List<int> token = reply.data.sublist(3, 7);
|
||||
final List<String> saveStrList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
@ -120,14 +133,15 @@ class UploadDataLogic extends BaseGetXController{
|
||||
// 上传数据获取锁卡列表
|
||||
Future<void> _replyUpdataLockCardListReply(Reply reply) async {
|
||||
final int status = reply.data[2];
|
||||
switch(status){
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
cancelBlueConnetctToastTimer();
|
||||
|
||||
final int dataLength = reply.data[8];
|
||||
state.uploadCardDataList.addAll(reply.data.sublist(9, reply.data.length));
|
||||
if(dataLength == 10){
|
||||
state.uploadCardDataList
|
||||
.addAll(reply.data.sublist(9, reply.data.length));
|
||||
if (dataLength == 10) {
|
||||
// 当数据是10的时候继续请求
|
||||
state.uploadCardPage = state.uploadCardPage + 1;
|
||||
|
||||
@ -135,7 +149,7 @@ class UploadDataLogic extends BaseGetXController{
|
||||
|
||||
showEasyLoading();
|
||||
updataLockCardList(token, state.uploadCardPage);
|
||||
}else{
|
||||
} else {
|
||||
// // 当数据不是10的时候解析数据上传
|
||||
// if(state.uploadCardDataList.isEmpty){
|
||||
// // 如果是空的直接上传下一个
|
||||
@ -143,12 +157,13 @@ class UploadDataLogic extends BaseGetXController{
|
||||
// }else{
|
||||
// // 如果不是空的解析数据上传
|
||||
state.indexCount.value = state.indexCount.value + 1;
|
||||
_lockDataUpload(uploadType:2, recordType:3, records:state.uploadCardDataList);
|
||||
_lockDataUpload(
|
||||
uploadType: 2, recordType: 3, records: state.uploadCardDataList);
|
||||
// }
|
||||
}
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
//无权限
|
||||
final List<int> token = reply.data.sublist(3, 7);
|
||||
final List<String> saveStrList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
@ -167,14 +182,15 @@ class UploadDataLogic extends BaseGetXController{
|
||||
// 上传数据获取锁指纹列表
|
||||
Future<void> _replyUpdataLockFingerprintListReply(Reply reply) async {
|
||||
final int status = reply.data[2];
|
||||
switch(status){
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
//成功
|
||||
cancelBlueConnetctToastTimer();
|
||||
|
||||
final int dataLength = reply.data[8];
|
||||
state.uploadFingerprintDataList.addAll(reply.data.sublist(9, reply.data.length));
|
||||
if(dataLength == 10){
|
||||
state.uploadFingerprintDataList
|
||||
.addAll(reply.data.sublist(9, reply.data.length));
|
||||
if (dataLength == 10) {
|
||||
// 当数据是10的时候继续请求
|
||||
state.uploadFingerprintPage = state.uploadFingerprintPage + 1;
|
||||
|
||||
@ -182,7 +198,7 @@ class UploadDataLogic extends BaseGetXController{
|
||||
|
||||
showEasyLoading();
|
||||
updataLockFingerprintList(token, state.uploadFingerprintPage);
|
||||
}else{
|
||||
} else {
|
||||
// // 当数据不是10的时候解析数据上传
|
||||
// if(state.uploadFingerprintDataList.isEmpty){
|
||||
// // 如果是空的直接上传下一个
|
||||
@ -190,12 +206,15 @@ class UploadDataLogic extends BaseGetXController{
|
||||
// }else{
|
||||
// // 如果不是空的解析数据上传
|
||||
state.indexCount.value = state.indexCount.value + 1;
|
||||
_lockDataUpload(uploadType:2, recordType:4, records:state.uploadFingerprintDataList);
|
||||
_lockDataUpload(
|
||||
uploadType: 2,
|
||||
recordType: 4,
|
||||
records: state.uploadFingerprintDataList);
|
||||
// }
|
||||
}
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
//无权限
|
||||
final List<int> token = reply.data.sublist(3, 7);
|
||||
final List<String> saveStrList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
@ -214,14 +233,15 @@ class UploadDataLogic extends BaseGetXController{
|
||||
// 上传数据获取锁人脸列表解析
|
||||
Future<void> _replyUpdataLockFaceListReply(Reply reply) async {
|
||||
final int status = reply.data[2];
|
||||
switch(status){
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
cancelBlueConnetctToastTimer();
|
||||
|
||||
final int dataLength = reply.data[8];
|
||||
state.uploadFaceDataList.addAll(reply.data.sublist(9, reply.data.length));
|
||||
if(dataLength == 10){
|
||||
state.uploadFaceDataList
|
||||
.addAll(reply.data.sublist(9, reply.data.length));
|
||||
if (dataLength == 10) {
|
||||
// 当数据是10的时候继续请求
|
||||
state.uploadFacePage = state.uploadFacePage + 1;
|
||||
|
||||
@ -229,20 +249,21 @@ class UploadDataLogic extends BaseGetXController{
|
||||
|
||||
showEasyLoading();
|
||||
updataLockFaceList(token, state.uploadFacePage);
|
||||
}else{
|
||||
} else {
|
||||
// // 当数据不是10的时候解析数据上传
|
||||
// if(state.uploadFaceDataList.isEmpty){
|
||||
// // 如果是空的直接上传下一个
|
||||
// getUpdataLockPalmVeinList();
|
||||
// }else{
|
||||
// 如果不是空的解析数据上传
|
||||
// 如果不是空的解析数据上传
|
||||
state.indexCount.value = state.indexCount.value + 1;
|
||||
_lockDataUpload(uploadType:2, recordType:5, records:state.uploadFaceDataList);
|
||||
_lockDataUpload(
|
||||
uploadType: 2, recordType: 5, records: state.uploadFaceDataList);
|
||||
// }
|
||||
}
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
//无权限
|
||||
final List<int> token = reply.data.sublist(3, 7);
|
||||
final List<String> saveStrList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
@ -261,14 +282,15 @@ class UploadDataLogic extends BaseGetXController{
|
||||
// 上传数据获取锁掌静脉列表解析
|
||||
Future<void> _replyUpdataLockPalmVeinListReply(Reply reply) async {
|
||||
final int status = reply.data[2];
|
||||
switch(status){
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
cancelBlueConnetctToastTimer();
|
||||
|
||||
final int dataLength = reply.data[8];
|
||||
state.uploadPalmVeinDataList.addAll(reply.data.sublist(9, reply.data.length));
|
||||
if(dataLength == 10){
|
||||
state.uploadPalmVeinDataList
|
||||
.addAll(reply.data.sublist(9, reply.data.length));
|
||||
if (dataLength == 10) {
|
||||
// 当数据是10的时候继续请求
|
||||
state.uploadPalmVeinPage = state.uploadPalmVeinPage + 1;
|
||||
|
||||
@ -276,7 +298,7 @@ class UploadDataLogic extends BaseGetXController{
|
||||
|
||||
showEasyLoading();
|
||||
updataLockPalmVeinList(token, state.uploadPalmVeinPage);
|
||||
}else{
|
||||
} else {
|
||||
// // 当数据不是10的时候解析数据上传
|
||||
// if(state.uploadPalmVeinDataList.isEmpty){
|
||||
// // 不需要上传 如果是空的直接上传下一个
|
||||
@ -284,12 +306,15 @@ class UploadDataLogic extends BaseGetXController{
|
||||
// }else{
|
||||
// // 如果不是空的解析数据上传
|
||||
state.indexCount.value = state.indexCount.value + 1;
|
||||
_lockDataUpload(uploadType:2, recordType:6, records:state.uploadPalmVeinDataList);
|
||||
_lockDataUpload(
|
||||
uploadType: 2,
|
||||
recordType: 6,
|
||||
records: state.uploadPalmVeinDataList);
|
||||
// }
|
||||
}
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
//无权限
|
||||
final List<int> token = reply.data.sublist(3, 7);
|
||||
final List<String> saveStrList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
@ -308,14 +333,15 @@ class UploadDataLogic extends BaseGetXController{
|
||||
// 上传数据获取锁遥控列表解析
|
||||
Future<void> _replyUpdataLockRemoteControlListReply(Reply reply) async {
|
||||
final int status = reply.data[2];
|
||||
switch(status){
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
cancelBlueConnetctToastTimer();
|
||||
|
||||
final int dataLength = reply.data[8];
|
||||
state.uploadRemoteControlDataList.addAll(reply.data.sublist(9, reply.data.length));
|
||||
if(dataLength == 10){
|
||||
state.uploadRemoteControlDataList
|
||||
.addAll(reply.data.sublist(9, reply.data.length));
|
||||
if (dataLength == 10) {
|
||||
// 当数据是10的时候继续请求
|
||||
state.uploadRemoteControlPage = state.uploadRemoteControlPage + 1;
|
||||
|
||||
@ -323,7 +349,7 @@ class UploadDataLogic extends BaseGetXController{
|
||||
|
||||
showEasyLoading();
|
||||
updataLockRemoteControlList(token, state.uploadRemoteControlPage);
|
||||
}else{
|
||||
} else {
|
||||
// // 当数据不是10的时候解析数据上传
|
||||
// if(state.uploadPalmVeinDataList.isEmpty){
|
||||
// // 不需要上传 如果是空的直接上传下一个
|
||||
@ -331,12 +357,15 @@ class UploadDataLogic extends BaseGetXController{
|
||||
// }else{
|
||||
// // 如果不是空的解析数据上传
|
||||
state.indexCount.value = state.indexCount.value + 1;
|
||||
_lockDataUpload(uploadType:2, recordType:7, records:state.uploadRemoteControlDataList);
|
||||
_lockDataUpload(
|
||||
uploadType: 2,
|
||||
recordType: 7,
|
||||
records: state.uploadRemoteControlDataList);
|
||||
// }
|
||||
}
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
//无权限
|
||||
final List<int> token = reply.data.sublist(3, 7);
|
||||
final List<String> saveStrList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
@ -355,17 +384,19 @@ class UploadDataLogic extends BaseGetXController{
|
||||
// 上传数据获取锁设置解析
|
||||
Future<void> _replyUpdataLockSetReply(Reply reply) async {
|
||||
final int status = reply.data[2];
|
||||
switch(status){
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
state.indexCount.value = state.indexCount.value + 1;
|
||||
cancelBlueConnetctToastTimer();
|
||||
|
||||
state.uploadLockSetDataList.addAll(reply.data.sublist(7, reply.data.length));
|
||||
_lockDataUpload(uploadType:1, recordType:0, records:state.uploadLockSetDataList);
|
||||
state.uploadLockSetDataList
|
||||
.addAll(reply.data.sublist(7, reply.data.length));
|
||||
_lockDataUpload(
|
||||
uploadType: 1, recordType: 0, records: state.uploadLockSetDataList);
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
//无权限
|
||||
final List<int> token = reply.data.sublist(3, 7);
|
||||
final List<String> saveStrList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
@ -383,18 +414,19 @@ class UploadDataLogic extends BaseGetXController{
|
||||
|
||||
// 上传数据获取锁密码列表
|
||||
Future<void> getUpdataLockPasswordList() async {
|
||||
if(state.sureBtnState.value == 1){
|
||||
if (state.sureBtnState.value == 1) {
|
||||
return;
|
||||
}
|
||||
state.sureBtnState.value = 1;
|
||||
|
||||
showEasyLoading();
|
||||
showBlueConnetctToastTimer(action: (){
|
||||
showBlueConnetctToastTimer(action: () {
|
||||
dismissEasyLoading();
|
||||
AppLog.log('上传密码列表获取超时 关闭加载菊花');
|
||||
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>? token = await Storage.getStringList(saveBlueToken);
|
||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||
@ -405,7 +437,7 @@ class UploadDataLogic extends BaseGetXController{
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.sureBtnState.value = 0;
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
if (state.ifCurrentScreen.value == true) {
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
}
|
||||
@ -414,7 +446,8 @@ class UploadDataLogic extends BaseGetXController{
|
||||
|
||||
// 公共的获取密码列表
|
||||
Future<void> updataLockPasswordList(List<int> token, int page) async {
|
||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
@ -428,19 +461,19 @@ class UploadDataLogic extends BaseGetXController{
|
||||
token: token,
|
||||
needAuthor: 1,
|
||||
signKey: signKeyDataList,
|
||||
privateKey: getPrivateKeyList
|
||||
);
|
||||
privateKey: getPrivateKeyList);
|
||||
}
|
||||
|
||||
// 上传数据获取锁Card列表
|
||||
Future<void> getUpdataLockCardList() async {
|
||||
showEasyLoading();
|
||||
showBlueConnetctToastTimer(action: (){
|
||||
showBlueConnetctToastTimer(action: () {
|
||||
dismissEasyLoading();
|
||||
state.indexCount.value = 0;
|
||||
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>? token = await Storage.getStringList(saveBlueToken);
|
||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||
@ -451,7 +484,7 @@ class UploadDataLogic extends BaseGetXController{
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.sureBtnState.value = 0;
|
||||
state.indexCount.value = 0;
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
if (state.ifCurrentScreen.value == true) {
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
}
|
||||
@ -460,7 +493,8 @@ class UploadDataLogic extends BaseGetXController{
|
||||
|
||||
// 公共的获取Card列表
|
||||
Future<void> updataLockCardList(List<int> token, int page) async {
|
||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
@ -474,19 +508,19 @@ class UploadDataLogic extends BaseGetXController{
|
||||
token: token,
|
||||
needAuthor: 1,
|
||||
signKey: signKeyDataList,
|
||||
privateKey: getPrivateKeyList
|
||||
);
|
||||
privateKey: getPrivateKeyList);
|
||||
}
|
||||
|
||||
// 上传数据获取锁指纹列表
|
||||
Future<void> getUpdataLockFingerprintList() async {
|
||||
showEasyLoading();
|
||||
showBlueConnetctToastTimer(action: (){
|
||||
showBlueConnetctToastTimer(action: () {
|
||||
dismissEasyLoading();
|
||||
state.indexCount.value = 0;
|
||||
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>? token = await Storage.getStringList(saveBlueToken);
|
||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||
@ -497,7 +531,7 @@ class UploadDataLogic extends BaseGetXController{
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.sureBtnState.value = 0;
|
||||
state.indexCount.value = 0;
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
if (state.ifCurrentScreen.value == true) {
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
}
|
||||
@ -506,7 +540,8 @@ class UploadDataLogic extends BaseGetXController{
|
||||
|
||||
// 公共的获取指纹列表
|
||||
Future<void> updataLockFingerprintList(List<int> token, int page) async {
|
||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
@ -520,19 +555,19 @@ class UploadDataLogic extends BaseGetXController{
|
||||
token: token,
|
||||
needAuthor: 1,
|
||||
signKey: signKeyDataList,
|
||||
privateKey: getPrivateKeyList
|
||||
);
|
||||
privateKey: getPrivateKeyList);
|
||||
}
|
||||
|
||||
// 上传数据获取锁人脸列表
|
||||
Future<void> getUpdataLockFaceList() async {
|
||||
showEasyLoading();
|
||||
showBlueConnetctToastTimer(action: (){
|
||||
showBlueConnetctToastTimer(action: () {
|
||||
dismissEasyLoading();
|
||||
state.indexCount.value = 0;
|
||||
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>? token = await Storage.getStringList(saveBlueToken);
|
||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||
@ -543,7 +578,7 @@ class UploadDataLogic extends BaseGetXController{
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.sureBtnState.value = 0;
|
||||
state.indexCount.value = 0;
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
if (state.ifCurrentScreen.value == true) {
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
}
|
||||
@ -552,7 +587,8 @@ class UploadDataLogic extends BaseGetXController{
|
||||
|
||||
// 公共的获取人脸列表
|
||||
Future<void> updataLockFaceList(List<int> token, int page) async {
|
||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
@ -566,20 +602,19 @@ class UploadDataLogic extends BaseGetXController{
|
||||
token: token,
|
||||
needAuthor: 1,
|
||||
signKey: signKeyDataList,
|
||||
privateKey: getPrivateKeyList
|
||||
);
|
||||
privateKey: getPrivateKeyList);
|
||||
}
|
||||
|
||||
|
||||
// 上传数据获取锁掌静脉列表
|
||||
Future<void> getUpdataLockPalmVeinList() async {
|
||||
showEasyLoading();
|
||||
showBlueConnetctToastTimer(action: (){
|
||||
showBlueConnetctToastTimer(action: () {
|
||||
dismissEasyLoading();
|
||||
state.indexCount.value = 0;
|
||||
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>? token = await Storage.getStringList(saveBlueToken);
|
||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||
@ -590,7 +625,7 @@ class UploadDataLogic extends BaseGetXController{
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.sureBtnState.value = 0;
|
||||
state.indexCount.value = 0;
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
if (state.ifCurrentScreen.value == true) {
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
}
|
||||
@ -599,7 +634,8 @@ class UploadDataLogic extends BaseGetXController{
|
||||
|
||||
// 公共的获取掌静脉列表
|
||||
Future<void> updataLockPalmVeinList(List<int> token, int page) async {
|
||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
@ -613,30 +649,31 @@ class UploadDataLogic extends BaseGetXController{
|
||||
token: token,
|
||||
needAuthor: 1,
|
||||
signKey: signKeyDataList,
|
||||
privateKey: getPrivateKeyList
|
||||
);
|
||||
privateKey: getPrivateKeyList);
|
||||
}
|
||||
|
||||
// 上传数据获取锁遥控列表
|
||||
Future<void> getUpdataLockRemoteControlList() async {
|
||||
showEasyLoading();
|
||||
showBlueConnetctToastTimer(action: (){
|
||||
showBlueConnetctToastTimer(action: () {
|
||||
dismissEasyLoading();
|
||||
state.indexCount.value = 0;
|
||||
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>? token = await Storage.getStringList(saveBlueToken);
|
||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
updataLockRemoteControlList(getTokenList, state.uploadRemoteControlPage);
|
||||
updataLockRemoteControlList(
|
||||
getTokenList, state.uploadRemoteControlPage);
|
||||
} else if (connectionState == BluetoothConnectionState.disconnected) {
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.sureBtnState.value = 0;
|
||||
state.indexCount.value = 0;
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
if (state.ifCurrentScreen.value == true) {
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
}
|
||||
@ -645,7 +682,8 @@ class UploadDataLogic extends BaseGetXController{
|
||||
|
||||
// 公共的获取遥控列表
|
||||
Future<void> updataLockRemoteControlList(List<int> token, int page) async {
|
||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
@ -659,19 +697,19 @@ class UploadDataLogic extends BaseGetXController{
|
||||
token: token,
|
||||
needAuthor: 1,
|
||||
signKey: signKeyDataList,
|
||||
privateKey: getPrivateKeyList
|
||||
);
|
||||
privateKey: getPrivateKeyList);
|
||||
}
|
||||
|
||||
// 上传数据获取设置
|
||||
Future<void> getUpdataLockSet() async {
|
||||
showEasyLoading();
|
||||
showBlueConnetctToastTimer(action: (){
|
||||
showBlueConnetctToastTimer(action: () {
|
||||
dismissEasyLoading();
|
||||
state.indexCount.value = 0;
|
||||
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>? token = await Storage.getStringList(saveBlueToken);
|
||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||
@ -682,7 +720,7 @@ class UploadDataLogic extends BaseGetXController{
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.sureBtnState.value = 0;
|
||||
state.indexCount.value = 0;
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
if (state.ifCurrentScreen.value == true) {
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
}
|
||||
@ -691,7 +729,8 @@ class UploadDataLogic extends BaseGetXController{
|
||||
|
||||
// 公共的上传锁设置
|
||||
Future<void> updataLockSet(List<int> token) async {
|
||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
@ -703,32 +742,29 @@ class UploadDataLogic extends BaseGetXController{
|
||||
token: token,
|
||||
needAuthor: 1,
|
||||
signKey: signKeyDataList,
|
||||
privateKey: getPrivateKeyList
|
||||
);
|
||||
privateKey: getPrivateKeyList);
|
||||
}
|
||||
|
||||
// 锁数据上传服务器
|
||||
Future<void> _lockDataUpload({
|
||||
required int uploadType,
|
||||
required int recordType,
|
||||
required List records
|
||||
}) async{
|
||||
Future<void> _lockDataUpload(
|
||||
{required int uploadType,
|
||||
required int recordType,
|
||||
required List records}) async {
|
||||
final LoginEntity entity = await ApiRepository.to.lockDataUpload(
|
||||
lockId: CommonDataManage().currentKeyInfo.lockId!,
|
||||
uploadType:uploadType,
|
||||
uploadType: uploadType,
|
||||
recordType: recordType,
|
||||
records:records,
|
||||
isUnShowLoading: false
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
if(uploadType == 1){
|
||||
records: records,
|
||||
isUnShowLoading: false);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if (uploadType == 1) {
|
||||
// 1设置
|
||||
state.indexCount.value = 0;
|
||||
state.sureBtnState.value = 0;
|
||||
showToast('上传成功'.tr);
|
||||
}else{
|
||||
} else {
|
||||
// 2开门方式
|
||||
switch(recordType){
|
||||
switch (recordType) {
|
||||
// case 1:
|
||||
// // 电子钥匙
|
||||
//
|
||||
@ -761,13 +797,38 @@ class UploadDataLogic extends BaseGetXController{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
state.indexCount.value = 0;
|
||||
state.sureBtnState.value = 0;
|
||||
dismissEasyLoading();
|
||||
}
|
||||
}
|
||||
|
||||
// 上传数据成功后的回调
|
||||
void onUploadSuccess() {
|
||||
// 发送事件通知指纹列表刷新
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
// 返回上一页
|
||||
Get.back();
|
||||
}
|
||||
|
||||
// 在上传数据成功的地方调用
|
||||
Future<void> uploadData() async {
|
||||
try {
|
||||
// ... existing upload code ...
|
||||
|
||||
// 假设这是上传成功的标志
|
||||
bool uploadSuccess = true; // 这里需要根据实际的上传结果来设置
|
||||
|
||||
if (uploadSuccess) {
|
||||
onUploadSuccess();
|
||||
}
|
||||
} catch (e) {
|
||||
// 处理错误
|
||||
print('Upload failed: $e');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
@ -783,5 +844,4 @@ class UploadDataLogic extends BaseGetXController{
|
||||
|
||||
_replySubscription.cancel();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user