Clean up codebase.

pull/1/head
Matthew Chen 7 years ago
parent c2f092018c
commit 59c745756a

@ -714,7 +714,7 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Presentation #pragma mark - Presentation
- (void)presentFromViewController:(UIViewController *)viewController replacingView:(UIView *)view; - (void)presentFromViewController:(UIViewController *)viewController replacingView:(UIView *)view
{ {
self.replacingView = view; self.replacingView = view;
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:self]; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:self];

@ -147,7 +147,7 @@ NS_ASSUME_NONNULL_BEGIN
[UIApplication.sharedApplication endBackgroundTask:backgroundTaskIdentifier]; [UIApplication.sharedApplication endBackgroundTask:backgroundTaskIdentifier];
} }
- (void)ensureSleepBlocking:(BOOL)shouldBeBlocking blockingObjects:(NSArray<id> *)blockingObjects; - (void)ensureSleepBlocking:(BOOL)shouldBeBlocking blockingObjects:(NSArray<id> *)blockingObjects
{ {
if (UIApplication.sharedApplication.isIdleTimerDisabled != shouldBeBlocking) { if (UIApplication.sharedApplication.isIdleTimerDisabled != shouldBeBlocking) {
if (shouldBeBlocking) { if (shouldBeBlocking) {

@ -38,7 +38,7 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
@implementation SharingThreadPickerViewController @implementation SharingThreadPickerViewController
- (instancetype)initWithShareViewDelegate:(id<ShareViewDelegate>)shareViewDelegate; - (instancetype)initWithShareViewDelegate:(id<ShareViewDelegate>)shareViewDelegate
{ {
self = [super init]; self = [super init];
if (!self) { if (!self) {

@ -223,7 +223,7 @@ NSString *const OWSContactsManagerSignalAccountsDidChangeNotification
}); });
} }
- (void)buildSignalAccountsAndClearStaleCache:(BOOL)shouldClearStaleCache; - (void)buildSignalAccountsAndClearStaleCache:(BOOL)shouldClearStaleCache
{ {
dispatch_async(self.serialQueue, ^{ dispatch_async(self.serialQueue, ^{
NSMutableArray<SignalAccount *> *signalAccounts = [NSMutableArray new]; NSMutableArray<SignalAccount *> *signalAccounts = [NSMutableArray new];

@ -710,7 +710,7 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
}]; }];
} }
- (void)setProfileKeyData:(NSData *)profileKeyData forRecipientId:(NSString *)recipientId; - (void)setProfileKeyData:(NSData *)profileKeyData forRecipientId:(NSString *)recipientId
{ {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
OWSAES256Key *_Nullable profileKey = [OWSAES256Key keyWithData:profileKeyData]; OWSAES256Key *_Nullable profileKey = [OWSAES256Key keyWithData:profileKeyData];
@ -895,7 +895,7 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
- (void)updateProfileForRecipientId:(NSString *)recipientId - (void)updateProfileForRecipientId:(NSString *)recipientId
profileNameEncrypted:(nullable NSData *)profileNameEncrypted profileNameEncrypted:(nullable NSData *)profileNameEncrypted
avatarUrlPath:(nullable NSString *)avatarUrlPath; avatarUrlPath:(nullable NSString *)avatarUrlPath
{ {
OWSAssert(recipientId.length > 0); OWSAssert(recipientId.length > 0);

@ -262,7 +262,7 @@ NSString *const kLocalProfileUniqueId = @"kLocalProfileUniqueId";
- (void)clearWithProfileKey:(OWSAES256Key *)profileKey - (void)clearWithProfileKey:(OWSAES256Key *)profileKey
dbConnection:(YapDatabaseConnection *)dbConnection dbConnection:(YapDatabaseConnection *)dbConnection
completion:(nullable OWSUserProfileCompletion)completion; completion:(nullable OWSUserProfileCompletion)completion
{ {
[self applyChanges:^(OWSUserProfile *userProfile) { [self applyChanges:^(OWSUserProfile *userProfile) {
[userProfile setProfileKey:profileKey]; [userProfile setProfileKey:profileKey];
@ -279,7 +279,7 @@ NSString *const kLocalProfileUniqueId = @"kLocalProfileUniqueId";
- (void)updateWithProfileKey:(OWSAES256Key *)profileKey - (void)updateWithProfileKey:(OWSAES256Key *)profileKey
dbConnection:(YapDatabaseConnection *)dbConnection dbConnection:(YapDatabaseConnection *)dbConnection
completion:(nullable OWSUserProfileCompletion)completion; completion:(nullable OWSUserProfileCompletion)completion
{ {
OWSAssert(profileKey); OWSAssert(profileKey);

@ -1,5 +1,5 @@
// //
// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// //
#import "OWSLinkedDeviceReadReceipt.h" #import "OWSLinkedDeviceReadReceipt.h"
@ -8,7 +8,7 @@ NS_ASSUME_NONNULL_BEGIN
@implementation OWSLinkedDeviceReadReceipt @implementation OWSLinkedDeviceReadReceipt
- (instancetype)initWithSenderId:(NSString *)senderId timestamp:(uint64_t)timestamp; - (instancetype)initWithSenderId:(NSString *)senderId timestamp:(uint64_t)timestamp
{ {
OWSAssert(senderId.length > 0 && timestamp > 0); OWSAssert(senderId.length > 0 && timestamp > 0);

@ -1,5 +1,5 @@
// //
// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// //
#import "OWSReadReceiptsForSenderMessage.h" #import "OWSReadReceiptsForSenderMessage.h"
@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
@implementation OWSReadReceiptsForSenderMessage @implementation OWSReadReceiptsForSenderMessage
- (instancetype)initWithThread:(nullable TSThread *)thread messageTimestamps:(NSArray<NSNumber *> *)messageTimestamps; - (instancetype)initWithThread:(nullable TSThread *)thread messageTimestamps:(NSArray<NSNumber *> *)messageTimestamps
{ {
self = [super initWithTimestamp:[NSDate ows_millisecondTimeStamp] inThread:thread]; self = [super initWithTimestamp:[NSDate ows_millisecondTimeStamp] inThread:thread];
if (!self) { if (!self) {

@ -1,9 +1,10 @@
// //
// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// //
#import "OWSOutgoingSyncMessage.h" #import "OWSOutgoingSyncMessage.h"
#import "Cryptography.h" #import "Cryptography.h"
#import "NSDate+OWS.h"
#import "OWSSignalServiceProtos.pb.h" #import "OWSSignalServiceProtos.pb.h"
#import "ProtoBuf+OWS.h" #import "ProtoBuf+OWS.h"
@ -11,6 +12,16 @@ NS_ASSUME_NONNULL_BEGIN
@implementation OWSOutgoingSyncMessage @implementation OWSOutgoingSyncMessage
- (instancetype)init
{
self = [super initWithTimestamp:[NSDate ows_millisecondTimeStamp]];
if (!self) {
return self;
}
return self;
}
- (BOOL)shouldBeSaved - (BOOL)shouldBeSaved
{ {
return NO; return NO;

@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
@implementation OWSRequestFactory @implementation OWSRequestFactory
+ (TSRequest *)enable2FARequestWithPin:(NSString *)pin; + (TSRequest *)enable2FARequestWithPin:(NSString *)pin
{ {
OWSAssert(pin.length > 0); OWSAssert(pin.length > 0);
@ -212,8 +212,8 @@ NS_ASSUME_NONNULL_BEGIN
relay:(nullable NSString *)relay relay:(nullable NSString *)relay
timeStamp:(uint64_t)timeStamp timeStamp:(uint64_t)timeStamp
{ {
// NOTE: messages may be empty; See comments in OWSDeviceManager.
OWSAssert(recipientId.length > 0); OWSAssert(recipientId.length > 0);
OWSAssert(messages.count > 0);
OWSAssert(timeStamp > 0); OWSAssert(timeStamp > 0);
NSString *path = [textSecureMessagesAPI stringByAppendingString:recipientId]; NSString *path = [textSecureMessagesAPI stringByAppendingString:recipientId];

@ -101,7 +101,7 @@ NSString *const TSStorageManagerKeyPrekeyCurrentSignedPrekeyId = @"currentSigned
#pragma mark - Prekey update failures #pragma mark - Prekey update failures
- (int)prekeyUpdateFailureCount; - (int)prekeyUpdateFailureCount
{ {
NSNumber *value = [self.dbReadConnection objectForKey:TSStorageManagerKeyPrekeyUpdateFailureCount NSNumber *value = [self.dbReadConnection objectForKey:TSStorageManagerKeyPrekeyUpdateFailureCount
inCollection:TSStorageManagerSignedPreKeyMetadataCollection]; inCollection:TSStorageManagerSignedPreKeyMetadataCollection];

@ -303,7 +303,7 @@ const NSUInteger kAES256_KeyByteLength = 32;
withKey:(NSData *)key withKey:(NSData *)key
digest:(nullable NSData *)digest digest:(nullable NSData *)digest
unpaddedSize:(UInt32)unpaddedSize unpaddedSize:(UInt32)unpaddedSize
error:(NSError **)error; error:(NSError **)error
{ {
if (digest.length <= 0) { if (digest.length <= 0) {
// This *could* happen with sufficiently outdated clients. // This *could* happen with sufficiently outdated clients.

@ -256,7 +256,7 @@ NS_ASSUME_NONNULL_BEGIN
} }
} }
+ (nullable DataSource *)dataSourceWithURL:(NSURL *)fileUrl; + (nullable DataSource *)dataSourceWithURL:(NSURL *)fileUrl
{ {
OWSAssert(fileUrl); OWSAssert(fileUrl);
@ -268,7 +268,7 @@ NS_ASSUME_NONNULL_BEGIN
return instance; return instance;
} }
+ (nullable DataSource *)dataSourceWithFilePath:(NSString *)filePath; + (nullable DataSource *)dataSourceWithFilePath:(NSString *)filePath
{ {
OWSAssert(filePath); OWSAssert(filePath);

Loading…
Cancel
Save