From f0781c8fdfebf6de5ffabf042cc761efe083d02c Mon Sep 17 00:00:00 2001 From: Serhiy Mytrovtsiy Date: Sat, 7 May 2022 08:39:14 +0200 Subject: [PATCH] feat: hide the notification about the new version installed automatically after 10 seconds --- Stats/helpers.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Stats/helpers.swift b/Stats/helpers.swift index c481bdfd..80e317fc 100644 --- a/Stats/helpers.swift +++ b/Stats/helpers.swift @@ -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) + } } }