requestNotificationAuthorization method

  1. @override
Future<NotificationAuthorizationResponse> requestNotificationAuthorization(
  1. IosNotificationAuthorizationOptions options, {
  2. bool? registerRemote,
})
override

Implementation

@override
Future<NotificationAuthorizationResponse> requestNotificationAuthorization(
    IosNotificationAuthorizationOptions options,
    {bool? registerRemote}) async {
  try {
    final Map? result = await _permissionsChannel.invokeMethod<Map>(
        SuperfineSdkChannelMethods.requestNotificationAuthorization,
        {'options': options.value, 'registerRemote': registerRemote});
    return result != null
        ? NotificationAuthorizationResponse.fromJson(
            Map<String, dynamic>.from(result))
        : NotificationAuthorizationResponse(
            granted: false,
            message: "Failed to requesting notification authorization");
  } catch (e) {
    print("Error requesting notification authorization: $e");
    return NotificationAuthorizationResponse(
        granted: false,
        message: "Failed to requesting notification authorization");
  }
}