Notification token on Windows

This commit is contained in:
Fedor Indutny
2025-02-03 14:30:19 -08:00
committed by GitHub
parent 74acb3a2dd
commit 22d30ec4eb
10 changed files with 142 additions and 122 deletions

View File

@@ -12,12 +12,12 @@ describe('renderWindowsToast', () => {
avatarPath: 'C:/temp/ab/abcd',
body: 'Hi there!',
heading: 'Alice',
conversationId: 'conversation5',
token: 'token',
type: NotificationType.Message,
});
const expected =
'<toast launch="sgnl://show-conversation?conversationId=conversation5" activationType="protocol"><visual><binding template="ToastImageAndText02"><image id="1" src="file:///C:/temp/ab/abcd" hint-crop="circle"></image><text id="1">Alice</text><text id="2">Hi there!</text></binding></visual></toast>';
'<toast launch="sgnl://show-conversation?token=token" activationType="protocol"><visual><binding template="ToastImageAndText02"><image id="1" src="file:///C:/temp/ab/abcd" hint-crop="circle"></image><text id="1">Alice</text><text id="2">Hi there!</text></binding></visual></toast>';
assert.strictEqual(xml, expected);
});
@@ -26,12 +26,12 @@ describe('renderWindowsToast', () => {
const xml = renderWindowsToast({
body: 'Hi there!',
heading: 'Alice',
conversationId: 'conversation5',
token: 'token',
type: NotificationType.Message,
});
const expected =
'<toast launch="sgnl://show-conversation?conversationId=conversation5" activationType="protocol"><visual><binding template="ToastText02"><text id="1">Alice</text><text id="2">Hi there!</text></binding></visual></toast>';
'<toast launch="sgnl://show-conversation?token=token" activationType="protocol"><visual><binding template="ToastText02"><text id="1">Alice</text><text id="2">Hi there!</text></binding></visual></toast>';
assert.strictEqual(xml, expected);
});
@@ -40,14 +40,12 @@ describe('renderWindowsToast', () => {
const xml = renderWindowsToast({
body: 'Hi there!',
heading: 'Alice',
conversationId: 'conversation5',
messageId: 'message6',
storyId: 'story7',
token: 'token',
type: NotificationType.Message,
});
const expected =
'<toast launch="sgnl://show-conversation?conversationId=conversation5&amp;messageId=message6&amp;storyId=story7" activationType="protocol"><visual><binding template="ToastText02"><text id="1">Alice</text><text id="2">Hi there!</text></binding></visual></toast>';
'<toast launch="sgnl://show-conversation?token=token" activationType="protocol"><visual><binding template="ToastText02"><text id="1">Alice</text><text id="2">Hi there!</text></binding></visual></toast>';
assert.strictEqual(xml, expected);
});
@@ -56,7 +54,7 @@ describe('renderWindowsToast', () => {
const xml = renderWindowsToast({
body: 'Hi there!',
heading: 'Alice',
conversationId: 'conversation5',
token: 'token',
type: NotificationType.IncomingCall,
});
@@ -70,12 +68,12 @@ describe('renderWindowsToast', () => {
const xml = renderWindowsToast({
body: 'Hi there!',
heading: 'Alice',
conversationId: 'conversation5',
token: 'token',
type: NotificationType.IncomingGroupCall,
});
const expected =
'<toast launch="sgnl://start-call-lobby?conversationId=conversation5" activationType="protocol"><visual><binding template="ToastText02"><text id="1">Alice</text><text id="2">Hi there!</text></binding></visual></toast>';
'<toast launch="sgnl://start-call-lobby?token=token" activationType="protocol"><visual><binding template="ToastText02"><text id="1">Alice</text><text id="2">Hi there!</text></binding></visual></toast>';
assert.strictEqual(xml, expected);
});
@@ -84,7 +82,7 @@ describe('renderWindowsToast', () => {
const xml = renderWindowsToast({
body: 'Hi there!',
heading: 'Alice',
conversationId: 'conversation5',
token: 'token',
type: NotificationType.IsPresenting,
});