improved update checks

This commit is contained in:
Patrick Wardle 2022-11-18 17:21:56 -10:00
parent c4c97f2f2c
commit 56b14ed5d6
2 changed files with 35 additions and 20 deletions

View File

@ -367,7 +367,7 @@ bail:
case Update_NotSupported: case Update_NotSupported:
//dbg msg //dbg msg
os_log_debug(logHandle, "update available, but not for this version of macOS"); os_log_debug(logHandle, "update available, but not for this version of macOS.");
//set label //set label
self.updateLabel.stringValue = [NSString stringWithFormat:@"Update available, but isn't supported on macOS %ld.%ld", NSProcessInfo.processInfo.operatingSystemVersion.majorVersion, NSProcessInfo.processInfo.operatingSystemVersion.minorVersion]; self.updateLabel.stringValue = [NSString stringWithFormat:@"Update available, but isn't supported on macOS %ld.%ld", NSProcessInfo.processInfo.operatingSystemVersion.majorVersion, NSProcessInfo.processInfo.operatingSystemVersion.minorVersion];

View File

@ -969,33 +969,48 @@ bail:
return icon; return icon;
} }
//wait until a window is non nil //wait till window non-nil
// then make it modal // then make that window modal
void makeModal(NSWindowController* windowController) void makeModal(NSWindowController* windowController)
{ {
//wait up to 1 second window to be non-nil //window
// then make modal __block NSWindow* window = nil;
//wait till non-nil
// then make window modal
for(int i=0; i<20; i++) for(int i=0; i<20; i++)
{ {
//can make it modal once we have a window //grab window
if(nil != windowController.window) dispatch_sync(dispatch_get_main_queue(), ^{
{
//make modal on main thread //grab
dispatch_sync(dispatch_get_main_queue(), ^{ window = windowController.window;
//modal
[[NSApplication sharedApplication] runModalForWindow:windowController.window];
});
//all done });
break;
//nil?
// nap
if(nil == window)
{
//nap
[NSThread sleepForTimeInterval:0.05f];
//next
continue;
} }
//nap //have window?
[NSThread sleepForTimeInterval:0.05f]; // make it modal
dispatch_sync(dispatch_get_main_queue(), ^{
//modal
[[NSApplication sharedApplication] runModalForWindow:windowController.window];
});
}//until 1 second //done
break;
}
return; return;
} }