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
pull/1/head
Michael Kirk 9 years ago
parent 4d320d6015
commit 933281f234

@ -1,14 +1,10 @@
--- ---
BasedOnStyle: Chromium BasedOnStyle: WebKit
AlignTrailingComments: true AllowShortFunctionsOnASingleLine: false
AlignConsecutiveAssignments: true
AllowShortIfStatementsOnASingleLine: false
BreakBeforeBraces: Attach
BinPackArguments: false BinPackArguments: false
BinPackParameters: false BinPackParameters: false
ColumnLimit: 120 ColumnLimit: 120
IndentWidth: 4 IndentCaseLabels: true
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 2 MaxEmptyLinesToKeep: 2
ObjCSpaceAfterProperty: true ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true ObjCSpaceBeforeProtocolList: true

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

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

@ -12,7 +12,11 @@
- (id)init - (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; return nil;
} }

@ -64,7 +64,11 @@
- (NSString *)description - (NSString *)description
{ {
return [NSString stringWithFormat:@"<%@: senderId=%@, senderDisplayName=%@, date=%@, type=%ld>", 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 - (TSMessageAdapterType)messageType

@ -48,7 +48,11 @@
- (NSString *)description - (NSString *)description
{ {
return [NSString stringWithFormat:@"<%@: senderId=%@, senderDisplayName=%@, date=%@, type=%ld>", 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 @end

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

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

Loading…
Cancel
Save