mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 00:33:49 +03:00
feat: remove unused code
This commit is contained in:
parent
3b828ca0f4
commit
09af1d1f89
@ -5,12 +5,12 @@ export interface NotificationOptions {
|
|||||||
duration?: "short" | "long";
|
duration?: "short" | "long";
|
||||||
silent?: boolean;
|
silent?: boolean;
|
||||||
progress?: {
|
progress?: {
|
||||||
title?: string;
|
|
||||||
status?: string;
|
status?: string;
|
||||||
value: number;
|
value: number;
|
||||||
valueOverride: string;
|
valueOverride: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function escape(string: string) {
|
function escape(string: string) {
|
||||||
return string.replace(/[<>&'"]/g, (match) => {
|
return string.replace(/[<>&'"]/g, (match) => {
|
||||||
switch (match) {
|
switch (match) {
|
||||||
@ -30,35 +30,17 @@ function escape(string: string) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function addAttributeOrTrim(name, value) {
|
function addAttributeOrTrim(name: string, value: string) {
|
||||||
return value ? `${name}="${value}" ` : "";
|
return value ? `${name}="${value}" ` : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
const Activation = {
|
|
||||||
types: [
|
|
||||||
"protocol",
|
|
||||||
"background",
|
|
||||||
"foreground",
|
|
||||||
"system", //system call such as alarm (snooze/dismiss), also used by Notification Visualizer
|
|
||||||
],
|
|
||||||
behavior: ["default", "pendingUpdate"],
|
|
||||||
};
|
|
||||||
|
|
||||||
const Scenarios = [
|
|
||||||
"default",
|
|
||||||
"alarm",
|
|
||||||
"reminder",
|
|
||||||
"incomingCall",
|
|
||||||
"urgent", //win10/11 22h2
|
|
||||||
];
|
|
||||||
|
|
||||||
export function toXmlString(options: NotificationOptions) {
|
export function toXmlString(options: NotificationOptions) {
|
||||||
let template =
|
let template =
|
||||||
"<toast " +
|
"<toast " +
|
||||||
`displayTimestamp="${new Date().toISOString()}" ` +
|
`displayTimestamp="${new Date().toISOString()}" ` +
|
||||||
`scenario="${Scenarios[0]}" ` +
|
`scenario="default" ` +
|
||||||
`duration="${options.duration ?? "short"}" ` +
|
`duration="${options.duration ?? "short"}" ` +
|
||||||
`activationType="${Activation.types[0]}" ` +
|
`activationType="protocol" ` +
|
||||||
">";
|
">";
|
||||||
|
|
||||||
//Visual
|
//Visual
|
||||||
@ -75,7 +57,6 @@ export function toXmlString(options: NotificationOptions) {
|
|||||||
"<progress " +
|
"<progress " +
|
||||||
`value="${options.progress.value}" ` +
|
`value="${options.progress.value}" ` +
|
||||||
`status="" ` +
|
`status="" ` +
|
||||||
addAttributeOrTrim("title", escape(options.progress.title || "")) +
|
|
||||||
addAttributeOrTrim(
|
addAttributeOrTrim(
|
||||||
"valueStringOverride",
|
"valueStringOverride",
|
||||||
escape(options.progress.valueOverride)
|
escape(options.progress.valueOverride)
|
||||||
|
Loading…
Reference in New Issue
Block a user