Skip to content

Interruption Level for APS to deliver time-sensitive notifications for IOS #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@ class Aps {
this.mutableContent,
this.category,
this.threadId,
this.interruptionLevel,
this.soundRaw,
});

/// Alert to be included in the message. This may be a string or an object of
Expand All @@ -478,15 +480,24 @@ class Aps {
/// An app-specific identifier for grouping notifications.
final String? threadId;

/// Specifies the interruption level of the notification.
/// Usually critical or time-sensitive.
final String? interruptionLevel;

/// The sound name directly inserted as "sound": "sound_name" in the payload.
final String? soundRaw;

Map<String, Object?> _toProto() {
return {
if (alert != null) 'alert': alert?._toProto(),
if (badge != null) 'badge': badge,
if (sound != null) 'sound': sound?._toProto(),
if (sound != null || soundRaw != null)
'sound': sound?._toProto() ?? soundRaw,
if (contentAvailable != null) 'content-available': contentAvailable,
if (mutableContent != null) 'mutable-content': mutableContent,
if (category != null) 'category': category,
if (threadId != null) 'thread-id': threadId,
if (interruptionLevel != null) 'interruption-level': interruptionLevel,
}._cleanProto();
}
}
Expand Down