From f2fe09d77beb607390997dc9ade8dcbd97f459d2 Mon Sep 17 00:00:00 2001 From: Luke Roberts Date: Thu, 16 Nov 2023 18:21:08 +0000 Subject: [PATCH] Fixes Sparkle to prompt for updates in the bg --- TCCKronos/AppDelegate.h | 2 +- TCCKronos/AppDelegate.m | 23 +++++++++++++++++++++++ TCCKronos/Base.lproj/MainMenu.xib | 7 ++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/TCCKronos/AppDelegate.h b/TCCKronos/AppDelegate.h index bab77c0..20d5ba1 100644 --- a/TCCKronos/AppDelegate.h +++ b/TCCKronos/AppDelegate.h @@ -13,7 +13,7 @@ @class XPCConnection; -@interface AppDelegate : NSObject +@interface AppDelegate : NSObject @property(strong) IBOutlet NSMenu *statusMenu; diff --git a/TCCKronos/AppDelegate.m b/TCCKronos/AppDelegate.m index c16cbed..849aee8 100644 --- a/TCCKronos/AppDelegate.m +++ b/TCCKronos/AppDelegate.m @@ -230,4 +230,27 @@ -(void)setActivationPolicy return; } +- (BOOL)supportsGentleScheduledUpdateReminders { + return YES; +} + +- (void)standardUserDriverWillHandleShowingUpdate:(BOOL)handleShowingUpdate forUpdate:(SUAppcastItem *)update state:(SPUUserUpdateState *)state { + [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; + + if (!state.userInitiated) { + // Set a badge number on the app's Dock tile + [NSApp.dockTile setBadgeLabel:@"1"]; + } +} + +- (void)standardUserDriverDidReceiveUserAttentionForUpdate:(SUAppcastItem *)update { + [NSApp.dockTile setBadgeLabel:@""]; +} + +- (void)standardUserDriverWillFinishUpdateSession { + [self setActivationPolicy]; +} + + + @end diff --git a/TCCKronos/Base.lproj/MainMenu.xib b/TCCKronos/Base.lproj/MainMenu.xib index db11b35..642311c 100644 --- a/TCCKronos/Base.lproj/MainMenu.xib +++ b/TCCKronos/Base.lproj/MainMenu.xib @@ -92,7 +92,12 @@ - + + + + + +