Merge branch 'charlesmchen/buildWarnings'

pull/1/head
Matthew Chen 7 years ago
commit 5f66e1b0f7

@ -3747,8 +3747,9 @@ typedef enum : NSUInteger {
lastVisibleIndexPath = indexPath; lastVisibleIndexPath = indexPath;
} }
} }
if (lastVisibleIndexPath && lastVisibleIndexPath.row >= self.viewItems.count) { if (lastVisibleIndexPath && lastVisibleIndexPath.row >= (NSInteger)self.viewItems.count) {
return (self.viewItems.count > 0 ? [NSIndexPath indexPathForRow:self.viewItems.count - 1 inSection:0] : nil); return (self.viewItems.count > 0 ? [NSIndexPath indexPathForRow:(NSInteger)self.viewItems.count - 1 inSection:0]
: nil);
} }
return lastVisibleIndexPath; return lastVisibleIndexPath;
} }

@ -786,6 +786,11 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
} }
case OWSMessageCellType_Unknown: { case OWSMessageCellType_Unknown: {
OWSFail(@"%@ No text to share", self.logTag); 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_Unknown:
case OWSMessageCellType_TextMessage: case OWSMessageCellType_TextMessage:
case OWSMessageCellType_OversizeTextMessage: case OWSMessageCellType_OversizeTextMessage:
case OWSMessageCellType_ContactShare:
OWSFail(@"No media to share."); OWSFail(@"No media to share.");
break; break;
case OWSMessageCellType_StillImage: case OWSMessageCellType_StillImage:

@ -116,7 +116,10 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
_threadViewModelCache = [NSCache new]; _threadViewModelCache = [NSCache new];
// Ensure ExperienceUpgradeFinder has been initialized. // Ensure ExperienceUpgradeFinder has been initialized.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
[ExperienceUpgradeFinder sharedManager]; [ExperienceUpgradeFinder sharedManager];
#pragma GCC diagnostic pop
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(blockedPhoneNumbersDidChange:) selector:@selector(blockedPhoneNumbersDidChange:)

@ -758,13 +758,7 @@ NS_ASSUME_NONNULL_BEGIN
case MessageComposeResultCancelled: case MessageComposeResultCancelled:
break; break;
case MessageComposeResultFailed: { case MessageComposeResultFailed: {
UIAlertView *warningAlert = [OWSAlerts showErrorAlertWithMessage:NSLocalizedString(@"SEND_INVITE_FAILURE", @"")];
[[UIAlertView alloc] initWithTitle:@""
message:NSLocalizedString(@"SEND_INVITE_FAILURE", @"")
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", @"")
otherButtonTitles:nil];
[warningAlert show];
break; break;
} }
case MessageComposeResultSent: { case MessageComposeResultSent: {
@ -772,13 +766,8 @@ NS_ASSUME_NONNULL_BEGIN
completion:^{ completion:^{
DDLogDebug(@"view controller dismissed"); DDLogDebug(@"view controller dismissed");
}]; }];
UIAlertView *successAlert = [[UIAlertView alloc] [OWSAlerts
initWithTitle:@"" showAlertWithTitle:NSLocalizedString(@"SEND_INVITE_SUCCESS", @"Alert body after invite succeeded")];
message:NSLocalizedString(@"SEND_INVITE_SUCCESS", @"Alert body after invite succeeded")
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", @"")
otherButtonTitles:nil];
[successAlert show];
break; break;
} }
default: default:

@ -27,7 +27,7 @@ import SignalMessaging
/** /**
* |handle| is a user formatted phone number, e.g. from a system contacts entry * |handle| is a user formatted phone number, e.g. from a system contacts entry
*/ */
@objc public func initiateCall(handle: String) -> Bool { @discardableResult @objc public func initiateCall(handle: String) -> Bool {
Logger.info("\(TAG) in \(#function) with handle: \(handle)") Logger.info("\(TAG) in \(#function) with handle: \(handle)")
guard let recipientId = PhoneNumber(fromE164: handle)?.toE164() else { guard let recipientId = PhoneNumber(fromE164: handle)?.toE164() else {
@ -41,7 +41,7 @@ import SignalMessaging
/** /**
* |recipientId| is a e164 formatted phone number. * |recipientId| is a e164 formatted phone number.
*/ */
@objc public func initiateCall(recipientId: String, @discardableResult @objc public func initiateCall(recipientId: String,
isVideo: Bool) -> Bool { isVideo: Bool) -> Bool {
// Rather than an init-assigned dependency property, we access `callUIAdapter` via Environment // Rather than an init-assigned dependency property, we access `callUIAdapter` via Environment
// because it can change after app launch due to user settings // because it can change after app launch due to user settings

@ -112,13 +112,19 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
DDLogInfo(@"%@ received remote notification", self.logTag); DDLogInfo(@"%@ received remote notification", self.logTag);
[AppReadiness runNowOrWhenAppIsReady:^{ [AppReadiness runNowOrWhenAppIsReady:^{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
[self.messageFetcherJob run]; [self.messageFetcherJob run];
#pragma GCC diagnostic pop
}]; }];
} }
- (void)applicationDidBecomeActive { - (void)applicationDidBecomeActive {
[AppReadiness runNowOrWhenAppIsReady:^{ [AppReadiness runNowOrWhenAppIsReady:^{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
[self.messageFetcherJob run]; [self.messageFetcherJob run];
#pragma GCC diagnostic pop
}]; }];
} }

@ -39,7 +39,7 @@ extension String {
} }
extension SignalAttachmentError: LocalizedError { extension SignalAttachmentError: LocalizedError {
public var errorDescription: String { public var errorDescription: String? {
switch self { switch self {
case .missingData: case .missingData:
return NSLocalizedString("ATTACHMENT_ERROR_MISSING_DATA", comment: "Attachment error message for attachments without any data") 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") owsFail("\(logTag) Missing error")
return nil return nil
} }
guard let errorDescription = error.errorDescription else {
owsFail("\(logTag) Missing error description")
return nil
}
return "\(error.errorDescription)" return "\(errorDescription)"
} }
@objc @objc
public class var missingDataErrorMessage: String { 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 @objc

@ -19,7 +19,6 @@
#import <SignalServiceKit/PhoneNumber.h> #import <SignalServiceKit/PhoneNumber.h>
#import <SignalServiceKit/SignalAccount.h> #import <SignalServiceKit/SignalAccount.h>
@import AddressBook;
@import Contacts; @import Contacts;
NSString *const OWSContactsManagerSignalAccountsDidChangeNotification NSString *const OWSContactsManagerSignalAccountsDidChangeNotification
@ -570,9 +569,9 @@ NSString *const OWSContactsManagerSignalAccountsDidChangeNotification
NSDictionary<NSString *, id> *normalFontAttributes = NSDictionary<NSString *, id> *normalFontAttributes =
@{ NSFontAttributeName : font, NSForegroundColorAttributeName : [UIColor ows_darkGrayColor] }; @{ NSFontAttributeName : font, NSForegroundColorAttributeName : [UIColor ows_darkGrayColor] };
NSDictionary<NSString *, id> *firstNameAttributes NSDictionary<NSString *, id> *firstNameAttributes
= (ABPersonGetSortOrdering() == kABPersonSortByFirstName ? boldFontAttributes : normalFontAttributes); = (self.shouldSortByGivenName ? boldFontAttributes : normalFontAttributes);
NSDictionary<NSString *, id> *lastNameAttributes NSDictionary<NSString *, id> *lastNameAttributes
= (ABPersonGetSortOrdering() == kABPersonSortByFirstName ? normalFontAttributes : boldFontAttributes); = (self.shouldSortByGivenName ? normalFontAttributes : boldFontAttributes);
NSString *cachedFirstName = [self cachedFirstNameForRecipientId:recipientId]; NSString *cachedFirstName = [self cachedFirstNameForRecipientId:recipientId];
NSString *cachedLastName = [self cachedLastNameForRecipientId:recipientId]; NSString *cachedLastName = [self cachedLastNameForRecipientId:recipientId];
@ -585,8 +584,20 @@ NSString *const OWSContactsManagerSignalAccountsDidChangeNotification
NSAttributedString *lastName = NSAttributedString *lastName =
[[NSAttributedString alloc] initWithString:cachedLastName attributes:lastNameAttributes]; [[NSAttributedString alloc] initWithString:cachedLastName attributes:lastNameAttributes];
CNContact *_Nullable cnContact = self.allContactsMap[recipientId].cnContact;
if (!cnContact) {
// If we don't have a CNContact for this recipient id, make one.
// Presumably [CNContactFormatter nameOrderForContact:] tries
// to localizes its result based on the languages/scripts used
// in the contact's fields.
CNMutableContact *formatContact = [CNMutableContact new];
formatContact.givenName = firstName.string;
formatContact.familyName = lastName.string;
cnContact = formatContact;
}
CNContactDisplayNameOrder nameOrder = [CNContactFormatter nameOrderForContact:cnContact];
NSAttributedString *_Nullable leftName, *_Nullable rightName; NSAttributedString *_Nullable leftName, *_Nullable rightName;
if (ABPersonGetCompositeNameFormat() == kABPersonCompositeNameFormatFirstNameFirst) { if (nameOrder == CNContactDisplayNameOrderGivenNameFirst) {
leftName = firstName; leftName = firstName;
rightName = lastName; rightName = lastName;
} else { } else {
@ -812,11 +823,16 @@ NSString *const OWSContactsManagerSignalAccountsDidChangeNotification
}; };
} }
- (BOOL)shouldSortByGivenName
{
return [[CNContactsUserDefaults sharedDefaults] sortOrder] == CNContactSortOrderGivenName;
}
- (NSString *)comparableNameForSignalAccount:(SignalAccount *)signalAccount - (NSString *)comparableNameForSignalAccount:(SignalAccount *)signalAccount
{ {
NSString *_Nullable name; NSString *_Nullable name;
if (signalAccount.contact) { if (signalAccount.contact) {
if (ABPersonGetSortOrdering() == kABPersonSortByFirstName) { if (self.shouldSortByGivenName) {
name = signalAccount.contact.comparableNameFirstLast; name = signalAccount.contact.comparableNameFirstLast;
} else { } else {
name = signalAccount.contact.comparableNameLastFirst; name = signalAccount.contact.comparableNameLastFirst;

@ -185,7 +185,7 @@ public class SystemContactsFetcher: NSObject {
* where we might need contact access, but will ensure we don't wastefully reload contacts * where we might need contact access, but will ensure we don't wastefully reload contacts
* if we have already fetched 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 @objc
public func requestOnce(completion completionParam: ((Error?) -> Void)?) { public func requestOnce(completion completionParam: ((Error?) -> Void)?) {

@ -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 "OWSGroupAvatarBuilder.h"
#import "TSGroupThread.h" #import "TSGroupThread.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface OWSGroupAvatarBuilder () @interface OWSGroupAvatarBuilder ()

@ -27,6 +27,8 @@ NS_ASSUME_NONNULL_BEGIN
@end @end
#pragma mark -
@implementation TSThread @implementation TSThread
+ (NSString *)collection { + (NSString *)collection {

@ -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" #import "OWSOutgoingSyncMessage.h"
@ -8,7 +8,9 @@ NS_ASSUME_NONNULL_BEGIN
@interface OWSBlockedPhoneNumbersMessage : OWSOutgoingSyncMessage @interface OWSBlockedPhoneNumbersMessage : OWSOutgoingSyncMessage
- (instancetype)initWithPhoneNumbers:(NSArray<NSString *> *)phoneNumbers; - (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithPhoneNumbers:(NSArray<NSString *> *)phoneNumbers NS_DESIGNATED_INITIALIZER;
@end @end

@ -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" #import "OWSOutgoingSyncMessage.h"
@ -10,7 +10,9 @@ NS_ASSUME_NONNULL_BEGIN
@interface OWSReadReceiptsForLinkedDevicesMessage : OWSOutgoingSyncMessage @interface OWSReadReceiptsForLinkedDevicesMessage : OWSOutgoingSyncMessage
- (instancetype)initWithReadReceipts:(NSArray<OWSLinkedDeviceReadReceipt *> *)readReceipts; - (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithReadReceipts:(NSArray<OWSLinkedDeviceReadReceipt *> *)readReceipts NS_DESIGNATED_INITIALIZER;
@end @end

@ -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" #import "OWSOutgoingSyncMessage.h"
@ -10,6 +10,17 @@ NS_ASSUME_NONNULL_BEGIN
@interface OWSReadReceiptsForSenderMessage : TSOutgoingMessage @interface OWSReadReceiptsForSenderMessage : TSOutgoingMessage
- (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
messageBody:(nullable NSString *)body
attachmentIds:(NSMutableArray<NSString *> *)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<NSNumber *> *)messageTimestamps; - (instancetype)initWithThread:(nullable TSThread *)thread messageTimestamps:(NSArray<NSNumber *> *)messageTimestamps;
@end @end

@ -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" #import "OWSOutgoingSyncMessage.h"
@ -9,9 +9,11 @@ NS_ASSUME_NONNULL_BEGIN
@interface OWSVerificationStateSyncMessage : OWSOutgoingSyncMessage @interface OWSVerificationStateSyncMessage : OWSOutgoingSyncMessage
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithVerificationState:(OWSVerificationState)verificationState - (instancetype)initWithVerificationState:(OWSVerificationState)verificationState
identityKey:(NSData *)identityKey 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` // This is a clunky name, but we want to differentiate it from `recipientIdentifier` inherited from `TSOutgoingMessage`
@property (nonatomic, readonly) NSString *verificationForRecipientId; @property (nonatomic, readonly) NSString *verificationForRecipientId;

@ -1,4 +1,6 @@
// Copyright © 2016 Open Whisper Systems. All rights reserved. //
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "OWSOutgoingSyncMessage.h" #import "OWSOutgoingSyncMessage.h"
@ -12,7 +14,9 @@ NS_ASSUME_NONNULL_BEGIN
*/ */
@interface OWSOutgoingSentMessageTranscript : OWSOutgoingSyncMessage @interface OWSOutgoingSentMessageTranscript : OWSOutgoingSyncMessage
- (instancetype)initWithOutgoingMessage:(TSOutgoingMessage *)message; - (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithOutgoingMessage:(TSOutgoingMessage *)message NS_DESIGNATED_INITIALIZER;
@end @end

@ -1,4 +1,6 @@
// Copyright © 2016 Open Whisper Systems. All rights reserved. //
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "TSOutgoingMessage.h" #import "TSOutgoingMessage.h"
@ -11,6 +13,19 @@ NS_ASSUME_NONNULL_BEGIN
*/ */
@interface OWSOutgoingSyncMessage : TSOutgoingMessage @interface OWSOutgoingSyncMessage : TSOutgoingMessage
- (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
messageBody:(nullable NSString *)body
attachmentIds:(NSMutableArray<NSString *> *)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 @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

@ -12,6 +12,16 @@ NS_ASSUME_NONNULL_BEGIN
@implementation OWSOutgoingSyncMessage @implementation OWSOutgoingSyncMessage
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
}
return self;
}
- (instancetype)init - (instancetype)init
{ {
self = [super initOutgoingMessageWithTimestamp:[NSDate ows_millisecondTimeStamp] self = [super initOutgoingMessageWithTimestamp:[NSDate ows_millisecondTimeStamp]

@ -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" #import "OWSOutgoingSyncMessage.h"
@ -8,7 +8,9 @@ NS_ASSUME_NONNULL_BEGIN
@interface OWSSyncConfigurationMessage : OWSOutgoingSyncMessage @interface OWSSyncConfigurationMessage : OWSOutgoingSyncMessage
- (instancetype)initWithReadReceiptsEnabled:(BOOL)readReceiptsEnabled; - (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithReadReceiptsEnabled:(BOOL)readReceiptsEnabled NS_DESIGNATED_INITIALIZER;
@end @end

@ -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" #import "OWSOutgoingSyncMessage.h"
@ -7,14 +7,17 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@protocol ProfileManagerProtocol; @protocol ProfileManagerProtocol;
@class SignalAccount;
@class OWSIdentityManager; @class OWSIdentityManager;
@class SignalAccount;
@interface OWSSyncContactsMessage : OWSOutgoingSyncMessage @interface OWSSyncContactsMessage : OWSOutgoingSyncMessage
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithSignalAccounts:(NSArray<SignalAccount *> *)signalAccounts - (instancetype)initWithSignalAccounts:(NSArray<SignalAccount *> *)signalAccounts
identityManager:(OWSIdentityManager *)identityManager identityManager:(OWSIdentityManager *)identityManager
profileManager:(id<ProfileManagerProtocol>)profileManager; profileManager:(id<ProfileManagerProtocol>)profileManager NS_DESIGNATED_INITIALIZER;
- (NSData *)buildPlainTextAttachmentData; - (NSData *)buildPlainTextAttachmentData;

@ -30,16 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
identityManager:(OWSIdentityManager *)identityManager identityManager:(OWSIdentityManager *)identityManager
profileManager:(id<ProfileManagerProtocol>)profileManager profileManager:(id<ProfileManagerProtocol>)profileManager
{ {
self = [super initOutgoingMessageWithTimestamp:[NSDate ows_millisecondTimeStamp] self = [super init];
inThread:nil
messageBody:nil
attachmentIds:[NSMutableArray new]
expiresInSeconds:0
expireStartedAt:0
isVoiceMessage:NO
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:nil
contactShare:nil];
if (!self) { if (!self) {
return self; return self;
} }

@ -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" #import "OWSOutgoingSyncMessage.h"
@ -10,6 +10,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface OWSSyncGroupsMessage : OWSOutgoingSyncMessage @interface OWSSyncGroupsMessage : OWSOutgoingSyncMessage
- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (NSData *)buildPlainTextAttachmentDataWithTransaction:(YapDatabaseReadTransaction *)transaction; - (NSData *)buildPlainTextAttachmentDataWithTransaction:(YapDatabaseReadTransaction *)transaction;
@end @end

@ -17,16 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)init - (instancetype)init
{ {
return [super initOutgoingMessageWithTimestamp:[NSDate ows_millisecondTimeStamp] return [super init];
inThread:nil
messageBody:nil
attachmentIds:[NSMutableArray new]
expiresInSeconds:0
expireStartedAt:0
isVoiceMessage:NO
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:nil
contactShare:nil];
} }
- (OWSSignalServiceProtosSyncMessageBuilder *)syncMessageBuilder - (OWSSignalServiceProtosSyncMessageBuilder *)syncMessageBuilder

@ -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" #import "OWSOutgoingSyncMessage.h"
@ -8,7 +8,16 @@ NS_ASSUME_NONNULL_BEGIN
@interface OWSSyncGroupsRequestMessage : TSOutgoingMessage @interface OWSSyncGroupsRequestMessage : TSOutgoingMessage
- (instancetype)init NS_UNAVAILABLE; - (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
messageBody:(nullable NSString *)body
attachmentIds:(NSMutableArray<NSString *> *)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; - (instancetype)initWithThread:(nullable TSThread *)thread groupId:(NSData *)groupId;

@ -495,7 +495,7 @@ NSString *NSStringForContactAddressType(OWSContactAddressType value)
NSData *imageData = UIImageJPEGRepresentation(image, (CGFloat)0.9); NSData *imageData = UIImageJPEGRepresentation(image, (CGFloat)0.9);
TSAttachmentStream *attachmentStream = [[TSAttachmentStream alloc] initWithContentType:OWSMimeTypeImageJpeg TSAttachmentStream *attachmentStream = [[TSAttachmentStream alloc] initWithContentType:OWSMimeTypeImageJpeg
byteCount:imageData.length byteCount:(UInt32)imageData.length
sourceFilename:nil]; sourceFilename:nil];
NSError *error; NSError *error;

@ -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" #import "TSOutgoingMessage.h"
@ -9,6 +10,17 @@ NS_ASSUME_NONNULL_BEGIN
@interface OWSDisappearingMessagesConfigurationMessage : TSOutgoingMessage @interface OWSDisappearingMessagesConfigurationMessage : TSOutgoingMessage
- (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
messageBody:(nullable NSString *)body
attachmentIds:(NSMutableArray<NSString *> *)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; - (instancetype)initWithConfiguration:(OWSDisappearingMessagesConfiguration *)configuration thread:(TSThread *)thread;
@end @end

@ -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" #import "TSOutgoingMessage.h"
@ -13,6 +13,17 @@ typedef NSData *_Nonnull (^DynamicOutgoingMessageBlock)(SignalRecipient *);
@interface OWSDynamicOutgoingMessage : TSOutgoingMessage @interface OWSDynamicOutgoingMessage : TSOutgoingMessage
- (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
messageBody:(nullable NSString *)body
attachmentIds:(NSMutableArray<NSString *> *)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 thread:(nullable TSThread *)thread;
- (instancetype)initWithPlainTextDataBlock:(DynamicOutgoingMessageBlock)block - (instancetype)initWithPlainTextDataBlock:(DynamicOutgoingMessageBlock)block
timestamp:(uint64_t)timestamp timestamp:(uint64_t)timestamp

@ -9,6 +9,17 @@ NS_ASSUME_NONNULL_BEGIN
NS_SWIFT_NAME(EndSessionMessage) NS_SWIFT_NAME(EndSessionMessage)
@interface OWSEndSessionMessage : TSOutgoingMessage @interface OWSEndSessionMessage : TSOutgoingMessage
- (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
messageBody:(nullable NSString *)body
attachmentIds:(NSMutableArray<NSString *> *)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; - (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(nullable TSThread *)thread NS_DESIGNATED_INITIALIZER;
@end @end

@ -9,6 +9,11 @@ NS_ASSUME_NONNULL_BEGIN
@implementation OWSEndSessionMessage @implementation OWSEndSessionMessage
- (instancetype)initWithCoder:(NSCoder *)coder
{
return [super initWithCoder:coder];
}
- (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(nullable TSThread *)thread - (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(nullable TSThread *)thread
{ {
return [super initOutgoingMessageWithTimestamp:timestamp return [super initOutgoingMessageWithTimestamp:timestamp

@ -705,7 +705,7 @@ NS_ASSUME_NONNULL_BEGIN
} else if (syncMessage.hasBlocked) { } else if (syncMessage.hasBlocked) {
NSArray<NSString *> *blockedPhoneNumbers = [syncMessage.blocked.numbers copy]; NSArray<NSString *> *blockedPhoneNumbers = [syncMessage.blocked.numbers copy];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 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) { } else if (syncMessage.read.count > 0) {
DDLogInfo(@"%@ Received %ld read receipt(s)", self.logTag, (u_long)syncMessage.read.count); DDLogInfo(@"%@ Received %ld read receipt(s)", self.logTag, (u_long)syncMessage.read.count);

@ -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" #import "TSOutgoingMessage.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@class OWSCallOfferMessage;
@class OWSCallAnswerMessage; @class OWSCallAnswerMessage;
@class OWSCallIceUpdateMessage;
@class OWSCallHangupMessage;
@class OWSCallBusyMessage; @class OWSCallBusyMessage;
@class OWSCallHangupMessage;
@class OWSCallIceUpdateMessage;
@class OWSCallOfferMessage;
@class TSThread; @class TSThread;
/** /**
@ -19,6 +18,17 @@ NS_ASSUME_NONNULL_BEGIN
*/ */
@interface OWSOutgoingCallMessage : TSOutgoingMessage @interface OWSOutgoingCallMessage : TSOutgoingMessage
- (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
messageBody:(nullable NSString *)body
attachmentIds:(NSMutableArray<NSString *> *)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 offerMessage:(OWSCallOfferMessage *)offerMessage;
- (instancetype)initWithThread:(TSThread *)thread answerMessage:(OWSCallAnswerMessage *)answerMessage; - (instancetype)initWithThread:(TSThread *)thread answerMessage:(OWSCallAnswerMessage *)answerMessage;
- (instancetype)initWithThread:(TSThread *)thread iceUpdateMessage:(OWSCallIceUpdateMessage *)iceUpdateMessage; - (instancetype)initWithThread:(TSThread *)thread iceUpdateMessage:(OWSCallIceUpdateMessage *)iceUpdateMessage;

@ -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" #import "TSOutgoingMessage.h"
@ -11,6 +11,17 @@ NS_ASSUME_NONNULL_BEGIN
@interface OWSOutgoingNullMessage : TSOutgoingMessage @interface OWSOutgoingNullMessage : TSOutgoingMessage
- (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
messageBody:(nullable NSString *)body
attachmentIds:(NSMutableArray<NSString *> *)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 - (instancetype)initWithContactThread:(TSContactThread *)contactThread
verificationStateSyncMessage:(OWSVerificationStateSyncMessage *)verificationStateSyncMessage; verificationStateSyncMessage:(OWSVerificationStateSyncMessage *)verificationStateSyncMessage;

@ -8,6 +8,17 @@ NS_ASSUME_NONNULL_BEGIN
@interface OWSProfileKeyMessage : TSOutgoingMessage @interface OWSProfileKeyMessage : TSOutgoingMessage
- (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
messageBody:(nullable NSString *)body
attachmentIds:(NSMutableArray<NSString *> *)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; - (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(nullable TSThread *)thread NS_DESIGNATED_INITIALIZER;
@end @end

@ -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" #import "SecurityUtils.h"
@ -9,7 +9,7 @@
+ (NSData *)generateRandomBytes:(NSUInteger)length + (NSData *)generateRandomBytes:(NSUInteger)length
{ {
return [Randomness generateRandomBytes:length]; return [Randomness generateRandomBytes:(int)length];
} }
@end @end

@ -11,6 +11,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface OWSMediaGalleryFinder : NSObject @interface OWSMediaGalleryFinder : NSObject
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithThread:(TSThread *)thread NS_DESIGNATED_INITIALIZER; - (instancetype)initWithThread:(TSThread *)thread NS_DESIGNATED_INITIALIZER;
// How many media items a thread has // How many media items a thread has

Loading…
Cancel
Save