From 877ff932d428b372fce1aba6f1df835909418177 Mon Sep 17 00:00:00 2001
From: geyun <1556375442@qq.com>
Date: Fri, 11 Sep 2026 15:22:53 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DiOS=E8=93=9D=E7=89=99?=
=?UTF-8?q?=E6=89=AB=E6=8F=8F=E9=97=AE=E9=A2=98=E5=92=8C=E6=9D=83=E9=99=90?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- iOS 跳过 Android 专属权限检查(bluetoothConnect/bluetoothScan)
- iOS 跳过定位服务检查(iOS 蓝牙扫描不需要定位)
- Info.plist 添加 NSBluetoothAlwaysUsageDescription 蓝牙权限
- Podfile 修复被污染内容并添加 CDN 源
- project.pbxproj 临时修改 Bundle ID 和 Team(适配当前开发环境)
---
ios/Podfile | 5 +-
ios/Podfile.lock | 121 ++++++++++++++++++++++++++-
ios/Runner.xcodeproj/project.pbxproj | 18 ++--
ios/Runner/Info.plist | 15 ++--
lib/core/bluetooth/ble_manager.dart | 94 +++++++++++----------
pubspec.lock | 16 ++--
6 files changed, 193 insertions(+), 76 deletions(-)
diff --git a/ios/Podfile b/ios/Podfile
index f3bf4e0b..3956d436 100644
--- a/ios/Podfile
+++ b/ios/Podfile
@@ -1,6 +1,7 @@
# Uncomment this line to define a global platform for your project
-# platform :ios, '13.0'
-source 'https://github.com/volcengine/volcengine-specs.git'error: Classes can only extend other classes. (extends_non_class at [maibu_satabot_v2] lib\features\v2\device_list\domain\entities\video_stream_entity.dart:2)error: Classes can only extend other classes. (extends_non_class at [maibu_satabot_v2] lib\features\v2\device_list\domain\entities\video_stream_entity.dart:2)you
+platform :ios, '13.0'
+source 'https://github.com/volcengine/volcengine-specs.git'
+source 'https://cdn.cocoapods.org/'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
diff --git a/ios/Podfile.lock b/ios/Podfile.lock
index 4b8385f3..f5db88b1 100644
--- a/ios/Podfile.lock
+++ b/ios/Podfile.lock
@@ -1,7 +1,58 @@
PODS:
+ - agora_rtc_engine (6.5.3):
+ - AgoraIrisRTC_iOS (= 4.5.2-build.1)
+ - AgoraRtcEngine_iOS (= 4.5.2)
+ - Flutter
+ - AgoraInfra_iOS (1.2.13.1)
+ - AgoraIrisRTC_iOS (4.5.2-build.1)
+ - AgoraRtcEngine_iOS (4.5.2):
+ - AgoraRtcEngine_iOS/AIAEC (= 4.5.2)
+ - AgoraRtcEngine_iOS/AIAECLL (= 4.5.2)
+ - AgoraRtcEngine_iOS/AINS (= 4.5.2)
+ - AgoraRtcEngine_iOS/AINSLL (= 4.5.2)
+ - AgoraRtcEngine_iOS/AudioBeauty (= 4.5.2)
+ - AgoraRtcEngine_iOS/ClearVision (= 4.5.2)
+ - AgoraRtcEngine_iOS/ContentInspect (= 4.5.2)
+ - AgoraRtcEngine_iOS/FaceCapture (= 4.5.2)
+ - AgoraRtcEngine_iOS/FaceDetection (= 4.5.2)
+ - AgoraRtcEngine_iOS/LipSync (= 4.5.2)
+ - AgoraRtcEngine_iOS/ReplayKit (= 4.5.2)
+ - AgoraRtcEngine_iOS/RtcBasic (= 4.5.2)
+ - AgoraRtcEngine_iOS/SpatialAudio (= 4.5.2)
+ - AgoraRtcEngine_iOS/VideoAv1CodecDec (= 4.5.2)
+ - AgoraRtcEngine_iOS/VideoAv1CodecEnc (= 4.5.2)
+ - AgoraRtcEngine_iOS/VideoCodecDec (= 4.5.2)
+ - AgoraRtcEngine_iOS/VideoCodecEnc (= 4.5.2)
+ - AgoraRtcEngine_iOS/VirtualBackground (= 4.5.2)
+ - AgoraRtcEngine_iOS/VQA (= 4.5.2)
+ - AgoraRtcEngine_iOS/AIAEC (4.5.2)
+ - AgoraRtcEngine_iOS/AIAECLL (4.5.2)
+ - AgoraRtcEngine_iOS/AINS (4.5.2)
+ - AgoraRtcEngine_iOS/AINSLL (4.5.2)
+ - AgoraRtcEngine_iOS/AudioBeauty (4.5.2)
+ - AgoraRtcEngine_iOS/ClearVision (4.5.2)
+ - AgoraRtcEngine_iOS/ContentInspect (4.5.2)
+ - AgoraRtcEngine_iOS/FaceCapture (4.5.2)
+ - AgoraRtcEngine_iOS/FaceDetection (4.5.2)
+ - AgoraRtcEngine_iOS/LipSync (4.5.2)
+ - AgoraRtcEngine_iOS/ReplayKit (4.5.2)
+ - AgoraRtcEngine_iOS/RtcBasic (4.5.2):
+ - AgoraInfra_iOS (= 1.2.13.1)
+ - AgoraRtcEngine_iOS/SpatialAudio (4.5.2)
+ - AgoraRtcEngine_iOS/VideoAv1CodecDec (4.5.2)
+ - AgoraRtcEngine_iOS/VideoAv1CodecEnc (4.5.2)
+ - AgoraRtcEngine_iOS/VideoCodecDec (4.5.2)
+ - AgoraRtcEngine_iOS/VideoCodecEnc (4.5.2)
+ - AgoraRtcEngine_iOS/VirtualBackground (4.5.2)
+ - AgoraRtcEngine_iOS/VQA (4.5.2)
+ - connectivity_plus (0.0.1):
+ - Flutter
- device_info_plus (0.0.1):
- Flutter
- Flutter (1.0.0)
+ - flutter_blue_plus_darwin (0.0.2):
+ - Flutter
+ - FlutterMacOS
- flutter_webrtc (1.4.0):
- Flutter
- WebRTC-SDK (= 144.7559.01)
@@ -44,6 +95,8 @@ PODS:
- GTMSessionFetcher/Core (2.3.0)
- image_picker_ios (0.0.1):
- Flutter
+ - iris_method_channel (0.0.1):
+ - Flutter
- isar_community_flutter_libs (1.0.0):
- Flutter
- MLImage (1.0.0-beta4)
@@ -72,6 +125,8 @@ PODS:
- nanopb/encode (= 2.30910.0)
- nanopb/decode (2.30910.0)
- nanopb/encode (2.30910.0)
+ - open_file_ios (1.0.3):
+ - Flutter
- package_info_plus (0.4.5):
- Flutter
- permission_handler_apple (9.3.0):
@@ -89,29 +144,67 @@ PODS:
- Flutter
- vibration (3.0.0):
- Flutter
+ - video_player_avfoundation (0.0.1):
+ - Flutter
+ - FlutterMacOS
+ - volc_engine_rtc (3.60.4):
+ - Flutter
+ - VolcApiEngine (= 1.7.0)
+ - VolcEngineRTC (= 3.60.103.2100)
+ - VolcApiEngine (1.7.0)
+ - VolcEngineRTC (3.60.103.2100):
+ - VolcEngineRTC/BMF (= 3.60.103.2100)
+ - VolcEngineRTC/ByteRTCVideoDenoiseExtension (= 3.60.103.2100)
+ - VolcEngineRTC/ByteRTCVideoSharpenExtension (= 3.60.103.2100)
+ - VolcEngineRTC/ByteRTCVideoSRExtension (= 3.60.103.2100)
+ - VolcEngineRTC/Core (= 3.60.103.2100)
+ - VolcEngineRTC/CVByteNN (= 3.60.103.2100)
+ - VolcEngineRTC/RealXBase (= 3.60.103.2100)
+ - VolcEngineRTC/RTCFFmpeg (= 3.60.103.2100)
+ - VolcEngineRTC/BMF (3.60.103.2100)
+ - VolcEngineRTC/ByteRTCVideoDenoiseExtension (3.60.103.2100)
+ - VolcEngineRTC/ByteRTCVideoSharpenExtension (3.60.103.2100)
+ - VolcEngineRTC/ByteRTCVideoSRExtension (3.60.103.2100)
+ - VolcEngineRTC/Core (3.60.103.2100)
+ - VolcEngineRTC/CVByteNN (3.60.103.2100)
+ - VolcEngineRTC/RealXBase (3.60.103.2100)
+ - VolcEngineRTC/RTCFFmpeg (3.60.103.2100)
- WebRTC-SDK (144.7559.01)
- webview_flutter_wkwebview (0.0.1):
- Flutter
- FlutterMacOS
DEPENDENCIES:
+ - agora_rtc_engine (from `.symlinks/plugins/agora_rtc_engine/ios`)
+ - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- Flutter (from `Flutter`)
+ - flutter_blue_plus_darwin (from `.symlinks/plugins/flutter_blue_plus_darwin/darwin`)
- flutter_webrtc (from `.symlinks/plugins/flutter_webrtc/ios`)
- geolocator_apple (from `.symlinks/plugins/geolocator_apple/darwin`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
+ - iris_method_channel (from `.symlinks/plugins/iris_method_channel/ios`)
- isar_community_flutter_libs (from `.symlinks/plugins/isar_community_flutter_libs/ios`)
- mobile_scanner (from `.symlinks/plugins/mobile_scanner/ios`)
+ - open_file_ios (from `.symlinks/plugins/open_file_ios/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- vibration (from `.symlinks/plugins/vibration/ios`)
+ - video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`)
+ - volc_engine_rtc (from `.symlinks/plugins/volc_engine_rtc/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/darwin`)
SPEC REPOS:
+ https://github.com/volcengine/volcengine-specs.git:
+ - VolcApiEngine
+ - VolcEngineRTC
trunk:
+ - AgoraInfra_iOS
+ - AgoraIrisRTC_iOS
+ - AgoraRtcEngine_iOS
- GoogleDataTransport
- GoogleMLKit
- GoogleToolboxForMac
@@ -128,20 +221,30 @@ SPEC REPOS:
- WebRTC-SDK
EXTERNAL SOURCES:
+ agora_rtc_engine:
+ :path: ".symlinks/plugins/agora_rtc_engine/ios"
+ connectivity_plus:
+ :path: ".symlinks/plugins/connectivity_plus/ios"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
Flutter:
:path: Flutter
+ flutter_blue_plus_darwin:
+ :path: ".symlinks/plugins/flutter_blue_plus_darwin/darwin"
flutter_webrtc:
:path: ".symlinks/plugins/flutter_webrtc/ios"
geolocator_apple:
:path: ".symlinks/plugins/geolocator_apple/darwin"
image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios"
+ iris_method_channel:
+ :path: ".symlinks/plugins/iris_method_channel/ios"
isar_community_flutter_libs:
:path: ".symlinks/plugins/isar_community_flutter_libs/ios"
mobile_scanner:
:path: ".symlinks/plugins/mobile_scanner/ios"
+ open_file_ios:
+ :path: ".symlinks/plugins/open_file_ios/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
permission_handler_apple:
@@ -154,12 +257,22 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/url_launcher_ios/ios"
vibration:
:path: ".symlinks/plugins/vibration/ios"
+ video_player_avfoundation:
+ :path: ".symlinks/plugins/video_player_avfoundation/darwin"
+ volc_engine_rtc:
+ :path: ".symlinks/plugins/volc_engine_rtc/ios"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/darwin"
SPEC CHECKSUMS:
+ agora_rtc_engine: 0c7d50312967c4dc31c3c45e50589ce48f57e08a
+ AgoraInfra_iOS: 3691b2b277a1712a35ae96de25af319de0d73d08
+ AgoraIrisRTC_iOS: eab58c126439adf5ec99632828a558ea216860da
+ AgoraRtcEngine_iOS: 97e2398a2addda9057815a2a583a658e36796ff6
+ connectivity_plus: cb623214f4e1f6ef8fe7403d580fdad517d2f7dd
device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
+ flutter_blue_plus_darwin: ee2377ea51a6c9e481f2ed76ec597717ef5d287d
flutter_webrtc: ec91d94b484ad49cf191ef93413f64a40ffd3b4c
geolocator_apple: ab36aa0e8b7d7a2d7639b3b4e48308394e8cef5e
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
@@ -169,6 +282,7 @@ SPEC CHECKSUMS:
GoogleUtilitiesComponents: 679b2c881db3b615a2777504623df6122dd20afe
GTMSessionFetcher: 3a63d75eecd6aa32c2fc79f578064e1214dfdec2
image_picker_ios: e0ece4aa2a75771a7de3fa735d26d90817041326
+ iris_method_channel: 7d661cf3259b3009ae423508470dbeb9374446ee
isar_community_flutter_libs: bede843185a61a05ff364a05c9b23209523f7e0d
MLImage: 7bb7c4264164ade9bf64f679b40fb29c8f33ee9b
MLKitBarcodeScanning: 04e264482c5f3810cb89ebc134ef6b61e67db505
@@ -176,6 +290,7 @@ SPEC CHECKSUMS:
MLKitVision: 8baa5f46ee3352614169b85250574fde38c36f49
mobile_scanner: b67191637a5ea7ba15652ca208069d2bae1900ab
nanopb: 438bc412db1928dac798aa6fd75726007be04262
+ open_file_ios: 46184d802ee7959203f6392abcfa0dd49fdb5be0
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
permission_handler_apple: 4ed2196e43d0651e8ff7ca3483a069d469701f2d
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
@@ -184,9 +299,13 @@ SPEC CHECKSUMS:
shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb
url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b
vibration: ca8104a8875b9c493e15b21b04e456befd0ff6eb
+ video_player_avfoundation: 3453f792138786248960ca029747fcd9f318ef52
+ volc_engine_rtc: 1bc697fba3c7a2f6513a18ec2abfb629188ce6ff
+ VolcApiEngine: e1f8b47ec5ef64bf6b48e3600be132c42643f8f0
+ VolcEngineRTC: 889b981b13621208b25942263f0fd5817c93b9bc
WebRTC-SDK: ab9b5319e458c2bfebdc92b3600740da35d5630d
webview_flutter_wkwebview: 8ebf4fded22593026f7dbff1fbff31ea98573c8d
-PODFILE CHECKSUM: 3c63482e143d1b91d2d2560aee9fb04ecc74ac7e
+PODFILE CHECKSUM: 2da7455b7ebb4d9567497e4f758b13986b3bb736
COCOAPODS: 1.16.2
diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj
index 9d92c7b9..2a36b43b 100644
--- a/ios/Runner.xcodeproj/project.pbxproj
+++ b/ios/Runner.xcodeproj/project.pbxproj
@@ -494,14 +494,14 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
- DEVELOPMENT_TEAM = R5KTW5WPS3;
+ DEVELOPMENT_TEAM = 93X3AN3P79;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
- PRODUCT_BUNDLE_IDENTIFIER = com.maibu.maibuSatabotV2;
+ PRODUCT_BUNDLE_IDENTIFIER = com.maibu.maibuSatabotV2.dev;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -519,7 +519,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
- PRODUCT_BUNDLE_IDENTIFIER = com.maibu.maibuSatabotV2.RunnerTests;
+ PRODUCT_BUNDLE_IDENTIFIER = com.maibu.maibuSatabotV2.dev.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -537,7 +537,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
- PRODUCT_BUNDLE_IDENTIFIER = com.maibu.maibuSatabotV2.RunnerTests;
+ PRODUCT_BUNDLE_IDENTIFIER = com.maibu.maibuSatabotV2.dev.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
@@ -553,7 +553,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
- PRODUCT_BUNDLE_IDENTIFIER = com.maibu.maibuSatabotV2.RunnerTests;
+ PRODUCT_BUNDLE_IDENTIFIER = com.maibu.maibuSatabotV2.dev.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
@@ -680,14 +680,14 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
- DEVELOPMENT_TEAM = R5KTW5WPS3;
+ DEVELOPMENT_TEAM = 93X3AN3P79;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
- PRODUCT_BUNDLE_IDENTIFIER = com.maibu.maibuSatabotV2;
+ PRODUCT_BUNDLE_IDENTIFIER = com.maibu.maibuSatabotV2.dev;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -706,14 +706,14 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
- DEVELOPMENT_TEAM = R5KTW5WPS3;
+ DEVELOPMENT_TEAM = 93X3AN3P79;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
- PRODUCT_BUNDLE_IDENTIFIER = com.maibu.maibuSatabotV2;
+ PRODUCT_BUNDLE_IDENTIFIER = com.maibu.maibuSatabotV2.dev;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 9da7cc29..e58e1d2e 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -83,15 +83,10 @@
NSAllowsArbitraryLoads
-
-
-NSCameraUsageDescription
-需要使用相机
-NSMicrophoneUsageDescription
-需要使用麦克风
-NSAppTransportSecurity
-
- NSAllowsArbitraryLoads
-
+
+ NSBluetoothAlwaysUsageDescription
+ 需要使用蓝牙连接设备
+ NSBluetoothPeripheralUsageDescription
+ 需要使用蓝牙连接设备
diff --git a/lib/core/bluetooth/ble_manager.dart b/lib/core/bluetooth/ble_manager.dart
index 25553972..e769428a 100644
--- a/lib/core/bluetooth/ble_manager.dart
+++ b/lib/core/bluetooth/ble_manager.dart
@@ -1,5 +1,6 @@
import 'dart:async';
import 'dart:developer' as developer;
+import 'dart:io' show Platform;
import 'dart:typed_data';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:permission_handler/permission_handler.dart';
@@ -67,47 +68,46 @@ class BleManager {
}
Future requestPermissions() async {
- final connStatus = await Permission.bluetoothConnect.status;
- developer.log(
- '[BLE] bluetoothConnect status: $connStatus',
- name: 'BleManager',
- );
- if (connStatus.isDenied) {
- developer.log('[BLE] requesting bluetoothConnect...', name: 'BleManager');
- await Permission.bluetoothConnect.request();
- }
-
- final scanStatus = await Permission.bluetoothScan.status;
- developer.log(
- '[BLE] bluetoothScan status: $scanStatus',
- name: 'BleManager',
- );
- if (scanStatus.isDenied) {
- developer.log('[BLE] requesting bluetoothScan...', name: 'BleManager');
- await Permission.bluetoothScan.request();
- }
-
- final locStatus = await Permission.locationWhenInUse.status;
- developer.log(
- '[BLE] locationWhenInUse status: $locStatus',
- name: 'BleManager',
- );
- if (locStatus.isDenied) {
+ if (Platform.isAndroid) {
+ final connStatus = await Permission.bluetoothConnect.status;
developer.log(
- '[BLE] requesting locationWhenInUse...',
+ '[BLE] bluetoothConnect status: $connStatus',
name: 'BleManager',
);
- await Permission.locationWhenInUse.request();
- }
+ if (connStatus.isDenied) {
+ await Permission.bluetoothConnect.request();
+ }
- final allGranted =
- await Permission.bluetoothConnect.isGranted &&
- await Permission.bluetoothScan.isGranted;
- developer.log(
- '[BLE] all permissions granted: $allGranted',
- name: 'BleManager',
- );
- return allGranted;
+ final scanStatus = await Permission.bluetoothScan.status;
+ developer.log(
+ '[BLE] bluetoothScan status: $scanStatus',
+ name: 'BleManager',
+ );
+ if (scanStatus.isDenied) {
+ await Permission.bluetoothScan.request();
+ }
+
+ final locStatus = await Permission.locationWhenInUse.status;
+ developer.log(
+ '[BLE] locationWhenInUse status: $locStatus',
+ name: 'BleManager',
+ );
+ if (locStatus.isDenied) {
+ await Permission.locationWhenInUse.request();
+ }
+
+ final allGranted =
+ await Permission.bluetoothConnect.isGranted &&
+ await Permission.bluetoothScan.isGranted;
+ developer.log(
+ '[BLE] all permissions granted: $allGranted',
+ name: 'BleManager',
+ );
+ return allGranted;
+ }
+ // iOS: 蓝牙权限由 Info.plist 声明,系统弹窗授权,无需主动请求
+ developer.log('[BLE] iOS platform, skipping Android permissions', name: 'BleManager');
+ return true;
}
Future openBluetooth() async {
@@ -168,15 +168,17 @@ class BleManager {
return;
}
- final locEnabled = await _checkLocationService();
- if (myGen != _scanGen) return;
- if (!locEnabled) {
- developer.log(
- '[BLE] Location service OFF, directing to settings',
- name: 'BleManager',
- );
- await _openLocationSettings();
- return;
+ if (Platform.isAndroid) {
+ final locEnabled = await _checkLocationService();
+ if (myGen != _scanGen) return;
+ if (!locEnabled) {
+ developer.log(
+ '[BLE] Location service OFF, directing to settings',
+ name: 'BleManager',
+ );
+ await _openLocationSettings();
+ return;
+ }
}
_scanSubscription?.cancel();
diff --git a/pubspec.lock b/pubspec.lock
index 251afdf1..39be5755 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -132,10 +132,10 @@ packages:
dependency: transitive
description:
name: characters
- sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
+ sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
url: "https://pub.flutter-io.cn"
source: hosted
- version: "1.4.0"
+ version: "1.4.1"
checked_yaml:
dependency: transitive
description:
@@ -944,18 +944,18 @@ packages:
dependency: transitive
description:
name: matcher
- sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
+ sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861
url: "https://pub.flutter-io.cn"
source: hosted
- version: "0.12.17"
+ version: "0.12.19"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
- sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
+ sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
url: "https://pub.flutter-io.cn"
source: hosted
- version: "0.11.1"
+ version: "0.13.0"
meta:
dependency: transitive
description:
@@ -1493,10 +1493,10 @@ packages:
dependency: transitive
description:
name: test_api
- sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55
+ sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a"
url: "https://pub.flutter-io.cn"
source: hosted
- version: "0.7.7"
+ version: "0.7.10"
time:
dependency: transitive
description: