format objc.

This is part of unforking JSQMVC, but I'm only reformatting files
otherwise changed rather than reformatting the entire project for git
sanity.

This is intentionally a second commit so we can separate formatting
changes from code changes

* brace should drop after method definition (this is common across
  almost all objc projects, and allows you to quickly differentiate
  multi-line method signatures from their implementation.
* aligning consecutive assignments ongoingly muddies git history

// FREEBIE
This commit is contained in:
Michael Kirk 2016-07-12 16:15:02 -07:00
parent 4d320d6015
commit 933281f234
16 changed files with 127 additions and 120 deletions

View File

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

View File

@ -31,14 +31,17 @@
_status = status;
_messageType = TSCallAdapter;
_detailString = [detailString stringByAppendingFormat:@" "];
}
return self;
}
- (id)init
{
NSAssert(NO,@"%s is not a valid initializer for %@. Use %@ instead", __PRETTY_FUNCTION__, [self class], NSStringFromSelector(@selector(initWithCallerId:callerDisplayName:date:status:displayString:)));
NSAssert(NO,
@"%s is not a valid initializer for %@. Use %@ instead",
__PRETTY_FUNCTION__,
[self class],
NSStringFromSelector(@selector(initWithCallerId:callerDisplayName:date:status:displayString:)));
return nil;
}
@ -58,7 +61,8 @@
return [dateFormatter stringFromDate:_date];
}
-(UIImage*)thumbnailImage {
- (UIImage *)thumbnailImage
{
// This relies on those assets being in the project
if (!_useThumbnail) {
return nil;
@ -86,7 +90,6 @@
}
}
#pragma mark - NSObject
- (BOOL)isEqual:(id)object
@ -95,37 +98,36 @@
return YES;
}
if (![object isKindOfClass:[self class]])
{
if (![object isKindOfClass:[self class]]) {
return NO;
}
JSQCall *aCall = (JSQCall *)object;
return [self.senderId isEqualToString:aCall.senderId]
&& [self.senderDisplayName isEqualToString:aCall.senderDisplayName]
&& ([self.date compare:aCall.date] == NSOrderedSame)
&& self.status == aCall.status;
return [self.senderId isEqualToString:aCall.senderId] &&
[self.senderDisplayName isEqualToString:aCall.senderDisplayName]
&& ([self.date compare:aCall.date] == NSOrderedSame) && self.status == aCall.status;
}
- (NSUInteger)hash
{
return self.senderId.hash ^ self.date.hash;
}
- (NSString *)description
{
return [NSString stringWithFormat:@"<%@: senderId=%@, senderDisplayName=%@, date=%@>",
[self class], self.senderId, self.senderDisplayName, self.date];
[self class],
self.senderId,
self.senderDisplayName,
self.date];
}
#pragma mark - JSQMessageData
// TODO I'm not sure this is right. It affects bubble rendering.
- (BOOL)isMediaMessage {
- (BOOL)isMediaMessage
{
return NO;
}
#pragma mark - NSCoding
- (instancetype)initWithCoder:(NSCoder *)aDecoder
@ -159,12 +161,12 @@
displayString:self.detailString];
}
- (NSUInteger)messageHash{
- (NSUInteger)messageHash
{
return self.hash;
}
- (NSString *)text{
- (NSString *)text
{
return _detailString;
}
@end

View File

@ -6,9 +6,9 @@
// Copyright (c) 2014 Hexed Bits. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "JSQMessageData.h"
#import "TSMessageAdapter.h"
#import <Foundation/Foundation.h>
/* JSQDisplayed message is the parent class for displaying information to the user
* from within the conversation view. Do not use directly :

View File

@ -12,7 +12,11 @@
- (id)init
{
NSAssert(NO,@"%s is not a valid initializer for %@. Use %@ instead", __PRETTY_FUNCTION__, [self class], NSStringFromSelector(@selector(initWithSenderId:senderDisplayName:date:)));
NSAssert(NO,
@"%s is not a valid initializer for %@. Use %@ instead",
__PRETTY_FUNCTION__,
[self class],
NSStringFromSelector(@selector(initWithSenderId:senderDisplayName:date:)));
return nil;
}

View File

@ -64,7 +64,11 @@
- (NSString *)description
{
return [NSString stringWithFormat:@"<%@: senderId=%@, senderDisplayName=%@, date=%@, type=%ld>",
[self class], self.senderId, self.senderDisplayName, self.date, self.errorMessageType];
[self class],
self.senderId,
self.senderDisplayName,
self.date,
self.errorMessageType];
}
- (TSMessageAdapterType)messageType

View File

@ -48,7 +48,11 @@
- (NSString *)description
{
return [NSString stringWithFormat:@"<%@: senderId=%@, senderDisplayName=%@, date=%@, type=%ld>",
[self class], self.senderId, self.senderDisplayName, self.date, self.infoMessageType];
[self class],
self.senderId,
self.senderDisplayName,
self.date,
self.infoMessageType];
}
@end

View File

@ -7,8 +7,8 @@
//
#import "OWSMessagesBubblesSizeCalculator.h"
#import "TSMessageAdapter.h"
#import "JSQDisplayedMessageCollectionViewCell.h"
#import "TSMessageAdapter.h"
@implementation OWSMessagesBubblesSizeCalculator
@ -27,13 +27,10 @@
atIndexPath:(NSIndexPath *)indexPath
withLayout:(JSQMessagesCollectionViewFlowLayout *)layout
{
CGSize superSize = [super messageBubbleSizeForMessageData:messageData
atIndexPath:indexPath
withLayout:layout];
CGSize superSize = [super messageBubbleSizeForMessageData:messageData atIndexPath:indexPath withLayout:layout];
TSMessageAdapter *message = (TSMessageAdapter *)messageData;
if (message.messageType == TSInfoMessageAdapter ||
message.messageType == TSErrorMessageAdapter) {
if (message.messageType == TSInfoMessageAdapter || message.messageType == TSErrorMessageAdapter) {
// Prevent cropping message text by accounting for message container/icon
superSize.height = OWSDisplayedMessageCellHeight;

View File

@ -6,8 +6,8 @@
// Copyright (c) 2014 Hexed Bits. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <JSQMessagesViewController/JSQMessagesCollectionViewCell.h>
#import <UIKit/UIKit.h>
static const CGFloat OWSDisplayedMessageCellHeight = 70.0f;