1、优化bugly数据上报到一条数据上
2、添加蓝牙权限、定位权限数据上报
This commit is contained in:
parent
9336e83434
commit
ebc9b677ab
BIN
ios/.DS_Store
vendored
BIN
ios/.DS_Store
vendored
Binary file not shown.
@ -149,8 +149,10 @@ class BlueManage {
|
||||
if (_adapterState == BluetoothAdapterState.on) {
|
||||
try {
|
||||
BuglyTool.uploadException(
|
||||
message: 'startScanSingle:$deviceName',
|
||||
detail: 'startScanSingle$deviceName 开始指定设备名称的扫描蓝牙设备');
|
||||
message: '开始指定设备名称的扫描蓝牙设备',
|
||||
detail: '调用方法是:startScanSingle 指定设备名称是:$deviceName',
|
||||
upload: false
|
||||
);
|
||||
//android 扫描比较慢,取样只要 3 分之一
|
||||
final int divisor = Platform.isAndroid ? 3 : 1;
|
||||
FlutterBluePlus.startScan(
|
||||
@ -169,8 +171,10 @@ class BlueManage {
|
||||
AppLog.log(
|
||||
'扫描到的设备数:${results.length} 是否查找到 $isExit 以查找$milliseconds毫秒');
|
||||
BuglyTool.uploadException(
|
||||
message: 'startScanSingle:$deviceName',
|
||||
detail: 'startScanSingle$deviceName 监听扫描结果 扫描到的设备数:${results.length} 是否查找到 $isExit 以查找$milliseconds毫秒');
|
||||
message: '指定设备名称的扫描蓝牙设备 监听扫描结果',
|
||||
detail: 'startScanSingle$deviceName 监听扫描结果 是否查找到 $isExit 以查找$milliseconds毫秒 扫描到的设备数:${results.length} results:$results',
|
||||
upload: false
|
||||
);
|
||||
if (isExit) {
|
||||
for (final ScanResult scanResult in results) {
|
||||
if (((scanResult.advertisementData.serviceUuids.isNotEmpty
|
||||
@ -193,8 +197,10 @@ class BlueManage {
|
||||
scanDevices.add(scanResult);
|
||||
}
|
||||
BuglyTool.uploadException(
|
||||
message: 'startScanSingle:$deviceName',
|
||||
detail: 'startScanSingle$deviceName 查询到的结果scanResult:$scanResult');
|
||||
message: '遍历扫描到的结果跟缓存的结果对比,如果有最新的就更新缓存',
|
||||
detail: 'startScanSingle deviceName:$deviceName 查询到的结果scanResult:$scanResult',
|
||||
upload: false
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -202,9 +208,11 @@ class BlueManage {
|
||||
}
|
||||
}, onError: (e) {
|
||||
BuglyTool.uploadException(
|
||||
message: 'startScanSingle:$deviceName',
|
||||
detail: 'startScanSingle$deviceName 监听扫描结果失败 e:${e.toString()}');
|
||||
AppLog.log('扫描失败:$e',);
|
||||
message: '指定设备名称的扫描蓝牙设备 监听扫描结果失败',
|
||||
detail: '打印失败问题 e:${e.toString()}',
|
||||
upload: false
|
||||
);
|
||||
AppLog.log('扫描失败:$e',);
|
||||
});
|
||||
FlutterBluePlus.cancelWhenScanComplete(subscription);
|
||||
await completer.future;
|
||||
@ -212,8 +220,10 @@ class BlueManage {
|
||||
subscription.cancel();
|
||||
} catch (e) {
|
||||
BuglyTool.uploadException(
|
||||
message: 'startScanSingle:$deviceName',
|
||||
detail: 'startScanSingle$deviceName startScanSingle内部逻辑整形失败 e:${e.toString()}');
|
||||
message: '指定设备名称的扫描蓝牙设备 内部逻辑整形失败',
|
||||
detail: 'tartScanSingle内部逻辑整形失败 e:${e.toString()}',
|
||||
upload: false
|
||||
);
|
||||
AppLog.log('扫描失败');
|
||||
}
|
||||
} else {
|
||||
@ -300,36 +310,46 @@ class BlueManage {
|
||||
// 蓝牙已开启,可以进行蓝牙操作
|
||||
if (bluetoothConnectionState != BluetoothConnectionState.connected) {
|
||||
BuglyTool.uploadException(
|
||||
message: 'blueSendData 蓝牙未连接',
|
||||
detail: 'blueSendData 蓝牙未连接}');
|
||||
message: '点击按钮 蓝牙未连接 下一步扫描连接蓝牙',
|
||||
detail: 'blueSendData 蓝牙连接状态 bluetoothConnectionState:$bluetoothConnectionState deviceName:$deviceName',
|
||||
upload: false
|
||||
);
|
||||
_connect(deviceName, (BluetoothConnectionState state) {
|
||||
stateCallBack(bluetoothConnectionState!);
|
||||
}, isAddEquipment: isAddEquipment);
|
||||
} else {
|
||||
BuglyTool.uploadException(
|
||||
message: 'blueSendData 蓝牙是连接状态',
|
||||
detail: 'blueSendData 蓝牙是连接状态,直接回调}');
|
||||
message: '点击按钮 蓝牙已经连接 下一步扫描连接蓝牙',
|
||||
detail: 'blueSendData 直接回调状态 蓝牙连接状态bluetoothConnectionState:$bluetoothConnectionState deviceName:$deviceName',
|
||||
upload: false
|
||||
);
|
||||
stateCallBack(bluetoothConnectionState!);
|
||||
}
|
||||
} else {
|
||||
BuglyTool.uploadException(
|
||||
message: 'blueSendData 蓝牙未打开',
|
||||
detail: 'blueSendData 蓝牙未打开--_adapterState:${BluetoothAdapterState.on}');
|
||||
message: '点击按钮 蓝牙未打开',
|
||||
detail: 'blueSendData 蓝牙未打开--_adapterState:${BluetoothAdapterState.on} deviceName:$deviceName',
|
||||
upload: false
|
||||
);
|
||||
try {
|
||||
stateCallBack(BluetoothConnectionState.disconnected);
|
||||
openBlue();
|
||||
} catch (e) {
|
||||
AppLog.log('蓝牙打开失败');
|
||||
BuglyTool.uploadException(
|
||||
message: 'blueSendData 蓝牙打开失败',
|
||||
detail: 'blueSendData 蓝牙打开失败--_adapterState:${BluetoothAdapterState.on}');
|
||||
message: '点击按钮 蓝牙未打开 然后蓝牙打开失败',
|
||||
detail: 'blueSendData 蓝牙打开失败--_adapterState:${BluetoothAdapterState.on} deviceName:$deviceName',
|
||||
upload: false
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
BuglyTool.uploadException(
|
||||
message: 'blueSendData isAvailable状态',
|
||||
detail: 'blueSendData isAvailable不可用--isAvailable:$isAvailable');
|
||||
// FlutterBuglyPlugin.reportException(exceptionName: 'blueSendData isAvailable状态', reason: 'blueSendData isAvailable不可用');
|
||||
message: '点击按钮 蓝牙状态不可用',
|
||||
detail: 'blueSendData 蓝牙状态不可用--isAvailable:$isAvailable',
|
||||
upload: false
|
||||
);
|
||||
stateCallBack(BluetoothConnectionState.disconnected);
|
||||
AppLog.log('开始扫描 蓝牙不可用,不能进行蓝牙操作');
|
||||
}
|
||||
});
|
||||
@ -353,8 +373,10 @@ class BlueManage {
|
||||
if (GetPlatform.isAndroid && !isExistDevice && isCurrentDevice && mac != null) {
|
||||
// 当是安卓设备 且不存在缓存设备 且是当前设备 且mac地址不为空
|
||||
BuglyTool.uploadException(
|
||||
message: '_connect:$deviceName',
|
||||
detail: '_connect:$deviceName GetPlatform.isAndroid:${GetPlatform.isAndroid} isExistDevice:$isExistDevice mac:$mac');
|
||||
message: '开始连接 当是安卓设备 且不存在缓存设备 且是当前设备 且mac地址不为空 上传记录当前方法是:_connect',
|
||||
detail: '调用方法_connect deviceName:$deviceName GetPlatform.isAndroid:${GetPlatform.isAndroid} isExistDevice:$isExistDevice mac:$mac',
|
||||
upload: false
|
||||
);
|
||||
scanSingleTimer?.cancel();
|
||||
// 兼容android 的低配手机
|
||||
await doNotSearchBLE(mac, connectStateCallBack, isAddEquipment: isAddEquipment);
|
||||
@ -362,15 +384,19 @@ class BlueManage {
|
||||
scanSingleTimer = Timer(3.seconds, () {
|
||||
scanSingleTimer?.cancel();
|
||||
BuglyTool.uploadException(
|
||||
message: '_connect:$deviceName',
|
||||
detail: '_connect$deviceName scanSingleTimer 调用 startScanSingle');
|
||||
message: '开始连接 当是安卓设备 且不存在缓存设备 且是当前设备 且mac地址不为空 3秒以后调用startScanSingle 上传记录当前方法是:_connect',
|
||||
detail: '_connect deviceName:$deviceName scanSingleTimer调用startScanSingle',
|
||||
upload: false
|
||||
);
|
||||
startScanSingle(deviceName, 15, (List<ScanResult> scanDevices) => null);
|
||||
});
|
||||
} else if (isAddEquipment == false && isExistDevice == false) {
|
||||
//取消缓存直接使用,存在配对场景设备信息会更变
|
||||
// 取消缓存直接使用,存在配对场景设备信息会更变
|
||||
BuglyTool.uploadException(
|
||||
message: '_connect:$deviceName',
|
||||
detail: '_connect$deviceName isAddEquipment:$isAddEquipment isExistDevice:$isExistDevice 下一步调用startScanSingle');
|
||||
message: '取消缓存直接使用,存在配对场景设备信息会更变 然后开始指定设备名称的扫描蓝牙设备 上传记录当前方法是:_connect',
|
||||
detail: '符合条件(isAddEquipment == false && isExistDevice == false) 下一步调用startScanSingle',
|
||||
upload: false
|
||||
);
|
||||
|
||||
// AppLog.log('无存在设备需要扫描 deviceName:$deviceName isAddEquipment:$isAddEquipment');
|
||||
startScanSingle(deviceName, 15, (List<ScanResult> scanDevices) {
|
||||
@ -379,8 +405,10 @@ class BlueManage {
|
||||
});
|
||||
} else {
|
||||
BuglyTool.uploadException(
|
||||
message: '_connect:$deviceName',
|
||||
detail: '_connect$deviceName 直接调用_connectDevice');
|
||||
message: '没有扫描直接调用连接设备 上传记录当前方法是:_connect',
|
||||
detail: '走这个方法是有缓存或者添加设备的时候以及不符合(GetPlatform.isAndroid && !isExistDevice && isCurrentDevice && mac != null) deviceName:$deviceName 直接调用_connectDevice',
|
||||
upload: false
|
||||
);
|
||||
// AppLog.log('安卓或者iOS 存在设备不需要扫描 deviceName:$deviceName isAddEquipment:$isAddEquipment');
|
||||
_connectDevice(devicesList, deviceName, connectStateCallBack,
|
||||
isAddEquipment: isAddEquipment);
|
||||
@ -425,25 +453,25 @@ class BlueManage {
|
||||
}
|
||||
if (scanResult == null || connectDeviceMacAddress.isEmpty) {
|
||||
BuglyTool.uploadException(
|
||||
message: '_connectDevice:$deviceName',
|
||||
detail: '_connectDevice$deviceName scanResult:$scanResult connectDeviceMacAddress:$connectDeviceMacAddress scanResult == null || connectDeviceMacAddress.isEmpty不往下执行');
|
||||
message: '扫描结果scanResult == null || connectDeviceMacAddress.isEmpty不往下执行 return 上传记录当前方法是:_connectDevice',
|
||||
detail: 'scanResult:$scanResult connectDeviceMacAddress:$connectDeviceMacAddress',
|
||||
upload: false
|
||||
);
|
||||
return;
|
||||
}
|
||||
AppLog.log('调用了停止扫描的方法');
|
||||
await stopScan();
|
||||
BuglyTool.uploadException(
|
||||
message: '_connectDevice:$deviceName',
|
||||
detail: '_connectDevice$deviceName devicesList:$devicesList isReconnect:$isReconnect knownDeviceIndex:$knownDeviceIndex 调用了停止扫描方法');
|
||||
|
||||
if ((scanResult.advertisementData.serviceUuids[0].toString()[31] == '0') &&
|
||||
isAddEquipment == false) {
|
||||
if ((scanResult.advertisementData.serviceUuids[0].toString()[31] == '0') && isAddEquipment == false) {
|
||||
// 添加这个判断是因为有些苹果设备或者安卓等性能比较好的设备时,添加完锁之后,锁板未改变为已添加状态之前,就进行了蓝牙连接,导致添加完锁就失败,这里进行了判断,如果第一次连接失败,就清除缓存重新扫描连接
|
||||
if (isReconnect == true) {
|
||||
AppLog.log('该锁已被重置, 重新发送扫描命令');
|
||||
|
||||
BuglyTool.uploadException(
|
||||
message: '_connectDevice:$deviceName',
|
||||
detail: '_connectDevice$deviceName 该锁已被重置, 重新发送扫描命令 serviceUuids:${scanResult.advertisementData.serviceUuids[0].toString()}');
|
||||
message: '该锁已被重置, 重新发送扫描命令startScanSingle 上传记录当前方法是:_connectDevice',
|
||||
detail: '添加这个判断是因为有些苹果设备或者安卓等性能比较好的设备时,添加完锁之后,锁板未改变为已添加状态之前,就进行了蓝牙连接,导致添加完锁就失败,这里进行了判断,如果第一次连接失败,就清除缓存重新扫描连接 该锁已被重置, 重新发送扫描命令 serviceUuids:${scanResult.advertisementData.serviceUuids[0].toString()}',
|
||||
upload: false
|
||||
);
|
||||
|
||||
scanDevices.clear();
|
||||
startScanSingle(deviceName, 15, (List<ScanResult> scanDevices) {
|
||||
@ -454,10 +482,23 @@ class BlueManage {
|
||||
connectStateCallBack(BluetoothConnectionState.disconnected);
|
||||
EasyLoading.showToast('该锁已被重置'.tr, duration: 2000.milliseconds);
|
||||
scanDevices.clear();
|
||||
|
||||
BuglyTool.uploadException(
|
||||
message: '提示该锁已被重置, 回调断开连接, 清除缓存,上传记录当前方法是:_connectDevice',
|
||||
detail: 'isReconnect:$isReconnect serviceUuids:${scanResult.advertisementData.serviceUuids[0].toString()}',
|
||||
upload: false
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
//尝试连接设备
|
||||
|
||||
BuglyTool.uploadException(
|
||||
message: '从devicesList里面查到了设备 下一步连接设备 上传记录当前方法是:_connectDevice',
|
||||
detail: 'devicesList:$devicesList scanResult:${scanResult.toString()} bluetoothConnectDevice:${bluetoothConnectDevice.toString()} connectDeviceMacAddress:$connectDeviceMacAddress',
|
||||
upload: false
|
||||
);
|
||||
|
||||
//连接设备
|
||||
await bluetoothDeviceConnect(bluetoothConnectDevice!, connectStateCallBack);
|
||||
}
|
||||
|
||||
@ -465,19 +506,24 @@ class BlueManage {
|
||||
Future<void> doNotSearchBLE(
|
||||
String masAdds, ConnectStateCallBack connectStateCallBack,
|
||||
{bool isAddEquipment = false}) async {
|
||||
BuglyTool.uploadException(
|
||||
message: 'doNotSearchBLE:$masAdds',
|
||||
detail: 'doNotSearchBLE$masAdds 调用doNotSearchBLE');
|
||||
await FlutterBluePlus.stopScan();
|
||||
|
||||
if (bluetoothConnectDevice == null ||
|
||||
bluetoothConnectDevice?.remoteId.str != masAdds) {
|
||||
bluetoothConnectDevice = BluetoothDevice.fromId(masAdds);
|
||||
_initGetMtuSubscription();
|
||||
_initListenConnectionState();
|
||||
BuglyTool.uploadException(
|
||||
message: '直接给蓝牙设备写入 上传记录当前方法是:doNotSearchBLE',
|
||||
detail: '直接给蓝牙设备写入 通过fromId方法创建一个BluetoothDevice masAdds:$masAdds',
|
||||
upload: false
|
||||
);
|
||||
}else{
|
||||
BuglyTool.uploadException(
|
||||
message: 'doNotSearchBLE:$masAdds',
|
||||
detail: 'doNotSearchBLE$masAdds 未调用_initGetMtuSubscription()、_initListenConnectionState()');
|
||||
message: '直接给蓝牙设备写入 上传记录当前方法是:doNotSearchBLE',
|
||||
detail: '直接给蓝牙设备写入 用传入的bluetoothConnectDevice:${bluetoothConnectDevice.toString()}连接 masAdds:$masAdds',
|
||||
upload: false
|
||||
);
|
||||
}
|
||||
//尝试连接设备
|
||||
await bluetoothDeviceConnect(bluetoothConnectDevice!, connectStateCallBack,
|
||||
@ -507,8 +553,10 @@ class BlueManage {
|
||||
if (attempt >= maxAttempts) {
|
||||
AppLog.log('$maxAttempts次后尝试连接失败');
|
||||
BuglyTool.uploadException(
|
||||
message: 'bluetoothDeviceConnect:${bluetoothConnectDevice.toString()}',
|
||||
detail: 'bluetoothDeviceConnect:${bluetoothConnectDevice.toString()} $maxAttempts次后尝试连接失败');
|
||||
message: '连接三次超时断开连接 回调断开连接 上传记录当前方法是:bluetoothDeviceConnect',
|
||||
detail: 'bluetoothDeviceConnect:${bluetoothConnectDevice.toString()} $maxAttempts次后尝试连接失败',
|
||||
upload: false
|
||||
);
|
||||
connectStateCallBack(BluetoothConnectionState.disconnected);
|
||||
}
|
||||
|
||||
@ -524,18 +572,24 @@ class BlueManage {
|
||||
bluetoothConnectionState = BluetoothConnectionState.connected;
|
||||
connectStateCallBack(bluetoothConnectionState!);
|
||||
BuglyTool.uploadException(
|
||||
message: 'bluetoothDeviceConnect:${bluetoothConnectDevice.toString()}',
|
||||
detail: 'bluetoothDeviceConnect:${bluetoothConnectDevice.toString()} 发现服务,连接成功,订阅数据');
|
||||
message: '订阅成功 上传记录当前方法是:bluetoothDeviceConnect',
|
||||
detail: '发现服务,连接成功,订阅数据 bluetoothDeviceConnect:${bluetoothConnectDevice.toString()} ',
|
||||
upload: false
|
||||
);
|
||||
} else{
|
||||
BuglyTool.uploadException(
|
||||
message: 'bluetoothDeviceConnect:${bluetoothConnectDevice.toString()}',
|
||||
detail: 'bluetoothDeviceConnect:${bluetoothConnectDevice.toString()} characteristic.characteristicUuid != _characteristicIdSubscription 失败');
|
||||
message: '订阅失败 上传记录当前方法是:bluetoothDeviceConnect',
|
||||
detail: '失败原因: characteristic.characteristicUuid:${characteristic.characteristicUuid} != _characteristicIdSubscription:$_characteristicIdSubscription bluetoothDeviceConnect:${bluetoothConnectDevice.toString()}',
|
||||
upload: false
|
||||
);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
BuglyTool.uploadException(
|
||||
message: 'bluetoothDeviceConnect:${bluetoothConnectDevice.toString()}',
|
||||
detail: 'bluetoothDeviceConnect:${bluetoothConnectDevice.toString()} service.uuid != _serviceIdConnec 失败');
|
||||
message: '订阅失败 上传记录当前方法是:bluetoothDeviceConnect',
|
||||
detail: '失败原因: service.uuid:${service.uuid} != _serviceIdConnect:$_serviceIdConnect bluetoothDeviceConnect:${bluetoothConnectDevice.toString()}',
|
||||
upload: false
|
||||
);
|
||||
}
|
||||
}
|
||||
} on Exception catch (e) {
|
||||
@ -544,8 +598,10 @@ class BlueManage {
|
||||
AppLog.log(
|
||||
'发现设备时失败 e:$e bluetoothConnectionState:$bluetoothConnectionState');
|
||||
BuglyTool.uploadException(
|
||||
message: 'bluetoothDeviceConnect:${bluetoothConnectDevice.toString()}',
|
||||
detail: 'bluetoothDeviceConnect:${bluetoothConnectDevice.toString()} 发现服务时报错 e:$e');
|
||||
message: '发现服务时失败',
|
||||
detail: '发现服务时报错原因e:$e bluetoothDeviceConnect:${bluetoothConnectDevice.toString()}',
|
||||
upload: false
|
||||
);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,7 +61,11 @@ class LockDetailLogic extends BaseGetXController {
|
||||
Future<void> _replyOpenLock(Reply reply) async {
|
||||
final int status = reply.data[6];
|
||||
|
||||
BuglyTool.uploadException(message: '_replyOpenLock', detail: '_replyOpenLock:${reply.data}');
|
||||
BuglyTool.uploadException(
|
||||
message: '开锁结果,解析数据',
|
||||
detail: '开锁结果,解析数据 _replyOpenLock:${reply.data}',
|
||||
upload: true
|
||||
);
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
@ -357,15 +361,22 @@ class LockDetailLogic extends BaseGetXController {
|
||||
showBlueConnetctToastTimer(
|
||||
outTimer: 20,
|
||||
action: () {
|
||||
// FlutterBuglyPlugin.reportException(exceptionName: '开门超时处理', reason: '开门超时,断开连接');
|
||||
BuglyTool.uploadException(message: '开门超时处理', detail: '开门超时,断开连接--$command');
|
||||
resetOpenDoorState();
|
||||
blueManageDisconnect();
|
||||
BuglyTool.uploadException(
|
||||
message: '开门超时处理-开锁失败',
|
||||
detail: '开门超时,断开连接,开锁失败--OpenLockCommand:$command',
|
||||
upload: true
|
||||
);
|
||||
});
|
||||
|
||||
BlueManage().blueSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||
BuglyTool.uploadException(message: '蓝牙连接成功', detail: '蓝牙连接成功,发送开锁指令--$command');
|
||||
BuglyTool.uploadException(
|
||||
message: '蓝牙连接成功',
|
||||
detail: '蓝牙连接成功,发送开锁指令--OpenLockCommand:$command',
|
||||
upload: false
|
||||
);
|
||||
// FlutterBuglyPlugin.reportException(exceptionName: '蓝牙连接成功', reason: '蓝牙连接成功,发送开锁指令');
|
||||
IoSenderManage.senderOpenLock(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
@ -380,7 +391,11 @@ class LockDetailLogic extends BaseGetXController {
|
||||
);
|
||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||
cancelBlueConnetctToastTimer();
|
||||
BuglyTool.uploadException(message: '蓝牙连接失败', detail: '蓝牙连接失败,断开连接--$command');
|
||||
BuglyTool.uploadException(
|
||||
message: '蓝牙连接失败-开锁失败',
|
||||
detail: '蓝牙连接失败,断开连接, 开锁失败--OpenLockCommand:$command',
|
||||
upload: true
|
||||
);
|
||||
if (state.ifCurrentScreen.value == true) {
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
@ -467,8 +482,10 @@ class LockDetailLogic extends BaseGetXController {
|
||||
openDoorAction();
|
||||
} else {
|
||||
BuglyTool.uploadException(
|
||||
message: '点击了需要联网开锁 2',
|
||||
detail: '点击了需要联网开锁 获取连网token失败');
|
||||
message: '点击了需要联网开锁',
|
||||
detail: '点击了需要联网开锁 获取连网token失败',
|
||||
upload: true
|
||||
);
|
||||
showToast('网络访问失败,请检查网络是否正常'.tr, something: () {
|
||||
resetOpenDoorState();
|
||||
cancelBlueConnetctToastTimer();
|
||||
|
||||
@ -1440,7 +1440,10 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
// FlutterBuglyPlugin.reportException(exceptionName: '点击了不需要联网开锁');
|
||||
BuglyTool.uploadException(
|
||||
message: '点击了不需要联网开锁',
|
||||
detail: '点击了不需要联网开锁 openDoorModel:${state.openDoorModel}');
|
||||
detail: '点击了不需要联网开锁 openDoorModel:${state.openDoorModel}',
|
||||
upload: false,
|
||||
begin:true
|
||||
);
|
||||
AppLog.log('点击开锁 state.openDoorModel = 0 不需要联网');
|
||||
logic.openDoorAction();
|
||||
} else {
|
||||
@ -1449,7 +1452,10 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
// FlutterBuglyPlugin.reportException(exceptionName: '点击了需要联网开锁');
|
||||
BuglyTool.uploadException(
|
||||
message: '点击了需要联网开锁',
|
||||
detail: '点击了需要联网开锁 openDoorModel:${state.openDoorModel}');
|
||||
detail: '点击了需要联网开锁 openDoorModel:${state.openDoorModel}',
|
||||
upload: false,
|
||||
begin:true
|
||||
);
|
||||
AppLog.log('点击开锁 state.openDoorModel = 2 需要联网');
|
||||
logic.getLockNetToken();
|
||||
}
|
||||
|
||||
@ -60,11 +60,35 @@ class BuglyTool {
|
||||
FlutterBugly.setUserId(userId?.toString() ?? '');
|
||||
}
|
||||
|
||||
static String uploadStr = '';
|
||||
static Future<void> uploadException({
|
||||
required String message,
|
||||
required String detail,
|
||||
required bool upload,
|
||||
bool begin = false,
|
||||
Map? data,
|
||||
}) async {
|
||||
FlutterBugly.uploadException(message: '${(await Storage.getMobile())!.isNotEmpty ? (await Storage.getMobile()) : (await Storage.getEmail())}+$time ---' + message, detail: detail, data: data);
|
||||
String getMessage = '${(await Storage.getMobile())!.isNotEmpty ? (await Storage.getMobile()) : (await Storage.getEmail())}+$time --- message:$message detail:$detail';
|
||||
if(begin == true){
|
||||
// 开始
|
||||
uploadStr = '';
|
||||
}else{
|
||||
uploadStr = '$uploadStr \n<----------->\n $getMessage';
|
||||
}
|
||||
|
||||
if(upload){
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static Future<void> uploadExceptionWithEvent({
|
||||
required String eventStr,
|
||||
required String detail,
|
||||
}) async {
|
||||
FlutterBugly.uploadException(message: '${(await Storage.getMobile())!.isNotEmpty ? (await Storage.getMobile()) : (await Storage.getEmail())}+${time == 0 ? DateTime.now().millisecondsSinceEpoch : 0}--- $eventStr', detail: detail);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,8 @@ import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
import '../../tools/bugly/bugly_tool.dart';
|
||||
|
||||
class PermissionDialog {
|
||||
static Map<Permission, String> titles = <Permission, String>{
|
||||
Permission.camera: '相机'.tr,
|
||||
@ -66,12 +68,14 @@ class PermissionDialog {
|
||||
CupertinoDialogAction(
|
||||
child: Text('不允许'.tr),
|
||||
onPressed: () {
|
||||
BuglyTool.uploadExceptionWithEvent(eventStr: '${'申请'.tr}${titles[permission] ?? ''}${'权限'.tr}', detail: "不允许'${'申请'.tr}${titles[permission] ?? ''}${'权限'.tr} titles:$titles'");
|
||||
Get.back(result: false);
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text('允许'.tr),
|
||||
onPressed: () {
|
||||
BuglyTool.uploadExceptionWithEvent(eventStr: '${'申请'.tr}${titles[permission] ?? ''}${'权限'.tr}', detail: "不允许'${'申请'.tr}${titles[permission] ?? ''}${'权限'.tr} titles:$titles'");
|
||||
Get.back(result: true);
|
||||
},
|
||||
),
|
||||
@ -302,12 +306,14 @@ class PermissionDialog {
|
||||
CupertinoDialogAction(
|
||||
child: Text('不允许'.tr),
|
||||
onPressed: () {
|
||||
BuglyTool.uploadExceptionWithEvent(eventStr: '${'申请'.tr}${titles[permission] ?? ''}${'权限'.tr}', detail: "不允许'${'申请'.tr}${titles[permission] ?? ''}${'权限'.tr} titles:$titles'");
|
||||
Get.back(result: false);
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text('允许'.tr),
|
||||
onPressed: () {
|
||||
BuglyTool.uploadExceptionWithEvent(eventStr: '${'申请'.tr}${titles[permission] ?? ''}${'权限'.tr}', detail: "允许'${'申请'.tr}${titles[permission] ?? ''}${'权限'.tr} titles:$titles'");
|
||||
Get.back(result: true);
|
||||
},
|
||||
),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user