mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
New @available syntax avoids compiler warnings
// FREEBIE
This commit is contained in:
parent
f96b7bc27c
commit
0138777343
5 changed files with 16 additions and 16 deletions
|
@ -8,7 +8,7 @@
|
|||
|
||||
+ (UIFont *)ows_thinFontWithSize:(CGFloat)size
|
||||
{
|
||||
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(8, 2)) {
|
||||
if (@available(iOS 8.2, *)) {
|
||||
return [UIFont systemFontOfSize:size weight:UIFontWeightThin];
|
||||
} else {
|
||||
return [UIFont fontWithName:@"HelveticaNeue-Thin" size:size];
|
||||
|
@ -17,7 +17,7 @@
|
|||
|
||||
+ (UIFont *)ows_lightFontWithSize:(CGFloat)size
|
||||
{
|
||||
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(8, 2)) {
|
||||
if (@available(iOS 8.2, *)) {
|
||||
return [UIFont systemFontOfSize:size weight:UIFontWeightLight];
|
||||
} else {
|
||||
return [UIFont fontWithName:@"HelveticaNeue-Light" size:size];
|
||||
|
@ -26,7 +26,7 @@
|
|||
|
||||
+ (UIFont *)ows_regularFontWithSize:(CGFloat)size
|
||||
{
|
||||
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(8, 2)) {
|
||||
if (@available(iOS 8.2, *)) {
|
||||
return [UIFont systemFontOfSize:size weight:UIFontWeightRegular];
|
||||
} else {
|
||||
return [UIFont fontWithName:@"HelveticaNeue" size:size];
|
||||
|
@ -35,7 +35,7 @@
|
|||
|
||||
+ (UIFont *)ows_mediumFontWithSize:(CGFloat)size
|
||||
{
|
||||
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(8, 2)) {
|
||||
if (@available(iOS 8.2, *)) {
|
||||
return [UIFont systemFontOfSize:size weight:UIFontWeightMedium];
|
||||
} else {
|
||||
return [UIFont fontWithName:@"HelveticaNeue-Medium" size:size];
|
||||
|
@ -83,7 +83,7 @@
|
|||
|
||||
+ (UIFont *)ows_dynamicTypeTitle2Font
|
||||
{
|
||||
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(9, 0)) {
|
||||
if (@available(iOS 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.
|
||||
|
@ -96,7 +96,7 @@
|
|||
|
||||
+ (UIFont *)ows_dynamicTypeHeadlineFont
|
||||
{
|
||||
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(9, 0)) {
|
||||
if (@available(iOS 9.0, *)) {
|
||||
return [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline];
|
||||
} else {
|
||||
// See ows_dynamicTypeTitle2Font.
|
||||
|
|
|
@ -252,7 +252,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
|
|||
|
||||
- (BOOL)isRTL
|
||||
{
|
||||
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(9, 0)) {
|
||||
if (@available(iOS 9.0, *)) {
|
||||
return ([UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.semanticContentAttribute]
|
||||
== UIUserInterfaceLayoutDirectionRightToLeft);
|
||||
} else {
|
||||
|
@ -268,7 +268,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
|
|||
|
||||
- (NSLayoutConstraint *)autoPinLeadingToSuperviewWithMargin:(CGFloat)margin
|
||||
{
|
||||
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(9, 0)) {
|
||||
if (@available(iOS 9.0, *)) {
|
||||
NSLayoutConstraint *constraint =
|
||||
[self.leadingAnchor constraintEqualToAnchor:self.superview.layoutMarginsGuide.leadingAnchor
|
||||
constant:margin];
|
||||
|
@ -287,7 +287,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
|
|||
|
||||
- (NSLayoutConstraint *)autoPinTrailingToSuperviewWithMargin:(CGFloat)margin
|
||||
{
|
||||
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(9, 0)) {
|
||||
if (@available(iOS 9.0, *)) {
|
||||
NSLayoutConstraint *constraint =
|
||||
[self.trailingAnchor constraintEqualToAnchor:self.superview.layoutMarginsGuide.trailingAnchor
|
||||
constant:-margin];
|
||||
|
@ -310,7 +310,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
|
|||
{
|
||||
OWSAssert(view);
|
||||
|
||||
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(9, 0)) {
|
||||
if (@available(iOS 9.0, *)) {
|
||||
NSLayoutConstraint *constraint =
|
||||
[self.leadingAnchor constraintEqualToAnchor:view.trailingAnchor constant:margin];
|
||||
constraint.active = YES;
|
||||
|
@ -331,7 +331,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
|
|||
{
|
||||
OWSAssert(view);
|
||||
|
||||
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(9, 0)) {
|
||||
if (@available(iOS 9.0, *)) {
|
||||
NSLayoutConstraint *constraint =
|
||||
[self.trailingAnchor constraintEqualToAnchor:view.leadingAnchor constant:-margin];
|
||||
constraint.active = YES;
|
||||
|
@ -352,7 +352,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
|
|||
{
|
||||
OWSAssert(view);
|
||||
|
||||
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(9, 0)) {
|
||||
if (@available(iOS 9.0, *)) {
|
||||
NSLayoutConstraint *constraint =
|
||||
[self.leadingAnchor constraintEqualToAnchor:view.leadingAnchor constant:margin];
|
||||
constraint.active = YES;
|
||||
|
@ -373,7 +373,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
|
|||
{
|
||||
OWSAssert(view);
|
||||
|
||||
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(9, 0)) {
|
||||
if (@available(iOS 9.0, *)) {
|
||||
NSLayoutConstraint *constraint =
|
||||
[self.trailingAnchor constraintEqualToAnchor:view.trailingAnchor constant:margin];
|
||||
constraint.active = YES;
|
||||
|
|
|
@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
void AssertIsOnSendingQueue()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(10, 0)) {
|
||||
if (@available(iOS 10.0, *)) {
|
||||
dispatch_assert_queue([OWSDispatch sendingQueue]);
|
||||
} // else, skip assert as it's a development convenience.
|
||||
#endif
|
||||
|
|
|
@ -11,7 +11,7 @@ NSString *const kSessionStoreDBConnectionKey = @"kSessionStoreDBConnectionKey";
|
|||
void AssertIsOnSessionStoreQueue()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(10, 0)) {
|
||||
if (@available(iOS 10.0, *)) {
|
||||
dispatch_assert_queue([OWSDispatch sessionStoreQueue]);
|
||||
} // else, skip assert as it's a development convenience.
|
||||
#endif
|
||||
|
|
|
@ -8,7 +8,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
#define AssertOnDispatchQueue(queue) \
|
||||
{ \
|
||||
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(10, 0)) { \
|
||||
if (@available(iOS 10.0, *)) { \
|
||||
dispatch_assert_queue(queue); \
|
||||
} else { \
|
||||
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \
|
||||
|
|
Loading…
Reference in a new issue