Skip to content

Commit 036f035

Browse files
committed
[Health] added UnsupportedError for revoke permission
1 parent efe4dd4 commit 036f035

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: packages/health/lib/src/health_factory.dart

+10-2
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,16 @@ class HealthFactory {
8383
///
8484
/// Not implemented on iOS as there is no way to programmatically remove access.
8585
Future<void> revokePermissions() async {
86-
await _channel.invokeMethod('revokePermissions');
87-
return;
86+
try {
87+
if (_platformType == PlatformType.IOS) {
88+
throw UnsupportedError(
89+
'Revoke permissions is not supported on iOS. Please revoke permissions manually in the settings.');
90+
}
91+
await _channel.invokeMethod('revokePermissions');
92+
return;
93+
} catch (e) {
94+
print(e);
95+
}
8896
}
8997

9098
/// Requests permissions to access data types in Apple Health or Google Fit.

0 commit comments

Comments
 (0)