setForegroundPresentationOptions method

Future<void> setForegroundPresentationOptions(
  1. List<IOSForegroundPresentationOption> options
)

Sets the notification options.

Implementation

Future<void> setForegroundPresentationOptions(
    List<IOSForegroundPresentationOption> options) async {
  if (!Platform.isIOS) {
    return Future.value();
  }

  var strings = <String>[];
  for (var element in options) {
    switch (element) {
      case IOSForegroundPresentationOption.sound:
        strings.add("sound");
        break;
      case IOSForegroundPresentationOption.badge:
        strings.add("badge");
        break;
      case IOSForegroundPresentationOption.list:
        strings.add("list");
        break;
      case IOSForegroundPresentationOption.banner:
        strings.add("banner");
        break;
    }
  }

  return await _module.channel
      .invokeMethod('push#ios#setForegroundPresentationOptions', strings);
}