1.鸿蒙手机监控不能建立连接优化
2.鸿蒙手机搜索附近的锁优化
This commit is contained in:
parent
e1c1ee0d38
commit
2ccf8cac6b
@ -1,5 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
@ -790,10 +792,31 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
// StartChartManage().lockPeerId = peerId!;
|
// StartChartManage().lockPeerId = peerId!;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// 判断是否为鸿蒙系统
|
||||||
|
Future<bool> checkIfHarmonyOS() async {
|
||||||
|
final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
final AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
|
||||||
|
// 检查是否为华为设备且系统版本包含HarmonyOS标识,例如'HUAWEI'开头或特定系统属性等。
|
||||||
|
return androidInfo.brand == 'HONOR' || androidInfo.version.sdkInt >= 30; // 注意:具体API可能需要更新以适配最新鸿蒙系统版本。
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// 发送监控消息
|
/// 发送监控消息
|
||||||
void sendMonitorMessage() async {
|
void sendMonitorMessage() async {
|
||||||
final catEyeConfig = state.keyInfos.value.lockSetting?.catEyeConfig ?? [];
|
final catEyeConfig = state.keyInfos.value.lockSetting?.catEyeConfig ?? [];
|
||||||
final network = state.keyInfos.value.network;
|
final network = state.keyInfos.value.network;
|
||||||
|
final bool cameraPermissionGranted = await PermissionDialog.request(Permission.camera);
|
||||||
|
// 鸿蒙系统
|
||||||
|
bool isHarmonyOS = await checkIfHarmonyOS();
|
||||||
|
if(isHarmonyOS){
|
||||||
|
if (!cameraPermissionGranted) {
|
||||||
|
showToast('需要相机权限才能进行监控'.tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (catEyeConfig.isNotEmpty && catEyeConfig.length > 0 && catEyeConfig[0].catEyeMode != 0) {
|
if (catEyeConfig.isNotEmpty && catEyeConfig.length > 0 && catEyeConfig[0].catEyeMode != 0) {
|
||||||
if (network == null || network?.peerId == null || network?.peerId == '') {
|
if (network == null || network?.peerId == null || network?.peerId == '') {
|
||||||
showToast('设备未配网'.tr);
|
showToast('设备未配网'.tr);
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/commonDataManage.dart';
|
import 'package:star_lock/tools/commonDataManage.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
import '../../../appRouters.dart';
|
import '../../../appRouters.dart';
|
||||||
import '../../../network/api_repository.dart';
|
import '../../../network/api_repository.dart';
|
||||||
import '../../../widget/permission/permission_dialog.dart';
|
import '../../../widget/permission/permission_dialog.dart';
|
||||||
@ -19,11 +21,28 @@ class SelectLockTypeLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断是否为鸿蒙系统
|
||||||
|
Future<bool> checkIfHarmonyOS() async {
|
||||||
|
final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
final AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
|
||||||
|
// 检查是否为华为设备且系统版本包含HarmonyOS标识,例如'HUAWEI'开头或特定系统属性等。
|
||||||
|
return androidInfo.brand == 'HONOR' || androidInfo.version.sdkInt >= 30; // 注意:具体API可能需要更新以适配最新鸿蒙系统版本。
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//跳转到附近的锁页面先判断权限
|
//跳转到附近的锁页面先判断权限
|
||||||
Future<void> getNearByLimits() async {
|
Future<void> getNearByLimits() async {
|
||||||
if (!Platform.isIOS) {
|
if (!Platform.isIOS) {
|
||||||
final bool locationRequest = await PermissionDialog.request(Permission.location);
|
final bool locationRequest = await PermissionDialog.request(Permission.location);
|
||||||
final bool bluetoothRequest = await PermissionDialog.requestBluetooth();
|
final bool bluetoothRequest = await PermissionDialog.requestBluetooth();
|
||||||
|
bool isHarmonyOS = await checkIfHarmonyOS();
|
||||||
|
// 鸿蒙系统
|
||||||
|
if(isHarmonyOS){
|
||||||
|
Get.snackbar('提示', '如您是鸿蒙系统,请下拉手动开启系统的“位置信息”,否则无法搜索到锁哦');
|
||||||
|
}
|
||||||
if (!bluetoothRequest || !locationRequest) {
|
if (!bluetoothRequest || !locationRequest) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user