Don't dismiss toasts while hovered (and adjust timings slightly)

This commit is contained in:
Dean Herbert 2022-08-30 21:19:51 +09:00
parent 403fc18976
commit 224ab29ef4
1 changed files with 10 additions and 2 deletions

View File

@ -90,12 +90,20 @@ public void Post(Notification notification, Action addPermanently)
toastFlow.Insert(depth, notification); toastFlow.Insert(depth, notification);
pendingToastOperations.Add(Scheduler.AddDelayed(() => pendingToastOperations.Add(scheduleDismissal());
ScheduledDelegate scheduleDismissal() => Scheduler.AddDelayed(() =>
{ {
// add notification to permanent overlay unless it was already dismissed by the user. // add notification to permanent overlay unless it was already dismissed by the user.
if (notification.WasClosed) if (notification.WasClosed)
return; return;
if (notification.IsHovered)
{
pendingToastOperations.Add(scheduleDismissal());
return;
}
toastFlow.Remove(notification); toastFlow.Remove(notification);
AddInternal(notification); AddInternal(notification);
@ -107,7 +115,7 @@ public void Post(Notification notification, Action addPermanently)
notification.FadeIn(300, Easing.OutQuint); notification.FadeIn(300, Easing.OutQuint);
}); });
}, notification.IsImportant ? 15000 : 3000)); }, notification.IsImportant ? 12000 : 2500);
} }
protected override void Update() protected override void Update()