2.0.2 (#11)
* fix: 重构 * fix: 1 * fix: 重构 * fix: 修复 iOS 和 macOS 代码错误 * fix: 优化项目 * fix: 构建项目 * fix: 修复权限问题 * fix: 解决 macOS 沙盒权限问题 * fix: 修复代码问题 * fix: 更新依赖 * fix: 更新依赖项 * fix: 添加缺失的位置权限
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
group 'dev.yanshouwang.bluetooth_low_energy'
|
||||
group 'dev.yanshouwang.bluetooth_low_energy_android'
|
||||
version '1.0-SNAPSHOT'
|
||||
|
||||
buildscript {
|
||||
@ -25,6 +25,10 @@ apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
if (project.android.hasProperty("namespace")) {
|
||||
namespace 'dev.yanshouwang.bluetooth_low_energy_android'
|
||||
}
|
||||
|
||||
compileSdkVersion 31
|
||||
|
||||
compileOptions {
|
||||
|
@ -1 +1 @@
|
||||
rootProject.name = 'bluetooth_low_energy'
|
||||
rootProject.name = 'bluetooth_low_energy_android'
|
||||
|
@ -1,6 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="dev.yanshouwang.bluetooth_low_energy">
|
||||
package="dev.yanshouwang.bluetooth_low_energy_android">
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
|
||||
<uses-permission android:name="android.permission.BLUETOOTH"
|
||||
@ -10,4 +11,4 @@
|
||||
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
</manifest>
|
||||
</manifest>
|
@ -1,4 +1,4 @@
|
||||
package dev.yanshouwang.bluetooth_low_energy
|
||||
package dev.yanshouwang.bluetooth_low_energy_android
|
||||
|
||||
import io.flutter.embedding.engine.plugins.FlutterPlugin
|
||||
import io.flutter.embedding.engine.plugins.activity.ActivityAware
|
@ -1,7 +1,7 @@
|
||||
// Autogenerated from Pigeon (v10.1.6), do not edit directly.
|
||||
// See also: https://pub.dev/packages/pigeon
|
||||
|
||||
package dev.yanshouwang.bluetooth_low_energy
|
||||
package dev.yanshouwang.bluetooth_low_energy_android
|
||||
|
||||
import android.util.Log
|
||||
import io.flutter.plugin.common.BasicMessageChannel
|
@ -1,4 +1,4 @@
|
||||
package dev.yanshouwang.bluetooth_low_energy
|
||||
package dev.yanshouwang.bluetooth_low_energy_android
|
||||
|
||||
import android.bluetooth.BluetoothGatt
|
||||
import android.bluetooth.BluetoothGattCallback
|
@ -1,4 +1,4 @@
|
||||
package dev.yanshouwang.bluetooth_low_energy
|
||||
package dev.yanshouwang.bluetooth_low_energy_android
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
@ -1,4 +1,4 @@
|
||||
package dev.yanshouwang.bluetooth_low_energy
|
||||
package dev.yanshouwang.bluetooth_low_energy_android
|
||||
|
||||
import android.bluetooth.BluetoothAdapter
|
||||
import android.bluetooth.BluetoothDevice
|
||||
@ -77,9 +77,9 @@ class MyCentralController(private val context: Context, binaryMessenger: BinaryM
|
||||
throw IllegalStateException()
|
||||
}
|
||||
val permissions = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
arrayOf(android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.BLUETOOTH_SCAN, android.Manifest.permission.BLUETOOTH_CONNECT)
|
||||
arrayOf(android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.BLUETOOTH_SCAN, android.Manifest.permission.BLUETOOTH_CONNECT)
|
||||
} else {
|
||||
arrayOf(android.Manifest.permission.ACCESS_FINE_LOCATION)
|
||||
arrayOf(android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION)
|
||||
}
|
||||
val activity = binding.activity
|
||||
ActivityCompat.requestPermissions(activity, permissions, REQUEST_CODE)
|
@ -1,4 +1,4 @@
|
||||
package dev.yanshouwang.bluetooth_low_energy
|
||||
package dev.yanshouwang.bluetooth_low_energy_android
|
||||
|
||||
import io.flutter.plugin.common.PluginRegistry.RequestPermissionsResultListener
|
||||
|
@ -1,4 +1,4 @@
|
||||
package dev.yanshouwang.bluetooth_low_energy
|
||||
package dev.yanshouwang.bluetooth_low_energy_android
|
||||
|
||||
import android.bluetooth.le.ScanCallback
|
||||
import android.bluetooth.le.ScanResult
|
@ -1,4 +1,4 @@
|
||||
package dev.yanshouwang.bluetooth_low_energy
|
||||
package dev.yanshouwang.bluetooth_low_energy_android
|
||||
|
||||
import io.flutter.plugin.common.MethodCall
|
||||
import io.flutter.plugin.common.MethodChannel
|
||||
@ -13,10 +13,10 @@ import org.mockito.Mockito
|
||||
* you can run them directly from IDEs that support JUnit such as Android Studio.
|
||||
*/
|
||||
|
||||
internal class BluetoothLowEnergyPluginTest {
|
||||
internal class BluetoothLowEnergyAndroidPluginTest {
|
||||
@Test
|
||||
fun onMethodCall_getPlatformVersion_returnsExpectedValue() {
|
||||
val plugin = BluetoothLowEnergyAndroid()
|
||||
val plugin = BluetoothLowEnergyAndroidPlugin()
|
||||
|
||||
val call = MethodCall("getPlatformVersion", null)
|
||||
val mockResult: MethodChannel.Result = Mockito.mock(MethodChannel.Result::class.java)
|
Reference in New Issue
Block a user