Refactor new macOS code to reduce #ifs, increase shared code, and fix warnings

This commit is contained in:
Cameron Gutman
2018-03-27 00:34:38 -07:00
parent 6cc165b589
commit e8832ed746
22 changed files with 73 additions and 293 deletions
+2 -10
View File
@@ -22,20 +22,12 @@
// HACK: Avoid calling [UIApplication delegate] off the UI thread to keep
// Main Thread Checker happy.
if ([NSThread isMainThread]) {
#if TARGET_OS_IPHONE
_appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
#else
_appDelegate = (AppDelegate *)[[NSApplication sharedApplication] delegate];
#endif
_appDelegate = (AppDelegate *)[[OSApplication sharedApplication] delegate];
}
else {
dispatch_sync(dispatch_get_main_queue(), ^{
#if TARGET_OS_IPHONE
_appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
#else
_appDelegate = (AppDelegate *)[[NSApplication sharedApplication] delegate];
#endif
_appDelegate = (AppDelegate *)[[OSApplication sharedApplication] delegate];
});
}