diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index 890a13395..4865a188e 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -777,7 +777,10 @@ static NSTimeInterval launchStartedAt; OutboundCallInitiator *outboundCallInitiator = SignalApp.sharedApp.outboundCallInitiator; OWSAssert(outboundCallInitiator); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" [outboundCallInitiator initiateCallWithHandle:phoneNumber]; +#pragma GCC diagnostic pop }]; return YES; } else if ([userActivity.activityType isEqualToString:@"INStartAudioCallIntent"]) { @@ -821,7 +824,10 @@ static NSTimeInterval launchStartedAt; OutboundCallInitiator *outboundCallInitiator = SignalApp.sharedApp.outboundCallInitiator; OWSAssert(outboundCallInitiator); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" [outboundCallInitiator initiateCallWithHandle:phoneNumber]; +#pragma GCC diagnostic pop }]; return YES; } else { diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 789a54f39..6ffd11414 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -1456,7 +1456,10 @@ typedef enum : NSUInteger { return; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" [self.outboundCallInitiator initiateCallWithRecipientId:self.thread.contactIdentifier isVideo:isVideo]; +#pragma GCC diagnostic pop } - (BOOL)canCall diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m index c2ceae6a3..df71d3664 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m @@ -786,6 +786,11 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType) } case OWSMessageCellType_Unknown: { OWSFail(@"%@ No text to share", self.logTag); + break; + } + case OWSMessageCellType_ContactShare: { + OWSFail(@"%@ share contact not implemented.", self.logTag); + break; } } } @@ -796,6 +801,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType) case OWSMessageCellType_Unknown: case OWSMessageCellType_TextMessage: case OWSMessageCellType_OversizeTextMessage: + case OWSMessageCellType_ContactShare: OWSFail(@"No media to share."); break; case OWSMessageCellType_StillImage: diff --git a/Signal/src/ViewControllers/HomeView/HomeViewController.m b/Signal/src/ViewControllers/HomeView/HomeViewController.m index 762155537..27a72a5ef 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewController.m +++ b/Signal/src/ViewControllers/HomeView/HomeViewController.m @@ -116,7 +116,10 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations _threadViewModelCache = [NSCache new]; // Ensure ExperienceUpgradeFinder has been initialized. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" [ExperienceUpgradeFinder sharedManager]; +#pragma GCC diagnostic pop [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(blockedPhoneNumbersDidChange:) diff --git a/Signal/src/ViewControllers/NewContactThreadViewController.m b/Signal/src/ViewControllers/NewContactThreadViewController.m index bc531085a..886ba2ba8 100644 --- a/Signal/src/ViewControllers/NewContactThreadViewController.m +++ b/Signal/src/ViewControllers/NewContactThreadViewController.m @@ -758,13 +758,7 @@ NS_ASSUME_NONNULL_BEGIN case MessageComposeResultCancelled: break; case MessageComposeResultFailed: { - UIAlertView *warningAlert = - [[UIAlertView alloc] initWithTitle:@"" - message:NSLocalizedString(@"SEND_INVITE_FAILURE", @"") - delegate:nil - cancelButtonTitle:NSLocalizedString(@"OK", @"") - otherButtonTitles:nil]; - [warningAlert show]; + [OWSAlerts showErrorAlertWithMessage:NSLocalizedString(@"SEND_INVITE_FAILURE", @"")]; break; } case MessageComposeResultSent: { @@ -772,13 +766,8 @@ NS_ASSUME_NONNULL_BEGIN completion:^{ DDLogDebug(@"view controller dismissed"); }]; - UIAlertView *successAlert = [[UIAlertView alloc] - initWithTitle:@"" - message:NSLocalizedString(@"SEND_INVITE_SUCCESS", @"Alert body after invite succeeded") - delegate:nil - cancelButtonTitle:NSLocalizedString(@"OK", @"") - otherButtonTitles:nil]; - [successAlert show]; + [OWSAlerts + showAlertWithTitle:NSLocalizedString(@"SEND_INVITE_SUCCESS", @"Alert body after invite succeeded")]; break; } default: diff --git a/Signal/src/network/PushManager.m b/Signal/src/network/PushManager.m index 37859c532..1b5101346 100644 --- a/Signal/src/network/PushManager.m +++ b/Signal/src/network/PushManager.m @@ -112,13 +112,19 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe DDLogInfo(@"%@ received remote notification", self.logTag); [AppReadiness runNowOrWhenAppIsReady:^{ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" [self.messageFetcherJob run]; +#pragma GCC diagnostic pop }]; } - (void)applicationDidBecomeActive { [AppReadiness runNowOrWhenAppIsReady:^{ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" [self.messageFetcherJob run]; +#pragma GCC diagnostic pop }]; } diff --git a/SignalMessaging/attachments/SignalAttachment.swift b/SignalMessaging/attachments/SignalAttachment.swift index b31dcd997..147b18ae2 100644 --- a/SignalMessaging/attachments/SignalAttachment.swift +++ b/SignalMessaging/attachments/SignalAttachment.swift @@ -39,7 +39,7 @@ extension String { } extension SignalAttachmentError: LocalizedError { - public var errorDescription: String { + public var errorDescription: String? { switch self { case .missingData: return NSLocalizedString("ATTACHMENT_ERROR_MISSING_DATA", comment: "Attachment error message for attachments without any data") @@ -222,13 +222,21 @@ public class SignalAttachment: NSObject { owsFail("\(logTag) Missing error") return nil } + guard let errorDescription = error.errorDescription else { + owsFail("\(logTag) Missing error description") + return nil + } - return "\(error.errorDescription)" + return "\(errorDescription)" } @objc public class var missingDataErrorMessage: String { - return SignalAttachmentError.missingData.errorDescription + guard let errorDescription = SignalAttachmentError.missingData.errorDescription else { + owsFail("\(logTag) Missing error description") + return "" + } + return errorDescription } @objc diff --git a/SignalMessaging/contacts/SystemContactsFetcher.swift b/SignalMessaging/contacts/SystemContactsFetcher.swift index 672938ac5..b85abc582 100644 --- a/SignalMessaging/contacts/SystemContactsFetcher.swift +++ b/SignalMessaging/contacts/SystemContactsFetcher.swift @@ -185,7 +185,7 @@ public class SystemContactsFetcher: NSObject { * where we might need contact access, but will ensure we don't wastefully reload contacts * if we have already fetched contacts. * - * @param completion completion handler is called on main thread. + * @param completionParam completion handler is called on main thread. */ @objc public func requestOnce(completion completionParam: ((Error?) -> Void)?) { diff --git a/SignalMessaging/utils/OWSGroupAvatarBuilder.m b/SignalMessaging/utils/OWSGroupAvatarBuilder.m index beb4f49fb..fd5648f32 100644 --- a/SignalMessaging/utils/OWSGroupAvatarBuilder.m +++ b/SignalMessaging/utils/OWSGroupAvatarBuilder.m @@ -1,9 +1,10 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "OWSGroupAvatarBuilder.h" #import "TSGroupThread.h" + NS_ASSUME_NONNULL_BEGIN @interface OWSGroupAvatarBuilder () diff --git a/SignalServiceKit/src/Devices/OWSBlockedPhoneNumbersMessage.h b/SignalServiceKit/src/Devices/OWSBlockedPhoneNumbersMessage.h index a0d37041f..81f450ad6 100644 --- a/SignalServiceKit/src/Devices/OWSBlockedPhoneNumbersMessage.h +++ b/SignalServiceKit/src/Devices/OWSBlockedPhoneNumbersMessage.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "OWSOutgoingSyncMessage.h" @@ -8,7 +8,9 @@ NS_ASSUME_NONNULL_BEGIN @interface OWSBlockedPhoneNumbersMessage : OWSOutgoingSyncMessage -- (instancetype)initWithPhoneNumbers:(NSArray *)phoneNumbers; +- (instancetype)init NS_UNAVAILABLE; + +- (instancetype)initWithPhoneNumbers:(NSArray *)phoneNumbers NS_DESIGNATED_INITIALIZER; @end diff --git a/SignalServiceKit/src/Devices/OWSReadReceiptsForLinkedDevicesMessage.h b/SignalServiceKit/src/Devices/OWSReadReceiptsForLinkedDevicesMessage.h index ae57b9910..b3fa2e54d 100644 --- a/SignalServiceKit/src/Devices/OWSReadReceiptsForLinkedDevicesMessage.h +++ b/SignalServiceKit/src/Devices/OWSReadReceiptsForLinkedDevicesMessage.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "OWSOutgoingSyncMessage.h" @@ -10,7 +10,9 @@ NS_ASSUME_NONNULL_BEGIN @interface OWSReadReceiptsForLinkedDevicesMessage : OWSOutgoingSyncMessage -- (instancetype)initWithReadReceipts:(NSArray *)readReceipts; +- (instancetype)init NS_UNAVAILABLE; + +- (instancetype)initWithReadReceipts:(NSArray *)readReceipts NS_DESIGNATED_INITIALIZER; @end diff --git a/SignalServiceKit/src/Devices/OWSReadReceiptsForSenderMessage.h b/SignalServiceKit/src/Devices/OWSReadReceiptsForSenderMessage.h index a3c2aaa5f..de15a8fa6 100644 --- a/SignalServiceKit/src/Devices/OWSReadReceiptsForSenderMessage.h +++ b/SignalServiceKit/src/Devices/OWSReadReceiptsForSenderMessage.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "OWSOutgoingSyncMessage.h" @@ -10,6 +10,17 @@ NS_ASSUME_NONNULL_BEGIN @interface OWSReadReceiptsForSenderMessage : TSOutgoingMessage +- (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp + inThread:(nullable TSThread *)thread + messageBody:(nullable NSString *)body + attachmentIds:(NSMutableArray *)attachmentIds + expiresInSeconds:(uint32_t)expiresInSeconds + expireStartedAt:(uint64_t)expireStartedAt + isVoiceMessage:(BOOL)isVoiceMessage + groupMetaMessage:(TSGroupMetaMessage)groupMetaMessage + quotedMessage:(nullable TSQuotedMessage *)quotedMessage + contactShare:(nullable OWSContact *)contactShare NS_UNAVAILABLE; + - (instancetype)initWithThread:(nullable TSThread *)thread messageTimestamps:(NSArray *)messageTimestamps; @end diff --git a/SignalServiceKit/src/Devices/OWSVerificationStateSyncMessage.h b/SignalServiceKit/src/Devices/OWSVerificationStateSyncMessage.h index a4411c5c8..a03a51c3e 100644 --- a/SignalServiceKit/src/Devices/OWSVerificationStateSyncMessage.h +++ b/SignalServiceKit/src/Devices/OWSVerificationStateSyncMessage.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "OWSOutgoingSyncMessage.h" @@ -9,9 +9,11 @@ NS_ASSUME_NONNULL_BEGIN @interface OWSVerificationStateSyncMessage : OWSOutgoingSyncMessage +- (instancetype)init NS_UNAVAILABLE; + - (instancetype)initWithVerificationState:(OWSVerificationState)verificationState identityKey:(NSData *)identityKey - verificationForRecipientId:(NSString *)recipientId; + verificationForRecipientId:(NSString *)recipientId NS_DESIGNATED_INITIALIZER; // This is a clunky name, but we want to differentiate it from `recipientIdentifier` inherited from `TSOutgoingMessage` @property (nonatomic, readonly) NSString *verificationForRecipientId; diff --git a/SignalServiceKit/src/Messages/DeviceSyncing/OWSOutgoingSentMessageTranscript.h b/SignalServiceKit/src/Messages/DeviceSyncing/OWSOutgoingSentMessageTranscript.h index 01d67c400..0aea4b869 100644 --- a/SignalServiceKit/src/Messages/DeviceSyncing/OWSOutgoingSentMessageTranscript.h +++ b/SignalServiceKit/src/Messages/DeviceSyncing/OWSOutgoingSentMessageTranscript.h @@ -1,4 +1,6 @@ -// Copyright © 2016 Open Whisper Systems. All rights reserved. +// +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// #import "OWSOutgoingSyncMessage.h" @@ -12,7 +14,9 @@ NS_ASSUME_NONNULL_BEGIN */ @interface OWSOutgoingSentMessageTranscript : OWSOutgoingSyncMessage -- (instancetype)initWithOutgoingMessage:(TSOutgoingMessage *)message; +- (instancetype)init NS_UNAVAILABLE; + +- (instancetype)initWithOutgoingMessage:(TSOutgoingMessage *)message NS_DESIGNATED_INITIALIZER; @end diff --git a/SignalServiceKit/src/Messages/DeviceSyncing/OWSOutgoingSyncMessage.h b/SignalServiceKit/src/Messages/DeviceSyncing/OWSOutgoingSyncMessage.h index 257d131c5..cdee6e9b5 100644 --- a/SignalServiceKit/src/Messages/DeviceSyncing/OWSOutgoingSyncMessage.h +++ b/SignalServiceKit/src/Messages/DeviceSyncing/OWSOutgoingSyncMessage.h @@ -1,4 +1,6 @@ -// Copyright © 2016 Open Whisper Systems. All rights reserved. +// +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// #import "TSOutgoingMessage.h" @@ -11,6 +13,19 @@ NS_ASSUME_NONNULL_BEGIN */ @interface OWSOutgoingSyncMessage : TSOutgoingMessage +- (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp + inThread:(nullable TSThread *)thread + messageBody:(nullable NSString *)body + attachmentIds:(NSMutableArray *)attachmentIds + expiresInSeconds:(uint32_t)expiresInSeconds + expireStartedAt:(uint64_t)expireStartedAt + isVoiceMessage:(BOOL)isVoiceMessage + groupMetaMessage:(TSGroupMetaMessage)groupMetaMessage + quotedMessage:(nullable TSQuotedMessage *)quotedMessage + contactShare:(nullable OWSContact *)contactShare NS_UNAVAILABLE; + +- (instancetype)init NS_DESIGNATED_INITIALIZER; + @end NS_ASSUME_NONNULL_END diff --git a/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncConfigurationMessage.h b/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncConfigurationMessage.h index 7f15795ff..6391a0542 100644 --- a/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncConfigurationMessage.h +++ b/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncConfigurationMessage.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "OWSOutgoingSyncMessage.h" @@ -8,7 +8,9 @@ NS_ASSUME_NONNULL_BEGIN @interface OWSSyncConfigurationMessage : OWSOutgoingSyncMessage -- (instancetype)initWithReadReceiptsEnabled:(BOOL)readReceiptsEnabled; +- (instancetype)init NS_UNAVAILABLE; + +- (instancetype)initWithReadReceiptsEnabled:(BOOL)readReceiptsEnabled NS_DESIGNATED_INITIALIZER; @end diff --git a/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncContactsMessage.h b/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncContactsMessage.h index 3cd3a1ad1..356fe1ad0 100644 --- a/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncContactsMessage.h +++ b/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncContactsMessage.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "OWSOutgoingSyncMessage.h" @@ -7,14 +7,17 @@ NS_ASSUME_NONNULL_BEGIN @protocol ProfileManagerProtocol; -@class SignalAccount; + @class OWSIdentityManager; +@class SignalAccount; @interface OWSSyncContactsMessage : OWSOutgoingSyncMessage +- (instancetype)init NS_UNAVAILABLE; + - (instancetype)initWithSignalAccounts:(NSArray *)signalAccounts identityManager:(OWSIdentityManager *)identityManager - profileManager:(id)profileManager; + profileManager:(id)profileManager NS_DESIGNATED_INITIALIZER; - (NSData *)buildPlainTextAttachmentData; diff --git a/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncContactsMessage.m b/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncContactsMessage.m index 966a7e9d3..7d5c85b5f 100644 --- a/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncContactsMessage.m +++ b/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncContactsMessage.m @@ -30,16 +30,7 @@ NS_ASSUME_NONNULL_BEGIN identityManager:(OWSIdentityManager *)identityManager profileManager:(id)profileManager { - self = [super initOutgoingMessageWithTimestamp:[NSDate ows_millisecondTimeStamp] - inThread:nil - messageBody:nil - attachmentIds:[NSMutableArray new] - expiresInSeconds:0 - expireStartedAt:0 - isVoiceMessage:NO - groupMetaMessage:TSGroupMessageUnspecified - quotedMessage:nil - contactShare:nil]; + self = [super init]; if (!self) { return self; } diff --git a/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncGroupsMessage.h b/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncGroupsMessage.h index 212d3051b..261bbd0f1 100644 --- a/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncGroupsMessage.h +++ b/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncGroupsMessage.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "OWSOutgoingSyncMessage.h" @@ -10,6 +10,8 @@ NS_ASSUME_NONNULL_BEGIN @interface OWSSyncGroupsMessage : OWSOutgoingSyncMessage +- (instancetype)init NS_DESIGNATED_INITIALIZER; + - (NSData *)buildPlainTextAttachmentDataWithTransaction:(YapDatabaseReadTransaction *)transaction; @end diff --git a/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncGroupsMessage.m b/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncGroupsMessage.m index 715b46b60..bd010f301 100644 --- a/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncGroupsMessage.m +++ b/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncGroupsMessage.m @@ -17,16 +17,7 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init { - return [super initOutgoingMessageWithTimestamp:[NSDate ows_millisecondTimeStamp] - inThread:nil - messageBody:nil - attachmentIds:[NSMutableArray new] - expiresInSeconds:0 - expireStartedAt:0 - isVoiceMessage:NO - groupMetaMessage:TSGroupMessageUnspecified - quotedMessage:nil - contactShare:nil]; + return [super init]; } - (OWSSignalServiceProtosSyncMessageBuilder *)syncMessageBuilder diff --git a/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncGroupsRequestMessage.h b/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncGroupsRequestMessage.h index 344286b03..1c1be3442 100644 --- a/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncGroupsRequestMessage.h +++ b/SignalServiceKit/src/Messages/DeviceSyncing/OWSSyncGroupsRequestMessage.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "OWSOutgoingSyncMessage.h" @@ -8,7 +8,16 @@ NS_ASSUME_NONNULL_BEGIN @interface OWSSyncGroupsRequestMessage : TSOutgoingMessage -- (instancetype)init NS_UNAVAILABLE; +- (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp + inThread:(nullable TSThread *)thread + messageBody:(nullable NSString *)body + attachmentIds:(NSMutableArray *)attachmentIds + expiresInSeconds:(uint32_t)expiresInSeconds + expireStartedAt:(uint64_t)expireStartedAt + isVoiceMessage:(BOOL)isVoiceMessage + groupMetaMessage:(TSGroupMetaMessage)groupMetaMessage + quotedMessage:(nullable TSQuotedMessage *)quotedMessage + contactShare:(nullable OWSContact *)contactShare NS_UNAVAILABLE; - (instancetype)initWithThread:(nullable TSThread *)thread groupId:(NSData *)groupId; diff --git a/SignalServiceKit/src/Messages/Interactions/OWSContact.m b/SignalServiceKit/src/Messages/Interactions/OWSContact.m index adfefa277..a05c514b8 100644 --- a/SignalServiceKit/src/Messages/Interactions/OWSContact.m +++ b/SignalServiceKit/src/Messages/Interactions/OWSContact.m @@ -495,7 +495,7 @@ NSString *NSStringForContactAddressType(OWSContactAddressType value) NSData *imageData = UIImageJPEGRepresentation(image, (CGFloat)0.9); TSAttachmentStream *attachmentStream = [[TSAttachmentStream alloc] initWithContentType:OWSMimeTypeImageJpeg - byteCount:imageData.length + byteCount:(UInt32)imageData.length sourceFilename:nil]; NSError *error; diff --git a/SignalServiceKit/src/Messages/Interactions/OWSDisappearingMessagesConfigurationMessage.h b/SignalServiceKit/src/Messages/Interactions/OWSDisappearingMessagesConfigurationMessage.h index 59ecc4c2f..37c9a3be8 100644 --- a/SignalServiceKit/src/Messages/Interactions/OWSDisappearingMessagesConfigurationMessage.h +++ b/SignalServiceKit/src/Messages/Interactions/OWSDisappearingMessagesConfigurationMessage.h @@ -1,5 +1,6 @@ -// Created by Michael Kirk on 9/25/16. -// Copyright © 2016 Open Whisper Systems. All rights reserved. +// +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// #import "TSOutgoingMessage.h" @@ -9,6 +10,17 @@ NS_ASSUME_NONNULL_BEGIN @interface OWSDisappearingMessagesConfigurationMessage : TSOutgoingMessage +- (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp + inThread:(nullable TSThread *)thread + messageBody:(nullable NSString *)body + attachmentIds:(NSMutableArray *)attachmentIds + expiresInSeconds:(uint32_t)expiresInSeconds + expireStartedAt:(uint64_t)expireStartedAt + isVoiceMessage:(BOOL)isVoiceMessage + groupMetaMessage:(TSGroupMetaMessage)groupMetaMessage + quotedMessage:(nullable TSQuotedMessage *)quotedMessage + contactShare:(nullable OWSContact *)contactShare NS_UNAVAILABLE; + - (instancetype)initWithConfiguration:(OWSDisappearingMessagesConfiguration *)configuration thread:(TSThread *)thread; @end diff --git a/SignalServiceKit/src/Messages/Interactions/OWSDynamicOutgoingMessage.h b/SignalServiceKit/src/Messages/Interactions/OWSDynamicOutgoingMessage.h index eba50aa55..ea8f21e11 100644 --- a/SignalServiceKit/src/Messages/Interactions/OWSDynamicOutgoingMessage.h +++ b/SignalServiceKit/src/Messages/Interactions/OWSDynamicOutgoingMessage.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "TSOutgoingMessage.h" @@ -13,6 +13,17 @@ typedef NSData *_Nonnull (^DynamicOutgoingMessageBlock)(SignalRecipient *); @interface OWSDynamicOutgoingMessage : TSOutgoingMessage +- (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp + inThread:(nullable TSThread *)thread + messageBody:(nullable NSString *)body + attachmentIds:(NSMutableArray *)attachmentIds + expiresInSeconds:(uint32_t)expiresInSeconds + expireStartedAt:(uint64_t)expireStartedAt + isVoiceMessage:(BOOL)isVoiceMessage + groupMetaMessage:(TSGroupMetaMessage)groupMetaMessage + quotedMessage:(nullable TSQuotedMessage *)quotedMessage + contactShare:(nullable OWSContact *)contactShare NS_UNAVAILABLE; + - (instancetype)initWithPlainTextDataBlock:(DynamicOutgoingMessageBlock)block thread:(nullable TSThread *)thread; - (instancetype)initWithPlainTextDataBlock:(DynamicOutgoingMessageBlock)block timestamp:(uint64_t)timestamp diff --git a/SignalServiceKit/src/Messages/Interactions/OWSEndSessionMessage.h b/SignalServiceKit/src/Messages/Interactions/OWSEndSessionMessage.h index 4e49289f9..62274ed32 100644 --- a/SignalServiceKit/src/Messages/Interactions/OWSEndSessionMessage.h +++ b/SignalServiceKit/src/Messages/Interactions/OWSEndSessionMessage.h @@ -9,6 +9,17 @@ NS_ASSUME_NONNULL_BEGIN NS_SWIFT_NAME(EndSessionMessage) @interface OWSEndSessionMessage : TSOutgoingMessage +- (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp + inThread:(nullable TSThread *)thread + messageBody:(nullable NSString *)body + attachmentIds:(NSMutableArray *)attachmentIds + expiresInSeconds:(uint32_t)expiresInSeconds + expireStartedAt:(uint64_t)expireStartedAt + isVoiceMessage:(BOOL)isVoiceMessage + groupMetaMessage:(TSGroupMetaMessage)groupMetaMessage + quotedMessage:(nullable TSQuotedMessage *)quotedMessage + contactShare:(nullable OWSContact *)contactShare NS_UNAVAILABLE; + - (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(nullable TSThread *)thread NS_DESIGNATED_INITIALIZER; @end diff --git a/SignalServiceKit/src/Messages/Interactions/OWSEndSessionMessage.m b/SignalServiceKit/src/Messages/Interactions/OWSEndSessionMessage.m index 1b76988ee..6ad21affa 100644 --- a/SignalServiceKit/src/Messages/Interactions/OWSEndSessionMessage.m +++ b/SignalServiceKit/src/Messages/Interactions/OWSEndSessionMessage.m @@ -9,6 +9,11 @@ NS_ASSUME_NONNULL_BEGIN @implementation OWSEndSessionMessage +- (instancetype)initWithCoder:(NSCoder *)coder +{ + return [super initWithCoder:coder]; +} + - (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(nullable TSThread *)thread { return [super initOutgoingMessageWithTimestamp:timestamp diff --git a/SignalServiceKit/src/Messages/OWSMessageManager.m b/SignalServiceKit/src/Messages/OWSMessageManager.m index 67097cfc1..7f1179ea1 100644 --- a/SignalServiceKit/src/Messages/OWSMessageManager.m +++ b/SignalServiceKit/src/Messages/OWSMessageManager.m @@ -705,7 +705,7 @@ NS_ASSUME_NONNULL_BEGIN } else if (syncMessage.hasBlocked) { NSArray *blockedPhoneNumbers = [syncMessage.blocked.numbers copy]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - [_blockingManager setBlockedPhoneNumbers:blockedPhoneNumbers sendSyncMessage:NO]; + [self.blockingManager setBlockedPhoneNumbers:blockedPhoneNumbers sendSyncMessage:NO]; }); } else if (syncMessage.read.count > 0) { DDLogInfo(@"%@ Received %ld read receipt(s)", self.logTag, (u_long)syncMessage.read.count); diff --git a/SignalServiceKit/src/Messages/OWSOutgoingCallMessage.h b/SignalServiceKit/src/Messages/OWSOutgoingCallMessage.h index e74a27db4..314460b4e 100644 --- a/SignalServiceKit/src/Messages/OWSOutgoingCallMessage.h +++ b/SignalServiceKit/src/Messages/OWSOutgoingCallMessage.h @@ -1,17 +1,16 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "TSOutgoingMessage.h" NS_ASSUME_NONNULL_BEGIN -@class OWSCallOfferMessage; @class OWSCallAnswerMessage; -@class OWSCallIceUpdateMessage; -@class OWSCallHangupMessage; @class OWSCallBusyMessage; - +@class OWSCallHangupMessage; +@class OWSCallIceUpdateMessage; +@class OWSCallOfferMessage; @class TSThread; /** @@ -19,6 +18,17 @@ NS_ASSUME_NONNULL_BEGIN */ @interface OWSOutgoingCallMessage : TSOutgoingMessage +- (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp + inThread:(nullable TSThread *)thread + messageBody:(nullable NSString *)body + attachmentIds:(NSMutableArray *)attachmentIds + expiresInSeconds:(uint32_t)expiresInSeconds + expireStartedAt:(uint64_t)expireStartedAt + isVoiceMessage:(BOOL)isVoiceMessage + groupMetaMessage:(TSGroupMetaMessage)groupMetaMessage + quotedMessage:(nullable TSQuotedMessage *)quotedMessage + contactShare:(nullable OWSContact *)contactShare NS_UNAVAILABLE; + - (instancetype)initWithThread:(TSThread *)thread offerMessage:(OWSCallOfferMessage *)offerMessage; - (instancetype)initWithThread:(TSThread *)thread answerMessage:(OWSCallAnswerMessage *)answerMessage; - (instancetype)initWithThread:(TSThread *)thread iceUpdateMessage:(OWSCallIceUpdateMessage *)iceUpdateMessage; diff --git a/SignalServiceKit/src/Messages/OWSOutgoingNullMessage.h b/SignalServiceKit/src/Messages/OWSOutgoingNullMessage.h index a42f09a22..f3a4d9c0d 100644 --- a/SignalServiceKit/src/Messages/OWSOutgoingNullMessage.h +++ b/SignalServiceKit/src/Messages/OWSOutgoingNullMessage.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "TSOutgoingMessage.h" @@ -11,6 +11,17 @@ NS_ASSUME_NONNULL_BEGIN @interface OWSOutgoingNullMessage : TSOutgoingMessage +- (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp + inThread:(nullable TSThread *)thread + messageBody:(nullable NSString *)body + attachmentIds:(NSMutableArray *)attachmentIds + expiresInSeconds:(uint32_t)expiresInSeconds + expireStartedAt:(uint64_t)expireStartedAt + isVoiceMessage:(BOOL)isVoiceMessage + groupMetaMessage:(TSGroupMetaMessage)groupMetaMessage + quotedMessage:(nullable TSQuotedMessage *)quotedMessage + contactShare:(nullable OWSContact *)contactShare NS_UNAVAILABLE; + - (instancetype)initWithContactThread:(TSContactThread *)contactThread verificationStateSyncMessage:(OWSVerificationStateSyncMessage *)verificationStateSyncMessage; diff --git a/SignalServiceKit/src/Messages/OWSProfileKeyMessage.h b/SignalServiceKit/src/Messages/OWSProfileKeyMessage.h index b223199ac..e4ef1dbd2 100644 --- a/SignalServiceKit/src/Messages/OWSProfileKeyMessage.h +++ b/SignalServiceKit/src/Messages/OWSProfileKeyMessage.h @@ -8,6 +8,17 @@ NS_ASSUME_NONNULL_BEGIN @interface OWSProfileKeyMessage : TSOutgoingMessage +- (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp + inThread:(nullable TSThread *)thread + messageBody:(nullable NSString *)body + attachmentIds:(NSMutableArray *)attachmentIds + expiresInSeconds:(uint32_t)expiresInSeconds + expireStartedAt:(uint64_t)expireStartedAt + isVoiceMessage:(BOOL)isVoiceMessage + groupMetaMessage:(TSGroupMetaMessage)groupMetaMessage + quotedMessage:(nullable TSQuotedMessage *)quotedMessage + contactShare:(nullable OWSContact *)contactShare NS_UNAVAILABLE; + - (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(nullable TSThread *)thread NS_DESIGNATED_INITIALIZER; @end diff --git a/SignalServiceKit/src/Security/SecurityUtils.m b/SignalServiceKit/src/Security/SecurityUtils.m index 39a2ff575..3a4a68775 100644 --- a/SignalServiceKit/src/Security/SecurityUtils.m +++ b/SignalServiceKit/src/Security/SecurityUtils.m @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "SecurityUtils.h" @@ -9,7 +9,7 @@ + (NSData *)generateRandomBytes:(NSUInteger)length { - return [Randomness generateRandomBytes:length]; + return [Randomness generateRandomBytes:(int)length]; } @end diff --git a/SignalServiceKit/src/Storage/OWSMediaGalleryFinder.h b/SignalServiceKit/src/Storage/OWSMediaGalleryFinder.h index 602e10a1e..3e15bfd78 100644 --- a/SignalServiceKit/src/Storage/OWSMediaGalleryFinder.h +++ b/SignalServiceKit/src/Storage/OWSMediaGalleryFinder.h @@ -11,6 +11,8 @@ NS_ASSUME_NONNULL_BEGIN @interface OWSMediaGalleryFinder : NSObject +- (instancetype)init NS_UNAVAILABLE; + - (instancetype)initWithThread:(TSThread *)thread NS_DESIGNATED_INITIALIZER; // How many media items a thread has