feat: hide the notification about the new version installed automatically after 10 seconds

This commit is contained in:
Serhiy Mytrovtsiy
2022-05-07 08:39:14 +02:00
parent c664d7c1a6
commit f0781c8fdf

View File

@@ -74,16 +74,22 @@ extension AppDelegate {
let subtitle: String = localizedString("Stats was updated to v", currentVersion)
if #available(macOS 10.14, *) {
_ = showNotification(
let id = showNotification(
title: title,
subtitle: subtitle,
delegate: self
)
DispatchQueue.main.asyncAfter(deadline: .now() + 10) {
removeNotification(id)
}
} else {
_ = showNSNotification(
let id = showNSNotification(
title: title,
subtitle: subtitle
)
DispatchQueue.main.asyncAfter(deadline: .now() + 10) {
removeNSNotification(id)
}
}
}