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
+5 -8
View File
@@ -16,16 +16,13 @@
self.statusMessage = @"App asset has no status message";
self.statusCode = -1;
}
- (OSImage*) getImage {
#if TARGET_OS_IPHONE
- (UIImage*) getImage {
UIImage* appImage = [[UIImage alloc] initWithData:self.data];
OSImage* appImage = [[OSImage alloc] initWithData:self.data];
#else
OSImage* appImage = nil;
#endif
return appImage;
}
#else
- (NSImage*) getImage {
return nil;
}
#endif
@end
+1 -5
View File
@@ -19,11 +19,7 @@ static const int MAX_ATTEMPTS = 5;
- (void) main {
#if TARGET_OS_IPHONE
UIImage* appImage = nil;
#else
NSImage* appImage = nil;
#endif
OSImage* appImage = nil;
int attempts = 0;
while (![self isCancelled] && appImage == nil && attempts++ < MAX_ATTEMPTS) {