diff --git a/.clang-format b/.clang-format index 0ef36b1e5..6d3ed1c24 100644 --- a/.clang-format +++ b/.clang-format @@ -1,14 +1,10 @@ --- -BasedOnStyle: Chromium -AlignTrailingComments: true -AlignConsecutiveAssignments: true -AllowShortIfStatementsOnASingleLine: false -BreakBeforeBraces: Attach +BasedOnStyle: WebKit +AllowShortFunctionsOnASingleLine: false BinPackArguments: false BinPackParameters: false ColumnLimit: 120 -IndentWidth: 4 -KeepEmptyLinesAtTheStartOfBlocks: false +IndentCaseLabels: true MaxEmptyLinesToKeep: 2 ObjCSpaceAfterProperty: true ObjCSpaceBeforeProtocolList: true diff --git a/src/Contacts/TSThread.m b/src/Contacts/TSThread.m index 56c5a64c5..8be9329b1 100644 --- a/src/Contacts/TSThread.m +++ b/src/Contacts/TSThread.m @@ -21,7 +21,7 @@ @property (nonatomic, retain) NSDate *lastMessageDate; @property (nonatomic, copy) NSString *messageDraft; -- (TSInteraction *) lastInteraction; +- (TSInteraction *)lastInteraction; @end @@ -111,7 +111,7 @@ if (self.lastInteraction == nil) { return @""; } else { - return self.lastInteraction.description; + return [self lastInteraction].description; } } diff --git a/src/Messages/Interactions/TSMessage.m b/src/Messages/Interactions/TSMessage.m index 5cdc9c4f2..66f22342a 100644 --- a/src/Messages/Interactions/TSMessage.m +++ b/src/Messages/Interactions/TSMessage.m @@ -55,13 +55,25 @@ NSString *const TSAttachementsRelationshipEdgeName = @"TSAttachmentEdge"; return self; } -- (BOOL)hasAttachments { +- (BOOL)hasAttachments +{ return self.attachments ? (self.attachments.count > 0) : false; } -- (NSString *)description { +- (NSString *)debugDescription +{ if ([self hasAttachments]) { - NSString *attachmentId = self.attachments[0]; + NSString *attachmentId = self.attachments[0]; + return [NSString stringWithFormat:@"Media Message with attachmentId:%@", attachmentId]; + } else { + return [NSString stringWithFormat:@"Message with body:%@", self.body]; + } +} + +- (NSString *)description +{ + if ([self hasAttachments]) { + NSString *attachmentId = self.attachments[0]; TSAttachment *attachment = [TSAttachment fetchObjectWithUniqueID:attachmentId]; if (attachment) { return attachment.description; diff --git a/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.m b/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.m index 9005cf06c..f96613a41 100644 --- a/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.m +++ b/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.m @@ -69,7 +69,7 @@ NSString *collection, NSString *key, id object, NSUInteger index, BOOL *stop) { TSInteraction *interaction = (TSInteraction *)object; - DDLogVerbose(@"Interaction type: %@", interaction.description); + DDLogVerbose(@"Interaction type: %@", interaction.debugDescription); if ([interaction isKindOfClass:[TSInvalidIdentityKeyErrorMessage class]]) { TSInvalidIdentityKeyErrorMessage *invalidKeyMessage =