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