mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-06 12:02:24 +00:00
bugfix: remove race condition, respect duration settings
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user