1、添加卡指纹bugly统计

2、添加授权管理员、卡、记录、指纹、密码、删除锁、友盟统计
This commit is contained in:
魏少阳 2024-10-21 16:18:53 +08:00
parent fc18ca5614
commit e4eaa97046
10 changed files with 353 additions and 108 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<umeng_config>
<appkey>671244cf80464b33f6df9648</appkey>
<channel>RD_test</channel>
<channel>Product</channel>
</umeng_config>

View File

@ -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") {

View File

@ -25,10 +25,6 @@ import 'tools/store_service.dart';
// flavorizr.yaml
FutureOr<void> main() async {
UmengCommonSdk.initCommon('671244cf80464b33f6df9648', '671244ae80464b33f6df9646', 'RD_test');
UmengCommonSdk.setPageCollectionModeManual();
FlutterBugly.postCatchedException(() async {
WidgetsFlutterBinding.ensureInitialized();
@ -82,6 +78,9 @@ Future<void> _setCommonServices() async {
//
Future<void> privacySDKInitialization() async {
UmengCommonSdk.initCommon('671244cf80464b33f6df9648', '671244ae80464b33f6df9646', 'Product');
UmengCommonSdk.setPageCollectionModeManual();
await Get.putAsync(() => PlatformInfoService().init());
await BuglyTool.init();
// JPush服务

View File

@ -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<Reply> _replySubscription;
void _initReplySubscription() {
_replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
//
if (reply is TransferPermissionsReply) {
final List<int> token = reply.data.sublist(2, 6);
final List<String> saveStrList = changeIntListToStringList(token);
Storage.setStringList(saveBlueToken, saveStrList);
final int status = reply.data[6];
switch (status) {
case 0x00:
//
break;
case 0x06:
//
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
final List<String>? publicKey =
await Storage.getStringList(saveBluePublicKey);
final List<int> publicKeyDataList =
changeStringListToIntList(publicKey!);
final List<String>? token =
await Storage.getStringList(saveBlueToken);
final List<int> 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<Reply> _replySubscription;
// void _initReplySubscription() {
// _replySubscription =
// EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
// //
// if (reply is TransferPermissionsReply) {
// final List<int> token = reply.data.sublist(2, 6);
// final List<String> saveStrList = changeIntListToStringList(token);
// Storage.setStringList(saveBlueToken, saveStrList);
//
// final int status = reply.data[6];
// switch (status) {
// case 0x00:
// //
// break;
// case 0x06:
// //
// final List<String>? privateKey =
// await Storage.getStringList(saveBluePrivateKey);
// final List<int> getPrivateKeyList =
// changeStringListToIntList(privateKey!);
//
// final List<String>? publicKey =
// await Storage.getStringList(saveBluePublicKey);
// final List<int> publicKeyDataList =
// changeStringListToIntList(publicKey!);
//
// final List<String>? token =
// await Storage.getStringList(saveBlueToken);
// final List<int> 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<void> transferPermissionsAction() async {
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState state) async {
if (state == BluetoothConnectionState.connected) {
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
final List<String>? publicKey =
await Storage.getStringList(saveBluePublicKey);
final List<int> publicKeyDataList =
changeStringListToIntList(publicKey!);
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> 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<void> transferPermissionsAction() async {
// BlueManage().blueSendData(BlueManage().connectDeviceName,
// (BluetoothConnectionState state) async {
// if (state == BluetoothConnectionState.connected) {
// final List<String>? privateKey =
// await Storage.getStringList(saveBluePrivateKey);
// final List<int> getPrivateKeyList =
// changeStringListToIntList(privateKey!);
//
// final List<String>? publicKey =
// await Storage.getStringList(saveBluePublicKey);
// final List<int> publicKeyDataList =
// changeStringListToIntList(publicKey!);
//
// final List<String>? token = await Storage.getStringList(saveBlueToken);
// final List<int> 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<void> 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();
}
}

View File

@ -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<void> _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<void> _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<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);
});
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected){
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(
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();
}

View File

@ -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':'上传数据接口失败',
});
}
}

View File

@ -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<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){
case 0x00:
//
@ -102,8 +110,12 @@ class AddFingerprintLogic extends BaseGetXController {
}
Future<void> _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<void> _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<int> 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<int> 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<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);
});
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
);
}
}

View File

@ -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) {

View File

@ -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;

View File

@ -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);
}
}