1、添加卡指纹bugly统计
2、添加授权管理员、卡、记录、指纹、密码、删除锁、友盟统计
This commit is contained in:
parent
fc18ca5614
commit
e4eaa97046
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<umeng_config>
|
<umeng_config>
|
||||||
<appkey>671244cf80464b33f6df9648</appkey>
|
<appkey>671244cf80464b33f6df9648</appkey>
|
||||||
<channel>RD_test</channel>
|
<channel>Product</channel>
|
||||||
</umeng_config>
|
</umeng_config>
|
||||||
@ -20,7 +20,7 @@ class MainActivity : FlutterActivity() {
|
|||||||
GeneratedPluginRegistrant.registerWith(flutterEngine!!)
|
GeneratedPluginRegistrant.registerWith(flutterEngine!!)
|
||||||
|
|
||||||
// 初始化 Umeng SDK
|
// 初始化 Umeng SDK
|
||||||
UMConfigure.init(this, "671244cf80464b33f6df9648", "RD_test", UMConfigure.DEVICE_TYPE_PHONE, null)
|
UMConfigure.init(this, "671244cf80464b33f6df9648", "Product", UMConfigure.DEVICE_TYPE_PHONE, null)
|
||||||
|
|
||||||
MethodChannel(flutterEngine?.dartExecutor!!.binaryMessenger, "starLockFlutterSend").setMethodCallHandler { call, result ->
|
MethodChannel(flutterEngine?.dartExecutor!!.binaryMessenger, "starLockFlutterSend").setMethodCallHandler { call, result ->
|
||||||
if (call.method == "loadNativeShare") {
|
if (call.method == "loadNativeShare") {
|
||||||
|
|||||||
@ -25,10 +25,6 @@ import 'tools/store_service.dart';
|
|||||||
|
|
||||||
// 该文件不可作为编译入口,请查看 flavorizr.yaml 中的说明
|
// 该文件不可作为编译入口,请查看 flavorizr.yaml 中的说明
|
||||||
FutureOr<void> main() async {
|
FutureOr<void> main() async {
|
||||||
|
|
||||||
UmengCommonSdk.initCommon('671244cf80464b33f6df9648', '671244ae80464b33f6df9646', 'RD_test');
|
|
||||||
UmengCommonSdk.setPageCollectionModeManual();
|
|
||||||
|
|
||||||
FlutterBugly.postCatchedException(() async {
|
FlutterBugly.postCatchedException(() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
@ -82,6 +78,9 @@ Future<void> _setCommonServices() async {
|
|||||||
|
|
||||||
//关于隐私协议的初始化
|
//关于隐私协议的初始化
|
||||||
Future<void> privacySDKInitialization() async {
|
Future<void> privacySDKInitialization() async {
|
||||||
|
UmengCommonSdk.initCommon('671244cf80464b33f6df9648', '671244ae80464b33f6df9646', 'Product');
|
||||||
|
UmengCommonSdk.setPageCollectionModeManual();
|
||||||
|
|
||||||
await Get.putAsync(() => PlatformInfoService().init());
|
await Get.putAsync(() => PlatformInfoService().init());
|
||||||
await BuglyTool.init();
|
await BuglyTool.init();
|
||||||
// 初始化JPush服务
|
// 初始化JPush服务
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import 'package:star_lock/mine/valueAddedServices/valueAddedServicesHighFunction
|
|||||||
import 'package:star_lock/tools/NativeInteractionTool.dart';
|
import 'package:star_lock/tools/NativeInteractionTool.dart';
|
||||||
import 'package:star_lock/tools/dateTool.dart';
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||||
|
import 'package:umeng_common_sdk/umeng_common_sdk.dart';
|
||||||
|
|
||||||
import '../../../../blue/blue_manage.dart';
|
import '../../../../blue/blue_manage.dart';
|
||||||
import '../../../../blue/io_protocol/io_transferPermissions.dart';
|
import '../../../../blue/io_protocol/io_transferPermissions.dart';
|
||||||
@ -33,86 +34,84 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
int? keyId;
|
int? keyId;
|
||||||
|
|
||||||
// 监听设备返回的数据
|
// 监听设备返回的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
// late StreamSubscription<Reply> _replySubscription;
|
||||||
|
// void _initReplySubscription() {
|
||||||
void _initReplySubscription() {
|
// _replySubscription =
|
||||||
_replySubscription =
|
// EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||||
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
// // 转移权限
|
||||||
// 转移权限
|
// if (reply is TransferPermissionsReply) {
|
||||||
if (reply is TransferPermissionsReply) {
|
// final List<int> token = reply.data.sublist(2, 6);
|
||||||
final List<int> token = reply.data.sublist(2, 6);
|
// final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
final List<String> saveStrList = changeIntListToStringList(token);
|
// Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
//
|
||||||
|
// final int status = reply.data[6];
|
||||||
final int status = reply.data[6];
|
// switch (status) {
|
||||||
|
// case 0x00:
|
||||||
switch (status) {
|
// //成功
|
||||||
case 0x00:
|
// break;
|
||||||
//成功
|
// case 0x06:
|
||||||
break;
|
// //无权限
|
||||||
case 0x06:
|
// final List<String>? privateKey =
|
||||||
//无权限
|
// await Storage.getStringList(saveBluePrivateKey);
|
||||||
final List<String>? privateKey =
|
// final List<int> getPrivateKeyList =
|
||||||
await Storage.getStringList(saveBluePrivateKey);
|
// changeStringListToIntList(privateKey!);
|
||||||
final List<int> getPrivateKeyList =
|
//
|
||||||
changeStringListToIntList(privateKey!);
|
// final List<String>? publicKey =
|
||||||
|
// await Storage.getStringList(saveBluePublicKey);
|
||||||
final List<String>? publicKey =
|
// final List<int> publicKeyDataList =
|
||||||
await Storage.getStringList(saveBluePublicKey);
|
// changeStringListToIntList(publicKey!);
|
||||||
final List<int> publicKeyDataList =
|
//
|
||||||
changeStringListToIntList(publicKey!);
|
// final List<String>? token =
|
||||||
|
// await Storage.getStringList(saveBlueToken);
|
||||||
final List<String>? token =
|
// final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
await Storage.getStringList(saveBlueToken);
|
//
|
||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
// IoSenderManage.senderFactoryDataReset(
|
||||||
|
// lockID: BlueManage().connectDeviceName,
|
||||||
IoSenderManage.senderFactoryDataReset(
|
// userID: await Storage.getUid(),
|
||||||
lockID: BlueManage().connectDeviceName,
|
// keyID: '1',
|
||||||
userID: await Storage.getUid(),
|
// needAuthor: 1,
|
||||||
keyID: '1',
|
// publicKey: publicKeyDataList,
|
||||||
needAuthor: 1,
|
// privateKey: getPrivateKeyList,
|
||||||
publicKey: publicKeyDataList,
|
// token: getTokenList);
|
||||||
privateKey: getPrivateKeyList,
|
// break;
|
||||||
token: getTokenList);
|
// default:
|
||||||
break;
|
// break;
|
||||||
default:
|
// }
|
||||||
break;
|
// }
|
||||||
}
|
// });
|
||||||
}
|
// }
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 转移权限
|
// 转移权限
|
||||||
Future<void> transferPermissionsAction() async {
|
// Future<void> transferPermissionsAction() async {
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
// BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState state) async {
|
// (BluetoothConnectionState state) async {
|
||||||
if (state == BluetoothConnectionState.connected) {
|
// if (state == BluetoothConnectionState.connected) {
|
||||||
final List<String>? privateKey =
|
// final List<String>? privateKey =
|
||||||
await Storage.getStringList(saveBluePrivateKey);
|
// await Storage.getStringList(saveBluePrivateKey);
|
||||||
final List<int> getPrivateKeyList =
|
// final List<int> getPrivateKeyList =
|
||||||
changeStringListToIntList(privateKey!);
|
// changeStringListToIntList(privateKey!);
|
||||||
|
//
|
||||||
final List<String>? publicKey =
|
// final List<String>? publicKey =
|
||||||
await Storage.getStringList(saveBluePublicKey);
|
// await Storage.getStringList(saveBluePublicKey);
|
||||||
final List<int> publicKeyDataList =
|
// final List<int> publicKeyDataList =
|
||||||
changeStringListToIntList(publicKey!);
|
// changeStringListToIntList(publicKey!);
|
||||||
|
//
|
||||||
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!);
|
||||||
|
//
|
||||||
IoSenderManage.senderTransferPermissions(
|
// IoSenderManage.senderTransferPermissions(
|
||||||
lockID: BlueManage().connectDeviceName,
|
// lockID: BlueManage().connectDeviceName,
|
||||||
authUserID: await Storage.getUid(),
|
// authUserID: await Storage.getUid(),
|
||||||
keyID: '1',
|
// keyID: '1',
|
||||||
oldUserID: await Storage.getUid(),
|
// oldUserID: await Storage.getUid(),
|
||||||
newUserID: '100002',
|
// newUserID: '100002',
|
||||||
needAuthor: 1,
|
// needAuthor: 1,
|
||||||
publicKey: publicKeyDataList,
|
// publicKey: publicKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
// privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
// token: getTokenList);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
//发送授权管理员列表请求
|
//发送授权管理员列表请求
|
||||||
Future<void> sendElectronicKeyRequest() async {
|
Future<void> sendElectronicKeyRequest() async {
|
||||||
@ -222,7 +221,15 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
idCardNumber: state.isRequireAuth.value == true
|
idCardNumber: state.isRequireAuth.value == true
|
||||||
? state.idCardController.text
|
? state.idCardController.text
|
||||||
: '');
|
: '');
|
||||||
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
UmengCommonSdk.onEvent('add_authorizedAdmin', {
|
||||||
|
'lock_name':BlueManage().connectDeviceName,
|
||||||
|
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
|
'date':DateTool().getNowDateWithType(1),
|
||||||
|
'add_password_result':'添加授权管理员成功',
|
||||||
|
});
|
||||||
|
|
||||||
state.createUser.value = 0;
|
state.createUser.value = 0;
|
||||||
state.isSendSuccess.value = true;
|
state.isSendSuccess.value = true;
|
||||||
state.addUserId.value = entity.data!.receiverUser!.id.toString();
|
state.addUserId.value = entity.data!.receiverUser!.id.toString();
|
||||||
@ -237,6 +244,13 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
state.createUser.value = 1;
|
state.createUser.value = 1;
|
||||||
sendElectronicKeyRequest();
|
sendElectronicKeyRequest();
|
||||||
});
|
});
|
||||||
|
}else{
|
||||||
|
UmengCommonSdk.onEvent('add_authorizedAdmin', {
|
||||||
|
'lock_name':BlueManage().connectDeviceName,
|
||||||
|
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
|
'date':DateTool().getNowDateWithType(1),
|
||||||
|
'add_password_result':'添加授权管理员失败:${entity.errorMsg}',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -327,11 +341,11 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
void onReady() {
|
void onReady() {
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
_initReplySubscription();
|
// _initReplySubscription();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
_replySubscription.cancel();
|
// _replySubscription.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import '../../../../blue/io_tool/io_tool.dart';
|
|||||||
import '../../../../blue/io_tool/manager_event_bus.dart';
|
import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||||
import '../../../../blue/sender_manage.dart';
|
import '../../../../blue/sender_manage.dart';
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../../../../tools/bugly/bugly_tool.dart';
|
||||||
import '../../../../tools/dateTool.dart';
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../../../tools/eventBusEventManage.dart';
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
@ -42,6 +43,11 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
|
|
||||||
Future<void> _replyAddICCardBegin(Reply reply) async {
|
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||||
final int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
|
BuglyTool.uploadException(
|
||||||
|
message: '添加卡开始,解析数据',
|
||||||
|
detail: '添加卡开始,解析数据 _replyAddICCardBegin:${reply.data}',
|
||||||
|
upload: false
|
||||||
|
);
|
||||||
|
|
||||||
switch(status){
|
switch(status){
|
||||||
case 0x00:
|
case 0x00:
|
||||||
@ -102,6 +108,14 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
Future<void> _replyAddICCardConfirmation(Reply reply) async {
|
Future<void> _replyAddICCardConfirmation(Reply reply) async {
|
||||||
final int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
state.ifAddState.value = false;
|
state.ifAddState.value = false;
|
||||||
|
|
||||||
|
BuglyTool.uploadException(
|
||||||
|
message: '添加卡结果,解析数据',
|
||||||
|
detail: '添加卡结果,解析数据 _replyAddICCardConfirmation:${reply.data}',
|
||||||
|
eventStr: '添加卡事件',
|
||||||
|
upload: true
|
||||||
|
);
|
||||||
|
|
||||||
final String getMobile = (await Storage.getMobile())!;
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
switch(status){
|
switch(status){
|
||||||
case 0x00:
|
case 0x00:
|
||||||
@ -158,22 +172,58 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
|
|
||||||
// 添加卡片
|
// 添加卡片
|
||||||
Future<void> senderAddICCard() async {
|
Future<void> senderAddICCard() async {
|
||||||
showBlueConnetctToastTimer(action: (){
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
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 String command = SenderAddICCardWithTimeCycleCoercionCommand(
|
||||||
|
keyID:'1',
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
cardNo:0,
|
||||||
|
useCountLimit:0xffff,
|
||||||
|
operate:0, // 0:注册 1:修改 2:删除 3:删除全部
|
||||||
|
isAdmin:state.isAdministrator.value == '2' ? 1 : 0,
|
||||||
|
isForce:state.isCoerced.value == '1' ? 1 : 0, // 是否是胁迫
|
||||||
|
isRound:state.selectType.value == '2' ? 1: 0, // 是否是循环
|
||||||
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: int.parse(state.startDate.value)~/1000,
|
||||||
|
endDate: int.parse(state.endDate.value)~/1000,
|
||||||
|
startTime:DateTool().dateToHNString(state.effectiveDateTime.value),
|
||||||
|
endTime:DateTool().dateToHNString(state.failureDateTime.value),
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
).toString();
|
||||||
|
|
||||||
|
|
||||||
|
showBlueConnetctToastTimer(action: () async {
|
||||||
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
|
UmengCommonSdk.onEvent('add_card', {
|
||||||
|
'lock_name':BlueManage().connectDeviceName,
|
||||||
|
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
|
'date':DateTool().getNowDateWithType(1),
|
||||||
|
'add_card_result':'添加卡超时',
|
||||||
|
});
|
||||||
|
|
||||||
|
BuglyTool.uploadException(
|
||||||
|
message: '添加卡超时处理-添加卡失败',
|
||||||
|
detail: '添加卡超时处理,断开连接,添加卡失败--SenderAddICCardWithTimeCycleCoercionCommand:$command',
|
||||||
|
eventStr: '添加卡事件',
|
||||||
|
upload: true
|
||||||
|
);
|
||||||
|
|
||||||
Get.close(1);
|
Get.close(1);
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
|
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
|
||||||
|
|
||||||
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!);
|
|
||||||
|
|
||||||
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||||
keyID:'1',
|
keyID:'1',
|
||||||
userID:await Storage.getUid(),
|
userID:await Storage.getUid(),
|
||||||
@ -195,6 +245,21 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
isBeforeAddUser: false
|
isBeforeAddUser: false
|
||||||
);
|
);
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected){
|
} else if (deviceConnectionState == BluetoothConnectionState.disconnected){
|
||||||
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
|
UmengCommonSdk.onEvent('add_card', {
|
||||||
|
'lock_name':BlueManage().connectDeviceName,
|
||||||
|
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
|
'date':DateTool().getNowDateWithType(1),
|
||||||
|
'add_card_result':'添加卡断开连接',
|
||||||
|
});
|
||||||
|
|
||||||
|
BuglyTool.uploadException(
|
||||||
|
message: '添加卡超时处理-添加卡失败',
|
||||||
|
detail: '添加卡超时处理,断开连接,添加卡失败--SenderAddICCardWithTimeCycleCoercionCommand:$command',
|
||||||
|
eventStr: '添加卡事件',
|
||||||
|
upload: true
|
||||||
|
);
|
||||||
|
|
||||||
if(state.ifCurrentScreen.value == true){
|
if(state.ifCurrentScreen.value == true){
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -241,11 +241,11 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
final KeyOperationRecordEntity entity = await ApiRepository.to
|
final KeyOperationRecordEntity entity = await ApiRepository.to
|
||||||
.lockRecordUploadData(
|
.lockRecordUploadData(
|
||||||
lockId: state.keyInfos.value.lockId.toString(), records: list);
|
lockId: state.keyInfos.value.lockId.toString(), records: list);
|
||||||
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if (state.ifHaveNext == true) {
|
if (state.ifHaveNext == true) {
|
||||||
getLockRecordLastUploadDataTime();
|
getLockRecordLastUploadDataTime();
|
||||||
} else {
|
} else {
|
||||||
final String getMobile = (await Storage.getMobile())!;
|
|
||||||
UmengCommonSdk.onEvent('check_doorLockLog', {
|
UmengCommonSdk.onEvent('check_doorLockLog', {
|
||||||
'lockName':state.keyInfos.value.lockName!,
|
'lockName':state.keyInfos.value.lockName!,
|
||||||
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
@ -254,6 +254,13 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
mockNetworkDataRequest(isRefresh: true);
|
mockNetworkDataRequest(isRefresh: true);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
UmengCommonSdk.onEvent('check_doorLockLog', {
|
||||||
|
'lockName':state.keyInfos.value.lockName!,
|
||||||
|
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
|
'date':DateTool().getNowDateWithType(1),
|
||||||
|
'open_lock_result':'上传数据接口失败',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,9 +3,11 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/app_settings/app_settings.dart';
|
||||||
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/fingerprint/addFingerprint/addFingerprint_entity.dart';
|
import 'package:star_lock/main/lockDetail/fingerprint/addFingerprint/addFingerprint_entity.dart';
|
||||||
import 'package:star_lock/tools/dateTool.dart';
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
|
import 'package:umeng_common_sdk/umeng_common_sdk.dart';
|
||||||
|
|
||||||
import '../../../../../blue/blue_manage.dart';
|
import '../../../../../blue/blue_manage.dart';
|
||||||
import '../../../../../blue/io_reply.dart';
|
import '../../../../../blue/io_reply.dart';
|
||||||
@ -17,6 +19,7 @@ import '../../../../../tools/baseGetXController.dart';
|
|||||||
import '../../../../../tools/eventBusEventManage.dart';
|
import '../../../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../../../tools/storage.dart';
|
import '../../../../../tools/storage.dart';
|
||||||
import '../../../../blue/io_protocol/io_addFingerprintWithTimeCycleCoercion.dart';
|
import '../../../../blue/io_protocol/io_addFingerprintWithTimeCycleCoercion.dart';
|
||||||
|
import '../../../../tools/bugly/bugly_tool.dart';
|
||||||
import 'addFingerprint_state.dart';
|
import 'addFingerprint_state.dart';
|
||||||
|
|
||||||
class AddFingerprintLogic extends BaseGetXController {
|
class AddFingerprintLogic extends BaseGetXController {
|
||||||
@ -44,8 +47,13 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
||||||
final int status = reply.data[2];
|
BuglyTool.uploadException(
|
||||||
|
message: '添加指纹开始,解析数据',
|
||||||
|
detail: '添加指纹开始,解析数据 _replyAddFingerprintBegin:${reply.data}',
|
||||||
|
upload: false
|
||||||
|
);
|
||||||
|
|
||||||
|
final int status = reply.data[2];
|
||||||
switch(status){
|
switch(status){
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
@ -102,8 +110,12 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _replyAddFingerprintProcess(Reply reply) async {
|
Future<void> _replyAddFingerprintProcess(Reply reply) async {
|
||||||
|
BuglyTool.uploadException(
|
||||||
|
message: '添加指纹过程,解析数据',
|
||||||
|
detail: '添加指纹过程,解析数据 _replyAddFingerprintProcess:${reply.data}',
|
||||||
|
upload: false
|
||||||
|
);
|
||||||
final int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
|
|
||||||
switch(status){
|
switch(status){
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
@ -154,13 +166,27 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
|
|
||||||
Future<void> _replyAddFingerprintConfirmation(Reply reply) async {
|
Future<void> _replyAddFingerprintConfirmation(Reply reply) async {
|
||||||
final int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
switch(status){
|
switch(status){
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
// var fingerprintNum = listChangInt(reply.data.sublist(9, 11)).toString();
|
// var fingerprintNum = listChangInt(reply.data.sublist(9, 11)).toString();
|
||||||
final List<int> fingerprintList = reply.data.sublist(reply.data.length - 2);
|
UmengCommonSdk.onEvent('add_fingerprint', {
|
||||||
final String fingerprintNum = listChangInt(fingerprintList).toString();
|
'lock_name':BlueManage().connectDeviceName,
|
||||||
state.regIndex.value++;
|
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
|
'date':DateTool().getNowDateWithType(1),
|
||||||
|
'add_fingerprint_result':'成功',
|
||||||
|
});
|
||||||
|
|
||||||
|
BuglyTool.uploadException(
|
||||||
|
message: '添加指纹确认结果,解析数据',
|
||||||
|
detail: '添加指纹确认结果,解析数据 _replyAddFingerprintConfirmation:${reply.data}',
|
||||||
|
upload: false
|
||||||
|
);
|
||||||
|
|
||||||
|
final List<int> fingerprintList = reply.data.sublist(reply.data.length - 2);
|
||||||
|
final String fingerprintNum = listChangInt(fingerprintList).toString();
|
||||||
|
state.regIndex.value++;
|
||||||
if(state.fingerprintNumber.value == fingerprintNum){
|
if(state.fingerprintNumber.value == fingerprintNum){
|
||||||
return;
|
return;
|
||||||
}else{
|
}else{
|
||||||
@ -177,6 +203,19 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
|
UmengCommonSdk.onEvent('add_fingerprint', {
|
||||||
|
'lock_name':BlueManage().connectDeviceName,
|
||||||
|
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
|
'date':DateTool().getNowDateWithType(1),
|
||||||
|
'add_fingerprint_result':'失败-${reply.data}',
|
||||||
|
});
|
||||||
|
|
||||||
|
BuglyTool.uploadException(
|
||||||
|
message: '添加指纹确认结果,解析数据',
|
||||||
|
detail: '添加指纹确认结果,解析数据 _replyAddFingerprintConfirmation:${reply.data}',
|
||||||
|
eventStr: '添加指纹事件',
|
||||||
|
upload: true
|
||||||
|
);
|
||||||
state.ifAddState.value = false;
|
state.ifAddState.value = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -184,7 +223,50 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 添加指纹开始
|
// 添加指纹开始
|
||||||
Future<void> senderAddFingerprint() async {
|
Future<void> senderAddFingerprint() async {
|
||||||
showBlueConnetctToastTimer(action: (){
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
final String command = SenderAddFingerprintWithTimeCycleCoercionCommand(
|
||||||
|
keyID:'1',
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
fingerNo:0,
|
||||||
|
useCountLimit:0xffff,
|
||||||
|
isForce:state.isCoerced.value == '1' ? 1 : 0, // 是否是胁迫
|
||||||
|
isAdmin: state.isAdministrator.value == '2' ? 1 : 0,
|
||||||
|
operate: 0,
|
||||||
|
isRound:state.selectType.value == '2' ? 1: 0, // 是否是循环
|
||||||
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: int.parse(state.startDate.value)~/1000,
|
||||||
|
endDate: int.parse(state.endDate.value)~/1000,
|
||||||
|
startTime:DateTool().dateToHNString(state.effectiveDateTime.value),
|
||||||
|
endTime:DateTool().dateToHNString(state.failureDateTime.value),
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
).toString();
|
||||||
|
|
||||||
|
showBlueConnetctToastTimer(action: () async {
|
||||||
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
|
UmengCommonSdk.onEvent('add_fingerprint', {
|
||||||
|
'lock_name':BlueManage().connectDeviceName,
|
||||||
|
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
|
'date':DateTool().getNowDateWithType(1),
|
||||||
|
'add_fingerprint_result':'超时',
|
||||||
|
});
|
||||||
|
|
||||||
|
BuglyTool.uploadException(
|
||||||
|
message: '添加指纹超时处理-添加指纹失败',
|
||||||
|
detail: '添加指纹超时处理,断开连接,添加指纹失败--SenderAddFingerprintWithTimeCycleCoercionCommand:$command',
|
||||||
|
eventStr: '添加指纹事件',
|
||||||
|
upload: true
|
||||||
|
);
|
||||||
Get.close(1);
|
Get.close(1);
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
@ -219,6 +301,21 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
isBeforeAddUser: false
|
isBeforeAddUser: false
|
||||||
);
|
);
|
||||||
}else if (deviceConnectionState == BluetoothConnectionState.disconnected){
|
}else if (deviceConnectionState == BluetoothConnectionState.disconnected){
|
||||||
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
|
UmengCommonSdk.onEvent('add_fingerprint', {
|
||||||
|
'lock_name':BlueManage().connectDeviceName,
|
||||||
|
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
|
'date':DateTool().getNowDateWithType(1),
|
||||||
|
'add_fingerprint_result':'断开',
|
||||||
|
});
|
||||||
|
|
||||||
|
BuglyTool.uploadException(
|
||||||
|
message: '添加指纹断开连接-添加指纹失败',
|
||||||
|
detail: '添加指纹断开连接-添加指纹失败--SenderAddFingerprintWithTimeCycleCoercionCommand:$command',
|
||||||
|
eventStr: '添加指纹事件',
|
||||||
|
upload: true
|
||||||
|
);
|
||||||
|
|
||||||
if(state.ifCurrentScreen.value == true){
|
if(state.ifCurrentScreen.value == true){
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
}
|
}
|
||||||
@ -277,6 +374,20 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
updateFingerprintUserNoLoadData(entity.data!.fingerprintId.toString());
|
updateFingerprintUserNoLoadData(entity.data!.fingerprintId.toString());
|
||||||
|
BuglyTool.uploadException(
|
||||||
|
message: '添加指纹调用接口成功',
|
||||||
|
detail: '添加指纹调用接口成功 - ',
|
||||||
|
eventStr: '添加指纹事件',
|
||||||
|
upload: true
|
||||||
|
);
|
||||||
|
}else{
|
||||||
|
updateFingerprintUserNoLoadData(entity.data!.fingerprintId.toString());
|
||||||
|
BuglyTool.uploadException(
|
||||||
|
message: '添加指纹调用接口失败',
|
||||||
|
detail: '添加指纹调用接口添加指纹调用接口失败 - ${entity.errorMsg}',
|
||||||
|
eventStr: '添加指纹事件',
|
||||||
|
upload: true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -289,7 +289,16 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
showBlueConnetctToastTimer(
|
showBlueConnetctToastTimer(
|
||||||
isShowBlueConnetctToast: false,
|
isShowBlueConnetctToast: false,
|
||||||
action: () {
|
action: () async {
|
||||||
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
|
UmengCommonSdk.onEvent('delet_lock', {
|
||||||
|
'lock_name':BlueManage().connectDeviceName,
|
||||||
|
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
|
'date':DateTool().getNowDateWithType(1),
|
||||||
|
'delet_type':'lock',
|
||||||
|
'delet_lock_result':'删除锁超时',
|
||||||
|
});
|
||||||
|
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
showDeletAlertTipDialog();
|
showDeletAlertTipDialog();
|
||||||
});
|
});
|
||||||
@ -318,6 +327,15 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
} else if (connectionState == BluetoothConnectionState.disconnected) {
|
} else if (connectionState == BluetoothConnectionState.disconnected) {
|
||||||
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
|
UmengCommonSdk.onEvent('delet_lock', {
|
||||||
|
'lock_name':BlueManage().connectDeviceName,
|
||||||
|
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
|
'date':DateTool().getNowDateWithType(1),
|
||||||
|
'delet_type':'lock',
|
||||||
|
'delet_lock_result':'删除锁断开',
|
||||||
|
});
|
||||||
|
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
if (state.ifCurrentScreen.value == true) {
|
if (state.ifCurrentScreen.value == true) {
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/pass
|
|||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||||
|
import 'package:umeng_common_sdk/umeng_common_sdk.dart';
|
||||||
|
|
||||||
import '../../../../blue/blue_manage.dart';
|
import '../../../../blue/blue_manage.dart';
|
||||||
import '../../../../blue/io_modelVendor.dart';
|
import '../../../../blue/io_modelVendor.dart';
|
||||||
@ -178,7 +179,15 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
endDate: getFailureDateTime,
|
endDate: getFailureDateTime,
|
||||||
addType: '1',
|
addType: '1',
|
||||||
pwdRight: state.isAdministrator.value == true ? 1 : 0);
|
pwdRight: state.isAdministrator.value == true ? 1 : 0);
|
||||||
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
UmengCommonSdk.onEvent('add_password', {
|
||||||
|
'lock_name':BlueManage().connectDeviceName,
|
||||||
|
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
|
'date':DateTool().getNowDateWithType(1),
|
||||||
|
'add_password_result':'成功',
|
||||||
|
});
|
||||||
|
|
||||||
state.isSendSuccess.value = true;
|
state.isSendSuccess.value = true;
|
||||||
state.sendSucceedType.value = state.widgetType.value;
|
state.sendSucceedType.value = state.widgetType.value;
|
||||||
state.pwdNameStr = state.nameController.text;
|
state.pwdNameStr = state.nameController.text;
|
||||||
@ -189,6 +198,12 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
updatePWDNumberRequest(entity.data!.keyboardPwdId.toString());
|
updatePWDNumberRequest(entity.data!.keyboardPwdId.toString());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
UmengCommonSdk.onEvent('add_password', {
|
||||||
|
'lock_name':BlueManage().connectDeviceName,
|
||||||
|
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
|
'date':DateTool().getNowDateWithType(1),
|
||||||
|
'add_password_result':'${entity.errorMsg}',
|
||||||
|
});
|
||||||
showToast('${entity.errorMsg}');
|
showToast('${entity.errorMsg}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -370,7 +385,15 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
state.sureBtnState.value = 1;
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
showBlueConnetctToastTimer(action: () {
|
showBlueConnetctToastTimer(action: () async {
|
||||||
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
|
UmengCommonSdk.onEvent('add_password', {
|
||||||
|
'lock_name':BlueManage().connectDeviceName,
|
||||||
|
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
|
'date':DateTool().getNowDateWithType(1),
|
||||||
|
'add_password_result':'添加自定义密码超时',
|
||||||
|
});
|
||||||
|
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
@ -404,8 +427,15 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
} else if (deviceConnectionState ==
|
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||||
BluetoothConnectionState.disconnected) {
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
|
UmengCommonSdk.onEvent('add_password', {
|
||||||
|
'lock_name':BlueManage().connectDeviceName,
|
||||||
|
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
|
'date':DateTool().getNowDateWithType(1),
|
||||||
|
'add_password_result':'添加自定义密码断开',
|
||||||
|
});
|
||||||
|
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
|
|||||||
@ -65,6 +65,7 @@ class BuglyTool {
|
|||||||
required String message,
|
required String message,
|
||||||
required String detail,
|
required String detail,
|
||||||
required bool upload,
|
required bool upload,
|
||||||
|
String eventStr = '开门事件',
|
||||||
bool begin = false,
|
bool begin = false,
|
||||||
Map? data,
|
Map? data,
|
||||||
}) async {
|
}) async {
|
||||||
@ -80,7 +81,7 @@ class BuglyTool {
|
|||||||
// AppLog.log('message:${(await Storage.getMobile())!.isNotEmpty ? (await Storage.getMobile()) : (await Storage.getEmail())}+$time --- 开门事件 detail:$uploadStr');
|
// AppLog.log('message:${(await Storage.getMobile())!.isNotEmpty ? (await Storage.getMobile()) : (await Storage.getEmail())}+$time --- 开门事件 detail:$uploadStr');
|
||||||
// FlutterBugly.uploadException(message: '${(await Storage.getMobile())!.isNotEmpty ? (await Storage.getMobile()) : (await Storage.getEmail())}+$time --- 开门事件', detail: uploadStr, data: data);
|
// FlutterBugly.uploadException(message: '${(await Storage.getMobile())!.isNotEmpty ? (await Storage.getMobile()) : (await Storage.getEmail())}+$time --- 开门事件', detail: uploadStr, data: data);
|
||||||
|
|
||||||
BuglyTool.uploadExceptionWithEvent(eventStr:'开门事件', detail: uploadStr);
|
BuglyTool.uploadExceptionWithEvent(eventStr:eventStr, detail: uploadStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user