Release Vulpes OS 2.7 Preview 25 for Desktop, Android and Pixel 3a
This commit is contained in:
parent
6a44daeaaa
commit
3a1fba4efe
1 changed files with 1301 additions and 196 deletions
|
|
@ -18,12 +18,19 @@ export class Notifications {
|
|||
const old = options.tag && this.list(app.id).find(row => row.tag === options.tag);
|
||||
const id = old?.id || String(++this.sequence);
|
||||
const icons = app.manifest.icons || {};
|
||||
const icon = options.icon || icons[Math.max(...Object.keys(icons).map(Number))] || '';
|
||||
const sizes = Object.keys(icons).filter(size => /^[1-9][0-9]*$/.test(size))
|
||||
.sort((a, b) => Number(b) - Number(a));
|
||||
let icon = '';
|
||||
for (const candidate of [options.icon, ...sizes.map(size => icons[size]), icons.any]) {
|
||||
if (!candidate || !URL.canParse(candidate, app.origin)) continue;
|
||||
icon = new URL(candidate, app.origin).href;
|
||||
break;
|
||||
}
|
||||
const row = {id, owner:app.id, manifestURL:app.manifestURL,
|
||||
title:String(options.title || ''), text:String(options.body || ''),
|
||||
body:String(options.body || ''), tag:String(options.tag || ''),
|
||||
data:options.data ?? null, timestamp:Date.now(),
|
||||
icon:icon ? new URL(icon, app.origin).href : '',
|
||||
icon,
|
||||
lang:options.lang || '', dir:options.dir || 'auto',
|
||||
mozbehavior:{noscreen:!!options.silent, nosound:!!options.silent,
|
||||
novibrate:!!options.silent}, type:'desktop-notification'};
|
||||
|
|
|
|||
Loading…
Reference in a new issue