From e4eaa97046deca09291bbecbd971384b9a3b362f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=B0=91=E9=98=B3?= <786612630@qq.com> Date: Mon, 21 Oct 2024 16:18:53 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=B7=BB=E5=8A=A0=E5=8D=A1=E6=8C=87?= =?UTF-8?q?=E7=BA=B9bugly=E7=BB=9F=E8=AE=A1=202=E3=80=81=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=8E=88=E6=9D=83=E7=AE=A1=E7=90=86=E5=91=98=E3=80=81=E5=8D=A1?= =?UTF-8?q?=E3=80=81=E8=AE=B0=E5=BD=95=E3=80=81=E6=8C=87=E7=BA=B9=E3=80=81?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E3=80=81=E5=88=A0=E9=99=A4=E9=94=81=E3=80=81?= =?UTF-8?q?=E5=8F=8B=E7=9B=9F=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/app/src/main/assets/umeng_config.xml | 2 +- .../kotlin/com/skychip/lock/MainActivity.kt | 2 +- lib/main.dart | 7 +- .../authorizedAdmin_logic.dart | 174 ++++++++++-------- .../card/addICCard/addICCard_logic.dart | 85 ++++++++- .../doorLockLog/doorLockLog_logic.dart | 9 +- .../addFingerprint/addFingerprint_logic.dart | 123 ++++++++++++- .../lockSet/lockSet/lockSet_logic.dart | 20 +- .../passwordKey_perpetual_logic.dart | 36 +++- lib/tools/bugly/bugly_tool.dart | 3 +- 10 files changed, 353 insertions(+), 108 deletions(-) diff --git a/android/app/src/main/assets/umeng_config.xml b/android/app/src/main/assets/umeng_config.xml index 28e1002b..1ba6cc4c 100644 --- a/android/app/src/main/assets/umeng_config.xml +++ b/android/app/src/main/assets/umeng_config.xml @@ -1,5 +1,5 @@ 671244cf80464b33f6df9648 - RD_test + Product \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/skychip/lock/MainActivity.kt b/android/app/src/main/kotlin/com/skychip/lock/MainActivity.kt index 520179ea..741b150f 100755 --- a/android/app/src/main/kotlin/com/skychip/lock/MainActivity.kt +++ b/android/app/src/main/kotlin/com/skychip/lock/MainActivity.kt @@ -20,7 +20,7 @@ class MainActivity : FlutterActivity() { GeneratedPluginRegistrant.registerWith(flutterEngine!!) // 初始化 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 -> if (call.method == "loadNativeShare") { diff --git a/lib/main.dart b/lib/main.dart index e2490742..49457cbd 100755 --- a/lib/main.dart +++ b/lib/main.dart @@ -25,10 +25,6 @@ import 'tools/store_service.dart'; // 该文件不可作为编译入口,请查看 flavorizr.yaml 中的说明 FutureOr main() async { - - UmengCommonSdk.initCommon('671244cf80464b33f6df9648', '671244ae80464b33f6df9646', 'RD_test'); - UmengCommonSdk.setPageCollectionModeManual(); - FlutterBugly.postCatchedException(() async { WidgetsFlutterBinding.ensureInitialized(); @@ -82,6 +78,9 @@ Future _setCommonServices() async { //关于隐私协议的初始化 Future privacySDKInitialization() async { + UmengCommonSdk.initCommon('671244cf80464b33f6df9648', '671244ae80464b33f6df9646', 'Product'); + UmengCommonSdk.setPageCollectionModeManual(); + await Get.putAsync(() => PlatformInfoService().init()); await BuglyTool.init(); // 初始化JPush服务 diff --git a/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart b/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart index 1719a67f..6c7d3748 100755 --- a/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart +++ b/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart @@ -12,6 +12,7 @@ import 'package:star_lock/mine/valueAddedServices/valueAddedServicesHighFunction import 'package:star_lock/tools/NativeInteractionTool.dart'; import 'package:star_lock/tools/dateTool.dart'; import 'package:star_lock/tools/showCupertinoAlertView.dart'; +import 'package:umeng_common_sdk/umeng_common_sdk.dart'; import '../../../../blue/blue_manage.dart'; import '../../../../blue/io_protocol/io_transferPermissions.dart'; @@ -33,86 +34,84 @@ class AuthorizedAdminLogic extends BaseGetXController { int? keyId; // 监听设备返回的数据 - late StreamSubscription _replySubscription; - - void _initReplySubscription() { - _replySubscription = - EventBusManager().eventBus!.on().listen((Reply reply) async { - // 转移权限 - if (reply is TransferPermissionsReply) { - final List token = reply.data.sublist(2, 6); - final List saveStrList = changeIntListToStringList(token); - Storage.setStringList(saveBlueToken, saveStrList); - - final int status = reply.data[6]; - - switch (status) { - case 0x00: - //成功 - break; - case 0x06: - //无权限 - final List? privateKey = - await Storage.getStringList(saveBluePrivateKey); - final List getPrivateKeyList = - changeStringListToIntList(privateKey!); - - final List? publicKey = - await Storage.getStringList(saveBluePublicKey); - final List publicKeyDataList = - changeStringListToIntList(publicKey!); - - final List? token = - await Storage.getStringList(saveBlueToken); - final List getTokenList = changeStringListToIntList(token!); - - IoSenderManage.senderFactoryDataReset( - lockID: BlueManage().connectDeviceName, - userID: await Storage.getUid(), - keyID: '1', - needAuthor: 1, - publicKey: publicKeyDataList, - privateKey: getPrivateKeyList, - token: getTokenList); - break; - default: - break; - } - } - }); - } + // late StreamSubscription _replySubscription; + // void _initReplySubscription() { + // _replySubscription = + // EventBusManager().eventBus!.on().listen((Reply reply) async { + // // 转移权限 + // if (reply is TransferPermissionsReply) { + // final List token = reply.data.sublist(2, 6); + // final List saveStrList = changeIntListToStringList(token); + // Storage.setStringList(saveBlueToken, saveStrList); + // + // final int status = reply.data[6]; + // switch (status) { + // case 0x00: + // //成功 + // break; + // case 0x06: + // //无权限 + // final List? privateKey = + // await Storage.getStringList(saveBluePrivateKey); + // final List getPrivateKeyList = + // changeStringListToIntList(privateKey!); + // + // final List? publicKey = + // await Storage.getStringList(saveBluePublicKey); + // final List publicKeyDataList = + // changeStringListToIntList(publicKey!); + // + // final List? token = + // await Storage.getStringList(saveBlueToken); + // final List getTokenList = changeStringListToIntList(token!); + // + // IoSenderManage.senderFactoryDataReset( + // lockID: BlueManage().connectDeviceName, + // userID: await Storage.getUid(), + // keyID: '1', + // needAuthor: 1, + // publicKey: publicKeyDataList, + // privateKey: getPrivateKeyList, + // token: getTokenList); + // break; + // default: + // break; + // } + // } + // }); + // } // 转移权限 - Future transferPermissionsAction() async { - BlueManage().blueSendData(BlueManage().connectDeviceName, - (BluetoothConnectionState state) async { - if (state == BluetoothConnectionState.connected) { - final List? privateKey = - await Storage.getStringList(saveBluePrivateKey); - final List getPrivateKeyList = - changeStringListToIntList(privateKey!); - - final List? publicKey = - await Storage.getStringList(saveBluePublicKey); - final List publicKeyDataList = - changeStringListToIntList(publicKey!); - - final List? token = await Storage.getStringList(saveBlueToken); - final List getTokenList = changeStringListToIntList(token!); - - IoSenderManage.senderTransferPermissions( - lockID: BlueManage().connectDeviceName, - authUserID: await Storage.getUid(), - keyID: '1', - oldUserID: await Storage.getUid(), - newUserID: '100002', - needAuthor: 1, - publicKey: publicKeyDataList, - privateKey: getPrivateKeyList, - token: getTokenList); - } - }); - } + // Future transferPermissionsAction() async { + // BlueManage().blueSendData(BlueManage().connectDeviceName, + // (BluetoothConnectionState state) async { + // if (state == BluetoothConnectionState.connected) { + // final List? privateKey = + // await Storage.getStringList(saveBluePrivateKey); + // final List getPrivateKeyList = + // changeStringListToIntList(privateKey!); + // + // final List? publicKey = + // await Storage.getStringList(saveBluePublicKey); + // final List publicKeyDataList = + // changeStringListToIntList(publicKey!); + // + // final List? token = await Storage.getStringList(saveBlueToken); + // final List getTokenList = changeStringListToIntList(token!); + // + // IoSenderManage.senderTransferPermissions( + // lockID: BlueManage().connectDeviceName, + // authUserID: await Storage.getUid(), + // keyID: '1', + // oldUserID: await Storage.getUid(), + // newUserID: '100002', + // needAuthor: 1, + // publicKey: publicKeyDataList, + // privateKey: getPrivateKeyList, + // token: getTokenList); + // } + // }); + // } //发送授权管理员列表请求 Future sendElectronicKeyRequest() async { @@ -222,7 +221,15 @@ class AuthorizedAdminLogic extends BaseGetXController { idCardNumber: state.isRequireAuth.value == true ? state.idCardController.text : ''); + final String getMobile = (await Storage.getMobile())!; 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.isSendSuccess.value = true; state.addUserId.value = entity.data!.receiverUser!.id.toString(); @@ -237,6 +244,13 @@ class AuthorizedAdminLogic extends BaseGetXController { state.createUser.value = 1; 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() { super.onReady(); - _initReplySubscription(); + // _initReplySubscription(); } @override void onClose() { - _replySubscription.cancel(); + // _replySubscription.cancel(); } } diff --git a/lib/main/lockDetail/card/addICCard/addICCard_logic.dart b/lib/main/lockDetail/card/addICCard/addICCard_logic.dart index 26945a8a..4f4f3475 100755 --- a/lib/main/lockDetail/card/addICCard/addICCard_logic.dart +++ b/lib/main/lockDetail/card/addICCard/addICCard_logic.dart @@ -16,6 +16,7 @@ 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/bugly/bugly_tool.dart'; import '../../../../tools/dateTool.dart'; import '../../../../tools/eventBusEventManage.dart'; import '../../../../tools/storage.dart'; @@ -42,6 +43,11 @@ class AddICCardLogic extends BaseGetXController{ Future _replyAddICCardBegin(Reply reply) async { final int status = reply.data[2]; + BuglyTool.uploadException( + message: '添加卡开始,解析数据', + detail: '添加卡开始,解析数据 _replyAddICCardBegin:${reply.data}', + upload: false + ); switch(status){ case 0x00: @@ -102,6 +108,14 @@ class AddICCardLogic extends BaseGetXController{ Future _replyAddICCardConfirmation(Reply reply) async { final int status = reply.data[2]; state.ifAddState.value = false; + + BuglyTool.uploadException( + message: '添加卡结果,解析数据', + detail: '添加卡结果,解析数据 _replyAddICCardConfirmation:${reply.data}', + eventStr: '添加卡事件', + upload: true + ); + final String getMobile = (await Storage.getMobile())!; switch(status){ case 0x00: @@ -158,22 +172,58 @@ class AddICCardLogic extends BaseGetXController{ // 添加卡片 Future senderAddICCard() async { - showBlueConnetctToastTimer(action: (){ + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? token = await Storage.getStringList(saveBlueToken); + final List 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); }); BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected){ cancelBlueConnetctToastTimer(); - final List? signKey = await Storage.getStringList(saveBlueSignKey); - final List signKeyDataList = changeStringListToIntList(signKey!); - - final List? privateKey = await Storage.getStringList(saveBluePrivateKey); - final List getPrivateKeyList = changeStringListToIntList(privateKey!); - - final List? token = await Storage.getStringList(saveBlueToken); - final List getTokenList = changeStringListToIntList(token!); - IoSenderManage.senderAddCardWithTimeCycleCoercionCommand( keyID:'1', userID:await Storage.getUid(), @@ -195,6 +245,21 @@ class AddICCardLogic extends BaseGetXController{ isBeforeAddUser: false ); } 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){ showBlueConnetctToast(); } diff --git a/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart b/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart index b3c66aa7..84ee56af 100755 --- a/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart +++ b/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart @@ -241,11 +241,11 @@ class DoorLockLogLogic extends BaseGetXController { final KeyOperationRecordEntity entity = await ApiRepository.to .lockRecordUploadData( lockId: state.keyInfos.value.lockId.toString(), records: list); + final String getMobile = (await Storage.getMobile())!; if (entity.errorCode!.codeIsSuccessful) { if (state.ifHaveNext == true) { getLockRecordLastUploadDataTime(); } else { - final String getMobile = (await Storage.getMobile())!; UmengCommonSdk.onEvent('check_doorLockLog', { 'lockName':state.keyInfos.value.lockName!, 'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!, @@ -254,6 +254,13 @@ class DoorLockLogLogic extends BaseGetXController { }); 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':'上传数据接口失败', + }); } } diff --git a/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart b/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart index 72dfe924..3e0ddb62 100755 --- a/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart +++ b/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart @@ -3,9 +3,11 @@ import 'dart:async'; import 'package:flutter_blue_plus/flutter_blue_plus.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/main/lockDetail/fingerprint/addFingerprint/addFingerprint_entity.dart'; import 'package:star_lock/tools/dateTool.dart'; +import 'package:umeng_common_sdk/umeng_common_sdk.dart'; import '../../../../../blue/blue_manage.dart'; import '../../../../../blue/io_reply.dart'; @@ -17,6 +19,7 @@ import '../../../../../tools/baseGetXController.dart'; import '../../../../../tools/eventBusEventManage.dart'; import '../../../../../tools/storage.dart'; import '../../../../blue/io_protocol/io_addFingerprintWithTimeCycleCoercion.dart'; +import '../../../../tools/bugly/bugly_tool.dart'; import 'addFingerprint_state.dart'; class AddFingerprintLogic extends BaseGetXController { @@ -44,8 +47,13 @@ class AddFingerprintLogic extends BaseGetXController { } Future _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){ case 0x00: //成功 @@ -102,8 +110,12 @@ class AddFingerprintLogic extends BaseGetXController { } Future _replyAddFingerprintProcess(Reply reply) async { + BuglyTool.uploadException( + message: '添加指纹过程,解析数据', + detail: '添加指纹过程,解析数据 _replyAddFingerprintProcess:${reply.data}', + upload: false + ); final int status = reply.data[2]; - switch(status){ case 0x00: //成功 @@ -154,13 +166,27 @@ class AddFingerprintLogic extends BaseGetXController { Future _replyAddFingerprintConfirmation(Reply reply) async { final int status = reply.data[2]; + final String getMobile = (await Storage.getMobile())!; switch(status){ case 0x00: //成功 // var fingerprintNum = listChangInt(reply.data.sublist(9, 11)).toString(); - final List fingerprintList = reply.data.sublist(reply.data.length - 2); - final String fingerprintNum = listChangInt(fingerprintList).toString(); - state.regIndex.value++; + 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: '添加指纹确认结果,解析数据 _replyAddFingerprintConfirmation:${reply.data}', + upload: false + ); + + final List fingerprintList = reply.data.sublist(reply.data.length - 2); + final String fingerprintNum = listChangInt(fingerprintList).toString(); + state.regIndex.value++; if(state.fingerprintNumber.value == fingerprintNum){ return; }else{ @@ -177,6 +203,19 @@ class AddFingerprintLogic extends BaseGetXController { break; 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; break; } @@ -184,7 +223,50 @@ class AddFingerprintLogic extends BaseGetXController { // 添加指纹开始 Future senderAddFingerprint() async { - showBlueConnetctToastTimer(action: (){ + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + final List? token = await Storage.getStringList(saveBlueToken); + final List 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); }); BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { @@ -219,6 +301,21 @@ class AddFingerprintLogic extends BaseGetXController { isBeforeAddUser: false ); }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){ showBlueConnetctToast(); } @@ -277,6 +374,20 @@ class AddFingerprintLogic extends BaseGetXController { ); if(entity.errorCode!.codeIsSuccessful){ 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 + ); } } diff --git a/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart b/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart index 3ccbe408..0198879c 100755 --- a/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart +++ b/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart @@ -289,7 +289,16 @@ class LockSetLogic extends BaseGetXController { showEasyLoading(); showBlueConnetctToastTimer( 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(); showDeletAlertTipDialog(); }); @@ -318,6 +327,15 @@ class LockSetLogic extends BaseGetXController { privateKey: getPrivateKeyList, token: getTokenList); } 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(); cancelBlueConnetctToastTimer(); if (state.ifCurrentScreen.value == true) { diff --git a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart index 4b1357b2..a54021a0 100755 --- a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart +++ b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart @@ -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/network/api_repository.dart'; import 'package:star_lock/tools/eventBusEventManage.dart'; +import 'package:umeng_common_sdk/umeng_common_sdk.dart'; import '../../../../blue/blue_manage.dart'; import '../../../../blue/io_modelVendor.dart'; @@ -178,7 +179,15 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { endDate: getFailureDateTime, addType: '1', pwdRight: state.isAdministrator.value == true ? 1 : 0); + final String getMobile = (await Storage.getMobile())!; 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.sendSucceedType.value = state.widgetType.value; state.pwdNameStr = state.nameController.text; @@ -189,6 +198,12 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { updatePWDNumberRequest(entity.data!.keyboardPwdId.toString()); } } 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}'); } } @@ -370,7 +385,15 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { state.sureBtnState.value = 1; 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(); state.sureBtnState.value = 0; }); @@ -404,8 +427,15 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { signKey: signKeyDataList, privateKey: getPrivateKeyList, token: getTokenList); - } else if (deviceConnectionState == - BluetoothConnectionState.disconnected) { + } else if (deviceConnectionState == 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(); cancelBlueConnetctToastTimer(); state.sureBtnState.value = 0; diff --git a/lib/tools/bugly/bugly_tool.dart b/lib/tools/bugly/bugly_tool.dart index 57f06c33..89d0ab94 100644 --- a/lib/tools/bugly/bugly_tool.dart +++ b/lib/tools/bugly/bugly_tool.dart @@ -65,6 +65,7 @@ class BuglyTool { required String message, required String detail, required bool upload, + String eventStr = '开门事件', bool begin = false, Map? data, }) async { @@ -80,7 +81,7 @@ class BuglyTool { // 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); - BuglyTool.uploadExceptionWithEvent(eventStr:'开门事件', detail: uploadStr); + BuglyTool.uploadExceptionWithEvent(eventStr:eventStr, detail: uploadStr); } }