bugfix: remove race condition, respect duration settings

This commit is contained in:
FUFSoB
2025-09-23 11:34:21 +05:00
parent ea0350bcca
commit e35264708a
2 changed files with 6 additions and 9 deletions
+1 -6
View File
@@ -107,7 +107,7 @@ Variants {
// Connect to animation signal from service - UPDATED TO USE ID
Component.onCompleted: {
NotificationService.animateAndRemove.connect(function (notificationId, index) {
NotificationService.animateAndRemove.connect(function (notificationId) {
// Find the delegate by notification ID
var delegate = null
if (notificationStack && notificationStack.children && notificationStack.children.length > 0) {
@@ -120,11 +120,6 @@ Variants {
}
}
// Fallback to index if ID lookup failed
if (!delegate && notificationStack && notificationStack.children && notificationStack.children[index]) {
delegate = notificationStack.children[index]
}
if (delegate && delegate.animateOut) {
delegate.animateOut()
} else {
+5 -3
View File
@@ -187,7 +187,9 @@ Singleton {
running: activeList.count > 0
onTriggered: {
const now = Date.now()
const durations = [3000, 8000, 15000] // low, normal, critical
const durations = [Settings.data.notifications?.lowUrgencyDuration * 1000 || 3000,
Settings.data.notifications?.normalUrgencyDuration * 1000 || 8000,
Settings.data.notifications?.criticalUrgencyDuration * 1000 || 15000]
for (var i = activeList.count - 1; i >= 0; i--) {
const notif = activeList.get(i)
@@ -203,7 +205,7 @@ Singleton {
updateModel(activeList, notif.id, "progress", progress)
if (elapsed >= expire) {
animateAndRemove(notif.id, i)
animateAndRemove(notif.id)
delete progressTimers[notif.id]
break
}
@@ -397,7 +399,7 @@ Singleton {
}
// Signals & connections
signal animateAndRemove(string notificationId, int index)
signal animateAndRemove(string notificationId)
Connections {
target: Settings.data.notifications