also looking at this
feat(android): the Bluetooth scan pair in Zig — ratchet 56 → 54
#186
7 files
+377
-3
| @@ -42,6 +42,10 @@ pub const read_contacts = "android.permission.READ_CONTACTS"; | ||
| 42 | 42 | pub const write_contacts = "android.permission.WRITE_CONTACTS"; |
| 43 | 43 | pub const access_fine_location = "android.permission.ACCESS_FINE_LOCATION"; |
| 44 | 44 | |
| 45 | /// API 31 and later only — see `CraftNative.requestBluetoothScanPermission`, | |
| 46 | /// which is where the version check lives. | |
| 47 | pub const bluetooth_scan = "android.permission.BLUETOOTH_SCAN"; | |
| 48 | ||
| 45 | 49 | /// `activity.checkSelfPermission(permission) == PERMISSION_GRANTED`. |
| 46 | 50 | pub fn isGranted(j: Jni, activity: jobject, permission: [*:0]const u8) !bool { |
| 47 | 51 | try j.pushLocalFrame(8); |
| @@ -94,6 +98,7 @@ test "the permission names match Manifest.permission exactly" { | ||
| 94 | 98 | try testing.expectEqualStrings("android.permission.READ_CONTACTS", read_contacts); |
| 95 | 99 | try testing.expectEqualStrings("android.permission.WRITE_CONTACTS", write_contacts); |
| 96 | 100 | try testing.expectEqualStrings("android.permission.ACCESS_FINE_LOCATION", access_fine_location); |
| 101 | try testing.expectEqualStrings("android.permission.BLUETOOTH_SCAN", bluetooth_scan); | |
| 97 | 102 | } |
| 98 | 103 | |
| 99 | 104 | test "PERMISSION_GRANTED is zero, and PERMISSION_DENIED is not" { |