diff --git a/Signal/src/contact/OWSContactsManager.m b/Signal/src/contact/OWSContactsManager.m index 176bc3adb..350e0eeb6 100644 --- a/Signal/src/contact/OWSContactsManager.m +++ b/Signal/src/contact/OWSContactsManager.m @@ -38,7 +38,7 @@ typedef BOOL (^ContactSearchBlock)(id, NSUInteger, BOOL *); } - (void)doAfterEnvironmentInitSetup { - if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(_iOS_9)) { + if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(9, 0)) { self.contactStore = [[CNContactStore alloc] init]; [self.contactStore requestAccessForEntityType:CNEntityTypeContacts completionHandler:^(BOOL granted, NSError *_Nullable error) { diff --git a/Signal/src/environment/iOSVersions.h b/Signal/src/environment/iOSVersions.h index a8ebb772f..d1f60d207 100644 --- a/Signal/src/environment/iOSVersions.h +++ b/Signal/src/environment/iOSVersions.h @@ -9,94 +9,6 @@ #import #include -// Source: https://github.com/carlj/CJAMacros/blob/master/CJAMacros/CJAMacros.h +#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(major, minor) \ + ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){.majorVersion = major, .minorVersion = minor, .patchVersion = 0}]) -/** - Runtime check for the current version Nummer. - checks ( CURRENT_VERSION_NUMBR == GIVEN_VERSION_NUMBER) - @_gVersion - the given Version Number. aka (_iOS_7_0 or NSFoundationVersionNumber_iOS_7_0 and so on) - */ -#define SYSTEM_VERSION_EQUAL_TO(_gVersion) ( floor(NSFoundationVersionNumber) == _gVersion ) - -/** - Runtime check for the current version Nummer. - checks CURRENT_VERSION_NUMBER > GIVEN_VERSION_NUMBER - @_gVersion - the given Version Number. aka (_iOS_7_0 or NSFoundationVersionNumber_iOS_7_0 and so on) - */ -#define SYSTEM_VERSION_GREATER_THAN(_gVersion) ( floor(NSFoundationVersionNumber) > _gVersion ) - -/** - Runtime check for the current version Nummer. - checks CURRENT_VERSION_NUMBER >= GIVEN_VERSION_NUMBER - @_gVersion - the given Version Number. aka (_iOS_7_0 or NSFoundationVersionNumber_iOS_7_0 and so on) - */ -#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(_gVersion) ( floor(NSFoundationVersionNumber) >= _gVersion ) - - -/** - Runtime check for the current version Nummer. - checks CURRENT_VERSION_NUMBER < GIVEN_VERSION_NUMBER - @_gVersion - the given Version Number. aka (_iOS_7_0 or NSFoundationVersionNumber_iOS_7_0 and so on) - */ -#define SYSTEM_VERSION_LESS_THAN(_gVersion) ( floor(NSFoundationVersionNumber) < _gVersion ) - - -/** - Runtime check for the current version Nummer. - checks CURRENT_VERSION_NUMBER <= GIVEN_VERSION_NUMBER - @_gVersion - the given Version Number. aka (_iOS_7_0 or NSFoundationVersionNumber_iOS_7_0 and so on) - */ -#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(_gVersion) ( floor(NSFoundationVersionNumber) <= _gVersion ) - - -//If the symbol for iOS 7 isnt defined, define it. -#ifndef NSFoundationVersionNumber_iOS_7_0 -#define NSFoundationVersionNumber_iOS_7_0 1047.00 //extracted from iOS 7 Header -#endif - -#ifdef NSFoundationVersionNumber_iOS_7_0 -#define _iOS_7_0 NSFoundationVersionNumber_iOS_7_0 -#endif - -//If the symbol for iOS 7.1 isnt defined, define it. -#ifndef NSFoundationVersionNumber_iOS_7_1 -#define NSFoundationVersionNumber_iOS_7_1 1047.25 //extracted from iOS 8 Header -#endif - -#ifdef NSFoundationVersionNumber_iOS_7_1 -#define _iOS_7_1 NSFoundationVersionNumber_iOS_7_1 -#endif - -//If the symbol for iOS 8 isnt defined, define it. -#ifndef NSFoundationVersionNumber_iOS_8_0 -#define NSFoundationVersionNumber_iOS_8_0 1134.10 //extracted with NSLog(@"%f", NSFoundationVersionNumber) -#endif - -#ifdef NSFoundationVersionNumber_iOS_8_0 -#define _iOS_8_0 NSFoundationVersionNumber_iOS_8_0 -#endif - -#ifndef NSFoundationVersionNumber_iOS_8_0_2 -#define NSFoundationVersionNumber_iOS_8_0_2 1140.110000 //extracted with NSLog(@"%f", NSFoundationVersionNumber) -#endif - -#ifdef NSFoundationVersionNumber_iOS_8_0_2 -#define _iOS_8_0_2 NSFoundationVersionNumber_iOS_8_0_2 -#endif - - -#ifndef NSFoundationVersionNumber_iOS_8_2_0 -#define NSFoundationVersionNumber_iOS_8_2_0 1142 //extracted with NSLog(@"%f", NSFoundationVersionNumber) -#endif - -#ifdef NSFoundationVersionNumber_iOS_8_2_0 -#define _iOS_8_2_0 NSFoundationVersionNumber_iOS_8_2_0 -#endif - -#ifndef NSFoundationVersionNumber_iOS_9 -#define NSFoundationVersionNumber_iOS_9 1231 //extracted with NSLog(@"%f", NSFoundationVersionNumber) -#endif - -#ifdef NSFoundationVersionNumber_iOS_9 -#define _iOS_9 NSFoundationVersionNumber_iOS_9 -#endif diff --git a/Signal/src/network/PushManager.m b/Signal/src/network/PushManager.m index e0701db89..3bc4a1665 100644 --- a/Signal/src/network/PushManager.m +++ b/Signal/src/network/PushManager.m @@ -394,7 +394,7 @@ } - (BOOL)supportsVOIPPush { - if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(_iOS_8_2_0)) { + if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(8, 2)) { return YES; } else { return NO; @@ -449,7 +449,7 @@ action_reply.title = NSLocalizedString(@"PUSH_MANAGER_REPLY", @""); action_reply.destructive = NO; action_reply.authenticationRequired = NO; // Since YES is broken in iOS 9 GM - if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(_iOS_9)) { + if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(9, 0)) { action_reply.behavior = UIUserNotificationActionBehaviorTextInput; action_reply.activationMode = UIUserNotificationActivationModeBackground; } else { diff --git a/Signal/src/util/UIFont+OWS.m b/Signal/src/util/UIFont+OWS.m index ea1b68526..613feddfd 100644 --- a/Signal/src/util/UIFont+OWS.m +++ b/Signal/src/util/UIFont+OWS.m @@ -12,19 +12,35 @@ @implementation UIFont (OWS) + (UIFont *)ows_thinFontWithSize:(CGFloat)size { - return [UIFont systemFontOfSize:size weight:UIFontWeightThin]; + if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(8, 2)) { + return [UIFont systemFontOfSize:size weight:UIFontWeightThin]; + } else { + return [UIFont fontWithName:@"HelveticaNeue-Thin" size:size]; + } } + (UIFont *)ows_lightFontWithSize:(CGFloat)size { - return [UIFont systemFontOfSize:size weight:UIFontWeightLight]; + if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(8, 2)) { + return [UIFont systemFontOfSize:size weight:UIFontWeightLight]; + } else { + return [UIFont fontWithName:@"HelveticaNeue-Light" size:size]; + } } + (UIFont *)ows_regularFontWithSize:(CGFloat)size { - return [UIFont systemFontOfSize:size weight:UIFontWeightRegular]; + if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(8, 2)) { + return [UIFont systemFontOfSize:size weight:UIFontWeightRegular]; + } else { + return [UIFont fontWithName:@"HelveticaNeue" size:size]; + } } + (UIFont *)ows_mediumFontWithSize:(CGFloat)size { - return [UIFont systemFontOfSize:size weight:UIFontWeightMedium]; + if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(8, 2)) { + return [UIFont systemFontOfSize:size weight:UIFontWeightMedium]; + } else { + return [UIFont fontWithName:@"HelveticaNeue-Medium" size:size]; + } } + (UIFont *)ows_boldFontWithSize:(CGFloat)size { @@ -43,7 +59,7 @@ } + (UIFont *)ows_dynamicTypeTitle2Font { - if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(_iOS_9)) { + if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(9, 0)) { return [UIFont preferredFontForTextStyle:UIFontTextStyleTitle2]; } else { // Dynamic title font for ios8 defaults to bold 12.0 pt, whereas ios9+ it's 22.0pt regular weight.