Skip to content

Commit c013888

Browse files
mvanbeusekomened
andauthored
Background refresh status platform interface (#1281)
* Fix/1174 background refresh status (#1176) * Update project files * Add a new background refresh permission check for iOS * versions * cleanups * version bumps * missing constants * Revert to platforms to main * Revert changes to Apple package --------- Co-authored-by: Sebastian Roth <sebastian.roth@gmail.com>
1 parent 669aff8 commit c013888

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

permission_handler_platform_interface/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 4.2.0
2+
3+
* Adds a new permission `Permission.backgroundRefresh` to check the background refresh permission status on iOS & macOS platforms. This is a no-op on all other platforms.
4+
15
## 4.1.0
26

37
* Adds the `Permission.assistant` which allows users to request permissions to access SiriKit on iOS and macOS platforms. This is a no-op on all other platforms.

permission_handler_platform_interface/lib/src/permissions.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@ class Permission {
323323
/// iOS: SiriKit
324324
static const assistant = Permission._(38);
325325

326+
/// Permission for reading the current background refresh status. (iOS only)
327+
static const backgroundRefresh = Permission._(39);
328+
326329
/// Returns a list of all possible [PermissionGroup] values.
327330
static const List<Permission> values = <Permission>[
328331
// ignore: deprecated_member_use_from_same_package
@@ -365,6 +368,7 @@ class Permission {
365368
calendarWriteOnly,
366369
calendarFullAccess,
367370
assistant,
371+
backgroundRefresh,
368372
];
369373

370374
static const List<String> _names = <String>[
@@ -407,6 +411,7 @@ class Permission {
407411
'calendarWriteOnly',
408412
'calendarFullAccess',
409413
'assistant',
414+
'backgroundRefresh'
410415
];
411416

412417
@override

permission_handler_platform_interface/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: A common platform interface for the permission_handler plugin.
33
homepage: https://github.com/baseflow/flutter-permission-handler/tree/master/permission_handler_platform_interface
44
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
55
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
6-
version: 4.1.0
6+
version: 4.2.0
77

88
dependencies:
99
flutter:

permission_handler_platform_interface/test/src/permissions_test.dart

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@ import 'package:flutter_test/flutter_test.dart';
22
import 'package:permission_handler_platform_interface/permission_handler_platform_interface.dart';
33

44
void main() {
5-
test('Permission has the right amount of possible PermissionGroup values',
6-
() {
5+
test('Permission has the right amount of possible Permission values', () {
76
const values = Permission.values;
87

9-
expect(values.length, 39);
8+
expect(values.length, 40);
109
});
1110

12-
test('check if byValue returns corresponding PermissionGroup value', () {
11+
test('check if byValue returns corresponding Permission value', () {
1312
const values = Permission.values;
1413

1514
for (var i = 0; i < values.length; i++) {
@@ -24,6 +23,14 @@ void main() {
2423
expect(permissionName, 'Permission.calendar');
2524
});
2625

26+
test('check if toString works on all Permission values', () {
27+
const values = Permission.values;
28+
29+
for (var i = 0; i < values.length; i++) {
30+
expect(values[i].toString(), isNotNull);
31+
}
32+
});
33+
2734
test(
2835
// ignore: lines_longer_than_80_chars
2936
'equality operator should return true for two instances with the same values',

0 commit comments

Comments
 (0)