更新ios蓝牙权限

This commit is contained in:
wyf
2025-08-21 11:30:20 +08:00
parent 4fba3eb3a4
commit 5cb59bb5be
6 changed files with 164 additions and 127 deletions

View File

@@ -1,5 +1,6 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
import 'package:easydevice/easydevice.dart';
@@ -63,7 +64,7 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
web.jsbridge!.bind((bridge) {
var minible = Minibleapp(bridge: bridge);
// ef.kvroot.devicelist.listen((x) {});
bridge.sdk.updateDeviceRoute((args) async {
bridge.sdk.updateDeviceRoute((args) async {
ef.log('updateDeviceRoute: $args');
selectDevice['blueToothStatus'] = bluetooth;
Get.toNamed("${args[0]}", arguments: selectDevice);
@@ -236,11 +237,21 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
if (data == null || data.isEmpty) {
return false;
}
if (!data['bluetoothScanGranted'] ||
!data['bluetoothConnectGranted'] ||
!data['locationGranted']) {
if (Platform.isIOS) {
if (!data['bluetoothScanGranted'] ||
!data['bluetoothConnectGranted']) {
return false;
}
} else if (Platform.isAndroid) {
if (!data['bluetoothScanGranted'] ||
!data['bluetoothConnectGranted'] ||
!data['locationGranted']) {
return false;
}
} else {
return false;
}
return true;
} catch (e) {
ef.log("[网页加载失败]:$e");
@@ -565,12 +576,14 @@ class WebviewTestView extends GetComponent<WebviewTestController> {
// return (controller.ready.value && (MainPageBBottomChange.getCurrentIndex() == 2))
return (controller.ready.value)
? controller.web.build()
: Center(child:CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(
themeController.currentColor.sc1,
),
),);
: Center(
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(
themeController.currentColor.sc1,
),
),
);
}),
),
),