fix: batch clear all notifs to prevent blocking
This commit is contained in:
parent
b83ac6e50a
commit
5b153fde8f
1 changed files with 14 additions and 4 deletions
|
|
@ -149,14 +149,24 @@ Item {
|
||||||
id: clearTimer
|
id: clearTimer
|
||||||
|
|
||||||
repeat: true
|
repeat: true
|
||||||
|
triggeredOnStart: true
|
||||||
interval: Math.max(15, Math.min(80, 69.8 - 12.3 * Math.log(Notifs.notClosed.length)))
|
interval: Math.max(15, Math.min(80, 69.8 - 12.3 * Math.log(Notifs.notClosed.length)))
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
const first = Notifs.notClosed[0];
|
const first = Notifs.notClosed[0];
|
||||||
if (first) {
|
if (!first) {
|
||||||
for (const n of Notifs.notClosed.filter(n => n.appName === first.appName))
|
|
||||||
n.close();
|
|
||||||
} else {
|
|
||||||
stop();
|
stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const appName = first.appName;
|
||||||
|
let cleared = 0;
|
||||||
|
for (const n of Notifs.notClosed.filter(n => n.appName === appName)) {
|
||||||
|
n.close();
|
||||||
|
cleared++;
|
||||||
|
if (cleared > 30) {
|
||||||
|
interval = 5;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue