From 12e8e877197f314692b7925791b641ef497355f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Alcal=C3=A1=20Correa?= Date: Mon, 22 Feb 2016 11:42:58 +0100 Subject: [PATCH 1/6] Add nullability specifiers --- Pod/Classes/NSDictionary+QueryString.h | 4 +++ Pod/Classes/NSDictionary+QueryString.m | 12 +++---- Pod/Classes/NSString+URLEncoding.h | 4 +++ Pod/Classes/PhxChannel.h | 15 +++++---- Pod/Classes/PhxChannel.m | 12 +++++-- Pod/Classes/PhxChannel_Private.h | 8 +++-- Pod/Classes/PhxPush.h | 14 +++++--- Pod/Classes/PhxPush.m | 36 ++++++++++---------- Pod/Classes/PhxPush_Private.h | 7 ++-- Pod/Classes/PhxSocket.h | 12 ++++--- Pod/Classes/PhxSocket.m | 46 +++++++++++++++----------- Pod/Classes/PhxSocket_Private.h | 6 ++-- 12 files changed, 110 insertions(+), 66 deletions(-) diff --git a/Pod/Classes/NSDictionary+QueryString.h b/Pod/Classes/NSDictionary+QueryString.h index 59c7a68..92c928c 100644 --- a/Pod/Classes/NSDictionary+QueryString.h +++ b/Pod/Classes/NSDictionary+QueryString.h @@ -8,7 +8,11 @@ #import +NS_ASSUME_NONNULL_BEGIN + @interface NSDictionary (QueryString) + (NSDictionary *)dictionaryWithQueryString:(NSString *)queryString; - (NSString *)queryStringValue; @end + +NS_ASSUME_NONNULL_END diff --git a/Pod/Classes/NSDictionary+QueryString.m b/Pod/Classes/NSDictionary+QueryString.m index 28fe181..3a3dc20 100644 --- a/Pod/Classes/NSDictionary+QueryString.m +++ b/Pod/Classes/NSDictionary+QueryString.m @@ -11,8 +11,7 @@ @implementation NSDictionary (QueryString) -+ (NSDictionary *)dictionaryWithQueryString:(NSString *)queryString -{ ++ (NSDictionary *)dictionaryWithQueryString:(NSString *)queryString { NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; NSArray *pairs = [queryString componentsSeparatedByString:@"&"]; @@ -26,11 +25,13 @@ + (NSDictionary *)dictionaryWithQueryString:(NSString *)queryString NSString *decodedKey = [key URLDecodedString]; NSString *decodedValue = [value URLDecodedString]; - if (![key isEqualToString:decodedKey]) + if (![key isEqualToString:decodedKey]) { key = decodedKey; + } - if (![value isEqualToString:decodedValue]) + if (![value isEqualToString:decodedValue]) { value = decodedValue; + } [dictionary setObject:value forKey:key]; } @@ -39,8 +40,7 @@ + (NSDictionary *)dictionaryWithQueryString:(NSString *)queryString return [NSDictionary dictionaryWithDictionary:dictionary]; } -- (NSString *)queryStringValue -{ +- (NSString *)queryStringValue { NSMutableArray *pairs = [NSMutableArray array]; for (NSString *key in [self keyEnumerator]) { diff --git a/Pod/Classes/NSString+URLEncoding.h b/Pod/Classes/NSString+URLEncoding.h index 96d4a7f..18435ab 100644 --- a/Pod/Classes/NSString+URLEncoding.h +++ b/Pod/Classes/NSString+URLEncoding.h @@ -8,7 +8,11 @@ #import +NS_ASSUME_NONNULL_BEGIN + @interface NSString (URLEncoding) - (NSString *)URLEncodedString; - (NSString *)URLDecodedString; @end + +NS_ASSUME_NONNULL_END diff --git a/Pod/Classes/PhxChannel.h b/Pod/Classes/PhxChannel.h index fcf8dce..3e40e96 100644 --- a/Pod/Classes/PhxChannel.h +++ b/Pod/Classes/PhxChannel.h @@ -9,6 +9,7 @@ #import #import "PhxTypes.h" +NS_ASSUME_NONNULL_BEGIN @class PhxSocket; @class PhxChannel; @@ -26,12 +27,12 @@ @property (nonatomic, weak) id delegate; @property (nonatomic, weak) PhxSocket* socket; @property (nonatomic, readonly) ChannelState state; -@property (nonatomic, retain) NSString* topic; -@property (nonatomic, retain) NSDictionary *params; +@property (nonatomic) NSString* topic; +@property (nonatomic) NSDictionary *params; -- (id)initWithSocket:(PhxSocket*)socket - topic:(NSString*)topic - params:(NSDictionary*)params; +- (instancetype)initWithSocket:(PhxSocket*)socket + topic:(NSString*)topic + params:(nullable NSDictionary*)params; - (PhxPush*)join; - (void)leave; @@ -44,4 +45,6 @@ - (PhxPush*)pushEvent:(NSString*)event payload:(NSDictionary*)payload; -@end \ No newline at end of file +@end + +NS_ASSUME_NONNULL_END diff --git a/Pod/Classes/PhxChannel.m b/Pod/Classes/PhxChannel.m index 3a23158..e7be7a5 100644 --- a/Pod/Classes/PhxChannel.m +++ b/Pod/Classes/PhxChannel.m @@ -12,6 +12,8 @@ #import "PhxSocket.h" #import "PhxSocket_Private.h" +NS_ASSUME_NONNULL_BEGIN + @interface PhxChannel () @property (nonatomic, readwrite) ChannelState state; @@ -25,7 +27,9 @@ @interface PhxChannel () @implementation PhxChannel -- (id)initWithSocket:(PhxSocket *)socket topic:(NSString *)topic params:(NSDictionary *)params { +- (instancetype)initWithSocket:(PhxSocket *)socket + topic:(NSString *)topic + params:(nullable NSDictionary *)params { self = [super init]; if (self) { self.state = ChannelClosed; @@ -131,7 +135,7 @@ - (NSString*)replyEventName:(NSString*)ref { return [NSString stringWithFormat:@"chan_reply_%@", ref]; } -- (void)triggerEvent:(NSString*)event message:(id)message ref:(id)ref { +- (void)triggerEvent:(NSString*)event message:(id)message ref:(nullable id)ref { NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(NSDictionary *binding, NSDictionary *bindings) { return [[binding valueForKey:@"event"] isEqualToString:event]; }]; @@ -147,4 +151,8 @@ - (PhxPush*)pushEvent:(NSString*)event payload:(NSDictionary*)payload { [pushEvent send]; return pushEvent; } + @end + +NS_ASSUME_NONNULL_END + diff --git a/Pod/Classes/PhxChannel_Private.h b/Pod/Classes/PhxChannel_Private.h index 80cd8ee..6ed6b3a 100644 --- a/Pod/Classes/PhxChannel_Private.h +++ b/Pod/Classes/PhxChannel_Private.h @@ -8,13 +8,17 @@ #import +NS_ASSUME_NONNULL_BEGIN + @class PhxChannel; @interface PhxChannel () - (void)rejoin; -- (void)triggerEvent:(NSString*)event message:(id)message ref:(id)ref; +- (void)triggerEvent:(NSString*)event message:(id)message ref:(nullable id)ref; - (BOOL)isMemberOfTopic:(NSString*)topic; - (NSString*)replyEventName:(NSString*)ref; -@end \ No newline at end of file +@end + +NS_ASSUME_NONNULL_END diff --git a/Pod/Classes/PhxPush.h b/Pod/Classes/PhxPush.h index e528f05..ef958b2 100644 --- a/Pod/Classes/PhxPush.h +++ b/Pod/Classes/PhxPush.h @@ -9,17 +9,21 @@ #import #import "PhxTypes.h" +NS_ASSUME_NONNULL_BEGIN + @class PhxChannel; @interface PhxPush : NSObject -- (id)initWithChannel:(PhxChannel*)channel - event:(NSString*)event - payload:(NSDictionary*)payload; +- (instancetype)initWithChannel:(PhxChannel*)channel + event:(NSString*)event + payload:(NSDictionary*)payload; - (void)send; -- (PhxPush*)onReceive:(NSString*)status callback:(OnMessage)callback; -- (PhxPush*)after:(int)ms callback:(After)callback; +- (PhxPush *)onReceive:(NSString *)status callback:(OnMessage)callback; +- (PhxPush *)after:(int)ms callback:(After)callback; @end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/Pod/Classes/PhxPush.m b/Pod/Classes/PhxPush.m index e35966b..2c32a15 100644 --- a/Pod/Classes/PhxPush.m +++ b/Pod/Classes/PhxPush.m @@ -11,37 +11,35 @@ #import "PhxChannel_Private.h" #import "PhxSocket.h" +NS_ASSUME_NONNULL_BEGIN + @interface PhxPush () @property (nonatomic, weak) PhxChannel *channel; -@property (nonatomic, retain) NSString *event; -@property (nonatomic, retain) NSString *refEvent; -@property (nonatomic, retain) NSDictionary *payload; +@property (nonatomic) NSString *event; +@property (nonatomic) NSString *refEvent; +@property (nonatomic) NSDictionary *payload; -@property (nonatomic, copy) After afterHook; -@property (readwrite) int afterInterval; -@property (nonatomic, retain) NSTimer *afterTimer; +@property (nullable, nonatomic, copy) After afterHook; +@property int afterInterval; +@property (nullable, nonatomic) NSTimer *afterTimer; -@property (nonatomic, retain) NSMutableArray *recHooks; -@property (nonatomic, retain) id receivedResp; -@property (readwrite) BOOL sent; +@property (nonatomic) NSMutableArray *recHooks; +@property (nullable, nonatomic) id receivedResp; +@property (atomic) BOOL sent; @end @implementation PhxPush -- (id)initWithChannel:(PhxChannel*)channel - event:(NSString*)event - payload:(NSDictionary*)payload { +- (instancetype)initWithChannel:(PhxChannel*)channel + event:(NSString*)event + payload:(NSDictionary*)payload { self = [super init]; if (self) { self.channel = channel; self.event = event; - if (payload) { - self.payload = payload; - } else { - self.payload = @{}; - } + self.payload = payload; self.receivedResp = nil; self.afterHook = nil; self.recHooks = [NSMutableArray new]; @@ -51,7 +49,7 @@ - (id)initWithChannel:(PhxChannel*)channel } - (void)send { - const NSString *ref = [self.channel.socket makeRef]; + NSString *ref = [self.channel.socket makeRef]; self.refEvent = [self.channel replyEventName:ref]; self.receivedResp = nil; self.sent = NO; @@ -129,3 +127,5 @@ - (void)matchReceive:(NSDictionary*)payload { } @end + +NS_ASSUME_NONNULL_END diff --git a/Pod/Classes/PhxPush_Private.h b/Pod/Classes/PhxPush_Private.h index 492ed0d..48bed34 100644 --- a/Pod/Classes/PhxPush_Private.h +++ b/Pod/Classes/PhxPush_Private.h @@ -8,9 +8,12 @@ #import +NS_ASSUME_NONNULL_BEGIN @interface PhxPush() -@property (nonatomic, retain) NSDictionary *payload; +@property (nonatomic) NSDictionary *payload; -@end \ No newline at end of file +@end + +NS_ASSUME_NONNULL_END diff --git a/Pod/Classes/PhxSocket.h b/Pod/Classes/PhxSocket.h index c44eeca..236b873 100644 --- a/Pod/Classes/PhxSocket.h +++ b/Pod/Classes/PhxSocket.h @@ -9,6 +9,8 @@ #import #import "PhxTypes.h" +NS_ASSUME_NONNULL_BEGIN + @protocol PhxSocketDelegate - (void)phxSocketDidOpen; @@ -22,13 +24,13 @@ @interface PhxSocket : NSObject @property (nonatomic, weak) id delegate; -@property (nonatomic, readwrite) BOOL reconnectOnError; +@property (nonatomic) BOOL reconnectOnError; -- (id)initWithURL:(NSURL*)url; -- (id)initWithURL:(NSURL*)url heartbeatInterval:(int)interval; +- (instancetype)initWithURL:(NSURL*)url; +- (instancetype)initWithURL:(NSURL*)url heartbeatInterval:(int)interval; - (void)connect; -- (void)connectWithParams:(NSDictionary*)params; +- (void)connectWithParams:(nullable NSDictionary*)params; - (void)disconnect; - (void)reconnect; @@ -47,3 +49,5 @@ - (void)push:(NSDictionary*)data; @end + +NS_ASSUME_NONNULL_END diff --git a/Pod/Classes/PhxSocket.m b/Pod/Classes/PhxSocket.m index 2578a44..b289494 100644 --- a/Pod/Classes/PhxSocket.m +++ b/Pod/Classes/PhxSocket.m @@ -13,39 +13,41 @@ #import "PhxChannel_Private.h" #import "NSDictionary+QueryString.h" -static NSTimeInterval reconnectInterval = 5; +NS_ASSUME_NONNULL_BEGIN + +static NSTimeInterval kReconnectInterval = 5; @interface PhxSocket () -@property (nonatomic, retain) SRWebSocket *socket; -@property (nonatomic, retain) NSURL *URL; -@property (nonatomic, assign) int heartbeatInterval; +@property (nullable, nonatomic) SRWebSocket *socket; +@property (nonatomic) NSURL *URL; +@property (nonatomic) int heartbeatInterval; -@property (nonatomic, retain) NSMutableArray *channels; -@property (nonatomic, strong) NSOperationQueue *queue; +@property (nonatomic) NSMutableArray *channels; +@property (nonatomic) NSOperationQueue *queue; -@property (nonatomic, retain) NSTimer *sendBufferTimer; -@property (nonatomic, retain) NSTimer *reconnectTimer; -@property (nonatomic, retain) NSTimer *heartbeatTimer; +@property (nonatomic) NSTimer *sendBufferTimer; +@property (nullable, nonatomic) NSTimer *reconnectTimer; +@property (nullable, nonatomic) NSTimer *heartbeatTimer; -@property (nonatomic, retain) NSMutableArray *openCallbacks; -@property (nonatomic, retain) NSMutableArray *closeCallbacks; -@property (nonatomic, retain) NSMutableArray *errorCallbacks; -@property (nonatomic, retain) NSMutableArray *messageCallbacks; +@property (nonatomic) NSMutableArray *openCallbacks; +@property (nonatomic) NSMutableArray *closeCallbacks; +@property (nonatomic) NSMutableArray *errorCallbacks; +@property (nonatomic) NSMutableArray *messageCallbacks; -@property (nonatomic, retain) NSDictionary *params; +@property (nullable, nonatomic) NSDictionary *params; -@property (readwrite) int ref; +@property int ref; @end @implementation PhxSocket -- (id)initWithURL:(NSURL*)url { +- (instancetype)initWithURL:(NSURL*)url { return [self initWithURL:url heartbeatInterval:0]; } -- (id)initWithURL:(NSURL*)url heartbeatInterval:(int)interval { +- (instancetype)initWithURL:(NSURL*)url heartbeatInterval:(int)interval { self = [super init]; if (self) { self.URL = url; @@ -70,7 +72,7 @@ - (void)connect { [self connectWithParams:nil]; } -- (void)connectWithParams:(NSDictionary*)params { +- (void)connectWithParams:(nullable NSDictionary*)params { NSURL *url; self.params = params; if (self.params != nil) { @@ -211,7 +213,11 @@ - (void)onConnClose:(id)event { if (self.reconnectOnError) { [self discardReconnectTimer]; - self.reconnectTimer = [NSTimer scheduledTimerWithTimeInterval:reconnectInterval target:self selector:@selector(reconnect) userInfo:nil repeats:YES]; + self.reconnectTimer = [NSTimer scheduledTimerWithTimeInterval:kReconnectInterval + target:self + selector:@selector(reconnect) + userInfo:nil + repeats:YES]; } [self discardHeartbeatTimer]; @@ -302,3 +308,5 @@ - (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reas } @end + +NS_ASSUME_NONNULL_END diff --git a/Pod/Classes/PhxSocket_Private.h b/Pod/Classes/PhxSocket_Private.h index e60be2e..c1f8744 100644 --- a/Pod/Classes/PhxSocket_Private.h +++ b/Pod/Classes/PhxSocket_Private.h @@ -8,7 +8,7 @@ #import - +NS_ASSUME_NONNULL_BEGIN @class PhxSocket; @class PhxChannel; @@ -18,4 +18,6 @@ - (void)addChannel:(PhxChannel*)channel; - (void)removeChannel:(PhxChannel*)channel; -@end \ No newline at end of file +@end + +NS_ASSUME_NONNULL_END From 753a01315b9926e8f7be61f40c4bbe0f50f7fcc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Alcal=C3=A1=20Correa?= Date: Mon, 22 Feb 2016 11:44:20 +0100 Subject: [PATCH 2/6] Set type of timeIntervals to NSTimeInterval --- Pod/Classes/PhxPush.h | 2 +- Pod/Classes/PhxPush.m | 4 ++-- Pod/Classes/PhxSocket.h | 2 +- Pod/Classes/PhxSocket.m | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Pod/Classes/PhxPush.h b/Pod/Classes/PhxPush.h index ef958b2..7d29c7d 100644 --- a/Pod/Classes/PhxPush.h +++ b/Pod/Classes/PhxPush.h @@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)send; - (PhxPush *)onReceive:(NSString *)status callback:(OnMessage)callback; -- (PhxPush *)after:(int)ms callback:(After)callback; +- (PhxPush *)after:(NSTimeInterval)ms callback:(After)callback; @end diff --git a/Pod/Classes/PhxPush.m b/Pod/Classes/PhxPush.m index 2c32a15..7b08aa8 100644 --- a/Pod/Classes/PhxPush.m +++ b/Pod/Classes/PhxPush.m @@ -21,7 +21,7 @@ @interface PhxPush () @property (nonatomic) NSDictionary *payload; @property (nullable, nonatomic, copy) After afterHook; -@property int afterInterval; +@property (nonatomic) NSTimeInterval afterInterval; @property (nullable, nonatomic) NSTimer *afterTimer; @property (nonatomic) NSMutableArray *recHooks; @@ -74,7 +74,7 @@ - (PhxPush*)onReceive:(NSString *)status callback:(OnMessage)callback { return self; } -- (PhxPush*)after:(int)ms callback:(After)callback { +- (PhxPush*)after:(NSTimeInterval)ms callback:(After)callback { if (self.afterHook) { // ERROR } diff --git a/Pod/Classes/PhxSocket.h b/Pod/Classes/PhxSocket.h index 236b873..48e819d 100644 --- a/Pod/Classes/PhxSocket.h +++ b/Pod/Classes/PhxSocket.h @@ -27,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic) BOOL reconnectOnError; - (instancetype)initWithURL:(NSURL*)url; -- (instancetype)initWithURL:(NSURL*)url heartbeatInterval:(int)interval; +- (instancetype)initWithURL:(NSURL*)url heartbeatInterval:(NSTimeInterval)interval; - (void)connect; - (void)connectWithParams:(nullable NSDictionary*)params; diff --git a/Pod/Classes/PhxSocket.m b/Pod/Classes/PhxSocket.m index b289494..1d0599a 100644 --- a/Pod/Classes/PhxSocket.m +++ b/Pod/Classes/PhxSocket.m @@ -21,7 +21,7 @@ @interface PhxSocket () @property (nullable, nonatomic) SRWebSocket *socket; @property (nonatomic) NSURL *URL; -@property (nonatomic) int heartbeatInterval; +@property (nonatomic) NSTimeInterval heartbeatInterval; @property (nonatomic) NSMutableArray *channels; @property (nonatomic) NSOperationQueue *queue; @@ -47,7 +47,7 @@ - (instancetype)initWithURL:(NSURL*)url { return [self initWithURL:url heartbeatInterval:0]; } -- (instancetype)initWithURL:(NSURL*)url heartbeatInterval:(int)interval { +- (instancetype)initWithURL:(NSURL*)url heartbeatInterval:(NSTimeInterval)interval { self = [super init]; if (self) { self.URL = url; From 4861c5a2dca0b0bc764046cd539253cab8e51c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Alcal=C3=A1=20Correa?= Date: Mon, 22 Feb 2016 11:44:46 +0100 Subject: [PATCH 3/6] Uncrustify all files --- Pod/Classes/NSDictionary+QueryString.m | 22 ++++++------- Pod/Classes/NSString+URLEncoding.m | 28 ++++++++-------- Pod/Classes/PhoenixClient.h | 4 +-- Pod/Classes/PhxChannel.h | 18 +++++------ Pod/Classes/PhxChannel.m | 34 ++++++++++---------- Pod/Classes/PhxChannel_Private.h | 6 ++-- Pod/Classes/PhxPush.h | 6 ++-- Pod/Classes/PhxPush.m | 20 ++++++------ Pod/Classes/PhxPush_Private.h | 2 +- Pod/Classes/PhxSocket.h | 10 +++--- Pod/Classes/PhxSocket.m | 44 ++++++++++++-------------- Pod/Classes/PhxSocket_Private.h | 4 +-- 12 files changed, 95 insertions(+), 103 deletions(-) diff --git a/Pod/Classes/NSDictionary+QueryString.m b/Pod/Classes/NSDictionary+QueryString.m index 3a3dc20..355bc4f 100644 --- a/Pod/Classes/NSDictionary+QueryString.m +++ b/Pod/Classes/NSDictionary+QueryString.m @@ -14,47 +14,43 @@ @implementation NSDictionary (QueryString) + (NSDictionary *)dictionaryWithQueryString:(NSString *)queryString { NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; NSArray *pairs = [queryString componentsSeparatedByString:@"&"]; - - for (NSString *pair in pairs) - { + + for (NSString *pair in pairs) { NSArray *elements = [pair componentsSeparatedByString:@"="]; - if (elements.count == 2) - { + if (elements.count == 2) { NSString *key = [elements[0] stringValue]; NSString *value = [elements[1] stringValue]; NSString *decodedKey = [key URLDecodedString]; NSString *decodedValue = [value URLDecodedString]; - + if (![key isEqualToString:decodedKey]) { key = decodedKey; } - + if (![value isEqualToString:decodedValue]) { value = decodedValue; } - + [dictionary setObject:value forKey:key]; } } - + return [NSDictionary dictionaryWithDictionary:dictionary]; } - (NSString *)queryStringValue { NSMutableArray *pairs = [NSMutableArray array]; - for (NSString *key in [self keyEnumerator]) - { + for (NSString *key in [self keyEnumerator]) { id value = [self objectForKey:key]; @try { value = [value stringValue]; } @catch (NSException *exception) { - } NSString *escapedValue = [value URLEncodedString]; [pairs addObject:[NSString stringWithFormat:@"%@=%@", key, escapedValue]]; } - + return [pairs componentsJoinedByString:@"&"]; } diff --git a/Pod/Classes/NSString+URLEncoding.m b/Pod/Classes/NSString+URLEncoding.m index 5a99be0..84fa1c8 100644 --- a/Pod/Classes/NSString+URLEncoding.m +++ b/Pod/Classes/NSString+URLEncoding.m @@ -9,30 +9,28 @@ #import "NSString+URLEncoding.h" @implementation NSString (URLEncoding) -- (NSString *)URLEncodedString -{ +- (NSString *)URLEncodedString { __autoreleasing NSString *encodedString; NSString *originalString = (NSString *)self; encodedString = (__bridge_transfer NSString *)CFURLCreateStringByAddingPercentEscapes( - NULL, - (__bridge CFStringRef)originalString, - NULL, - (CFStringRef)@":!*();@/&?#[]+$,='%’\"", - kCFStringEncodingUTF8 - ); + NULL, + (__bridge CFStringRef)originalString, + NULL, + (CFStringRef)@":!*();@/&?#[]+$,='%’\"", + kCFStringEncodingUTF8 + ); return encodedString; } -- (NSString *)URLDecodedString -{ +- (NSString *)URLDecodedString { __autoreleasing NSString *decodedString; NSString *originalString = (NSString *)self; decodedString = (__bridge_transfer NSString *)CFURLCreateStringByReplacingPercentEscapesUsingEncoding( - NULL, - (__bridge CFStringRef)originalString, - CFSTR(""), - kCFStringEncodingUTF8 - ); + NULL, + (__bridge CFStringRef)originalString, + CFSTR(""), + kCFStringEncodingUTF8 + ); return decodedString; } @end diff --git a/Pod/Classes/PhoenixClient.h b/Pod/Classes/PhoenixClient.h index d9c2848..e2238ba 100644 --- a/Pod/Classes/PhoenixClient.h +++ b/Pod/Classes/PhoenixClient.h @@ -9,10 +9,10 @@ #import -//! Project version number for PhoenixClient. +// ! Project version number for PhoenixClient. FOUNDATION_EXPORT double PhoenixClientVersionNumber; -//! Project version string for PhoenixClient. +// ! Project version string for PhoenixClient. FOUNDATION_EXPORT const unsigned char PhoenixClientVersionString[]; diff --git a/Pod/Classes/PhxChannel.h b/Pod/Classes/PhxChannel.h index 3e40e96..9ec0520 100644 --- a/Pod/Classes/PhxChannel.h +++ b/Pod/Classes/PhxChannel.h @@ -25,25 +25,25 @@ NS_ASSUME_NONNULL_BEGIN @interface PhxChannel : NSObject @property (nonatomic, weak) id delegate; -@property (nonatomic, weak) PhxSocket* socket; +@property (nonatomic, weak) PhxSocket * socket; @property (nonatomic, readonly) ChannelState state; -@property (nonatomic) NSString* topic; +@property (nonatomic) NSString * topic; @property (nonatomic) NSDictionary *params; -- (instancetype)initWithSocket:(PhxSocket*)socket - topic:(NSString*)topic - params:(nullable NSDictionary*)params; +- (instancetype)initWithSocket:(PhxSocket *)socket + topic:(NSString *)topic + params:(nullable NSDictionary *)params; -- (PhxPush*)join; +- (PhxPush *)join; - (void)leave; -- (void)onEvent:(NSString*)event callback:(OnReceive)callback; -- (void)offEvent:(NSString*)event; +- (void)onEvent:(NSString *)event callback:(OnReceive)callback; +- (void)offEvent:(NSString *)event; - (void)onClose:(OnClose)callback; - (void)onError:(OnError)callback; -- (PhxPush*)pushEvent:(NSString*)event payload:(NSDictionary*)payload; +- (PhxPush *)pushEvent:(NSString *)event payload:(NSDictionary *)payload; @end diff --git a/Pod/Classes/PhxChannel.m b/Pod/Classes/PhxChannel.m index e7be7a5..8d9d908 100644 --- a/Pod/Classes/PhxChannel.m +++ b/Pod/Classes/PhxChannel.m @@ -42,28 +42,28 @@ - (instancetype)initWithSocket:(PhxSocket *)socket self.socket = socket; self.bindings = [NSMutableArray new]; [self.socket addChannel:self]; - + self.joinedOnce = NO; self.joinPush = [[PhxPush alloc] initWithChannel:self event:@"phx_join" payload:self.params]; - + __weak typeof(self) weakSelf = self; [self.joinPush onReceive:@"ok" callback:^(id message) { weakSelf.state = ChannelJoined; }]; - + [self.socket onOpen:^{ [weakSelf rejoin]; }]; - + [self onClose:^(id event) { weakSelf.state = ChannelClosed; [weakSelf.socket removeChannel:weakSelf]; }]; - + [self onError:^(id error) { weakSelf.state = ChannelErrored; }]; - + [self onEvent:@"phx_reply" callback:^(id message, id ref) { [weakSelf triggerEvent:[weakSelf replyEventName:ref] message:message ref:ref]; }]; @@ -71,13 +71,13 @@ - (instancetype)initWithSocket:(PhxSocket *)socket return self; } -- (PhxPush*)join { +- (PhxPush *)join { if (self.joinedOnce) { // ERROR } else { self.joinedOnce = YES; } - + [self sendJoin]; return self.joinPush; } @@ -113,12 +113,12 @@ - (void)onError:(OnError)callback { }]; } -- (void)onEvent:(NSString*)event callback:(OnReceive)callback { - [self.bindings addObject:@{@"event":event, @"callback":callback}]; +- (void)onEvent:(NSString *)event callback:(OnReceive)callback { + [self.bindings addObject:@{@"event": event, @"callback": callback}]; } -- (void)offEvent:(NSString*)event { - NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(NSDictionary *binding, NSDictionary *bindings) { +- (void)offEvent:(NSString *)event { + NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL (NSDictionary *binding, NSDictionary *bindings) { return [[binding valueForKey:@"event"] isEqualToString:event]; }]; NSArray *bindings = [self.bindings filteredArrayUsingPredicate:predicate]; @@ -127,16 +127,16 @@ - (void)offEvent:(NSString*)event { } } -- (BOOL)isMemberOfTopic:(NSString*)topic { +- (BOOL)isMemberOfTopic:(NSString *)topic { return [self.topic isEqualToString:topic]; } -- (NSString*)replyEventName:(NSString*)ref { +- (NSString *)replyEventName:(NSString *)ref { return [NSString stringWithFormat:@"chan_reply_%@", ref]; } -- (void)triggerEvent:(NSString*)event message:(id)message ref:(nullable id)ref { - NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(NSDictionary *binding, NSDictionary *bindings) { +- (void)triggerEvent:(NSString *)event message:(id)message ref:(nullable id)ref { + NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL (NSDictionary *binding, NSDictionary *bindings) { return [[binding valueForKey:@"event"] isEqualToString:event]; }]; NSArray *bindings = [self.bindings filteredArrayUsingPredicate:predicate]; @@ -146,7 +146,7 @@ - (void)triggerEvent:(NSString*)event message:(id)message ref:(nullable id)ref { } } -- (PhxPush*)pushEvent:(NSString*)event payload:(NSDictionary*)payload { +- (PhxPush *)pushEvent:(NSString *)event payload:(NSDictionary *)payload { PhxPush *pushEvent = [[PhxPush alloc] initWithChannel:self event:event payload:payload]; [pushEvent send]; return pushEvent; diff --git a/Pod/Classes/PhxChannel_Private.h b/Pod/Classes/PhxChannel_Private.h index 6ed6b3a..fd4d396 100644 --- a/Pod/Classes/PhxChannel_Private.h +++ b/Pod/Classes/PhxChannel_Private.h @@ -15,9 +15,9 @@ NS_ASSUME_NONNULL_BEGIN @interface PhxChannel () - (void)rejoin; -- (void)triggerEvent:(NSString*)event message:(id)message ref:(nullable id)ref; -- (BOOL)isMemberOfTopic:(NSString*)topic; -- (NSString*)replyEventName:(NSString*)ref; +- (void)triggerEvent:(NSString *)event message:(id)message ref:(nullable id)ref; +- (BOOL)isMemberOfTopic:(NSString *)topic; +- (NSString *)replyEventName:(NSString *)ref; @end diff --git a/Pod/Classes/PhxPush.h b/Pod/Classes/PhxPush.h index 7d29c7d..14dc1c7 100644 --- a/Pod/Classes/PhxPush.h +++ b/Pod/Classes/PhxPush.h @@ -15,9 +15,9 @@ NS_ASSUME_NONNULL_BEGIN @interface PhxPush : NSObject -- (instancetype)initWithChannel:(PhxChannel*)channel - event:(NSString*)event - payload:(NSDictionary*)payload; +- (instancetype)initWithChannel:(PhxChannel *)channel + event:(NSString *)event + payload:(NSDictionary *)payload; - (void)send; diff --git a/Pod/Classes/PhxPush.m b/Pod/Classes/PhxPush.m index 7b08aa8..2a333b5 100644 --- a/Pod/Classes/PhxPush.m +++ b/Pod/Classes/PhxPush.m @@ -32,9 +32,9 @@ @interface PhxPush () @implementation PhxPush -- (instancetype)initWithChannel:(PhxChannel*)channel - event:(NSString*)event - payload:(NSDictionary*)payload { +- (instancetype)initWithChannel:(PhxChannel *)channel + event:(NSString *)event + payload:(NSDictionary *)payload { self = [super init]; if (self) { self.channel = channel; @@ -53,7 +53,7 @@ - (void)send { self.refEvent = [self.channel replyEventName:ref]; self.receivedResp = nil; self.sent = NO; - + __weak typeof(self) weakSelf = self; [self.channel onEvent:self.refEvent callback:^(id message, id ref) { weakSelf.receivedResp = message; @@ -63,10 +63,10 @@ - (void)send { }]; [self startAfter]; self.sent = YES; - [self.channel.socket push:@{@"topic":self.channel.topic, @"event": self.event, @"payload":self.payload, @"ref": ref}]; + [self.channel.socket push:@{@"topic": self.channel.topic, @"event": self.event, @"payload": self.payload, @"ref": ref}]; } -- (PhxPush*)onReceive:(NSString *)status callback:(OnMessage)callback { +- (PhxPush *)onReceive:(NSString *)status callback:(OnMessage)callback { if (self.receivedResp && [[self.receivedResp valueForKey:@"status"] isEqualToString:status]) { callback(self.receivedResp); } @@ -74,7 +74,7 @@ - (PhxPush*)onReceive:(NSString *)status callback:(OnMessage)callback { return self; } -- (PhxPush*)after:(NSTimeInterval)ms callback:(After)callback { +- (PhxPush *)after:(NSTimeInterval)ms callback:(After)callback { if (self.afterHook) { // ERROR } @@ -108,15 +108,15 @@ - (void)startAfter { self.afterTimer = [NSTimer scheduledTimerWithTimeInterval:self.afterInterval target:self selector:@selector(afterTimerFire:) userInfo:callback repeats:NO]; } -- (void)afterTimerFire:(NSTimer*)timer { +- (void)afterTimerFire:(NSTimer *)timer { if ([timer userInfo]) { After callback = [timer userInfo]; callback(); } } -- (void)matchReceive:(NSDictionary*)payload { - NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(NSDictionary *recHook, NSDictionary *bindings) { +- (void)matchReceive:(NSDictionary *)payload { + NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL (NSDictionary *recHook, NSDictionary *bindings) { return [[recHook valueForKey:@"status"] isEqualToString:[payload valueForKey:@"status"]]; }]; NSArray *recHooks = [self.recHooks filteredArrayUsingPredicate:predicate]; diff --git a/Pod/Classes/PhxPush_Private.h b/Pod/Classes/PhxPush_Private.h index 48bed34..aabcece 100644 --- a/Pod/Classes/PhxPush_Private.h +++ b/Pod/Classes/PhxPush_Private.h @@ -10,7 +10,7 @@ NS_ASSUME_NONNULL_BEGIN -@interface PhxPush() +@interface PhxPush () @property (nonatomic) NSDictionary *payload; diff --git a/Pod/Classes/PhxSocket.h b/Pod/Classes/PhxSocket.h index 48e819d..09a1947 100644 --- a/Pod/Classes/PhxSocket.h +++ b/Pod/Classes/PhxSocket.h @@ -26,11 +26,11 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, weak) id delegate; @property (nonatomic) BOOL reconnectOnError; -- (instancetype)initWithURL:(NSURL*)url; -- (instancetype)initWithURL:(NSURL*)url heartbeatInterval:(NSTimeInterval)interval; +- (instancetype)initWithURL:(NSURL *)url; +- (instancetype)initWithURL:(NSURL *)url heartbeatInterval:(NSTimeInterval)interval; - (void)connect; -- (void)connectWithParams:(nullable NSDictionary*)params; +- (void)connectWithParams:(nullable NSDictionary *)params; - (void)disconnect; - (void)reconnect; @@ -42,11 +42,11 @@ NS_ASSUME_NONNULL_BEGIN - (BOOL)isConnected; -- (NSString*)makeRef; +- (NSString *)makeRef; - (SocketState)socketState; -- (void)push:(NSDictionary*)data; +- (void)push:(NSDictionary *)data; @end diff --git a/Pod/Classes/PhxSocket.m b/Pod/Classes/PhxSocket.m index 1d0599a..3537e4f 100644 --- a/Pod/Classes/PhxSocket.m +++ b/Pod/Classes/PhxSocket.m @@ -43,11 +43,11 @@ @interface PhxSocket () @implementation PhxSocket -- (instancetype)initWithURL:(NSURL*)url { +- (instancetype)initWithURL:(NSURL *)url { return [self initWithURL:url heartbeatInterval:0]; } -- (instancetype)initWithURL:(NSURL*)url heartbeatInterval:(NSTimeInterval)interval { +- (instancetype)initWithURL:(NSURL *)url heartbeatInterval:(NSTimeInterval)interval { self = [super init]; if (self) { self.URL = url; @@ -62,8 +62,8 @@ - (instancetype)initWithURL:(NSURL*)url heartbeatInterval:(NSTimeInterval)interv self.queue = [[NSOperationQueue alloc] init]; [self.queue setSuspended:YES]; - - //[self reconnect]; + + // [self reconnect]; } return self; } @@ -72,16 +72,15 @@ - (void)connect { [self connectWithParams:nil]; } -- (void)connectWithParams:(nullable NSDictionary*)params { +- (void)connectWithParams:(nullable NSDictionary *)params { NSURL *url; self.params = params; if (self.params != nil) { - url = [NSURL URLWithString:[NSString stringWithFormat:@"%@?%@", [self.URL absoluteString], [self.params queryStringValue]]]; } else { url = self.URL; } - + NSLog(@"URL: %@", url); self.socket = [[SRWebSocket alloc]initWithURL:url]; self.socket.delegate = self; @@ -127,8 +126,8 @@ - (void)addChannel:(PhxChannel *)channel { [self.channels addObject:channel]; } -- (void)removeChannel:(PhxChannel*)channel { - NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(PhxChannel *evalChannel, NSDictionary *bindings) { +- (void)removeChannel:(PhxChannel *)channel { + NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL (PhxChannel *evalChannel, NSDictionary *bindings) { return evalChannel == channel; }]; NSArray *channels = [self.channels filteredArrayUsingPredicate:predicate]; @@ -153,7 +152,7 @@ - (void)onMessage:(OnMessage)callback { [self.messageCallbacks addObject:callback]; } -- (void)push:(NSDictionary*)data { +- (void)push:(NSDictionary *)data { NSError *error; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:data options:0 error:&error]; if (!error) { @@ -174,8 +173,7 @@ - (void)disconnectSocket { } } -- (void)discardHeartbeatTimer -{ +- (void)discardHeartbeatTimer { if (self.heartbeatTimer) { [self.heartbeatTimer invalidate]; self.heartbeatTimer = nil; @@ -196,11 +194,11 @@ - (void)onConnOpen { if (self.heartbeatInterval > 0) { [self startHeartbeatTimerWithInterval:self.heartbeatInterval]; } - + for (OnOpen callback in self.openCallbacks) { callback(); } - + if ([self.delegate respondsToSelector:@selector(phxSocketDidOpen)]) { [self.delegate phxSocketDidOpen]; } @@ -210,7 +208,7 @@ - (void)onConnClose:(id)event { NSLog(@"PhxSocket Closed"); [self.queue setSuspended:YES]; [self triggerChanError:event]; - + if (self.reconnectOnError) { [self discardReconnectTimer]; self.reconnectTimer = [NSTimer scheduledTimerWithTimeInterval:kReconnectInterval @@ -220,11 +218,11 @@ - (void)onConnClose:(id)event { repeats:YES]; } [self discardHeartbeatTimer]; - + for (OnClose callback in self.closeCallbacks) { callback(event); } - + if ([self.delegate respondsToSelector:@selector(phxSocketDidClose:)]) { [self.delegate phxSocketDidClose:event]; } @@ -238,15 +236,15 @@ - (void)onConnError:(id)error { for (OnError callback in self.errorCallbacks) { callback(error); } - + if ([self.delegate respondsToSelector:@selector(phxSocketDidReceiveError:)]) { [self.delegate phxSocketDidReceiveError:error]; } [self onConnClose:error]; } -- (void)onConnMessage:(NSString*)rawMessage { - NSLog(@"PhxSocket Message:%@",(NSString*)rawMessage); +- (void)onConnMessage:(NSString *)rawMessage { + NSLog(@"PhxSocket Message:%@",(NSString *)rawMessage); NSData *data = [rawMessage dataUsingEncoding:NSUTF8StringEncoding]; NSError *error; id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error]; @@ -255,7 +253,7 @@ - (void)onConnMessage:(NSString*)rawMessage { NSString *event = [json valueForKey:@"event"]; NSString *payload = [json valueForKey:@"payload"]; NSString *ref = [json valueForKey:@"ref"]; - NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(PhxChannel *channel, NSDictionary *bindings) { + NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL (PhxChannel *channel, NSDictionary *bindings) { return [channel.topic isEqualToString:topic]; }]; NSArray *channels = [self.channels filteredArrayUsingPredicate:predicate]; @@ -279,10 +277,10 @@ - (void)startHeartbeatTimerWithInterval:(int)interval { } - (void)sendHeartbeat { - [self push:@{@"topic":@"phoenix", @"event":@"heartbeat", @"payload": @{}, @"ref":[self makeRef]}]; + [self push:@{@"topic": @"phoenix", @"event": @"heartbeat", @"payload": @{}, @"ref": [self makeRef]}]; } -- (NSString*)makeRef { +- (NSString *)makeRef { // TODO: Catch integer overflow int newRef = self.ref + 1; return [NSString stringWithFormat:@"%i", newRef]; diff --git a/Pod/Classes/PhxSocket_Private.h b/Pod/Classes/PhxSocket_Private.h index c1f8744..7dbc8a8 100644 --- a/Pod/Classes/PhxSocket_Private.h +++ b/Pod/Classes/PhxSocket_Private.h @@ -15,8 +15,8 @@ NS_ASSUME_NONNULL_BEGIN @interface PhxSocket () -- (void)addChannel:(PhxChannel*)channel; -- (void)removeChannel:(PhxChannel*)channel; +- (void)addChannel:(PhxChannel *)channel; +- (void)removeChannel:(PhxChannel *)channel; @end From 6030cfb1e0d0abeb212ffe222e8db295e5160953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Alcal=C3=A1=20Correa?= Date: Mon, 22 Feb 2016 11:44:46 +0100 Subject: [PATCH 4/6] Uncrustify all files --- Pod/Classes/NSDictionary+QueryString.m | 22 ++++++------- Pod/Classes/NSString+URLEncoding.m | 28 ++++++++-------- Pod/Classes/PhoenixClient.h | 4 +-- Pod/Classes/PhxChannel.h | 18 +++++------ Pod/Classes/PhxChannel.m | 34 ++++++++++---------- Pod/Classes/PhxChannel_Private.h | 6 ++-- Pod/Classes/PhxPush.h | 6 ++-- Pod/Classes/PhxPush.m | 20 ++++++------ Pod/Classes/PhxPush_Private.h | 2 +- Pod/Classes/PhxSocket.h | 10 +++--- Pod/Classes/PhxSocket.m | 44 ++++++++++++-------------- Pod/Classes/PhxSocket_Private.h | 4 +-- 12 files changed, 95 insertions(+), 103 deletions(-) diff --git a/Pod/Classes/NSDictionary+QueryString.m b/Pod/Classes/NSDictionary+QueryString.m index 3a3dc20..355bc4f 100644 --- a/Pod/Classes/NSDictionary+QueryString.m +++ b/Pod/Classes/NSDictionary+QueryString.m @@ -14,47 +14,43 @@ @implementation NSDictionary (QueryString) + (NSDictionary *)dictionaryWithQueryString:(NSString *)queryString { NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; NSArray *pairs = [queryString componentsSeparatedByString:@"&"]; - - for (NSString *pair in pairs) - { + + for (NSString *pair in pairs) { NSArray *elements = [pair componentsSeparatedByString:@"="]; - if (elements.count == 2) - { + if (elements.count == 2) { NSString *key = [elements[0] stringValue]; NSString *value = [elements[1] stringValue]; NSString *decodedKey = [key URLDecodedString]; NSString *decodedValue = [value URLDecodedString]; - + if (![key isEqualToString:decodedKey]) { key = decodedKey; } - + if (![value isEqualToString:decodedValue]) { value = decodedValue; } - + [dictionary setObject:value forKey:key]; } } - + return [NSDictionary dictionaryWithDictionary:dictionary]; } - (NSString *)queryStringValue { NSMutableArray *pairs = [NSMutableArray array]; - for (NSString *key in [self keyEnumerator]) - { + for (NSString *key in [self keyEnumerator]) { id value = [self objectForKey:key]; @try { value = [value stringValue]; } @catch (NSException *exception) { - } NSString *escapedValue = [value URLEncodedString]; [pairs addObject:[NSString stringWithFormat:@"%@=%@", key, escapedValue]]; } - + return [pairs componentsJoinedByString:@"&"]; } diff --git a/Pod/Classes/NSString+URLEncoding.m b/Pod/Classes/NSString+URLEncoding.m index 5a99be0..84fa1c8 100644 --- a/Pod/Classes/NSString+URLEncoding.m +++ b/Pod/Classes/NSString+URLEncoding.m @@ -9,30 +9,28 @@ #import "NSString+URLEncoding.h" @implementation NSString (URLEncoding) -- (NSString *)URLEncodedString -{ +- (NSString *)URLEncodedString { __autoreleasing NSString *encodedString; NSString *originalString = (NSString *)self; encodedString = (__bridge_transfer NSString *)CFURLCreateStringByAddingPercentEscapes( - NULL, - (__bridge CFStringRef)originalString, - NULL, - (CFStringRef)@":!*();@/&?#[]+$,='%’\"", - kCFStringEncodingUTF8 - ); + NULL, + (__bridge CFStringRef)originalString, + NULL, + (CFStringRef)@":!*();@/&?#[]+$,='%’\"", + kCFStringEncodingUTF8 + ); return encodedString; } -- (NSString *)URLDecodedString -{ +- (NSString *)URLDecodedString { __autoreleasing NSString *decodedString; NSString *originalString = (NSString *)self; decodedString = (__bridge_transfer NSString *)CFURLCreateStringByReplacingPercentEscapesUsingEncoding( - NULL, - (__bridge CFStringRef)originalString, - CFSTR(""), - kCFStringEncodingUTF8 - ); + NULL, + (__bridge CFStringRef)originalString, + CFSTR(""), + kCFStringEncodingUTF8 + ); return decodedString; } @end diff --git a/Pod/Classes/PhoenixClient.h b/Pod/Classes/PhoenixClient.h index d9c2848..e2238ba 100644 --- a/Pod/Classes/PhoenixClient.h +++ b/Pod/Classes/PhoenixClient.h @@ -9,10 +9,10 @@ #import -//! Project version number for PhoenixClient. +// ! Project version number for PhoenixClient. FOUNDATION_EXPORT double PhoenixClientVersionNumber; -//! Project version string for PhoenixClient. +// ! Project version string for PhoenixClient. FOUNDATION_EXPORT const unsigned char PhoenixClientVersionString[]; diff --git a/Pod/Classes/PhxChannel.h b/Pod/Classes/PhxChannel.h index 3e40e96..9ec0520 100644 --- a/Pod/Classes/PhxChannel.h +++ b/Pod/Classes/PhxChannel.h @@ -25,25 +25,25 @@ NS_ASSUME_NONNULL_BEGIN @interface PhxChannel : NSObject @property (nonatomic, weak) id delegate; -@property (nonatomic, weak) PhxSocket* socket; +@property (nonatomic, weak) PhxSocket * socket; @property (nonatomic, readonly) ChannelState state; -@property (nonatomic) NSString* topic; +@property (nonatomic) NSString * topic; @property (nonatomic) NSDictionary *params; -- (instancetype)initWithSocket:(PhxSocket*)socket - topic:(NSString*)topic - params:(nullable NSDictionary*)params; +- (instancetype)initWithSocket:(PhxSocket *)socket + topic:(NSString *)topic + params:(nullable NSDictionary *)params; -- (PhxPush*)join; +- (PhxPush *)join; - (void)leave; -- (void)onEvent:(NSString*)event callback:(OnReceive)callback; -- (void)offEvent:(NSString*)event; +- (void)onEvent:(NSString *)event callback:(OnReceive)callback; +- (void)offEvent:(NSString *)event; - (void)onClose:(OnClose)callback; - (void)onError:(OnError)callback; -- (PhxPush*)pushEvent:(NSString*)event payload:(NSDictionary*)payload; +- (PhxPush *)pushEvent:(NSString *)event payload:(NSDictionary *)payload; @end diff --git a/Pod/Classes/PhxChannel.m b/Pod/Classes/PhxChannel.m index e7be7a5..8d9d908 100644 --- a/Pod/Classes/PhxChannel.m +++ b/Pod/Classes/PhxChannel.m @@ -42,28 +42,28 @@ - (instancetype)initWithSocket:(PhxSocket *)socket self.socket = socket; self.bindings = [NSMutableArray new]; [self.socket addChannel:self]; - + self.joinedOnce = NO; self.joinPush = [[PhxPush alloc] initWithChannel:self event:@"phx_join" payload:self.params]; - + __weak typeof(self) weakSelf = self; [self.joinPush onReceive:@"ok" callback:^(id message) { weakSelf.state = ChannelJoined; }]; - + [self.socket onOpen:^{ [weakSelf rejoin]; }]; - + [self onClose:^(id event) { weakSelf.state = ChannelClosed; [weakSelf.socket removeChannel:weakSelf]; }]; - + [self onError:^(id error) { weakSelf.state = ChannelErrored; }]; - + [self onEvent:@"phx_reply" callback:^(id message, id ref) { [weakSelf triggerEvent:[weakSelf replyEventName:ref] message:message ref:ref]; }]; @@ -71,13 +71,13 @@ - (instancetype)initWithSocket:(PhxSocket *)socket return self; } -- (PhxPush*)join { +- (PhxPush *)join { if (self.joinedOnce) { // ERROR } else { self.joinedOnce = YES; } - + [self sendJoin]; return self.joinPush; } @@ -113,12 +113,12 @@ - (void)onError:(OnError)callback { }]; } -- (void)onEvent:(NSString*)event callback:(OnReceive)callback { - [self.bindings addObject:@{@"event":event, @"callback":callback}]; +- (void)onEvent:(NSString *)event callback:(OnReceive)callback { + [self.bindings addObject:@{@"event": event, @"callback": callback}]; } -- (void)offEvent:(NSString*)event { - NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(NSDictionary *binding, NSDictionary *bindings) { +- (void)offEvent:(NSString *)event { + NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL (NSDictionary *binding, NSDictionary *bindings) { return [[binding valueForKey:@"event"] isEqualToString:event]; }]; NSArray *bindings = [self.bindings filteredArrayUsingPredicate:predicate]; @@ -127,16 +127,16 @@ - (void)offEvent:(NSString*)event { } } -- (BOOL)isMemberOfTopic:(NSString*)topic { +- (BOOL)isMemberOfTopic:(NSString *)topic { return [self.topic isEqualToString:topic]; } -- (NSString*)replyEventName:(NSString*)ref { +- (NSString *)replyEventName:(NSString *)ref { return [NSString stringWithFormat:@"chan_reply_%@", ref]; } -- (void)triggerEvent:(NSString*)event message:(id)message ref:(nullable id)ref { - NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(NSDictionary *binding, NSDictionary *bindings) { +- (void)triggerEvent:(NSString *)event message:(id)message ref:(nullable id)ref { + NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL (NSDictionary *binding, NSDictionary *bindings) { return [[binding valueForKey:@"event"] isEqualToString:event]; }]; NSArray *bindings = [self.bindings filteredArrayUsingPredicate:predicate]; @@ -146,7 +146,7 @@ - (void)triggerEvent:(NSString*)event message:(id)message ref:(nullable id)ref { } } -- (PhxPush*)pushEvent:(NSString*)event payload:(NSDictionary*)payload { +- (PhxPush *)pushEvent:(NSString *)event payload:(NSDictionary *)payload { PhxPush *pushEvent = [[PhxPush alloc] initWithChannel:self event:event payload:payload]; [pushEvent send]; return pushEvent; diff --git a/Pod/Classes/PhxChannel_Private.h b/Pod/Classes/PhxChannel_Private.h index 6ed6b3a..fd4d396 100644 --- a/Pod/Classes/PhxChannel_Private.h +++ b/Pod/Classes/PhxChannel_Private.h @@ -15,9 +15,9 @@ NS_ASSUME_NONNULL_BEGIN @interface PhxChannel () - (void)rejoin; -- (void)triggerEvent:(NSString*)event message:(id)message ref:(nullable id)ref; -- (BOOL)isMemberOfTopic:(NSString*)topic; -- (NSString*)replyEventName:(NSString*)ref; +- (void)triggerEvent:(NSString *)event message:(id)message ref:(nullable id)ref; +- (BOOL)isMemberOfTopic:(NSString *)topic; +- (NSString *)replyEventName:(NSString *)ref; @end diff --git a/Pod/Classes/PhxPush.h b/Pod/Classes/PhxPush.h index 7d29c7d..14dc1c7 100644 --- a/Pod/Classes/PhxPush.h +++ b/Pod/Classes/PhxPush.h @@ -15,9 +15,9 @@ NS_ASSUME_NONNULL_BEGIN @interface PhxPush : NSObject -- (instancetype)initWithChannel:(PhxChannel*)channel - event:(NSString*)event - payload:(NSDictionary*)payload; +- (instancetype)initWithChannel:(PhxChannel *)channel + event:(NSString *)event + payload:(NSDictionary *)payload; - (void)send; diff --git a/Pod/Classes/PhxPush.m b/Pod/Classes/PhxPush.m index 7b08aa8..2a333b5 100644 --- a/Pod/Classes/PhxPush.m +++ b/Pod/Classes/PhxPush.m @@ -32,9 +32,9 @@ @interface PhxPush () @implementation PhxPush -- (instancetype)initWithChannel:(PhxChannel*)channel - event:(NSString*)event - payload:(NSDictionary*)payload { +- (instancetype)initWithChannel:(PhxChannel *)channel + event:(NSString *)event + payload:(NSDictionary *)payload { self = [super init]; if (self) { self.channel = channel; @@ -53,7 +53,7 @@ - (void)send { self.refEvent = [self.channel replyEventName:ref]; self.receivedResp = nil; self.sent = NO; - + __weak typeof(self) weakSelf = self; [self.channel onEvent:self.refEvent callback:^(id message, id ref) { weakSelf.receivedResp = message; @@ -63,10 +63,10 @@ - (void)send { }]; [self startAfter]; self.sent = YES; - [self.channel.socket push:@{@"topic":self.channel.topic, @"event": self.event, @"payload":self.payload, @"ref": ref}]; + [self.channel.socket push:@{@"topic": self.channel.topic, @"event": self.event, @"payload": self.payload, @"ref": ref}]; } -- (PhxPush*)onReceive:(NSString *)status callback:(OnMessage)callback { +- (PhxPush *)onReceive:(NSString *)status callback:(OnMessage)callback { if (self.receivedResp && [[self.receivedResp valueForKey:@"status"] isEqualToString:status]) { callback(self.receivedResp); } @@ -74,7 +74,7 @@ - (PhxPush*)onReceive:(NSString *)status callback:(OnMessage)callback { return self; } -- (PhxPush*)after:(NSTimeInterval)ms callback:(After)callback { +- (PhxPush *)after:(NSTimeInterval)ms callback:(After)callback { if (self.afterHook) { // ERROR } @@ -108,15 +108,15 @@ - (void)startAfter { self.afterTimer = [NSTimer scheduledTimerWithTimeInterval:self.afterInterval target:self selector:@selector(afterTimerFire:) userInfo:callback repeats:NO]; } -- (void)afterTimerFire:(NSTimer*)timer { +- (void)afterTimerFire:(NSTimer *)timer { if ([timer userInfo]) { After callback = [timer userInfo]; callback(); } } -- (void)matchReceive:(NSDictionary*)payload { - NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(NSDictionary *recHook, NSDictionary *bindings) { +- (void)matchReceive:(NSDictionary *)payload { + NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL (NSDictionary *recHook, NSDictionary *bindings) { return [[recHook valueForKey:@"status"] isEqualToString:[payload valueForKey:@"status"]]; }]; NSArray *recHooks = [self.recHooks filteredArrayUsingPredicate:predicate]; diff --git a/Pod/Classes/PhxPush_Private.h b/Pod/Classes/PhxPush_Private.h index 48bed34..aabcece 100644 --- a/Pod/Classes/PhxPush_Private.h +++ b/Pod/Classes/PhxPush_Private.h @@ -10,7 +10,7 @@ NS_ASSUME_NONNULL_BEGIN -@interface PhxPush() +@interface PhxPush () @property (nonatomic) NSDictionary *payload; diff --git a/Pod/Classes/PhxSocket.h b/Pod/Classes/PhxSocket.h index 48e819d..09a1947 100644 --- a/Pod/Classes/PhxSocket.h +++ b/Pod/Classes/PhxSocket.h @@ -26,11 +26,11 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, weak) id delegate; @property (nonatomic) BOOL reconnectOnError; -- (instancetype)initWithURL:(NSURL*)url; -- (instancetype)initWithURL:(NSURL*)url heartbeatInterval:(NSTimeInterval)interval; +- (instancetype)initWithURL:(NSURL *)url; +- (instancetype)initWithURL:(NSURL *)url heartbeatInterval:(NSTimeInterval)interval; - (void)connect; -- (void)connectWithParams:(nullable NSDictionary*)params; +- (void)connectWithParams:(nullable NSDictionary *)params; - (void)disconnect; - (void)reconnect; @@ -42,11 +42,11 @@ NS_ASSUME_NONNULL_BEGIN - (BOOL)isConnected; -- (NSString*)makeRef; +- (NSString *)makeRef; - (SocketState)socketState; -- (void)push:(NSDictionary*)data; +- (void)push:(NSDictionary *)data; @end diff --git a/Pod/Classes/PhxSocket.m b/Pod/Classes/PhxSocket.m index 1d0599a..3537e4f 100644 --- a/Pod/Classes/PhxSocket.m +++ b/Pod/Classes/PhxSocket.m @@ -43,11 +43,11 @@ @interface PhxSocket () @implementation PhxSocket -- (instancetype)initWithURL:(NSURL*)url { +- (instancetype)initWithURL:(NSURL *)url { return [self initWithURL:url heartbeatInterval:0]; } -- (instancetype)initWithURL:(NSURL*)url heartbeatInterval:(NSTimeInterval)interval { +- (instancetype)initWithURL:(NSURL *)url heartbeatInterval:(NSTimeInterval)interval { self = [super init]; if (self) { self.URL = url; @@ -62,8 +62,8 @@ - (instancetype)initWithURL:(NSURL*)url heartbeatInterval:(NSTimeInterval)interv self.queue = [[NSOperationQueue alloc] init]; [self.queue setSuspended:YES]; - - //[self reconnect]; + + // [self reconnect]; } return self; } @@ -72,16 +72,15 @@ - (void)connect { [self connectWithParams:nil]; } -- (void)connectWithParams:(nullable NSDictionary*)params { +- (void)connectWithParams:(nullable NSDictionary *)params { NSURL *url; self.params = params; if (self.params != nil) { - url = [NSURL URLWithString:[NSString stringWithFormat:@"%@?%@", [self.URL absoluteString], [self.params queryStringValue]]]; } else { url = self.URL; } - + NSLog(@"URL: %@", url); self.socket = [[SRWebSocket alloc]initWithURL:url]; self.socket.delegate = self; @@ -127,8 +126,8 @@ - (void)addChannel:(PhxChannel *)channel { [self.channels addObject:channel]; } -- (void)removeChannel:(PhxChannel*)channel { - NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(PhxChannel *evalChannel, NSDictionary *bindings) { +- (void)removeChannel:(PhxChannel *)channel { + NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL (PhxChannel *evalChannel, NSDictionary *bindings) { return evalChannel == channel; }]; NSArray *channels = [self.channels filteredArrayUsingPredicate:predicate]; @@ -153,7 +152,7 @@ - (void)onMessage:(OnMessage)callback { [self.messageCallbacks addObject:callback]; } -- (void)push:(NSDictionary*)data { +- (void)push:(NSDictionary *)data { NSError *error; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:data options:0 error:&error]; if (!error) { @@ -174,8 +173,7 @@ - (void)disconnectSocket { } } -- (void)discardHeartbeatTimer -{ +- (void)discardHeartbeatTimer { if (self.heartbeatTimer) { [self.heartbeatTimer invalidate]; self.heartbeatTimer = nil; @@ -196,11 +194,11 @@ - (void)onConnOpen { if (self.heartbeatInterval > 0) { [self startHeartbeatTimerWithInterval:self.heartbeatInterval]; } - + for (OnOpen callback in self.openCallbacks) { callback(); } - + if ([self.delegate respondsToSelector:@selector(phxSocketDidOpen)]) { [self.delegate phxSocketDidOpen]; } @@ -210,7 +208,7 @@ - (void)onConnClose:(id)event { NSLog(@"PhxSocket Closed"); [self.queue setSuspended:YES]; [self triggerChanError:event]; - + if (self.reconnectOnError) { [self discardReconnectTimer]; self.reconnectTimer = [NSTimer scheduledTimerWithTimeInterval:kReconnectInterval @@ -220,11 +218,11 @@ - (void)onConnClose:(id)event { repeats:YES]; } [self discardHeartbeatTimer]; - + for (OnClose callback in self.closeCallbacks) { callback(event); } - + if ([self.delegate respondsToSelector:@selector(phxSocketDidClose:)]) { [self.delegate phxSocketDidClose:event]; } @@ -238,15 +236,15 @@ - (void)onConnError:(id)error { for (OnError callback in self.errorCallbacks) { callback(error); } - + if ([self.delegate respondsToSelector:@selector(phxSocketDidReceiveError:)]) { [self.delegate phxSocketDidReceiveError:error]; } [self onConnClose:error]; } -- (void)onConnMessage:(NSString*)rawMessage { - NSLog(@"PhxSocket Message:%@",(NSString*)rawMessage); +- (void)onConnMessage:(NSString *)rawMessage { + NSLog(@"PhxSocket Message:%@",(NSString *)rawMessage); NSData *data = [rawMessage dataUsingEncoding:NSUTF8StringEncoding]; NSError *error; id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error]; @@ -255,7 +253,7 @@ - (void)onConnMessage:(NSString*)rawMessage { NSString *event = [json valueForKey:@"event"]; NSString *payload = [json valueForKey:@"payload"]; NSString *ref = [json valueForKey:@"ref"]; - NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(PhxChannel *channel, NSDictionary *bindings) { + NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL (PhxChannel *channel, NSDictionary *bindings) { return [channel.topic isEqualToString:topic]; }]; NSArray *channels = [self.channels filteredArrayUsingPredicate:predicate]; @@ -279,10 +277,10 @@ - (void)startHeartbeatTimerWithInterval:(int)interval { } - (void)sendHeartbeat { - [self push:@{@"topic":@"phoenix", @"event":@"heartbeat", @"payload": @{}, @"ref":[self makeRef]}]; + [self push:@{@"topic": @"phoenix", @"event": @"heartbeat", @"payload": @{}, @"ref": [self makeRef]}]; } -- (NSString*)makeRef { +- (NSString *)makeRef { // TODO: Catch integer overflow int newRef = self.ref + 1; return [NSString stringWithFormat:@"%i", newRef]; diff --git a/Pod/Classes/PhxSocket_Private.h b/Pod/Classes/PhxSocket_Private.h index c1f8744..7dbc8a8 100644 --- a/Pod/Classes/PhxSocket_Private.h +++ b/Pod/Classes/PhxSocket_Private.h @@ -15,8 +15,8 @@ NS_ASSUME_NONNULL_BEGIN @interface PhxSocket () -- (void)addChannel:(PhxChannel*)channel; -- (void)removeChannel:(PhxChannel*)channel; +- (void)addChannel:(PhxChannel *)channel; +- (void)removeChannel:(PhxChannel *)channel; @end From ede2edd7b173a8e9ef23cdeb6a2ca49d57ed46f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Alcal=C3=A1=20Correa?= Date: Mon, 22 Feb 2016 12:45:54 +0100 Subject: [PATCH 5/6] Add strong property modifiers, rename ms parameters to timeInterval --- Pod/Classes/PhxChannel.h | 4 ++-- Pod/Classes/PhxChannel.m | 8 ++++---- Pod/Classes/PhxPush.h | 2 +- Pod/Classes/PhxPush.m | 22 +++++++++++++--------- Pod/Classes/PhxPush_Private.h | 2 +- Pod/Classes/PhxSocket.h | 2 +- Pod/Classes/PhxSocket.m | 22 +++++++++++----------- 7 files changed, 33 insertions(+), 29 deletions(-) diff --git a/Pod/Classes/PhxChannel.h b/Pod/Classes/PhxChannel.h index 3e40e96..a0d6d91 100644 --- a/Pod/Classes/PhxChannel.h +++ b/Pod/Classes/PhxChannel.h @@ -27,8 +27,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, weak) id delegate; @property (nonatomic, weak) PhxSocket* socket; @property (nonatomic, readonly) ChannelState state; -@property (nonatomic) NSString* topic; -@property (nonatomic) NSDictionary *params; +@property (nonatomic, strong) NSString* topic; +@property (nonatomic, strong) NSDictionary *params; - (instancetype)initWithSocket:(PhxSocket*)socket topic:(NSString*)topic diff --git a/Pod/Classes/PhxChannel.m b/Pod/Classes/PhxChannel.m index e7be7a5..43ad689 100644 --- a/Pod/Classes/PhxChannel.m +++ b/Pod/Classes/PhxChannel.m @@ -16,12 +16,12 @@ @interface PhxChannel () -@property (nonatomic, readwrite) ChannelState state; +@property (nonatomic) ChannelState state; -@property (nonatomic, retain) NSMutableArray *bindings; +@property (nonatomic, strong) NSMutableArray *bindings; -@property (readwrite) BOOL joinedOnce; -@property (nonatomic, retain) PhxPush *joinPush; +@property (atomic) BOOL joinedOnce; +@property (nonatomic, strong) PhxPush *joinPush; @end diff --git a/Pod/Classes/PhxPush.h b/Pod/Classes/PhxPush.h index 7d29c7d..22cb7aa 100644 --- a/Pod/Classes/PhxPush.h +++ b/Pod/Classes/PhxPush.h @@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)send; - (PhxPush *)onReceive:(NSString *)status callback:(OnMessage)callback; -- (PhxPush *)after:(NSTimeInterval)ms callback:(After)callback; +- (PhxPush *)after:(NSTimeInterval)timeInterval callback:(After)callback; @end diff --git a/Pod/Classes/PhxPush.m b/Pod/Classes/PhxPush.m index 7b08aa8..267b91f 100644 --- a/Pod/Classes/PhxPush.m +++ b/Pod/Classes/PhxPush.m @@ -16,16 +16,16 @@ @interface PhxPush () @property (nonatomic, weak) PhxChannel *channel; -@property (nonatomic) NSString *event; -@property (nonatomic) NSString *refEvent; -@property (nonatomic) NSDictionary *payload; +@property (nonatomic, strong) NSString *event; +@property (nonatomic, strong) NSString *refEvent; +@property (nonatomic, strong) NSDictionary *payload; @property (nullable, nonatomic, copy) After afterHook; @property (nonatomic) NSTimeInterval afterInterval; -@property (nullable, nonatomic) NSTimer *afterTimer; +@property (nullable, nonatomic, strong) NSTimer *afterTimer; -@property (nonatomic) NSMutableArray *recHooks; -@property (nullable, nonatomic) id receivedResp; +@property (nonatomic, strong) NSMutableArray *recHooks; +@property (nullable, nonatomic, strong) id receivedResp; @property (atomic) BOOL sent; @end @@ -74,12 +74,16 @@ - (PhxPush*)onReceive:(NSString *)status callback:(OnMessage)callback { return self; } -- (PhxPush*)after:(NSTimeInterval)ms callback:(After)callback { +- (PhxPush*)after:(NSTimeInterval)timeInterval callback:(After)callback { if (self.afterHook) { // ERROR } - self.afterTimer = [NSTimer scheduledTimerWithTimeInterval:ms target:self selector:@selector(afterTimerFire:) userInfo:nil repeats:NO]; - self.afterInterval = ms; + self.afterTimer = [NSTimer scheduledTimerWithTimeInterval:timeInterval + target:self + selector:@selector(afterTimerFire:) + userInfo:nil + repeats:NO]; + self.afterInterval = timeInterval; self.afterHook = callback; return self; } diff --git a/Pod/Classes/PhxPush_Private.h b/Pod/Classes/PhxPush_Private.h index 48bed34..28f58de 100644 --- a/Pod/Classes/PhxPush_Private.h +++ b/Pod/Classes/PhxPush_Private.h @@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN @interface PhxPush() -@property (nonatomic) NSDictionary *payload; +@property (nonatomic, strong) NSDictionary *payload; @end diff --git a/Pod/Classes/PhxSocket.h b/Pod/Classes/PhxSocket.h index 48e819d..7b5c66b 100644 --- a/Pod/Classes/PhxSocket.h +++ b/Pod/Classes/PhxSocket.h @@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN @interface PhxSocket : NSObject @property (nonatomic, weak) id delegate; -@property (nonatomic) BOOL reconnectOnError; +@property (nonatomic, strong) BOOL reconnectOnError; - (instancetype)initWithURL:(NSURL*)url; - (instancetype)initWithURL:(NSURL*)url heartbeatInterval:(NSTimeInterval)interval; diff --git a/Pod/Classes/PhxSocket.m b/Pod/Classes/PhxSocket.m index 1d0599a..6ee9a15 100644 --- a/Pod/Classes/PhxSocket.m +++ b/Pod/Classes/PhxSocket.m @@ -20,20 +20,20 @@ @interface PhxSocket () @property (nullable, nonatomic) SRWebSocket *socket; -@property (nonatomic) NSURL *URL; -@property (nonatomic) NSTimeInterval heartbeatInterval; +@property (nonatomic, strong) NSURL *URL; +@property (nonatomic, strong) NSTimeInterval heartbeatInterval; -@property (nonatomic) NSMutableArray *channels; -@property (nonatomic) NSOperationQueue *queue; +@property (nonatomic, strong) NSMutableArray *channels; +@property (nonatomic, strong) NSOperationQueue *queue; -@property (nonatomic) NSTimer *sendBufferTimer; -@property (nullable, nonatomic) NSTimer *reconnectTimer; -@property (nullable, nonatomic) NSTimer *heartbeatTimer; +@property (nonatomic, strong) NSTimer *sendBufferTimer; +@property (nullable, nonatomic, strong) NSTimer *reconnectTimer; +@property (nullable, nonatomic, strong) NSTimer *heartbeatTimer; -@property (nonatomic) NSMutableArray *openCallbacks; -@property (nonatomic) NSMutableArray *closeCallbacks; -@property (nonatomic) NSMutableArray *errorCallbacks; -@property (nonatomic) NSMutableArray *messageCallbacks; +@property (nonatomic, strong) NSMutableArray *openCallbacks; +@property (nonatomic, strong) NSMutableArray *closeCallbacks; +@property (nonatomic, strong) NSMutableArray *errorCallbacks; +@property (nonatomic, strong) NSMutableArray *messageCallbacks; @property (nullable, nonatomic) NSDictionary *params; From e6038eb7cf6194305ff27d6577e73099b9d1a6db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Alcal=C3=A1=20Correa?= Date: Mon, 22 Feb 2016 12:51:58 +0100 Subject: [PATCH 6/6] Remove unneeded strong modifiers --- Pod/Classes/PhxSocket.h | 2 +- Pod/Classes/PhxSocket.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Pod/Classes/PhxSocket.h b/Pod/Classes/PhxSocket.h index 7b5c66b..48e819d 100644 --- a/Pod/Classes/PhxSocket.h +++ b/Pod/Classes/PhxSocket.h @@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN @interface PhxSocket : NSObject @property (nonatomic, weak) id delegate; -@property (nonatomic, strong) BOOL reconnectOnError; +@property (nonatomic) BOOL reconnectOnError; - (instancetype)initWithURL:(NSURL*)url; - (instancetype)initWithURL:(NSURL*)url heartbeatInterval:(NSTimeInterval)interval; diff --git a/Pod/Classes/PhxSocket.m b/Pod/Classes/PhxSocket.m index 6ee9a15..776d6bf 100644 --- a/Pod/Classes/PhxSocket.m +++ b/Pod/Classes/PhxSocket.m @@ -21,7 +21,7 @@ @interface PhxSocket () @property (nullable, nonatomic) SRWebSocket *socket; @property (nonatomic, strong) NSURL *URL; -@property (nonatomic, strong) NSTimeInterval heartbeatInterval; +@property (nonatomic) NSTimeInterval heartbeatInterval; @property (nonatomic, strong) NSMutableArray *channels; @property (nonatomic, strong) NSOperationQueue *queue;