Skip to content

Commit f589667

Browse files
committed
Add validating contentChanged logic
1 parent 126cbc4 commit f589667

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/messaging/messaging-internal.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ function validateAps(aps: Aps): void {
274274
contentAvailable: 'content-available',
275275
mutableContent: 'mutable-content',
276276
threadId: 'thread-id',
277+
contentChanged: 'content-changed',
277278
};
278279
Object.keys(propertyMappings).forEach((key) => {
279280
if (key in aps && propertyMappings[key] in aps) {
@@ -300,6 +301,15 @@ function validateAps(aps: Aps): void {
300301
delete aps['mutable-content'];
301302
}
302303
}
304+
305+
const contentChanged = aps['content-changed'];
306+
if (typeof contentChanged !== 'undefined' && contentChanged !== 1) {
307+
if (contentChanged === true) {
308+
aps['content-changed'] = 1;
309+
} else {
310+
delete aps['content-changed'];
311+
}
312+
}
303313
}
304314

305315
function validateApsSound(sound: string | CriticalSound | undefined): void {

0 commit comments

Comments
 (0)