Skip to content

Commit bbcd26c

Browse files
authored
Resolve unhandled exception on iOS (#1298)
1 parent 2db062f commit bbcd26c

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
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.1
2+
3+
* Resolves an error that occurred when calling the `shouldShowRequestPermissionRationale` on iOS.
4+
15
## 4.2.0
26

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

permission_handler_platform_interface/lib/src/method_channel/method_channel_permission_handler.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dart:async';
22

3+
import 'package:flutter/foundation.dart';
34
import 'package:flutter/services.dart';
45

56
import '../../permission_handler_platform_interface.dart';
@@ -88,6 +89,10 @@ class MethodChannelPermissionHandler extends PermissionHandlerPlatform {
8889
@override
8990
Future<bool> shouldShowRequestPermissionRationale(
9091
Permission permission) async {
92+
if (defaultTargetPlatform != TargetPlatform.android) {
93+
return false;
94+
}
95+
9196
final shouldShowRationale = await _methodChannel.invokeMethod(
9297
'shouldShowRequestPermissionRationale', permission.value);
9398

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.2.0
6+
version: 4.2.1
77

88
dependencies:
99
flutter:

0 commit comments

Comments
 (0)