Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background refresh status platform interface #1281

Merged
merged 3 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions permission_handler_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.2.0

* 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.1.0

* 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ class Permission {
/// iOS: SiriKit
static const assistant = Permission._(38);

/// Permission for reading the current background refresh status. (iOS only)
static const backgroundRefresh = Permission._(39);

/// Returns a list of all possible [PermissionGroup] values.
static const List<Permission> values = <Permission>[
// ignore: deprecated_member_use_from_same_package
Expand Down Expand Up @@ -365,6 +368,7 @@ class Permission {
calendarWriteOnly,
calendarFullAccess,
assistant,
backgroundRefresh,
];

static const List<String> _names = <String>[
Expand Down Expand Up @@ -407,6 +411,7 @@ class Permission {
'calendarWriteOnly',
'calendarFullAccess',
'assistant',
'backgroundRefresh'
];

@override
Expand Down
2 changes: 1 addition & 1 deletion permission_handler_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A common platform interface for the permission_handler plugin.
homepage: https://github.com/baseflow/flutter-permission-handler/tree/master/permission_handler_platform_interface
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 4.1.0
version: 4.2.0

dependencies:
flutter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:permission_handler_platform_interface/permission_handler_platform_interface.dart';

void main() {
test('Permission has the right amount of possible PermissionGroup values',
() {
test('Permission has the right amount of possible Permission values', () {
const values = Permission.values;

expect(values.length, 39);
expect(values.length, 40);
});

test('check if byValue returns corresponding PermissionGroup value', () {
test('check if byValue returns corresponding Permission value', () {
const values = Permission.values;

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

test('check if toString works on all Permission values', () {
const values = Permission.values;

for (var i = 0; i < values.length; i++) {
expect(values[i].toString(), isNotNull);
}
});

test(
// ignore: lines_longer_than_80_chars
'equality operator should return true for two instances with the same values',
Expand Down
Loading