Merge branch 'mkirk/fix-build-warnings'

This commit is contained in:
Michael Kirk 2017-12-04 12:52:34 -05:00
commit 2cc417daf7
33 changed files with 81 additions and 71 deletions

View file

@ -185,7 +185,7 @@ SPEC CHECKSUMS:
PureLayout: 4d550abe49a94f24c2808b9b95db9131685fe4cd
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c
SignalServiceKit: cfcc3b067458b74392750ed324fb40d5bcfa2b2a
SignalServiceKit: e1fa31c513e47afcb02c9c540d2931fd24d86311
SocketRocket: dbb1554b8fc288ef8ef370d6285aeca7361be31e
SQLCipher: 43d12c0eb9c57fb438749618fc3ce0065509a559
TwistedOakCollapsingFutures: f359b90f203e9ab13dfb92c9ff41842a7fe1cd0c

View file

@ -3493,6 +3493,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 9B533A9FA46206D3D99C9ADA /* Pods-SignalMessaging.debug.xcconfig */;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
@ -3546,6 +3547,7 @@
baseConfigurationReference = 948239851C08032C842937CC /* Pods-SignalMessaging.test.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
@ -3618,6 +3620,7 @@
baseConfigurationReference = 8EEE74B0753448C085B48721 /* Pods-SignalMessaging.app store release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";

View file

@ -67,7 +67,7 @@ class ModalActivityIndicatorViewController: OWSViewController {
override func loadView() {
super.loadView()
self.view.backgroundColor = UIColor(colorLiteralRed: 0, green: 0, blue: 0, alpha: 0.25)
self.view.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.25)
self.view.isOpaque = false
let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle:.whiteLarge)

View file

@ -28,7 +28,7 @@ class ExperienceUpgrade: TSYapDatabaseObject {
super.init(uniqueId: uniqueId)
}
required init!(coder: NSCoder!) {
required init!(coder: NSCoder) {
// This is the unfortunate seam between strict swift and fast-and-loose objc
// we can't leave these properties nil, since we really "don't know" that the superclass
// will assign them.

View file

@ -802,7 +802,7 @@ extension URLSessionTask {
return
}
guard let httpResponse = task.response as? HTTPURLResponse else {
Logger.error("\(TAG) missing or unexpected response: \(task.response)")
Logger.error("\(TAG) missing or unexpected response: \(String(describing: task.response))")
segmentRequestDidFail(assetRequest:assetRequest, assetSegment:assetSegment)
return
}

View file

@ -18,6 +18,12 @@ NS_ASSUME_NONNULL_BEGIN
return [UIApplication sharedApplication].applicationState == UIApplicationStateActive;
}
- (BOOL)isRTL
{
return
[[UIApplication sharedApplication] userInterfaceLayoutDirection] == UIUserInterfaceLayoutDirectionRightToLeft;
}
- (UIApplicationState)mainApplicationState
{
return [UIApplication sharedApplication].applicationState;

View file

@ -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.

View file

@ -4,6 +4,7 @@
#import "OWSMath.h"
#import "UIView+OWS.h"
#import <SignalServiceKit/AppContext.h>
NS_ASSUME_NONNULL_BEGIN
@ -252,12 +253,11 @@ 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 {
return
[UIApplication sharedApplication].userInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft;
return [CurrentAppContext() isRTL];
}
}
@ -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;

View file

@ -27,6 +27,12 @@ An Objective-C library for communicating with the Signal messaging service.
s.requires_arc = true
s.source_files = 'SignalServiceKit/src/**/*.{h,m,mm}'
# We want to use modules to avoid clobbering CocoaLumberjack macros defined
# by other OWS modules which *also* import CocoaLumberjack. But because we
# also use Objective-C++, modules are disabled unless we explicitly enable
# them
s.compiler_flags = "-fcxx-modules"
s.prefix_header_file = 'SignalServiceKit/src/TSPrefix.h'
s.xcconfig = { 'OTHER_CFLAGS' => '$(inherited) -DSQLITE_HAS_CODEC' }

View file

@ -344,7 +344,7 @@ static const NSTimeInterval kSignedPreKeyUpdateFailureMaxFailureDuration = 10 *
[self clearSignedPreKeyRecordsWithKeyId:currentSignedPrekeyId success:nil];
}
+ (void)clearSignedPreKeyRecordsWithKeyId:(NSNumber *)keyId success:(void (^_Nullable)())successHandler
+ (void)clearSignedPreKeyRecordsWithKeyId:(NSNumber *)keyId success:(void (^_Nullable)(void))successHandler
{
if (!keyId) {
OWSFail(@"%@ Ignoring request to clear signed preKeys since no keyId was specified", self.logTag);

View file

@ -49,7 +49,7 @@ NS_ASSUME_NONNULL_BEGIN
andImage:(nullable UIImage *)image
andContactID:(ABRecordID)record;
- (instancetype)initWithSystemContact:(CNContact *)contact;
- (instancetype)initWithSystemContact:(CNContact *)contact NS_AVAILABLE_IOS(9_0);
- (NSString *)nameForPhoneNumber:(NSString *)recipientId;

View file

@ -305,7 +305,7 @@ static const CGFloat kAttachmentDownloadProgressTheta = 0.001f;
return;
}
void (^abortDownload)() = ^{
void (^abortDownload)(void) = ^{
OWSFail(@"%@ Download aborted.", self.logTag);
[task cancel];
};

View file

@ -9,7 +9,7 @@ NS_ASSUME_NONNULL_BEGIN
@class OWSSignalServiceProtosEnvelope;
typedef void (^DecryptSuccessBlock)(NSData *_Nullable plaintextData);
typedef void (^DecryptFailureBlock)();
typedef void (^DecryptFailureBlock)(void);
@interface OWSMessageDecrypter : OWSMessageHandler

View file

@ -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

View file

@ -47,7 +47,7 @@ static const CGFloat kAttachmentUploadProgressTheta = 0.001f;
success:(void (^)(void))successHandler
failure:(RetryableFailureHandler)failureHandler
{
void (^successHandlerWrapper)() = ^{
void (^successHandlerWrapper)(void) = ^{
[self fireProgressNotification:1 attachmentId:attachmentStream.uniqueId];
successHandler();
@ -61,7 +61,7 @@ static const CGFloat kAttachmentUploadProgressTheta = 0.001f;
if (attachmentStream.serverId) {
DDLogDebug(@"%@ Attachment previously uploaded.", self.logTag);
successHandlerWrapper(outgoingMessage);
successHandlerWrapper();
return;
}

View file

@ -1,4 +1,6 @@
// Copyright © 2016 Open Whisper Systems. All rights reserved.
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "TSRequest.h"
@ -12,4 +14,4 @@ NS_ASSUME_NONNULL_BEGIN
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END

View file

@ -8,7 +8,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface TSProfileAvatarUploadFormRequest : TSRequest
- (nullable instancetype)init;
- (instancetype)init;
@end

View file

@ -9,7 +9,7 @@ NS_ASSUME_NONNULL_BEGIN
@implementation TSProfileAvatarUploadFormRequest
- (nullable instancetype)init
- (instancetype)init
{
self = [super initWithURL:[NSURL URLWithString:textSecureProfileAvatarFormAPI]];

View file

@ -20,7 +20,7 @@ extern NSString *const kNSNotificationName_IsCensorshipCircumventionActiveDidCha
@property (atomic, readonly) BOOL isCensorshipCircumventionActive;
@property (nonatomic, readonly) BOOL hasCensoredPhoneNumber;
@property (atomic, readonly) BOOL hasCensoredPhoneNumber;
+ (instancetype)sharedInstance;

View file

@ -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

View file

@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)auditAsync;
// completion, if present, will be invoked on the main thread.
+ (void)auditAndCleanupAsync:(void (^_Nullable)())completion;
+ (void)auditAndCleanupAsync:(void (^_Nullable)(void))completion;
+ (NSSet<NSString *> *)filePathsInAttachmentsFolder;

View file

@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
});
}
+ (void)auditAndCleanupAsync:(void (^_Nullable)())completion
+ (void)auditAndCleanupAsync:(void (^_Nullable)(void))completion
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[OWSOrphanedDataCleaner auditAndCleanup:YES completion:completion];
@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN
// They can't be cleaned up - we don't want to delete the TSAttachmentStream or
// its corresponding message. Better that the broken message shows up in the
// conversation view.
+ (void)auditAndCleanup:(BOOL)shouldCleanup completion:(void (^_Nullable)())completion
+ (void)auditAndCleanup:(BOOL)shouldCleanup completion:(void (^_Nullable)(void))completion
{
NSSet<NSString *> *diskFilePaths = [self filePathsInAttachmentsFolder];
long long totalFileSize = [self fileSizeOfFilePaths:diskFilePaths.allObjects];

View file

@ -34,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
* Specifically, these migration should not depend on or affect the data
* of any database view.
*/
- (void)setupDatabaseWithSafeBlockingMigrations:(void (^_Nonnull)())safeBlockingMigrationsBlock;
- (void)setupDatabaseWithSafeBlockingMigrations:(void (^_Nonnull)(void))safeBlockingMigrationsBlock;
- (void)deleteThreadsAndMessages;
- (void)resetSignalStorage;

View file

@ -307,7 +307,7 @@ void setDatabaseInitialized()
};
}
- (void)setupDatabaseWithSafeBlockingMigrations:(void (^_Nonnull)())safeBlockingMigrationsBlock
- (void)setupDatabaseWithSafeBlockingMigrations:(void (^_Nonnull)(void))safeBlockingMigrationsBlock
{
// Synchronously register extensions which are essential for views.
[TSDatabaseView registerCrossProcessNotifier];

View file

@ -2,8 +2,6 @@
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
@class TSNumberVerifier;
#ifndef TextSecureKit_Constants_h
#define TextSecureKit_Constants_h
@ -15,8 +13,6 @@ typedef NS_ENUM(NSInteger, TSWhisperMessageType) {
TSUnencryptedWhisperMessageType = 4,
};
typedef enum { kSMSVerification, kPhoneNumberVerification } VerificationTransportType;
#pragma mark Server Address
#define textSecureHTTPTimeOut 10
@ -41,7 +37,6 @@ typedef enum { kSMSVerification, kPhoneNumberVerification } VerificationTranspor
//
//#endif
#define textSecureGeneralAPI @"v1"
#define textSecureAccountsAPI @"v1/accounts"
#define textSecureAttributesAPI @"/attributes/"
@ -59,14 +54,4 @@ typedef enum { kSMSVerification, kPhoneNumberVerification } VerificationTranspor
#define SignalApplicationGroup @"group.org.whispersystems.signal.group"
#pragma mark Push RegistrationSpecific Constants
typedef NS_ENUM(NSInteger, TSPushRegistrationError) {
TSPushRegistrationErrorNetwork,
TSPushRegistrationErrorAuthentication,
TSPushRegistrationErrorRequest
};
typedef void (^failedPushRegistrationRequestBlock)(TSPushRegistrationError error);
#endif

View file

@ -4,15 +4,12 @@
#import <Foundation/Foundation.h>
#import <CocoaLumberjack/CocoaLumberjack.h>
#define LOG_LEVEL_DEF sskLogLevel
#define LOG_ASYNC_ENABLED YES
@import CocoaLumberjack;
#ifdef DEBUG
static const NSUInteger sskLogLevel = DDLogLevelAll;
static const NSUInteger ddLogLevel = DDLogLevelAll;
#else
static const NSUInteger sskLogLevel = DDLogLevelInfo;
static const NSUInteger ddLogLevel = DDLogLevelInfo;
#endif
#import "Asserts.h"

View file

@ -26,6 +26,8 @@ typedef void (^BackgroundTaskExpirationHandler)(void);
// Should only be called if isMainApp is YES.
- (void)setMainAppBadgeNumber:(NSInteger)value;
- (BOOL)isRTL;
@end
id<AppContext> CurrentAppContext(void);

View file

@ -44,7 +44,7 @@ typedef NS_ENUM(NSUInteger, OWSAnalyticsSeverity) {
@end
typedef NSDictionary<NSString *, id> *_Nonnull (^OWSProdAssertParametersBlock)();
typedef NSDictionary<NSString *, id> *_Nonnull (^OWSProdAssertParametersBlock)(void);
// These methods should be used to assert errors for which we want to fire analytics events.
//

View file

@ -222,8 +222,8 @@ NSString *NSStringForOWSAnalyticsSeverity(OWSAnalyticsSeverity severity)
- (void)submitEvent:(NSDictionary *)eventDictionary
eventKey:(NSString *)eventKey
success:(void (^_Nonnull)())successBlock
failure:(void (^_Nonnull)())failureBlock
success:(void (^_Nonnull)(void))successBlock
failure:(void (^_Nonnull)(void))failureBlock
{
OWSAssert(eventDictionary);
OWSAssert(eventKey);
@ -311,7 +311,7 @@ NSString *NSStringForOWSAnalyticsSeverity(OWSAnalyticsSeverity severity)
return;
}
void (^addEvent)() = ^{
void (^addEvent)(void) = ^{
// Add super properties.
NSMutableDictionary *eventProperties = (properties ? [properties mutableCopy] : [NSMutableDictionary new]);
[eventProperties addEntriesFromDictionary:self.eventSuperProperties];

View file

@ -24,6 +24,6 @@ NS_ASSUME_NONNULL_BEGIN
@end
void AssertIsOnMainThread();
void AssertIsOnMainThread(void);
NS_ASSUME_NONNULL_END

View file

@ -30,12 +30,12 @@ typedef NS_ENUM(NSInteger, OWSErrorCode) {
};
extern NSError *OWSErrorWithCodeDescription(OWSErrorCode code, NSString *description);
extern NSError *OWSErrorMakeUnableToProcessServerResponseError();
extern NSError *OWSErrorMakeFailedToSendOutgoingMessageError();
extern NSError *OWSErrorMakeNoSuchSignalRecipientError();
extern NSError *OWSErrorMakeAssertionError();
extern NSError *OWSErrorMakeMessageSendDisabledDueToPreKeyUpdateFailuresError();
extern NSError *OWSErrorMakeMessageSendFailedToBlockListError();
extern NSError *OWSErrorMakeWriteAttachmentDataError();
extern NSError *OWSErrorMakeUnableToProcessServerResponseError(void);
extern NSError *OWSErrorMakeFailedToSendOutgoingMessageError(void);
extern NSError *OWSErrorMakeNoSuchSignalRecipientError(void);
extern NSError *OWSErrorMakeAssertionError(void);
extern NSError *OWSErrorMakeMessageSendDisabledDueToPreKeyUpdateFailuresError(void);
extern NSError *OWSErrorMakeMessageSendFailedToBlockListError(void);
extern NSError *OWSErrorMakeWriteAttachmentDataError(void);
NS_ASSUME_NONNULL_END

View file

@ -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\"") \

View file

@ -18,6 +18,15 @@ NS_ASSUME_NONNULL_BEGIN
return NO;
}
- (BOOL)isRTL
{
// Borrowed from PureLayout's AppExtension compatible RTL support.
// App Extensions may not access -[UIApplication sharedApplication]; fall back to checking the bundle's preferred
// localization character direction
return [NSLocale characterDirectionForLanguage:[[NSBundle mainBundle] preferredLocalizations][0]]
== NSLocaleLanguageDirectionRightToLeft;
}
- (UIApplicationState)mainApplicationState
{
OWSFail(@"%@ called %s.", self.logTag, __PRETTY_FUNCTION__);