Fix notification hide issue
This commit is contained in:
parent
3623311150
commit
49e0acb377
1 changed files with 21 additions and 5 deletions
|
|
@ -47,13 +47,29 @@ Variants {
|
||||||
// Connect to animation signal from service
|
// Connect to animation signal from service
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
NotificationService.animateAndRemove.connect(function (notification, index) {
|
NotificationService.animateAndRemove.connect(function (notification, index) {
|
||||||
// Find the delegate and trigger its animation
|
// Prefer lookup by identity to avoid index mismatches
|
||||||
if (notificationStack.children && notificationStack.children[index]) {
|
var delegate = null
|
||||||
let delegate = notificationStack.children[index]
|
if (notificationStack.children && notificationStack.children.length > 0) {
|
||||||
if (delegate && delegate.animateOut) {
|
for (var i = 0; i < notificationStack.children.length; i++) {
|
||||||
delegate.animateOut()
|
var child = notificationStack.children[i]
|
||||||
|
if (child && child.model && child.model.rawNotification === notification) {
|
||||||
|
delegate = child
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fallback to index if identity lookup failed
|
||||||
|
if (!delegate && notificationStack.children && notificationStack.children[index]) {
|
||||||
|
delegate = notificationStack.children[index]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (delegate && delegate.animateOut) {
|
||||||
|
delegate.animateOut()
|
||||||
|
} else {
|
||||||
|
// As a last resort, force-remove without animation to avoid stuck popups
|
||||||
|
NotificationService.forceRemoveNotification(notification)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue