buildCallNotificationChannel static method

AndroidNotificationChannel buildCallNotificationChannel()

Implementation

static AndroidNotificationChannel buildCallNotificationChannel() {
// AndroidNotificationChannel createdChannel;
  var notificationSoundUri = SessionManagement.getNotificationUri();
  var isVibrate = SessionManagement.getVibration();
  var isRing = SessionManagement.getNotificationSound();
  var channelName = "App Call Notifications";
  var channelId = getCallNotificationChannelId();
  // var vibrateImportance = (isVibrate) ? Importance.high : Importance.low;
  // var ringImportance = (isRing) ? Importance.high : Importance.low;
  var channelImportance =
      (isRing || isVibrate) ? Importance.high : Importance.low;
  if (isRing) {
    return AndroidNotificationChannel(channelId, channelName,
        importance: channelImportance,
        showBadge: true,
        sound: notificationSoundUri != null
            ? UriAndroidNotificationSound(notificationSoundUri)
            : null,
        vibrationPattern: (isVibrate) ? getDefaultVibrate() : null,
        playSound: true);
  } else if (isVibrate) {
    return AndroidNotificationChannel(channelId, channelName,
        importance: channelImportance,
        showBadge: true,
        sound: null,
        vibrationPattern: (isVibrate) ? getDefaultVibrate() : null,
        playSound: false);
  } else {
    return AndroidNotificationChannel(channelId, channelName,
        importance: channelImportance, playSound: true);
  }
}