diff --git a/Fonts/fontawesome-webfont.ttf b/Fonts/fontawesome-webfont.ttf new file mode 100755 index 0000000..d365924 Binary files /dev/null and b/Fonts/fontawesome-webfont.ttf differ diff --git a/Play Client/PLAController.h b/Play Client/PLAController.h index 9db8962..6c3765a 100644 --- a/Play Client/PLAController.h +++ b/Play Client/PLAController.h @@ -7,39 +7,31 @@ // #import -#import "PTPusher.h" extern NSString *const PLANowPlayingUpdated; @class PLATrack; -@interface PLAController : NSObject { +@interface PLAController : NSObject{ NSArray *queuedTracks; PLATrack *currentlyPlayingTrack; - PTPusher *pusherClient; - NSString *pusherKey; - NSString *streamUrl; - PTPusherEventBinding *updateNowPlayingPusherChannelBinding; + NSTimer *queuePoller; } @property (nonatomic, retain) NSArray *queuedTracks; @property (nonatomic, retain) PLATrack *currentlyPlayingTrack; -@property (nonatomic, retain) PTPusher *pusherClient; -@property (nonatomic, retain) PTPusherEventBinding *updateNowPlayingPusherChannelBinding; -@property (nonatomic, retain) NSString *streamUrl; -@property (nonatomic, retain) NSString *pusherKey; +@property (nonatomic, retain) NSTimer *queuePoller; + (PLAController *)sharedController; - (void)logInWithBlock:(void(^)(BOOL succeeded))block; -- (PTPusherChannel *)nowPlayingPusherChannel; -- (void)setUpPusher; -- (void)subscribeToChannels; - (void)setPlayUrl:(NSString *)url; - (NSString *)playUrl; +- (NSString *)streamUrl; - (void)setAuthToken:(NSString *)token; - (NSString *)authToken; -- (void)updateNowPlaying:(NSDictionary *)nowPlayingDict; -- (void)channelEventPushed:(PTPusherEvent *)channelEvent; +- (void)updateNowPlaying; +- (void)startPolling; +- (void)stopPolling; @end diff --git a/Play Client/PLAController.m b/Play Client/PLAController.m index 65c898a..9aecd4b 100644 --- a/Play Client/PLAController.m +++ b/Play Client/PLAController.m @@ -10,7 +10,6 @@ #import "PLAPlayClient.h" #import "PLATrack.h" -#import "PTPusherChannel.h" #if TARGET_OS_EMBEDDED #import "Reachability.h" @@ -20,15 +19,13 @@ @implementation PLAController -@synthesize queuedTracks, currentlyPlayingTrack, pusherClient, updateNowPlayingPusherChannelBinding, streamUrl, pusherKey; +@synthesize queuedTracks, currentlyPlayingTrack, queuePoller; - (void) dealloc{ [queuedTracks release]; [currentlyPlayingTrack release]; - [pusherClient release]; - [updateNowPlayingPusherChannelBinding release]; - [streamUrl release]; - [pusherKey release]; + [queuePoller invalidate]; + [queuePoller release]; [super dealloc]; } @@ -53,12 +50,7 @@ - (id)init { } - (void)logInWithBlock:(void(^)(BOOL succeeded))block{ - [[PLAPlayClient sharedClient] getPath:@"/streaming_info" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { - self.streamUrl = [responseObject objectForKey:@"stream_url"]; - self.pusherKey = [responseObject objectForKey:@"pusher_key"]; - - [self setUpPusher]; - [self subscribeToChannels]; + [[PLAPlayClient sharedClient] getPath:@"/api/now_playing" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { if (block != nil) block(YES); @@ -70,42 +62,8 @@ - (void)logInWithBlock:(void(^)(BOOL succeeded))block{ } -#pragma mark - Pusher Bootstrap - -- (PTPusherChannel *)nowPlayingPusherChannel{ - if (pusherClient) { - return [pusherClient subscribeToChannelNamed:@"now_playing_updates"]; - } - - return nil; -} - -- (void)setUpPusher{ - if (pusherClient) { - NSLog(@"destroying pusherClient to be ready to create a new one"); - PTPusherChannel *channel = [self nowPlayingPusherChannel]; - [channel removeBinding:updateNowPlayingPusherChannelBinding]; - self.updateNowPlayingPusherChannelBinding = nil; - - [self.pusherClient setDelegate:nil]; - [self.pusherClient unsubscribeFromChannel:channel]; - [self.pusherClient setReconnectAutomatically:NO]; - [self.pusherClient disconnect]; - [self.pusherClient retain]; //intentional leak. For some when these object die they occasionally wreak havoc with a hard-as-shit crash. - self.pusherClient = nil; - } - - self.pusherClient = [PTPusher pusherWithKey:pusherKey delegate:self encrypted:NO]; - [pusherClient setReconnectAutomatically:YES]; - [pusherClient setReconnectDelay:30]; -} - -- (void)subscribeToChannels{ - if (pusherClient) { - NSLog(@"subscribing to channels"); - PTPusherChannel *channel = [self nowPlayingPusherChannel]; - self.updateNowPlayingPusherChannelBinding = [channel bindToEventNamed:@"update_now_playing" target:self action:@selector(channelEventPushed:)]; - } +- (NSString *)streamUrl{ + return [NSString stringWithFormat:@"%@/api/stream?token=%@", [[PLAController sharedController] playUrl], [self authToken]]; } #pragma mark - Settings @@ -128,90 +86,39 @@ - (NSString *)authToken{ return [[NSUserDefaults standardUserDefaults] objectForKey:@"authToken"]; } -#pragma mark - State methods - -- (void)updateNowPlaying:(NSDictionary *)nowPlayingDict{ - // record current state - self.currentlyPlayingTrack = [[[PLATrack alloc] initWithAttributes:[nowPlayingDict objectForKey:@"now_playing"]] autorelease]; - - NSMutableArray *tracks = [NSMutableArray array]; - for (NSDictionary *trackDict in [nowPlayingDict objectForKey:@"songs"]) { - PLATrack *track = [[PLATrack alloc] initWithAttributes:trackDict]; - [tracks addObject:track]; - [track release]; - } - - self.queuedTracks = [NSArray arrayWithArray:tracks]; +- (void)startPolling{ + [queuePoller invalidate]; + self.queuePoller = nil; - [[NSNotificationCenter defaultCenter] postNotificationName:PLANowPlayingUpdated object:nil]; -} - -#pragma mark - Channel Event handler - -- (void)channelEventPushed:(PTPusherEvent *)channelEvent{ - if ([[channelEvent name] isEqualToString:@"update_now_playing"]) { - [self updateNowPlaying:(NSDictionary *)[channelEvent data]]; - } -} - -#pragma mark - PTPusher Delegate Methods - -- (void)pusher:(PTPusher *)client connectionDidConnect:(PTPusherConnection *)connection{ - NSLog(@"connectionDidConnect"); - client.reconnectAutomatically = YES; + self.queuePoller = [NSTimer scheduledTimerWithTimeInterval:60 target:self selector:@selector(updateNowPlaying) userInfo:nil repeats:YES]; + [queuePoller fire]; } -- (void)pusher:(PTPusher *)pusher didSubscribeToChannel:(PTPusherChannel *)channel { - NSLog(@"did subscribe to channel: %@", [channel name]); +- (void)stopPolling{ + [queuePoller invalidate]; + self.queuePoller = nil; + [queuePoller release]; } -- (void)pusher:(PTPusher *)pusher didFailToSubscribeToChannel:(PTPusherChannel *)channel withError:(NSError *)error{ - NSLog(@"failed to subscribe: %@", error.description); -} - -- (void)pusher:(PTPusher *)pusher didReceiveErrorEvent:(PTPusherErrorEvent *)errorEvent{ - NSLog(@"received error event: %@", errorEvent); -} +#pragma mark - State methods -- (void)pusher:(PTPusher *)client connectionDidDisconnect:(PTPusherConnection *)connection{ - NSLog(@"connectionDidDisconnect"); +- (void)updateNowPlaying{ + NSLog(@"Updating Now Playing"); -#if TARGET_OS_EMBEDDED - Reachability *reachability = [Reachability reachabilityForInternetConnection]; - - if ([reachability currentReachabilityStatus] == NotReachable) { - NSLog(@"NotReachable"); - client.reconnectAutomatically = NO; + [PLATrack currentQueueWithBlock:^(NSArray *tracks, NSError *err) { + NSMutableArray *foundTracks = [NSMutableArray arrayWithArray:tracks]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reachabilityChanged:) name:kReachabilityChangedNotification object:reachability]; + if ([foundTracks count] > 0) { + self.currentlyPlayingTrack = [foundTracks objectAtIndex:0]; + [foundTracks removeObjectAtIndex:0]; + } + + self.queuedTracks = [NSArray arrayWithArray:foundTracks]; - [reachability startNotifier]; - }else{ - [PLATrack currentTrackWithBlock:^(PLATrack *track, NSError *error) { - dispatch_async(dispatch_get_main_queue(), ^(void) { - self.currentlyPlayingTrack = track; - [[NSNotificationCenter defaultCenter] postNotificationName:PLANowPlayingUpdated object:nil]; - [self setUpPusher]; - [self subscribeToChannels]; - }); - }]; - } - -#else - [PLATrack currentTrackWithBlock:^(PLATrack *track, NSError *err) { dispatch_async(dispatch_get_main_queue(), ^(void) { - self.currentlyPlayingTrack = track; [[NSNotificationCenter defaultCenter] postNotificationName:PLANowPlayingUpdated object:nil]; - [self setUpPusher]; - [self subscribeToChannels]; }); - }]; - - [PLATrack currentQueueWithBlock:^(NSArray *tracks, NSError *err) { - if (tracks != nil) - self.queuedTracks = tracks; - }]; -#endif + }]; } #if TARGET_OS_EMBEDDED @@ -226,8 +133,6 @@ - (void)reachabilityChanged:(NSNotification *)note{ [PLATrack currentTrackWithBlock:^(PLATrack *track, NSError *error) { self.currentlyPlayingTrack = track; [[NSNotificationCenter defaultCenter] postNotificationName:PLANowPlayingUpdated object:nil]; - [self setUpPusher]; - [self subscribeToChannels]; }]; } diff --git a/Play Client/PLATrack.h b/Play Client/PLATrack.h index ff0975a..d5ef450 100644 --- a/Play Client/PLATrack.h +++ b/Play Client/PLATrack.h @@ -9,19 +9,25 @@ #import @interface PLATrack : NSObject { - NSString *trackId; + NSString *slug; NSString *name; NSString *album; + NSString *albumSlug; NSString *artist; - BOOL starred; + NSString *artistSlug; + NSString *albumArtPath; + BOOL liked; BOOL queued; } -@property (nonatomic, retain) NSString *trackId; +@property (nonatomic, retain) NSString *slug; @property (nonatomic, retain) NSString *name; @property (nonatomic, retain) NSString *album; +@property (nonatomic, retain) NSString *albumSlug; @property (nonatomic, retain) NSString *artist; -@property (nonatomic, assign) BOOL starred; +@property (nonatomic, retain) NSString *artistSlug; +@property (nonatomic, retain) NSString *albumArtPath; +@property (nonatomic, assign) BOOL liked; @property (nonatomic, assign) BOOL queued; @property (nonatomic, readonly) NSURL *albumArtURL; @property (nonatomic, readonly) NSURL *downloadURL; diff --git a/Play Client/PLATrack.m b/Play Client/PLATrack.m index c300a9b..d567879 100644 --- a/Play Client/PLATrack.m +++ b/Play Client/PLATrack.m @@ -26,15 +26,15 @@ @interface PLATrack () #endif @implementation PLATrack -@synthesize trackId, name, album, artist, queued, starred; +@synthesize slug, name, album, albumSlug, artist, artistSlug, albumArtPath, queued, liked; #if !TARGET_OS_IPHONE @synthesize albumArtwork = _albumArtwork; #endif + (void)currentTrackWithBlock:(void(^)(PLATrack *track, NSError *error))block{ - [[PLAPlayClient sharedClient] getPath:@"/now_playing" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { - PLATrack *track = [[[PLATrack alloc] initWithAttributes:responseObject] autorelease]; + [[PLAPlayClient sharedClient] getPath:@"/api/now_playing" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { + PLATrack *track = [[[PLATrack alloc] initWithAttributes:[responseObject objectForKey:@"now_playing"]] autorelease]; block(track, nil); } failure:^(AFHTTPRequestOperation *operation, NSError *error) { block(nil, error); @@ -43,7 +43,7 @@ + (void)currentTrackWithBlock:(void(^)(PLATrack *track, NSError *error))block{ + (void)currentQueueWithBlock:(void(^)(NSArray *tracks, NSError *error))block { - [[PLAPlayClient sharedClient] getPath:@"/queue" parameters:nil + [[PLAPlayClient sharedClient] getPath:@"/api/queue" parameters:nil success: ^ (AFHTTPRequestOperation *operation, id responseObject) { NSArray *songDicts = [responseObject valueForKey:@"songs"]; @@ -66,13 +66,16 @@ - (id)initWithAttributes:(NSDictionary *)attributes { if (!self) { return nil; } - - self.trackId = [attributes valueForKeyPath:@"id"]; - self.name = [attributes valueForKeyPath:@"name"]; - self.album = [attributes valueForKeyPath:@"album"]; - self.artist = [attributes valueForKeyPath:@"artist"]; + + self.slug = [attributes valueForKeyPath:@"slug"]; + self.name = [attributes valueForKeyPath:@"title"]; + self.album = [attributes valueForKeyPath:@"album_name"]; + self.albumSlug = [attributes valueForKeyPath:@"album_slug"]; + self.artist = [attributes valueForKeyPath:@"artist_name"]; + self.artistSlug = [attributes valueForKeyPath:@"artist_slug"]; + self.albumArtPath = [attributes valueForKeyPath:@"album_art_path"]; queued = [[attributes valueForKeyPath:@"queued"] boolValue]; - starred = [[attributes valueForKeyPath:@"starred"] boolValue]; + liked = [[attributes valueForKeyPath:@"liked"] boolValue]; #if !TARGET_OS_IPHONE [[PLAAlbumArtworkImageCache sharedCache] imageForTrack:self withCompletionBlock: ^ (NSImage *image, NSError *error) @@ -87,12 +90,15 @@ - (id)initWithAttributes:(NSDictionary *)attributes { - (id)copyWithZone:(NSZone *)zone { PLATrack *copy = [[PLATrack alloc] init]; - copy.trackId = self.trackId; + copy.slug = self.slug; copy.name = self.name; copy.album = self.album; + copy.albumSlug = self.albumSlug; copy.artist = self.artist; + copy.artistSlug = self.artistSlug; + copy.albumArtPath = self.albumArtPath; copy.queued = self.queued; - copy.starred = self.starred; + copy.liked = self.liked; #if !TARGET_OS_IPHONE copy.albumArtwork = self.albumArtwork; @@ -101,10 +107,13 @@ - (id)copyWithZone:(NSZone *)zone } - (void)dealloc{ - [trackId release]; + [slug release]; [name release]; [album release]; + [albumSlug release]; [artist release]; + [artistSlug release]; + [albumArtPath release]; #if !TARGET_OS_IPHONE [_albumArtwork release], _albumArtwork = nil; @@ -118,19 +127,19 @@ - (void)dealloc{ - (NSURL *)albumArtURL { - NSString *urlString = [NSString stringWithFormat:@"%@/images/art/%@.png", [[PLAController sharedController] playUrl], self.trackId]; + NSString *urlString = [NSString stringWithFormat:@"%@%@", [[PLAController sharedController] playUrl], self.albumArtPath]; return [NSURL URLWithString:urlString]; } - (NSURL *)downloadURL { - NSString *urlString = [NSString stringWithFormat:@"%@/song/%@/download", [[PLAController sharedController] playUrl], self.trackId]; + NSString *urlString = [NSString stringWithFormat:@"%@/api/artists/%@/songs/%@/download", [[PLAController sharedController] playUrl], [self.artistSlug stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], [self.albumSlug stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; return [NSURL URLWithString:urlString]; } - (NSURL *)albumDownloadURL { - NSString *urlString = [NSString stringWithFormat:@"%@/artist/%@/album/%@/download", [[PLAController sharedController] playUrl], [self.artist stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], [self.album stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; + NSString *urlString = [NSString stringWithFormat:@"%@/api/artists/%@/album/%@/download", [[PLAController sharedController] playUrl], [self.artistSlug stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], [self.albumSlug stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; return [NSURL URLWithString:urlString]; } @@ -139,7 +148,7 @@ - (NSURL *)albumDownloadURL - (void)toggleStarredWithCompletionBlock:(void(^)(BOOL success, NSError *err))completionBlock { - if (self.starred) { + if (self.liked) { [self unstarWithCompletionBlock:^(BOOL success, NSError *err) { if (completionBlock != nil) completionBlock(success, err); @@ -154,9 +163,9 @@ - (void)toggleStarredWithCompletionBlock:(void(^)(BOOL success, NSError *err))co - (void)starWithCompletionBlock:(void(^)(BOOL success, NSError *err))completionBlock { - NSLog(@"starring"); - [[PLAPlayClient sharedClient] postPath:@"/star" parameters:[NSDictionary dictionaryWithObject:self.trackId forKey:@"id"] success:^(AFHTTPRequestOperation *operation, id responseObject) { - self.starred = YES; + NSString *likePath = [[NSString stringWithFormat:@"api/artists/%@/songs/%@/like", self.artist, self.name] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + [[PLAPlayClient sharedClient] putPath:likePath parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { + self.liked = YES; if (completionBlock != nil) completionBlock(YES, nil); @@ -168,8 +177,9 @@ - (void)starWithCompletionBlock:(void(^)(BOOL success, NSError *err))completionB - (void)unstarWithCompletionBlock:(void(^)(BOOL success, NSError *err))completionBlock { - [[PLAPlayClient sharedClient] deletePath:@"/star" parameters:[NSDictionary dictionaryWithObject:self.trackId forKey:@"id"] success:^(AFHTTPRequestOperation *operation, id responseObject) { - self.starred = NO; + NSString *unLikePath = [[NSString stringWithFormat:@"api/artists/%@/songs/%@/unlike", self.artist, self.name] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + [[PLAPlayClient sharedClient] putPath:unLikePath parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { + self.liked = NO; if (completionBlock != nil) completionBlock(YES, nil); diff --git a/Play Cocoa.xcodeproj/project.pbxproj b/Play Cocoa.xcodeproj/project.pbxproj index 8c33fcb..1540430 100644 --- a/Play Cocoa.xcodeproj/project.pbxproj +++ b/Play Cocoa.xcodeproj/project.pbxproj @@ -59,9 +59,6 @@ E058E22615332C4C0079B226 /* icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = E058E22115332C4C0079B226 /* icon-72.png */; }; E058E22715332C4C0079B226 /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = E058E22215332C4C0079B226 /* icon.png */; }; E058E22815332C4C0079B226 /* icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E058E22315332C4C0079B226 /* icon@2x.png */; }; - E058E242153334860079B226 /* Pusher.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E058E22C153334860079B226 /* Pusher.framework */; }; - E058E245153334860079B226 /* README.txt in Resources */ = {isa = PBXBuildFile; fileRef = E058E22E153334860079B226 /* README.txt */; }; - E058E247153334860079B226 /* libPusher-combined.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E058E23F153334860079B226 /* libPusher-combined.a */; }; E058E25715333AB50079B226 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E058E2551533381F0079B226 /* SystemConfiguration.framework */; }; E058E25E15333AE40079B226 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E058E25C15333ADB0079B226 /* CoreGraphics.framework */; }; E058E25F15333AE70079B226 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E058E25A15333AD10079B226 /* Foundation.framework */; }; @@ -73,7 +70,6 @@ E058E277153376E80079B226 /* PLATrack.m in Sources */ = {isa = PBXBuildFile; fileRef = E058E273153376E80079B226 /* PLATrack.m */; }; E058E27A153377160079B226 /* PLAController.m in Sources */ = {isa = PBXBuildFile; fileRef = E058E279153377160079B226 /* PLAController.m */; }; E058E27B153377160079B226 /* PLAController.m in Sources */ = {isa = PBXBuildFile; fileRef = E058E279153377160079B226 /* PLAController.m */; }; - E058E284153390A00079B226 /* Pusher.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = E058E22C153334860079B226 /* Pusher.framework */; }; E05AEBEE1533D97E0094566C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E05AEBED1533D97E0094566C /* Foundation.framework */; }; E05AEBF01533D9840094566C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E05AEBEF1533D9840094566C /* Cocoa.framework */; }; E05AEBF21533D98B0094566C /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E05AEBF11533D98B0094566C /* AppKit.framework */; }; @@ -87,6 +83,8 @@ E05AEC0F1534B6BE0094566C /* PLALogInViewControllerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E05AEC0D1534B6BE0094566C /* PLALogInViewControllerViewController.xib */; }; E06844A0153F9C1E009C6B3F /* OpenSans-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E068449F153F9C1E009C6B3F /* OpenSans-Regular.ttf */; }; E06844A1153F9C1E009C6B3F /* OpenSans-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E068449F153F9C1E009C6B3F /* OpenSans-Regular.ttf */; }; + E06C3EB11795B6C600DD30E7 /* button-stop.png in Resources */ = {isa = PBXBuildFile; fileRef = E06C3EAF1795B6C600DD30E7 /* button-stop.png */; }; + E06C3EB21795B6C600DD30E7 /* button-stop@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E06C3EB01795B6C600DD30E7 /* button-stop@2x.png */; }; E072471C15408F7600F64C2B /* icon-72@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E072471B15408F7600F64C2B /* icon-72@2x.png */; }; E0761BB6153F928600CB3E2F /* OpenSans-LightItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E0761BB4153F928600CB3E2F /* OpenSans-LightItalic.ttf */; }; E0761BB7153F928600CB3E2F /* OpenSans-LightItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E0761BB4153F928600CB3E2F /* OpenSans-LightItalic.ttf */; }; @@ -128,6 +126,8 @@ E0783F7B15331ADF003EA138 /* AFURLConnectionOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = E0783EF11533187D003EA138 /* AFURLConnectionOperation.m */; }; E0783F7C15331ADF003EA138 /* AFXMLRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = E0783EF31533187D003EA138 /* AFXMLRequestOperation.m */; }; E0783F7D15331ADF003EA138 /* UIImageView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = E0783EF51533187D003EA138 /* UIImageView+AFNetworking.m */; }; + E0AF1F5A17C2960800551745 /* fontawesome-webfont.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E0AF1F5917C2960800551745 /* fontawesome-webfont.ttf */; }; + E0AF1F5B17C2960800551745 /* fontawesome-webfont.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E0AF1F5917C2960800551745 /* fontawesome-webfont.ttf */; }; E0C965BE1533279D001D52BF /* PLAItemAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E0C965AD1533279D001D52BF /* PLAItemAppDelegate.m */; }; E0C965BF1533279D001D52BF /* IgnoredAudioProcesses.plist in Resources */ = {isa = PBXBuildFile; fileRef = E0C965AF1533279D001D52BF /* IgnoredAudioProcesses.plist */; }; E0C965C01533279D001D52BF /* Play-Item-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = E0C965B01533279D001D52BF /* Play-Item-Info.plist */; }; @@ -180,7 +180,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - E058E284153390A00079B226 /* Pusher.framework in Copy Frameworks */, ); name = "Copy Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -256,24 +255,6 @@ E058E22115332C4C0079B226 /* icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-72.png"; sourceTree = ""; }; E058E22215332C4C0079B226 /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = ""; }; E058E22315332C4C0079B226 /* icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon@2x.png"; sourceTree = ""; }; - E058E22C153334860079B226 /* Pusher.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Pusher.framework; sourceTree = ""; }; - E058E22E153334860079B226 /* README.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.txt; sourceTree = ""; }; - E058E230153334860079B226 /* PTEventListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTEventListener.h; sourceTree = ""; }; - E058E231153334860079B226 /* PTJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTJSON.h; sourceTree = ""; }; - E058E232153334860079B226 /* PTJSONParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTJSONParser.h; sourceTree = ""; }; - E058E233153334860079B226 /* PTPusher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTPusher.h; sourceTree = ""; }; - E058E234153334860079B226 /* PTPusherAPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTPusherAPI.h; sourceTree = ""; }; - E058E235153334860079B226 /* PTPusherChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTPusherChannel.h; sourceTree = ""; }; - E058E236153334860079B226 /* PTPusherConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTPusherConnection.h; sourceTree = ""; }; - E058E237153334860079B226 /* PTPusherDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTPusherDelegate.h; sourceTree = ""; }; - E058E238153334860079B226 /* PTPusherErrors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTPusherErrors.h; sourceTree = ""; }; - E058E239153334860079B226 /* PTPusherEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTPusherEvent.h; sourceTree = ""; }; - E058E23A153334860079B226 /* PTPusherEventDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTPusherEventDispatcher.h; sourceTree = ""; }; - E058E23B153334860079B226 /* PTPusherEventPublisher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTPusherEventPublisher.h; sourceTree = ""; }; - E058E23C153334860079B226 /* PTPusherMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTPusherMacros.h; sourceTree = ""; }; - E058E23D153334860079B226 /* PTPusherPresenceChannelDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTPusherPresenceChannelDelegate.h; sourceTree = ""; }; - E058E23E153334860079B226 /* SRWebSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SRWebSocket.h; sourceTree = ""; }; - E058E23F153334860079B226 /* libPusher-combined.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libPusher-combined.a"; sourceTree = ""; }; E058E2551533381F0079B226 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/SystemConfiguration.framework; sourceTree = DEVELOPER_DIR; }; E058E25815333AC80079B226 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; E058E25A15333AD10079B226 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; @@ -300,6 +281,8 @@ E05AEC0C1534B6BE0094566C /* PLALogInViewControllerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PLALogInViewControllerViewController.m; sourceTree = ""; }; E05AEC0D1534B6BE0094566C /* PLALogInViewControllerViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PLALogInViewControllerViewController.xib; sourceTree = ""; }; E068449F153F9C1E009C6B3F /* OpenSans-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "OpenSans-Regular.ttf"; sourceTree = ""; }; + E06C3EAF1795B6C600DD30E7 /* button-stop.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "button-stop.png"; sourceTree = ""; }; + E06C3EB01795B6C600DD30E7 /* button-stop@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "button-stop@2x.png"; sourceTree = ""; }; E072471B15408F7600F64C2B /* icon-72@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-72@2x.png"; sourceTree = ""; }; E0761BB4153F928600CB3E2F /* OpenSans-LightItalic.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "OpenSans-LightItalic.ttf"; sourceTree = ""; }; E0761BB5153F928600CB3E2F /* OpenSans-Semibold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "OpenSans-Semibold.ttf"; sourceTree = ""; }; @@ -351,6 +334,7 @@ E0783F0E1533187D003EA138 /* SFHFKeychainUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SFHFKeychainUtils.h; sourceTree = ""; }; E0783F0F1533187D003EA138 /* SFHFKeychainUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SFHFKeychainUtils.m; sourceTree = ""; }; E09B1E4814E3FD4C001BD57E /* Play.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Play.app; sourceTree = BUILT_PRODUCTS_DIR; }; + E0AF1F5917C2960800551745 /* fontawesome-webfont.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "fontawesome-webfont.ttf"; sourceTree = ""; }; E0C965AC1533279D001D52BF /* PLAItemAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PLAItemAppDelegate.h; path = ../PLAItemAppDelegate.h; sourceTree = ""; }; E0C965AD1533279D001D52BF /* PLAItemAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PLAItemAppDelegate.m; path = ../PLAItemAppDelegate.m; sourceTree = ""; }; E0C965AF1533279D001D52BF /* IgnoredAudioProcesses.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = IgnoredAudioProcesses.plist; sourceTree = ""; }; @@ -400,7 +384,6 @@ E0CAF64415332610007EE510 /* AudioToolbox.framework in Frameworks */, E0CAF642153325FA007EE510 /* CoreAudio.framework in Frameworks */, E0CAF63B153325DB007EE510 /* MediaPlayer.framework in Frameworks */, - E058E247153334860079B226 /* libPusher-combined.a in Frameworks */, E058E25715333AB50079B226 /* SystemConfiguration.framework in Frameworks */, E058E25E15333AE40079B226 /* CoreGraphics.framework in Frameworks */, E058E25F15333AE70079B226 /* Foundation.framework in Frameworks */, @@ -422,7 +405,6 @@ E05AEBF21533D98B0094566C /* AppKit.framework in Frameworks */, E05AEBF01533D9840094566C /* Cocoa.framework in Frameworks */, E05AEBEE1533D97E0094566C /* Foundation.framework in Frameworks */, - E058E242153334860079B226 /* Pusher.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -566,55 +548,6 @@ name = "Download Song"; sourceTree = ""; }; - E058E22A153334860079B226 /* libPusher */ = { - isa = PBXGroup; - children = ( - E058E22B153334860079B226 /* OS X */, - E058E22D153334860079B226 /* iOS */, - ); - path = libPusher; - sourceTree = ""; - }; - E058E22B153334860079B226 /* OS X */ = { - isa = PBXGroup; - children = ( - E058E22C153334860079B226 /* Pusher.framework */, - ); - path = "OS X"; - sourceTree = ""; - }; - E058E22D153334860079B226 /* iOS */ = { - isa = PBXGroup; - children = ( - E058E22E153334860079B226 /* README.txt */, - E058E22F153334860079B226 /* headers */, - E058E23F153334860079B226 /* libPusher-combined.a */, - ); - path = iOS; - sourceTree = ""; - }; - E058E22F153334860079B226 /* headers */ = { - isa = PBXGroup; - children = ( - E058E230153334860079B226 /* PTEventListener.h */, - E058E231153334860079B226 /* PTJSON.h */, - E058E232153334860079B226 /* PTJSONParser.h */, - E058E233153334860079B226 /* PTPusher.h */, - E058E234153334860079B226 /* PTPusherAPI.h */, - E058E235153334860079B226 /* PTPusherChannel.h */, - E058E236153334860079B226 /* PTPusherConnection.h */, - E058E237153334860079B226 /* PTPusherDelegate.h */, - E058E238153334860079B226 /* PTPusherErrors.h */, - E058E239153334860079B226 /* PTPusherEvent.h */, - E058E23A153334860079B226 /* PTPusherEventDispatcher.h */, - E058E23B153334860079B226 /* PTPusherEventPublisher.h */, - E058E23C153334860079B226 /* PTPusherMacros.h */, - E058E23D153334860079B226 /* PTPusherPresenceChannelDelegate.h */, - E058E23E153334860079B226 /* SRWebSocket.h */, - ); - path = headers; - sourceTree = ""; - }; E058E26F153376E80079B226 /* Play Client */ = { isa = PBXGroup; children = ( @@ -647,6 +580,7 @@ E0761BB3153F928600CB3E2F /* Fonts */ = { isa = PBXGroup; children = ( + E0AF1F5917C2960800551745 /* fontawesome-webfont.ttf */, E068449F153F9C1E009C6B3F /* OpenSans-Regular.ttf */, E0761BBC153F977500CB3E2F /* OpenSans-Italic.ttf */, E0761BB4153F928600CB3E2F /* OpenSans-LightItalic.ttf */, @@ -659,7 +593,6 @@ isa = PBXGroup; children = ( E058E2801533837E0079B226 /* Reachability */, - E058E22A153334860079B226 /* libPusher */, E0783EE01533187D003EA138 /* AFNetworking */, E0783EF61533187D003EA138 /* AudioStreamer */, E0783EFB1533187D003EA138 /* SDWebImage */, @@ -903,6 +836,8 @@ E0C965DC153327A6001D52BF /* button-pause@2x.png */, E0C965DD153327A6001D52BF /* button-play.png */, E0C965DE153327A6001D52BF /* button-play@2x.png */, + E06C3EAF1795B6C600DD30E7 /* button-stop.png */, + E06C3EB01795B6C600DD30E7 /* button-stop@2x.png */, E0C965DF153327A6001D52BF /* default_album.png */, E0C965E0153327A6001D52BF /* default_album@2x.png */, E0C965E1153327A6001D52BF /* shadow.png */, @@ -1019,7 +954,6 @@ E058E22615332C4C0079B226 /* icon-72.png in Resources */, E058E22715332C4C0079B226 /* icon.png in Resources */, E058E22815332C4C0079B226 /* icon@2x.png in Resources */, - E058E245153334860079B226 /* README.txt in Resources */, E05AEC0F1534B6BE0094566C /* PLALogInViewControllerViewController.xib in Resources */, E0761BB7153F928600CB3E2F /* OpenSans-LightItalic.ttf in Resources */, E0761BB9153F928600CB3E2F /* OpenSans-Semibold.ttf in Resources */, @@ -1027,6 +961,9 @@ E06844A1153F9C1E009C6B3F /* OpenSans-Regular.ttf in Resources */, E072471C15408F7600F64C2B /* icon-72@2x.png in Resources */, E0146EBD1602EF9E0042C696 /* Default-568h@2x.png in Resources */, + E06C3EB11795B6C600DD30E7 /* button-stop.png in Resources */, + E06C3EB21795B6C600DD30E7 /* button-stop@2x.png in Resources */, + E0AF1F5B17C2960800551745 /* fontawesome-webfont.ttf in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1073,6 +1010,7 @@ E0761BB8153F928600CB3E2F /* OpenSans-Semibold.ttf in Resources */, E0761BBD153F977500CB3E2F /* OpenSans-Italic.ttf in Resources */, E06844A0153F9C1E009C6B3F /* OpenSans-Regular.ttf in Resources */, + E0AF1F5A17C2960800551745 /* fontawesome-webfont.ttf in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Play Item/Classes/Controllers/PLAItemLogInWindowController.m b/Play Item/Classes/Controllers/PLAItemLogInWindowController.m index b9eedd7..bfdeeb8 100644 --- a/Play Item/Classes/Controllers/PLAItemLogInWindowController.m +++ b/Play Item/Classes/Controllers/PLAItemLogInWindowController.m @@ -57,7 +57,7 @@ - (IBAction)getToken:(id)sender return; } - NSURL *tokenURL = [playURL URLByAppendingPathComponent:@"token"]; + NSURL *tokenURL = [playURL URLByAppendingPathComponent:@"account/token"]; [[NSWorkspace sharedWorkspace] openURL:tokenURL]; } diff --git a/Play Item/Classes/Controllers/PLAQueueWindowController.m b/Play Item/Classes/Controllers/PLAQueueWindowController.m index 3267ad4..164d6e1 100644 --- a/Play Item/Classes/Controllers/PLAQueueWindowController.m +++ b/Play Item/Classes/Controllers/PLAQueueWindowController.m @@ -85,8 +85,8 @@ - (void)updateQueue - (void)updateNowPlayingStarImage { - self.nowPlayingStarButton.image = [NSImage imageNamed:(self.currentTrack.starred ? @"starred-pink" : @"unstarred-pink")]; - self.nowPlayingStarButton.alternateImage = [NSImage imageNamed:(self.currentTrack.starred ? @"starred-pink-down" : @"unstarred-pink-down")]; + self.nowPlayingStarButton.image = [NSImage imageNamed:(self.currentTrack.liked ? @"starred-pink" : @"unstarred-pink")]; + self.nowPlayingStarButton.alternateImage = [NSImage imageNamed:(self.currentTrack.liked ? @"starred-pink-down" : @"unstarred-pink-down")]; } #pragma mark - @@ -116,7 +116,7 @@ - (IBAction)showPrefs:(id)sender if (downloadFolderPaths.count < 1) return (NSURL *)nil; - return [NSURL fileURLWithPath:[downloadFolderPaths objectAtIndex:0]]; + return (NSURL *)[NSURL fileURLWithPath:[downloadFolderPaths objectAtIndex:0]]; }; - (void)downloadTrack:(PLATrack *)track diff --git a/Play Item/Classes/PLAQueueTableCellView.m b/Play Item/Classes/PLAQueueTableCellView.m index 1fe4bbe..972f80f 100644 --- a/Play Item/Classes/PLAQueueTableCellView.m +++ b/Play Item/Classes/PLAQueueTableCellView.m @@ -41,8 +41,8 @@ - (IBAction)toggleStar:(id)sender - (void)updateStarImage { - self.starButton.image = [NSImage imageNamed:([self.objectValue starred] ? @"starred-grey" : @"unstarred-grey")]; - self.starButton.alternateImage = [NSImage imageNamed:([self.objectValue starred] ? @"starred-grey-down" : @"unstarred-grey-down")]; + self.starButton.image = [NSImage imageNamed:([self.objectValue liked] ? @"starred-grey" : @"unstarred-grey")]; + self.starButton.alternateImage = [NSImage imageNamed:([self.objectValue liked] ? @"starred-grey-down" : @"unstarred-grey-down")]; } #pragma mark - diff --git a/Play Item/PLAItemAppDelegate.m b/Play Item/PLAItemAppDelegate.m index 318885e..bcaa61d 100644 --- a/Play Item/PLAItemAppDelegate.m +++ b/Play Item/PLAItemAppDelegate.m @@ -100,19 +100,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification{ - (void)didLogIn{ [[NSNotificationCenter defaultCenter] postNotificationName:PLAItemLoggedInNotificationName object:self]; - - [PLATrack currentTrackWithBlock:^(PLATrack *track, NSError *err) { - [[PLAController sharedController] setCurrentlyPlayingTrack:track]; - - dispatch_async(dispatch_get_main_queue(), ^(void) { - [PLATrack currentQueueWithBlock:^(NSArray *tracks, NSError *err) { - [PLAController sharedController].queuedTracks = tracks; - [[NSNotificationCenter defaultCenter] postNotificationName:PLANowPlayingUpdated object:nil]; - }]; - }); - - }]; - + [[PLAController sharedController] startPolling]; } - (IBAction)toggleWindow:(id)sender @@ -187,22 +175,22 @@ - (void)createStreamer{ NSString *streamUrl = [[PLAController sharedController] streamUrl]; - NSLog(@"opening stream at: %@", streamUrl); - [self destroyStreamer]; self.streamer = [[AudioStreamer alloc] initWithURL:[NSURL URLWithString:streamUrl]]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playbackStateChanged:) name:ASStatusChangedNotification object:self.streamer]; + [[NSNotificationCenter defaultCenter] addObserver:[PLAController sharedController] selector:@selector(updateNowPlaying) name:ASUpdateMetadataNotification object:self.streamer]; } - (void)destroyStreamer{ if (self.streamer){ [[NSNotificationCenter defaultCenter] removeObserver:self name:ASStatusChangedNotification object:self.streamer]; + [[NSNotificationCenter defaultCenter] removeObserver:[PLAController sharedController] name:ASUpdateMetadataNotification object:self.streamer]; [self.streamer stop]; self.streamer = nil; - + [[NSNotificationCenter defaultCenter] postNotificationName:PLAItemStoppedPlayingNotificationName object:self]; } } diff --git a/Play Item/Supporting Files/Play-Item-Info.plist b/Play Item/Supporting Files/Play-Item-Info.plist index 0fef6b9..4b0a719 100644 --- a/Play Item/Supporting Files/Play-Item-Info.plist +++ b/Play Item/Supporting Files/Play-Item-Info.plist @@ -19,11 +19,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.0.2 + 2.1 CFBundleSignature ???? CFBundleVersion - 2.0.2 + 2.1 LSApplicationCategoryType public.app-category.music LSMinimumSystemVersion diff --git a/Play iOS/Classes/Controllers/PLALogInViewControllerViewController.h b/Play iOS/Classes/Controllers/PLALogInViewControllerViewController.h index e87dece..decbba8 100644 --- a/Play iOS/Classes/Controllers/PLALogInViewControllerViewController.h +++ b/Play iOS/Classes/Controllers/PLALogInViewControllerViewController.h @@ -8,33 +8,15 @@ #import -@interface PLALogInViewControllerViewController : UIViewController { - UIScrollView *pagingScrollView; - UIPageControl *pageControl; - - UIView *urlView; - UIView *tokenView; +@interface PLALogInViewControllerViewController : UIViewController { UIButton *urlButton; UILabel *welcomeLabel; - UILabel *urlInstructionLabel; - UILabel *tokenInstructionLabel; - UITextField *playUrlTextField; - UITextField *playTokenTextField; - BOOL pageControlBeingUsed; } -@property (retain, nonatomic) IBOutlet UIScrollView *pagingScrollView; -@property (retain, nonatomic) IBOutlet UIPageControl *pageControl; -@property (retain, nonatomic) IBOutlet UIView *urlView; -@property (retain, nonatomic) IBOutlet UIView *tokenView; @property (retain, nonatomic) IBOutlet UIButton *urlButton; @property (retain, nonatomic) IBOutlet UILabel *welcomeLabel; -@property (retain, nonatomic) IBOutlet UILabel *urlInstructionLabel; -@property (retain, nonatomic) IBOutlet UILabel *tokenInstructionLabel; - @property (retain, nonatomic) IBOutlet UITextField *playUrlTextField; -@property (retain, nonatomic) IBOutlet UITextField *playTokenTextField; @end diff --git a/Play iOS/Classes/Controllers/PLALogInViewControllerViewController.m b/Play iOS/Classes/Controllers/PLALogInViewControllerViewController.m index d8eb56d..04e8f1a 100644 --- a/Play iOS/Classes/Controllers/PLALogInViewControllerViewController.m +++ b/Play iOS/Classes/Controllers/PLALogInViewControllerViewController.m @@ -11,19 +11,12 @@ #import "PLAPlayerViewController.h" @implementation PLALogInViewControllerViewController -@synthesize pagingScrollView, pageControl, urlView, tokenView, welcomeLabel, urlInstructionLabel, tokenInstructionLabel, playUrlTextField, playTokenTextField, urlButton; +@synthesize welcomeLabel, playUrlTextField, urlButton; - (void)dealloc { [playUrlTextField release]; - [playTokenTextField release]; - [pagingScrollView release]; - [pageControl release]; - [tokenView release]; - [urlView release]; [urlButton release]; [welcomeLabel release]; - [tokenInstructionLabel release]; - [urlInstructionLabel release]; [super dealloc]; } @@ -31,60 +24,23 @@ - (void)dealloc { - (void)viewDidLoad{ [super viewDidLoad]; - pageControlBeingUsed = NO; - NSLog(@"font names: %@", [UIFont fontNamesForFamilyName:@"Open Sans"]); - [welcomeLabel setFont:[UIFont fontWithName:@"OpenSans-Semibold" size:24.0]]; - [urlInstructionLabel setFont:[UIFont fontWithName:@"OpenSans" size:18.0]]; - [tokenInstructionLabel setFont:[UIFont fontWithName:@"OpenSans" size:18.0]]; if ([[PLAController sharedController] playUrl]) { [playUrlTextField setText:[[PLAController sharedController] playUrl]]; } - - if ([[PLAController sharedController] authToken]) { - [playTokenTextField setText:[[PLAController sharedController] authToken]]; - } -} - -- (void)viewWillAppear:(BOOL)animated{ - [super viewWillAppear:animated]; - - CGFloat pageWidth = self.view.bounds.size.width; - - [pagingScrollView setContentSize:CGSizeMake(pageWidth * 2, 200.0)]; - [pagingScrollView setPagingEnabled:YES]; - - - [urlView setFrame:CGRectMake(0, 0, pageWidth, 200.0)]; - [tokenView setFrame:CGRectMake(pageWidth, 0, pageWidth, 200.0)]; - - [pagingScrollView addSubview:urlView]; - [pagingScrollView addSubview:tokenView]; - - [pageControl setNumberOfPages:2]; } - (void)viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; - CGFloat pageWidth = self.view.bounds.size.width; - NSLog(@"pageWidth: %f", pageWidth); - [playUrlTextField becomeFirstResponder]; } - (void)viewDidUnload{ self.playUrlTextField = nil; - self.playTokenTextField = nil; - self.pagingScrollView = nil; - self.pageControl = nil; - self.urlView = nil; - self.tokenView = nil; self.urlButton = nil; self.welcomeLabel = nil; - self.urlInstructionLabel = nil; - self.tokenInstructionLabel = nil; [super viewDidUnload]; } @@ -96,83 +52,18 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface } } -- (void)logIn{ - [[PLAController sharedController] setPlayUrl:playUrlTextField.text]; - [[PLAController sharedController] setAuthToken:playTokenTextField.text]; - - [[PLAController sharedController] logInWithBlock:^(BOOL succeeded) { - dispatch_async(dispatch_get_main_queue(), ^(void) { - if (succeeded) { - [(PLAPlayerViewController *)self.presentingViewController setUpForStreaming]; - [self dismissModalViewControllerAnimated:YES]; - }else{ - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Oops!" message:@"Play cannot be reached or your log in details are incorrect. Try again." delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil]; - [alert show]; - [alert release]; - } - }); - }]; -} - -- (IBAction)changePage { - pageControlBeingUsed = YES; - CGRect frame; - frame.origin.x = self.pagingScrollView.frame.size.width * self.pageControl.currentPage; - frame.origin.y = 0; - frame.size = self.pagingScrollView.frame.size; - [self.pagingScrollView scrollRectToVisible:frame animated:YES]; -} - -- (IBAction)goToPlayToken{ - [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/token?back_to=play-ios://", playUrlTextField.text]]]; -} - -- (void)setUpTokenView{ - [urlButton setTitle:[NSString stringWithFormat:@"%@ →", playUrlTextField.text] forState:UIControlStateNormal]; - - pageControl.currentPage = 1; - [self changePage]; +- (IBAction)logIn{ + [[PLAController sharedController] setPlayUrl:playUrlTextField.text]; + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/account/token?back_to=play-ios://", playUrlTextField.text]]]; } - (void)setFirstResponder{ - if (pageControl.currentPage == 0) { - [playUrlTextField becomeFirstResponder]; - }else if (pageControl.currentPage == 1) { - [playTokenTextField becomeFirstResponder]; - } -} - -- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { - pageControlBeingUsed = NO; -} - -- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { - pageControlBeingUsed = NO; - - [self setFirstResponder]; -} - -- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView{ - [self setFirstResponder]; -} - -- (void)scrollViewDidScroll:(UIScrollView *)sender { - if (!pageControlBeingUsed) { - // Update the page when more than 50% of the previous/next page is visible - CGFloat pageWidth = self.pagingScrollView.frame.size.width; - int page = floor((self.pagingScrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1; - self.pageControl.currentPage = page; - } + [playUrlTextField becomeFirstResponder]; } - - (BOOL)textFieldShouldReturn:(UITextField *)textField{ - if (textField == playUrlTextField) { - [self setUpTokenView]; - }else{ - [self logIn]; - } + [self logIn]; return YES; } diff --git a/Play iOS/Classes/Controllers/PLALogInViewControllerViewController.xib b/Play iOS/Classes/Controllers/PLALogInViewControllerViewController.xib index 5705391..d7f4d06 100644 --- a/Play iOS/Classes/Controllers/PLALogInViewControllerViewController.xib +++ b/Play iOS/Classes/Controllers/PLALogInViewControllerViewController.xib @@ -1,22 +1,20 @@ - 1296 - 11D50b - 2182 - 1138.32 - 568.00 + 1552 + 12E55 + 3084 + 1187.39 + 626.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 1181 + 2083 IBProxyObject IBUIButton IBUILabel IBUITextField - IBUIPageControl - IBUIScrollView IBUIView @@ -39,140 +37,23 @@ 274 - + 290 - {320, 200} + {{20, 146}, {280, 29}} - - _NS:9 - YES - YES - IBCocoaTouchFramework - YES - NO - NO - - - - 1317 - - {{141, 212}, {38, 36}} - - _NS:9 - NO - IBCocoaTouchFramework - 0 - 0 - 3 - - - {{0, 20}, {320, 460}} - - - - 2 - MC44ODYyNzQ1NzYyIDAuODgyMzUzMDA3OCAwLjg3MDU4ODMwMjYAA - - - IBCocoaTouchFramework - - - - 290 - - - - 295 - {{60, 169}, {200, 31}} - _NS:9 NO - YES IBCocoaTouchFramework + 0 0 - - 3 - 53kk2 - - 3 - MAA - - 2 - - - YES - 17 - - 1 - 1 - YES - IBCocoaTouchFramework - - - 1 - 14 - - - Helvetica - 14 - 16 - - - - - 290 - {{20, 57}, {280, 62}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - Next, visit your Play to get your log in token. - - 3 - MC4zMzMzMzMzMzMzAA - - - + Log In + 3 MQA - {0, 1} - 0 - 10 - 3 - 1 - 0 - - 2 - 20 - - - Helvetica-Bold - 20 - 16 - - - - - 290 - {{20, 121}, {280, 29}} - - - - _NS:9 - NO - IBCocoaTouchFramework - 0 - 0 - 2 MC45NDExNzY1MzM3IDAuNDM5MjE1NzE5NyAwLjk2ODYyNzUxMjUAA @@ -183,46 +64,36 @@ 2 - 14 + 24 Helvetica-Bold - 14 + 24 16 - - {320, 200} - - - - _NS:9 - - 3 - MCAwAA - - IBCocoaTouchFramework - - - - 290 - - - + + 290 - {{20, 48}, {280, 54}} - + {{20, 20}, {280, 65}} + - + _NS:9 - + + 3 + MCAwAA + NO YES 7 NO IBCocoaTouchFramework - First, enter the URL to your Play. - + Enter your Play URL and log in. + + 3 + MC4zMzMzMzMzMzMzAA + {0, 1} @@ -231,16 +102,24 @@ 6 1 0 - - + + 2 + 20 + + + Helvetica-Bold + 20 + 16 + + 280 - - + + 295 - {{60, 169}, {200, 31}} - + {{60, 107}, {200, 31}} + - + _NS:9 NO YES @@ -248,11 +127,13 @@ 0 3 - http://play.domain.com:5050 + http://play.domain.com:3030 3 MAA - + + 2 + YES 17 @@ -262,43 +143,26 @@ 4 IBCocoaTouchFramework - - - - - - 290 - {{20, 6}, {280, 45}} - - - - _NS:9 - - NO - YES - 7 - NO - IBCocoaTouchFramework - Welcome to Play. - - - - {0, 1} - 0 - 10 - 6 - 1 - 0 - - + + 1 + 14 + + + Helvetica + 14 + 16 + - {320, 200} + {{0, 20}, {320, 460}} - - _NS:9 - + + + 2 + MC44ODYyNzQ1NzYyIDAuODgyMzUzMDA3OCAwLjg3MDU4ODMwMjYAA + + IBCocoaTouchFramework @@ -316,123 +180,42 @@ playUrlTextField - - - 7 - - - - playTokenTextField - - - - 8 - - - - pagingScrollView - - + - 20 + 45 - pageControl - - - - 21 - - - - tokenView - - - - 22 - - - - urlView + welcomeLabel - + - 23 + 46 urlButton - - - 28 - - - - tokenInstructionLabel - - - - 31 - - - - urlInstructionLabel - - + - 32 + 47 - - welcomeLabel - - - - 34 - - - - delegate - - - - 10 - - - - delegate - + + logIn + + 7 - 9 + 48 delegate - - - - 19 - - - - changePage - - - 13 - - 24 - - - - goToPlayToken - + - 7 - 30 + 44 @@ -447,8 +230,9 @@ 1 - - + + + @@ -464,66 +248,19 @@ - 14 - + 35 + - 15 - + 41 + - 11 - - - - - - - - URL View - - - 4 - - - - - 12 - - - - - - - - Token View - - - 5 - - - - - 16 - - - - - 18 - - - - - 27 - - - - - 33 - - + 42 + + @@ -533,22 +270,15 @@ UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 34 + 48 @@ -556,54 +286,19 @@ PLALogInViewControllerViewController UIViewController - UIPageControl - UIScrollView - UITextField UITextField - UILabel - UIView UIButton - UILabel - UIView UILabel - - pageControl - UIPageControl - - - pagingScrollView - UIScrollView - - - playTokenTextField - UITextField - playUrlTextField UITextField - - tokenInstructionLabel - UILabel - - - tokenView - UIView - urlButton UIButton - - urlInstructionLabel - UILabel - - - urlView - UIView - welcomeLabel UILabel @@ -620,10 +315,10 @@ IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - + YES 3 - 1181 + 2083 diff --git a/Play iOS/Classes/Controllers/PLAPlayerViewController.h b/Play iOS/Classes/Controllers/PLAPlayerViewController.h index d47a954..025b5da 100644 --- a/Play iOS/Classes/Controllers/PLAPlayerViewController.h +++ b/Play iOS/Classes/Controllers/PLAPlayerViewController.h @@ -27,8 +27,6 @@ @property (retain, nonatomic) IBOutlet UILabel *artistLabel; @property (retain, nonatomic) IBOutlet UIImageView *albumArtImageView; @property (retain, nonatomic) IBOutlet UIButton *playButton; -@property (retain, nonatomic) IBOutlet UIView *nowPlayingView; -@property (retain, nonatomic) IBOutlet UIView *sliderView; @property (retain, nonatomic) IBOutlet UILabel *statusLabel; @property (retain, nonatomic) PLATrack *currentTrack; diff --git a/Play iOS/Classes/Controllers/PLAPlayerViewController.m b/Play iOS/Classes/Controllers/PLAPlayerViewController.m index 04c3cd0..f2d037f 100644 --- a/Play iOS/Classes/Controllers/PLAPlayerViewController.m +++ b/Play iOS/Classes/Controllers/PLAPlayerViewController.m @@ -16,7 +16,7 @@ #import @implementation PLAPlayerViewController -@synthesize songLabel, artistLabel, albumArtImageView, playButton, nowPlayingView, sliderView, statusLabel, currentTrack; +@synthesize songLabel, artistLabel, albumArtImageView, playButton, statusLabel, currentTrack; - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; @@ -28,8 +28,6 @@ - (void)dealloc { [artistLabel release]; [albumArtImageView release]; [playButton release]; - [nowPlayingView release]; - [sliderView release]; [statusLabel release]; [super dealloc]; } @@ -40,22 +38,21 @@ - (void)dealloc { - (void)viewDidLoad{ [super viewDidLoad]; - [self hideNowPlaying:NO]; - albumArtImageView.layer.masksToBounds = YES; - - CGRect nowPlayingViewFrame = nowPlayingView.frame; + [self.artistLabel setText:@""]; + [self.songLabel setText:@""]; - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { - nowPlayingViewFrame.size.height = 126.0; - }else{ - nowPlayingViewFrame.size.height = 246.0; - } - [nowPlayingView setFrame:nowPlayingViewFrame]; + albumArtImageView.layer.masksToBounds = YES; + + [playButton.titleLabel setFont:[UIFont fontWithName:@"FontAwesome" size:20.0]]; + [playButton setTitle:@"\uf04b" forState:UIControlStateNormal]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateViewsWithTrackInformation) name:PLANowPlayingUpdated object:nil]; + [[PLAController sharedController] logInWithBlock:^(BOOL succeeded) { dispatch_async(dispatch_get_main_queue(), ^(void) { if (succeeded) { - [self setUpForStreaming]; + [[PLAController sharedController] updateNowPlaying]; }else{ [self presentLogIn]; } @@ -70,19 +67,24 @@ - (void)viewDidUnload{ [self setArtistLabel:nil]; [self setAlbumArtImageView:nil]; [self setPlayButton:nil]; - [self setNowPlayingView:nil]; - [self setSliderView:nil]; [self setStatusLabel:nil]; [super viewDidUnload]; } - (void)viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; + + MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame:CGRectMake(self.view.bounds.size.width - 70.0, self.view.bounds.size.height - 35.0, 30.0, 50.0)]; + [volumeView setShowsVolumeSlider:NO]; + [volumeView setShowsRouteButton:YES]; + [volumeView sizeToFit]; + [self.view addSubview:volumeView]; + [volumeView release]; UIApplication *application = [UIApplication sharedApplication]; [application beginReceivingRemoteControlEvents]; [self becomeFirstResponder]; // this enables listening for events - [[NSNotificationCenter defaultCenter] postNotificationName:ASStatusChangedNotification object:self]; + [[NSNotificationCenter defaultCenter] postNotificationName:ASStatusChangedNotification object:self]; } - (NSUInteger)supportedInterfaceOrientations { @@ -107,23 +109,6 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface } - -#pragma mark - Bootstrapping methods - -- (void)setUpForStreaming{ - // listen for notifications for updated songs from the CFController and pusher - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateViewsWithTrackInformation) name:PLANowPlayingUpdated object:nil]; - - [PLATrack currentTrackWithBlock:^(PLATrack *track, NSError *error) { - [[PLAController sharedController] setCurrentlyPlayingTrack:track]; - - dispatch_async(dispatch_get_main_queue(), ^(void) { - [self updateViewsWithTrackInformation]; - }); - - }]; -} - #pragma mark - Actionable methods - (IBAction)presentLogIn{ @@ -159,16 +144,15 @@ - (void)updateViewsWithTrackInformation{ - (void)updateMetaData{ PLATrack *currentlyPlayingTrack = [[PLAController sharedController] currentlyPlayingTrack]; - + if (currentlyPlayingTrack) { self.songLabel.text = [currentlyPlayingTrack name]; - self.artistLabel.text = [currentlyPlayingTrack artist]; + self.artistLabel.text = [NSString stringWithFormat:@"%@ • %@", [currentlyPlayingTrack artist], [currentlyPlayingTrack album]]; [self adjustLabels]; - [self showNowPlaying:YES]; MPMediaItemArtwork *mediaItemArtwork = [[MPMediaItemArtwork alloc] initWithImage:albumArtImageView.image]; - + NSDictionary *nowPlayingMetaDict = [NSDictionary dictionaryWithObjectsAndKeys:[currentlyPlayingTrack name], MPMediaItemPropertyTitle, [currentlyPlayingTrack album], MPMediaItemPropertyAlbumTitle, [currentlyPlayingTrack artist], MPMediaItemPropertyArtist, mediaItemArtwork, MPMediaItemPropertyArtwork, nil]; [[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:nowPlayingMetaDict]; @@ -183,36 +167,6 @@ - (void)updateMetaData{ } } -- (void)hideNowPlaying:(BOOL)animated{ - float duration = 0.0; - if (animated) { - duration = 0.3; - } - - [UIView animateWithDuration:duration delay:0.0 options:UIViewAnimationCurveEaseOut animations:^{ - sliderView.transform = CGAffineTransformIdentity; - } completion:^(BOOL finished) {}]; -} - -- (void)showNowPlaying:(BOOL)animated{ - float duration = 0.0; - if (animated) { - duration = 0.3; - } - - float yDistance; - - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { - yDistance = 125.0; - }else{ - yDistance = 244.0; - } - - [UIView animateWithDuration:duration delay:0.0 options:UIViewAnimationCurveEaseIn animations:^{ - sliderView.transform = CGAffineTransformMakeTranslation(0, yDistance); - } completion:^(BOOL finished) {}]; -} - - (void)adjustLabels{ CGRect songLabelFrame = songLabel.frame; CGRect artistLabelFrame = artistLabel.frame; @@ -232,27 +186,27 @@ - (void)adjustLabels{ padding = 20.0; } - albumArtImageViewFrame.origin.y = padding + 3.0; - albumArtImageViewFrame.origin.x = nowPlayingView.bounds.size.width - albumArtImageViewFrame.size.width - padding; + albumArtImageViewFrame.origin.y = padding; + albumArtImageViewFrame.origin.x = padding; - songLabelFrame.origin.x = padding; - songLabelFrame.origin.y = padding; - songLabelFrame.size.width = albumArtImageViewFrame.origin.x - padding - 10.0; + songLabelFrame.origin.x = albumArtImageViewFrame.origin.x + albumArtImageViewFrame.size.width + padding; + songLabelFrame.origin.y = albumArtImageViewFrame.origin.y; + songLabelFrame.size.width = self.view.bounds.size.width - songLabelFrame.origin.x - padding; CGSize maximumSongLabelSize = CGSizeMake(songLabelFrame.size.width,9999); CGSize expectedSongLabelSize = [[songLabel text] sizeWithFont:[songLabel font] constrainedToSize:maximumSongLabelSize lineBreakMode:[songLabel lineBreakMode]]; - songLabelFrame.size = expectedSongLabelSize; + songLabelFrame.size.height = expectedSongLabelSize.height; artistLabelFrame.origin.x = songLabelFrame.origin.x; artistLabelFrame.origin.y = songLabelFrame.origin.y + songLabelFrame.size.height + 2.0; - artistLabelFrame.size.width = albumArtImageViewFrame.origin.x - padding - 10.0; + artistLabelFrame.size.width = songLabelFrame.size.width; CGSize maximumArtistLabelSize = CGSizeMake(artistLabelFrame.size.width,9999); CGSize expectedArtistLabelSize = [[artistLabel text] sizeWithFont:[artistLabel font] constrainedToSize:maximumArtistLabelSize lineBreakMode:[artistLabel lineBreakMode]]; - artistLabelFrame.size = expectedArtistLabelSize; + artistLabelFrame.size.height = expectedArtistLabelSize.height; self.songLabel.frame = songLabelFrame; @@ -265,7 +219,7 @@ - (void)adjustLabels{ - (IBAction)togglePlayState:(id)sender{ if ([streamer isPlaying]) { [self destroyStreamer]; - [playButton setImage:[UIImage imageNamed:@"button-play.png"] forState:UIControlStateNormal]; + [playButton setTitle:@"\uf04b" forState:UIControlStateNormal]; [statusLabel setHidden:YES]; }else{ [self createStreamer]; @@ -281,14 +235,13 @@ - (void)createStreamer{ NSString *streamUrl = [[PLAController sharedController] streamUrl]; - NSLog(@"opening stream at: %@", streamUrl); - [self destroyStreamer]; NSURL *url = [NSURL URLWithString:streamUrl]; streamer = [[AudioStreamer alloc] initWithURL:url]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playbackStateChanged:) name:ASStatusChangedNotification object:streamer]; + [[NSNotificationCenter defaultCenter] addObserver:[PLAController sharedController] selector:@selector(updateNowPlaying) name:ASUpdateMetadataNotification object:streamer]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(presentStreamerAlert:) name:ASPresentAlertWithTitleNotification object:streamer]; } @@ -296,6 +249,7 @@ - (void)destroyStreamer{ if (streamer){ [[NSNotificationCenter defaultCenter] removeObserver:self name:ASStatusChangedNotification object:streamer]; [[NSNotificationCenter defaultCenter] removeObserver:self name:ASPresentAlertWithTitleNotification object:streamer]; + [[NSNotificationCenter defaultCenter] removeObserver:[PLAController sharedController] name:ASUpdateMetadataNotification object:streamer]; self.currentTrack = nil; @@ -309,35 +263,46 @@ - (void)destroyStreamer{ - (void)playbackStateChanged:(NSNotification *)aNotification{ if ([streamer isWaiting]){ + [statusLabel setHidden:NO]; + [playButton setTitle:@"\uf04d" forState:UIControlStateNormal]; }else if ([streamer isPlaying]){ [statusLabel setHidden:YES]; - [playButton setImage:[UIImage imageNamed:@"button-pause.png"] forState:UIControlStateNormal]; + [playButton setTitle:@"\uf04d" forState:UIControlStateNormal]; }else if ([streamer isPaused]){ [statusLabel setHidden:YES]; - [playButton setImage:[UIImage imageNamed:@"button-play.png"] forState:UIControlStateNormal]; + [playButton setTitle:@"\uf04b" forState:UIControlStateNormal]; }else if ([streamer isIdle]){ [statusLabel setHidden:YES]; - [playButton setImage:[UIImage imageNamed:@"button-play.png"] forState:UIControlStateNormal]; + [playButton setTitle:@"\uf04b" forState:UIControlStateNormal]; } } - (void)presentStreamerAlert:(NSNotification *)aNotification{ [self destroyStreamer]; - [playButton setImage:[UIImage imageNamed:@"button-play.png"] forState:UIControlStateNormal]; + [playButton setTitle:@"\uf04b" forState:UIControlStateNormal]; + [statusLabel setHidden:YES]; NSDictionary *userInfo = [aNotification userInfo]; - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Stream Error" message:[userInfo objectForKey:@"message"] delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil]; - [alert show]; - [alert release]; + dispatch_async(dispatch_get_main_queue(), ^(void) { + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Stream Error" message:[userInfo objectForKey:@"message"] delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil]; + [alert show]; + [alert release]; + }); + + } #pragma mark - SDWebImageDownloader Callback - (void)imageDownloader:(SDWebImageDownloader *)imageDownloader didFinishWithImage:(UIImage *)image{ - [albumArtImageView setImage:image]; - [self updateMetaData]; + if (image) { + [albumArtImageView setImage:image]; + }else{ + [albumArtImageView setImage:[UIImage imageNamed:@"default_album.png"]]; + } + [self updateMetaData]; } #pragma mark - Remote Control Events diff --git a/Play iOS/Classes/Controllers/PLAPlayerViewController_iPhone.xib b/Play iOS/Classes/Controllers/PLAPlayerViewController_iPhone.xib index f65305b..4992a60 100644 --- a/Play iOS/Classes/Controllers/PLAPlayerViewController_iPhone.xib +++ b/Play iOS/Classes/Controllers/PLAPlayerViewController_iPhone.xib @@ -1,21 +1,21 @@ - 1296 - 11D50b - 2182 - 1138.32 - 568.00 + 1552 + 12E55 + 3084 + 1187.39 + 626.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 1181 + 2083 + IBProxyObject IBUIButton IBUIImageView - IBUIView IBUILabel - IBProxyObject + IBUIView com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -37,196 +37,153 @@ 274 - + + + 289 + {{10, 10}, {100, 100}} + + + + _NS:567 + 2 + NO + IBCocoaTouchFramework + + + + 294 + {{128, 10}, {192, 21}} + + + + _NS:328 + + 2 + MC44ODYyNzQ1NzYyIDAuODgyMzUzMDA3OCAwLjg3MDU4ODMwMjYAA + + NO + YES + 7 + NO + IBCocoaTouchFramework + Song Title + + 1 + MCAwIDAAA + darkTextColor + + + + 1 + MC44MDA3NjAwMjA0IDAuODAwNzYwMDIwNCAwLjgwMDc2MDAyMDQAA + + {0, 0} + 1 + 10 + 11 + + 1 + 17 + + + Helvetica + 17 + 16 + + NO + 192 + + + + 294 + {{128, 38}, {192, 20}} + + + + _NS:328 + + NO + YES + 7 + NO + IBCocoaTouchFramework + Artist Name + + 2 + MC45NDExNzY1MzM3IDAuNDM5MjE1NzE5NyAwLjk2ODYyNzUxMjUAA + + + + 1 + MC45NTUyMTc1MjM3IDAuODQzNTMxMjM1IDAuOTcyODk0MDcyNQA + + {0, 0} + 1 + 10 + 9 + + 1 + 13 + + + Helvetica + 13 + 16 + + NO + 192 + + - 290 + 266 - - - 290 - {320, 4} - - - - _NS:567 - NO - IBCocoaTouchFramework - - NSImage - shadow.png - - - - - 294 - {{10, 10}, {192, 20}} - - - - _NS:328 - - 3 - MQA - - NO - YES - 7 - NO - IBCocoaTouchFramework - N.Y. State of Mind - - 1 - MCAwIDAAA - - - - 1 - MC44MDA3NjAwMjA0IDAuODAwNzYwMDIwNCAwLjgwMDc2MDAyMDQAA - - {0, 0} - 1 - 10 - 11 - - 1 - 17 - - - Helvetica - 17 - 16 - - NO - - - - 294 - {{10, 38}, {192, 20}} - + + + -2147483342 + {320, 50} + - + _NS:328 - NO YES 7 NO IBCocoaTouchFramework - Label - - 2 - MC45NDExNzY1MzM3IDAuNDM5MjE1NzE5NyAwLjk2ODYyNzUxMjUAA - + Buffering... + - - 1 - MC45NTUyMTc1MjM3IDAuODQzNTMxMjM1IDAuOTcyODk0MDcyNQA - {0, 0} 1 10 - 9 + 1 1 - 13 + 14 Helvetica - 13 + 14 16 - NO - - + + 289 - {{210, 10}, {100, 100}} - + {{294, 15}, {18, 19}} + - - _NS:567 - 2 - NO - IBCocoaTouchFramework - - - {{0, 170}, {320, 126}} - - - - _NS:196 - - 3 - MQA - - 2 - - - IBCocoaTouchFramework - - - - 290 - - - - 290 - {320, 4} - - - - _NS:567 - - 3 - MCAwAA - - NO - IBCocoaTouchFramework - - NSImage - bottom-shadow.png - - - - - 290 - {{0, 4}, {320, 1996}} - - - _NS:9 - - 2 - MC44ODYyNzQ1NzYyIDAuODgyMzUzMDA3OCAwLjg3MDU4ODMwMjYAA - - IBCocoaTouchFramework - - - {{0, 166}, {320, 300}} - - - - _NS:196 - - IBCocoaTouchFramework - - - - 290 - - - - 292 - {{20, 39}, {50, 50}} - - - - _NS:225 NO IBCocoaTouchFramework 0 0 - + 3 + YES + + 3 + MQA + 1 MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA @@ -235,93 +192,51 @@ 3 MC41AA - - NSImage - button-play.png - 2 15 - + Helvetica-Bold 15 16 - - - -2147483356 - {{83, 53}, {182, 21}} - + + + 268 + {{10, 10}, {30, 30}} + - - _NS:328 + + _NS:225 NO - YES - 7 - NO IBCocoaTouchFramework - Buffering... - - 1 - MC4xOTI0NDY1MDE0IDAuMTkyNDQ2NTAxNCAwLjE5MjQ0NjUwMTQAA - - - - {0, 1} - 1 - 10 - - 1 - 14 - - - Helvetica - 14 - 16 - + 0 + 0 + + + + + - {320, 170} + {{0, 410}, {320, 50}} - - _NS:196 + + _NS:9 - 2 - MC44ODYyNzQ1NzYyIDAuODgyMzUzMDA3OCAwLjg3MDU4ODMwMjYAA + 3 + MC4zMzMzMzMzMzMzAA IBCocoaTouchFramework - - - 265 - {{288, 427}, {18, 19}} - - - - _NS:9 - NO - IBCocoaTouchFramework - 0 - 0 - 4 - YES - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - - {{0, 20}, {320, 460}} - + 2 MC44ODYyNzQ1NzYyIDAuODgyMzUzMDA3OCAwLjg3MDU4ODMwMjYAA @@ -341,14 +256,6 @@ 7 - - - artistLabel - - - - 14 - albumArtImageView @@ -359,19 +266,19 @@ - nowPlayingView + songLabel - + - 22 + 13 - songLabel + artistLabel - + - 13 + 14 @@ -389,14 +296,6 @@ 29 - - - sliderView - - - - 24 - togglePlayState: @@ -438,88 +337,53 @@ 6 - - - - - - - - - - 8 - - - + + - + 11 - - - - 12 - - - - - 23 - - + 10 - + - 27 - + 12 + + + + + 37 + + + + 35 + + + 9 - + 28 - - - - 21 - - - - - - - - - 31 - - - - - - 25 - - - - - 35 - - + @@ -531,22 +395,17 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 36 + 38 @@ -567,9 +426,7 @@ UIImageView UILabel - UIView UIButton - UIView UILabel UILabel @@ -582,18 +439,10 @@ artistLabel UILabel - - nowPlayingView - UIView - playButton UIButton - - sliderView - UIView - songLabel UILabel @@ -612,17 +461,8 @@ 0 IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - YES 3 - - {1, 4} - {50, 50} - {1, 4} - - 1181 + 2083 diff --git a/Play iOS/PLAIOSAppDelegate.m b/Play iOS/PLAIOSAppDelegate.m index e01f303..1160d74 100644 --- a/Play iOS/PLAIOSAppDelegate.m +++ b/Play iOS/PLAIOSAppDelegate.m @@ -32,4 +32,25 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( return YES; } +- (void)applicationDidBecomeActive:(UIApplication *)application{ + [[PLAController sharedController] updateNowPlaying]; +} + +- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{ + [[PLAController sharedController] setAuthToken:[[[url query] componentsSeparatedByString:@"="] lastObject]]; + [[PLAController sharedController] logInWithBlock:^(BOOL succeeded) { + if (succeeded) { + [_viewController.modalViewController dismissViewControllerAnimated:YES completion:^{}]; + [[PLAController sharedController] updateNowPlaying]; + }else{ + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Oops!" message:@"Play cannot be reached or your log in details are incorrect. Try again." delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil]; + [alert show]; + [alert release]; + } + }]; + + return YES; +} + + @end diff --git a/Play iOS/Supporting Files/Play-iOS-Info.plist b/Play iOS/Supporting Files/Play-iOS-Info.plist index bb942a9..59181a8 100644 --- a/Play iOS/Supporting Files/Play-iOS-Info.plist +++ b/Play iOS/Supporting Files/Play-iOS-Info.plist @@ -39,7 +39,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.5.1 + 2.0 CFBundleSignature ???? CFBundleURLTypes @@ -54,7 +54,7 @@ CFBundleVersion - 1.5.1 + 2.0 LSRequiresIPhoneOS UIAppFonts @@ -63,6 +63,7 @@ OpenSans-Semibold.ttf OpenSans-Italic.ttf OpenSans-Regular.ttf + fontawesome-webfont.ttf UIBackgroundModes diff --git a/Play iOS/images/button-play.png b/Play iOS/images/button-play.png index d5b3e6e..ad7126f 100644 Binary files a/Play iOS/images/button-play.png and b/Play iOS/images/button-play.png differ diff --git a/Play iOS/images/button-play@2x.png b/Play iOS/images/button-play@2x.png index f39621d..3eb6416 100644 Binary files a/Play iOS/images/button-play@2x.png and b/Play iOS/images/button-play@2x.png differ diff --git a/Play iOS/images/button-stop.png b/Play iOS/images/button-stop.png new file mode 100644 index 0000000..a114b11 Binary files /dev/null and b/Play iOS/images/button-stop.png differ diff --git a/Play iOS/images/button-stop@2x.png b/Play iOS/images/button-stop@2x.png new file mode 100644 index 0000000..915695c Binary files /dev/null and b/Play iOS/images/button-stop@2x.png differ diff --git a/vendor/libPusher/OS X/Pusher.framework/Headers/PTEventListener.h b/vendor/libPusher/OS X/Pusher.framework/Headers/PTEventListener.h deleted file mode 100644 index 90d3e27..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Headers/PTEventListener.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// PTEventListener.h -// PusherEvents -// -// Created by Luke Redpath on 22/03/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import - - -@class PTPusherEvent; - -@protocol PTEventListener - -- (void)dispatchEvent:(PTPusherEvent *)event; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Headers/PTJSON.h b/vendor/libPusher/OS X/Pusher.framework/Headers/PTJSON.h deleted file mode 100644 index 3683320..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Headers/PTJSON.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// PTJSON.h -// libPusher -// -// Created by Luke Redpath on 30/03/2012. -// Copyright (c) 2012 LJR Software Limited. All rights reserved. -// - -#import -#import "PTJSONParser.h" - -extern NSString *const PTJSONParserNotAvailable; - -@interface PTJSON : NSObject - -/** - Returns a JSON parser appropriate for the current platform. - - A runtime check is performed for the presence of NSJSONSerialization - (available on iOS 5.0 and OSX 10.7 and later). If it is available, - it will be used, otherwise it will fall back to using JSONKit. - - Important note: If you intend to support users of iOS 4.x, you must - ensure that you link JSONKit to your project as it is no longer - embedded within libPusher. - */ -+ (id)JSONParser; - -@end - -@interface PTJSONKitParser : NSObject -+ (id)JSONKitParser; -@end - -@interface PTNSJSONParser : NSObject -+ (id)NSJSONParser; -@end \ No newline at end of file diff --git a/vendor/libPusher/OS X/Pusher.framework/Headers/PTJSONParser.h b/vendor/libPusher/OS X/Pusher.framework/Headers/PTJSONParser.h deleted file mode 100644 index b12e292..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Headers/PTJSONParser.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// PTJSONParser.h -// libPusher -// -// Created by Luke Redpath on 30/03/2012. -// Copyright (c) 2012 LJR Software Limited. All rights reserved. -// - -#import - -@protocol PTJSONParser - -- (NSData *)JSONDataFromObject:(id)object; -- (NSString *)JSONStringFromObject:(id)object; -- (id)objectFromJSONData:(NSData *)data; -- (id)objectFromJSONString:(NSString *)string; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusher.h b/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusher.h deleted file mode 100644 index 81aa40a..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusher.h +++ /dev/null @@ -1,277 +0,0 @@ -// -// PTPusher.h -// PusherEvents -// -// Created by Luke Redpath on 22/03/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import -#import "PTPusherDelegate.h" -#import "PTPusherConnection.h" -#import "PTPusherEventPublisher.h" -#import "PTPusherPresenceChannelDelegate.h" - -/** The Pusher protocol version, used to determined which features - are supported. - */ -#define kPTPusherClientProtocolVersion 5 - -/** The version number of the libPusher library. - */ -#define kPTPusherClientLibraryVersion 1.0 - -/** The name of the notification posted when PTPusher receives an event. - */ -extern NSString *const PTPusherEventReceivedNotification; - -/** The key of the PTPusherEvent object in the PTPusherEventReceivedNotification userInfo dictionary. - */ -extern NSString *const PTPusherEventUserInfoKey; - -/** The error domain for all PTPusher errors. - */ -extern NSString *const PTPusherErrorDomain; - -/** The key for any underlying PTPusherEvent associated with a PTPusher error's userInfo dictionary. - */ -extern NSString *const PTPusherErrorUnderlyingEventKey; - -@class PTPusherChannel; -@class PTPusherPresenceChannel; -@class PTPusherPrivateChannel; -@class PTPusherEventDispatcher; - -/** A PTPusher object provides a high level API for communicating with the Pusher service. - - The provided API allows you to connect and disconnect from the service, subscribe and unsubscribe - from channels and bind to events. There is also beta support for sending events directly over the - connection (instead of using the Pusher REST API). - - To create an instance of PTPusher, you will need your Pusher API key. This can be obtained from your account - dashboard. - - PTPusher's delegate methods allow an object to receive important events in the client and connection's - lifecycle, such as connection, disconnection, reconnection and channel subscribe/unsubscribe events. - - Whilst PTPusher exposes it's connection object as a readonly property, there is no need to manage or - create this connection manually. The connection can be queried for it's current connection state and - socket ID if needed. - - PTPusher aims to mirror the Pusher Javascript client API as much as possible although whilst the - Javascript API uses event binding for any interesting events - not just server or other client events - - libPusher uses standard Cocoa and Objective-C patterns such as delegation and notification where - it makes sense to do so. - - Note: due to various problems people have had connecting to Pusher without SSL over a 3G connection, - it is highly recommend that you use SSL. For this reason, SSL is enabled by default. - */ -@interface PTPusher : NSObject { - PTPusherEventDispatcher *dispatcher; - NSMutableDictionary *channels; -} - -///------------------------------------------------------------------------------------/ -/// @name Properties -///------------------------------------------------------------------------------------/ - -/** The object that acts as the delegate for the receiving instance. - - The delegate must implement the PTPusherDelegate protocol. The delegate is not retained. - */ -@property (nonatomic, unsafe_unretained) id delegate; - - -/** Indicates whether the client should attempt to reconnect automatically when disconnected - or if the connection failed. - - When YES, the client will automatically attempt to re-establish a connection after a set delay. - - If the reconnection attempt fails, the client will continue to attempt to reconnect until this - property is set to NO. The delegate will be notified of each reconnection attempt; you could use - this method to disable reconnection after a number of attempts. - */ -@property (nonatomic, assign, getter=shouldReconnectAutomatically) BOOL reconnectAutomatically; - -/** Specifies the delay between reconnection attempts. Defaults to 5 seconds. - */ -@property (nonatomic, assign) NSTimeInterval reconnectDelay; - -/** The connection object for this client. - - Each instance uses a single connection only. Most clients will likely only ever need a single - PTPusher object and therefore a single connection. - - The connection is exposed to provide access to it's socketID and connection state. Clients - should not attempt to manage this connection directly. - */ -@property (nonatomic, strong, readonly) PTPusherConnection *connection; - -/** The authorization URL for private subscriptions. - - All private channels (including presence channels) require authorization in order to subscribe. - - Authorization happens on your own server. When subscribing to a private or presence channel, - an authorization POST request will be sent to the URL specified by this property. - - Attempting to subscribe to a private or presence channel without setting this property will - result in an assertion error. - - For more information on channel authorization, [see the Pusher documentation website](http://pusher.com/docs/authenticating_users). - */ -@property (nonatomic, strong) NSURL *authorizationURL; - -///------------------------------------------------------------------------------------/ -/// @name Creating new instances -///------------------------------------------------------------------------------------/ - -- (id)initWithConnection:(PTPusherConnection *)connection connectAutomatically:(BOOL)connectAutomatically; - -/** Returns a new PTPusher instance with a connection configured with the given key. - - Instances created using this method will connect automatically. Specify the delegate here - to ensure that it is notified about the connection status during connection. If you assign - a delegate using the delegate property after this method returns, it may not be notified - of connection events. - - @deprecated Use pusherWithKey:delegate:encrypted: - @param key Your application's API key. It can be found in the API Access section of your application within the Pusher user dashboard. - @param delegate The delegate for this instance - */ -+ (id)pusherWithKey:(NSString *)key delegate:(id)delegate __PUSHER_DEPRECATED__; - -/** Returns a new PTPusher instance with a connection configured with the given key. - - Instances created using this method will connect automatically. Specify the delegate here - to ensure that it is notified about the connection status during connection. If you assign - a delegate using the delegate property after this method returns, it may not be notified - of connection events. - - @param key Your application's API key. It can be found in the API Access section of your application within the Pusher user dashboard. - @param delegate The delegate for this instance - @param isEncrypted If yes, a secure connection over SSL will be established. - */ -+ (id)pusherWithKey:(NSString *)key delegate:(id)delegate encrypted:(BOOL)isEncrypted; - -/** Initialises a new PTPusher instance with a connection configured with the given key. - - If you intend to set a delegate for this instance, you are recommended to set connectAutomatically - to NO, set the delegate then manually call connect. - - @deprecated Use pusherWithKey:connectAutomatically:encrypted: - @param key Your application's API key. It can be found in the API Access section of your application within the Pusher user dashboard. - @param connect Automatically If YES, the connection will be connected on initialisation. - */ -+ (id)pusherWithKey:(NSString *)key connectAutomatically:(BOOL)connectAutomatically __PUSHER_DEPRECATED__; - -/** Initialises a new PTPusher instance with a connection configured with the given key. - - If you intend to set a delegate for this instance, you are recommended to set connectAutomatically - to NO, set the delegate then manually call connect. - - @param key Your application's API key. It can be found in the API Access section of your application within the Pusher user dashboard. - @param connectAutomatically If YES, the connection will be connected on initialisation. - @param isEncrypted If yes, a secure connection over SSL will be established. - */ -+ (id)pusherWithKey:(NSString *)key connectAutomatically:(BOOL)connectAutomatically encrypted:(BOOL)isEncrypted; - -///------------------------------------------------------------------------------------/ -/// @name Managing the connection -///------------------------------------------------------------------------------------/ - -/** Establishes a connection to the Pusher server. - - If already connected, this method does nothing. - */ -- (void)connect; - -/** Disconnects from the Pusher server. - - If already disconnected, this method does nothing. - */ -- (void)disconnect; - -///------------------------------------------------------------------------------------/ -/// @name Subscribing to channels -///------------------------------------------------------------------------------------/ - -/** Subscribes to the named channel. - - This method can be used to subscribe to any type of channel, including private and - presence channels by including the appropriate channel name prefix. - - @param name The name of the channel to subscribe to. - */ -- (PTPusherChannel *)subscribeToChannelNamed:(NSString *)name; - -/** Subscribes to the named private channel. - - The "private-" prefix should be excluded from the name; it will be added automatically. - - @param name The name of the channel (without the private prefix) to subscribe to. - */ -- (PTPusherPrivateChannel *)subscribeToPrivateChannelNamed:(NSString *)name; - -/** Subscribes to the named presence channel. - - The "presence-" prefix should be excluded from the name; it will be added automatically. - - @param name The name of the channel (without the presence prefix) to subscribe to. - */ -- (PTPusherPresenceChannel *)subscribeToPresenceChannelNamed:(NSString *)name; - -/** Subscribes to the named presence channel. - - The "presence-" prefix should be excluded from the name; it will be added automatically. - - Whilst the presence delegate can be set on the channel after it is returned, to ensure - events are not missed, it is advised that you call this method and specify a delegate. The - delegate will be assigned before subscription happens. - - @param name The name of the channel (without the presence prefix) to subscribe to. - @param presenceDelegate The presence delegate for this channel. - */ -- (PTPusherPresenceChannel *)subscribeToPresenceChannelNamed:(NSString *)name delegate:(id)presenceDelegate; - -/** Unsubscribes from the specified channel. - - This method is deprecated. You should use -[PTPusherChannel unsubscribe] instead. - - @param channel The channel to unsubscribe from. - */ -- (void)unsubscribeFromChannel:(PTPusherChannel *)channel __PUSHER_DEPRECATED__; - -/** Returns a previously subscribed channel with the given name. - - If the channel specified has not been subscribed to, this method will return nil. - - @param name The name of the channel required. - */ -- (PTPusherChannel *)channelNamed:(NSString *)name; - -///------------------------------------------------------------------------------------/ -/// @name Publishing events -///------------------------------------------------------------------------------------/ - -/** Sends an event directly over the connection's socket. - - Whilst Pusher provides a REST API for publishing events, it also supports the sending of - events directly from clients over the client's existing connection. - - Client events have the following restrictions: - - + The user must be subscribed to the channel that the event is being triggered on. - - + Client events can only be triggered on private and presence channels because they require authentication. - - + Client events must be prefixed by client-. Events with any other prefix will be rejected by the Pusher server, as will events sent to channels to which the client is not subscribed. - - This method does nothing to enforce the first two restrictions. It is instead recommended that - you use the `PTPusherChannel` event triggering API rather than calling this method directly. - - @warning Note: This Pusher feature is currently in beta and requires enabling on your account. - */ -- (void)sendEventNamed:(NSString *)name data:(id)data channel:(NSString *)channelName; - -@end - diff --git a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherAPI.h b/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherAPI.h deleted file mode 100644 index d843535..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherAPI.h +++ /dev/null @@ -1,48 +0,0 @@ -// -// PTPusherAPI.h -// libPusher -// -// Created by Luke Redpath on 14/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import - -/** A simple interface to the Pusher REST API. - - This functionality used to be part of the main PTPusher library but - has been extracted into a standalone component. - - The PTPusher client has alpha support for channel-based event triggering - but for general event triggering the API can be used. - - As well as your Pusher API key, you will also need your app ID and secret key - for signing requests. - */ -@interface PTPusherAPI : NSObject { - NSString *key, *appID, *secretKey; - NSOperationQueue *operationQueue; -} - -///------------------------------------------------------------------------------------/ -/// @name Initialisation -///------------------------------------------------------------------------------------/ - -- (id)initWithKey:(NSString *)aKey appID:(NSString *)anAppID secretKey:(NSString *)aSecretKey; - -///------------------------------------------------------------------------------------/ -/// @name Triggering events -///------------------------------------------------------------------------------------/ - -/** Triggers an event on the specified channel. - - The event data will be converted to JSON format so needs to be any object that can be - transformed into JSON (typically any plist-compatible object). - - @param eventName The name of the event to trigger. - @param channelName The channel the event should be triggered on. - @param eventData The JSON-compatible data object for the event. - */ -- (void)triggerEvent:(NSString *)eventName onChannel:(NSString *)channelName data:(id)eventData socketID:(NSString *)socketID; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherChannel.h b/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherChannel.h deleted file mode 100644 index 26da317..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherChannel.h +++ /dev/null @@ -1,184 +0,0 @@ -// -// PTPusherClient.h -// libPusher -// -// Created by Luke Redpath on 23/04/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import -#import "PTPusherEventPublisher.h" -#import "PTEventListener.h" -#import "PTPusherPresenceChannelDelegate.h" - - -@class PTPusher; -@class PTPusherEventDispatcher; - -/** A PTPusherChannel object represents a single Pusher channel. - - Channels can be used as a means of filtering or controlling access to events. - - Channels do not need to be explicitly created; they are created on demand. To obtain - an instance of a PTPusherChannel, you need to subscribe to it first. - - You should not create PTPusherChannel instances directly as they require subscription and - possibly authorization; you should instead use the subscribeTo methods provided by PTPusher. - - There are three types of channel: - - + Public channels can be subscribed to by anyone who knows their name. - - + Private channels allow you to control access to the data you are broadcasting. - - + Presence channels you to 'register' user information on subscription, and let other members of the channel know who's online. - - Channels can be subscribed to or unsubscribed to at any time, even before the initial - Pusher connection has been established. - */ -@interface PTPusherChannel : NSObject { - NSString *name; - __unsafe_unretained PTPusher *pusher; - PTPusherEventDispatcher *dispatcher; - NSMutableArray *internalBindings; -} - -///------------------------------------------------------------------------------------/ -/// @name Properties -///------------------------------------------------------------------------------------/ - -/** The channel name. - */ -@property (nonatomic, readonly) NSString *name; - -/** Indicates that this channel has been subscribed to. - - Whilst public channels are subscribed to immediately, presence and private channels require - authorization first. This property will be set to YES once an internal Pusher event has - been received indicating that the channel subscription has been registered. - */ -@property (nonatomic, readonly, getter=isSubscribed) BOOL subscribed; - -/** Indicates whether or not this is a private channel. - - The value of this property will be YES for private and presence channels. - */ -@property (nonatomic, readonly) BOOL isPrivate; - -/** Indicates whether or not this is a presence channel. - - The value of this property will be YES for presence channels only. - */ -@property (nonatomic, readonly) BOOL isPresence; - -///------------------------------------------------------------------------------------/ -/// @name Initialisation -///------------------------------------------------------------------------------------/ - -+ (id)channelWithName:(NSString *)name pusher:(PTPusher *)pusher; -- (id)initWithName:(NSString *)channelName pusher:(PTPusher *)pusher; - -///------------------------------------------------------------------------------------/ -/// @name Authorization -///------------------------------------------------------------------------------------/ - -- (void)authorizeWithCompletionHandler:(void(^)(BOOL, NSDictionary *, NSError *))completionHandler; - -///------------------------------------------------------------------------------------/ -/// @name Unsubscribing -///------------------------------------------------------------------------------------/ - -/** Unsubscribes from the channel. - */ -- (void)unsubscribe; - -@end - -/** A PTPusherPrivateChannel object represents a private Pusher channel. - - Private channels should be used when access to the channel needs to be restricted in some way. - In order for a user to subscribe to a private channel permission must be authorised. - - Private channel names always have the prefix of "private-". - - Only private and presence channels support the triggering client events. - */ -@interface PTPusherPrivateChannel : PTPusherChannel { - NSMutableArray *clientEventBuffer; -} - -///------------------------------------------------------------------------------------/ -/// @name Triggering events -///------------------------------------------------------------------------------------/ - -/** Triggers a named event directly over the connection. - - Client events have the following restrictions: - - + The user must be subscribed to the channel that the event is being triggered on. - - + Client events can only be triggered on private and presence channels because they require authentication. - - + Client events must be prefixed by client-. Events with any other prefix will be rejected by the Pusher server, as will events sent to channels to which the client is not subscribed. - - If you attempt to trigger event on a channel while isSubscribed is NO, the event will not be sent. - - If the event name does not have a prefix of "client-", it will be added automatically. - - The event data must be an object that can be serialized as JSON, typically an NSArray or NSDictionary although - it could be a simple string. - */ -- (void)triggerEventNamed:(NSString *)eventName data:(id)eventData; - -@end - -/** A PTPusherPresenceChannel object represents a Pusher presence channel. - - Presence channels build on the security of Private channels and expose the additional feature - of an awareness of who is subscribed to that channel. This makes it extremely easy to build - chat room and "who's online" type functionality to your application. - - Presence channel names always have the prefix of "presence-". - - Unlike the Pusher Javascript client API, PTPusherPresenceChannel does not use events to notify - when members are added or removed. Instead, you should assign a presenceDelegate which will - be notified of these events. - - @see PTPusherPresenceChannelDelegate - */ -@interface PTPusherPresenceChannel : PTPusherPrivateChannel { - NSMutableDictionary *members; - NSMutableArray *memberIDs; // store these separately to preserve order -} - -///------------------------------------------------------------------------------------/ -/// @name Properties -///------------------------------------------------------------------------------------/ - -/** The presence delegate for the receiver. - - The presence delegate will be notified of presence channel-specific events, such as the initial - member list on subscription and member added/removed events. - */ -@property (nonatomic, unsafe_unretained) id presenceDelegate; - -/** Returns the current list of channel members. - - Members are stored as a dictionary of dictionaries, keyed on the member's "user_id" field. - - @deprecated Use the methods below for accessing member data. - */ -@property (nonatomic, readonly) NSDictionary *members; - -/** Returns a dictionary of member metadata (email, name etc.) for the given member ID. - */ -- (NSDictionary *)infoForMemberWithID:(NSString *)memberID; - -/** Returns an array of available member IDs - */ -- (NSArray *)memberIDs; - -/** Returns the number of members currently connected to this channel. - */ -- (NSInteger)memberCount; -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherConnection.h b/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherConnection.h deleted file mode 100644 index 998ffc4..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherConnection.h +++ /dev/null @@ -1,91 +0,0 @@ -// -// PTPusherConnection.h -// libPusher -// -// Created by Luke Redpath on 13/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import -#import "SRWebSocket.h" -#import "PTPusherMacros.h" - -@class PTPusherConnection; -@class PTPusherEvent; - -@protocol PTPusherConnectionDelegate -- (void)pusherConnectionDidConnect:(PTPusherConnection *)connection; -- (void)pusherConnection:(PTPusherConnection *)connection didDisconnectWithCode:(NSInteger)errorCode reason:(NSString *)reason wasClean:(BOOL)wasClean; -- (void)pusherConnection:(PTPusherConnection *)connection didFailWithError:(NSError *)error wasConnected:(BOOL)wasConnected; -- (void)pusherConnection:(PTPusherConnection *)connection didReceiveEvent:(PTPusherEvent *)event; -@end - -extern NSString *const PTPusherConnectionEstablishedEvent; -extern NSString *const PTPusherConnectionPingEvent; - -typedef enum { - PTPusherConnectionClosing = 0, - PTPusherConnectionClosed, - PTPusherConnectionOpening, - PTPusherConnectionOpenAwaitingHandshake, - PTPusherConnectionOpenHandshakeReceived -} PTPusherConnectionState; - -@interface PTPusherConnection : NSObject - -@property (nonatomic, unsafe_unretained) id delegate; -@property (nonatomic, readonly, getter=isConnected) BOOL connected; -@property (nonatomic, copy, readonly) NSString *socketID; - -///------------------------------------------------------------------------------------/ -/// @name Initialisation -///------------------------------------------------------------------------------------/ - -/** Creates a new PTPusherConnection instance. - - Connections are not opened immediately; an explicit call to connect is required. - - @param aURL The websocket endpoint - @param delegate The delegate for this connection - */ -- (id)initWithURL:(NSURL *)aURL; - -/** Creates a new PTPusherConnection instance. - - Connections are not opened immediately; an explicit call to connect is required. - - DEPRECATED IN VERSION 1.2. The secure parameter is now ignored; secure mode will be - enabled automatically when the URL protocol is wss. - - @param aURL The websocket endpoint - @param delegate The delegate for this connection - @param secure Whether this connection should be secure (TLS) - */ -- (id)initWithURL:(NSURL *)aURL secure:(BOOL)secure __PUSHER_DEPRECATED__; - -///------------------------------------------------------------------------------------/ -/// @name Managing connections -///------------------------------------------------------------------------------------/ - -/** Establishes a web socket connection to the Pusher server. - - The delegate will only be sent a didConnect message when the web socket receives a - 'connection_established' event from Pusher, regardless of the web socket's connection state. - */ -- (void)connect; - -/** Closes the web socket connection */ -- (void)disconnect; - -///------------------------------------------------------------------------------------/ -/// @name Sending data -///------------------------------------------------------------------------------------/ - -/** Sends an object over the web socket connection. - - The object will be serialized to JSON before sending, so the object must be anything - that can be converted into JSON (typically, any plist compatible object). - */ -- (void)send:(id)object; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherDelegate.h b/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherDelegate.h deleted file mode 100644 index 9f0a8bf..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherDelegate.h +++ /dev/null @@ -1,128 +0,0 @@ -// -// PTPusherDelegate.h -// libPusher -// -// Created by Luke Redpath on 22/03/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import "PTPusherMacros.h" - -@class PTPusher; -@class PTPusherConnection; -@class PTPusherChannel; -@class PTPusherEvent; -@class PTPusherErrorEvent; - -/** The PTPusherDelegate protocol can be implemented to receive important events in a PTPusher object's lifetime. - - All of the delegate methods are optional; you only need to implement what is required for your app. - - It may be useful to assign a delegate to monitor the status of the connection; you could use this to update - your user interface accordingly. - */ -@protocol PTPusherDelegate - -@optional - -/** Notifies the delegate that the PTPusher instance has connected to the Pusher service successfully. - - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - */ -- (void)pusher:(PTPusher *)pusher connectionDidConnect:(PTPusherConnection *)connection; - -/** Notifies the delegate that the PTPusher instance has disconnected from the Pusher service. - - @deprecated Use pusher:connection:didDisconnectWithError: - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - */ -- (void)pusher:(PTPusher *)pusher connectionDidDisconnect:(PTPusherConnection *)connection __PUSHER_DEPRECATED__; - -/** Notifies the delegate that the PTPusher instance has disconnected from the Pusher service. - - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - @param error If the connection disconnected abnormally, error will be non-nil. - */ -- (void)pusher:(PTPusher *)pusher connection:(PTPusherConnection *)connection didDisconnectWithError:(NSError *)error; - -/** Notifies the delegate that the PTPusher instance failed to connect to the Pusher service. - - If reconnectAutomatically is YES, PTPusher will attempt to reconnect if the initial connection failed. - - This reconnect attempt will happen after this message is sent to the delegate, giving the delegate - a chance to inspect the connection error and disable automatic reconnection if it thinks the reconnection - attempt is likely to fail, depending on the error. - - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - @param error The connection error. - */ -- (void)pusher:(PTPusher *)pusher connection:(PTPusherConnection *)connection failedWithError:(NSError *)error; - -/** Notifies the delegate that the PTPusher instance is about to attempt reconnection. - - You may wish to use this method to keep track of the number of reconnection attempts and abort after a fixed number. - - If you do not set the `reconnectAutomatically` property of the PTPusher instance to NO, it will continue attempting - to reconnect until a successful connection has been established. - - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - */ -- (void)pusher:(PTPusher *)pusher connectionWillReconnect:(PTPusherConnection *)connection afterDelay:(NSTimeInterval)delay; - -/** Notifies the delegate of the request that will be used to authorize access to a channel. - - When using the Pusher Javascript client, authorization typically relies on an existing session cookie - on the server; when the Javascript client makes an AJAX POST to the server, the server can return - the user's credentials based on their current session. - - When using libPusher, there will likely be no existing server-side session; authorization will - need to happen by some other means (e.g. an authorization token or HTTP basic auth). - - By implementing this delegate method, you will be able to set any credentials as necessary by - modifying the request as required (such as setting POST parameters or headers). - */ -- (void)pusher:(PTPusher *)pusher willAuthorizeChannelWithRequest:(NSMutableURLRequest *)request; - -/** Notifies the delegate that the PTPusher instance has subscribed to the specified channel. - - This method will be called after any channel authorization has taken place and when a subscribe event has been received. - - @param pusher The PTPusher instance that has connected. - @param channel The channel that was subscribed to. - */ -- (void)pusher:(PTPusher *)pusher didSubscribeToChannel:(PTPusherChannel *)channel; - -/** Notifies the delegate that the PTPusher instance has unsubscribed from the specified channel. - - This method will be called immediately after unsubscribing from a channel. - - @param pusher The PTPusher instance that has connected. - @param channel The channel that was unsubscribed from. - */ -- (void)pusher:(PTPusher *)pusher didUnsubscribeFromChannel:(PTPusherChannel *)channel; - -/** Notifies the delegate that the PTPusher instance failed to subscribe to the specified channel. - - The most common reason for subscribing failing is authorization failing for private/presence channels. - - @param pusher The PTPusher instance that has connected. - @param channel The channel that was subscribed to. - @param error The error returned when attempting to subscribe. - */ -- (void)pusher:(PTPusher *)pusher didFailToSubscribeToChannel:(PTPusherChannel *)channel withError:(NSError *)error; - -/** Notifies the delegate that an error event has been received. - - If a client is binding to all events, either through the client or using NSNotificationCentre, they will also - receive notification of this event like any other. - - @param pusher The PTPusher instance that received the event. - @param errorEvent The error event. - */ -- (void)pusher:(PTPusher *)pusher didReceiveErrorEvent:(PTPusherErrorEvent *)errorEvent; -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherErrors.h b/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherErrors.h deleted file mode 100644 index a4b5f28..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherErrors.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// PTPusherErrors.h -// libPusher -// -// Created by Luke Redpath on 14/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import - -enum { - PTPusherSubscriptionError = 0, - PTPusherSubscriptionUnknownAuthorisationError -}; diff --git a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherEvent.h b/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherEvent.h deleted file mode 100644 index bcfb484..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherEvent.h +++ /dev/null @@ -1,74 +0,0 @@ -// -// PTPusherEvent.h -// PusherEvents -// -// Created by Luke Redpath on 22/03/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import - -extern NSString *const PTPusherDataKey; -extern NSString *const PTPusherEventKey; -extern NSString *const PTPusherChannelKey; - -/** A value object representing a Pusher event. - - All events dispatched by libPusher (via either bindings or notifications) will be represented - by instances of this class. - */ -@interface PTPusherEvent : NSObject { - NSString *_name; -} - -///------------------------------------------------------------------------------------/ -/// @name Properties -///------------------------------------------------------------------------------------/ - -/** The event name. - */ -@property (nonatomic, readonly) NSString *name; - -/** The channel that this event originated from. - */ -@property (strong, nonatomic, readonly) NSString *channel; - -/** The event data. - - Event data will typically be any kind of object that can be represented as JSON, often - an NSArray or NSDictionary but can be a simple string. - */ -@property (strong, nonatomic, readonly) id data; - -/** The time the event was received. - */ -@property (nonatomic, readonly, strong) NSDate *timeReceived; - -- (id)initWithEventName:(NSString *)name channel:(NSString *)channel data:(id)data; -+ (id)eventFromMessageDictionary:(NSDictionary *)dictionary; -@end - -typedef enum { - PTPusherErrorSSLRequired = 4000, - PTPusherErrorApplicationUnknown = 4001, - PTPusherErrorApplicationDisabled = 4002 -} PTPusherServerErrorCodes; - -/** A special sub-class of Pusher event, representing pusher:error events. - - This will be yielded to the Pusher client delegate as well as through the normal event - dispatch mechanism. - - This class adds some convenient properties for accessing error details. - */ -@interface PTPusherErrorEvent : PTPusherEvent - -/** A textual description of the error. - */ -@property (unsafe_unretained, nonatomic, readonly) NSString *message; - -/** The error code. See PTPusherServerErrorCodes for available errors. - */ -@property (nonatomic, readonly) NSInteger code; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherEventDispatcher.h b/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherEventDispatcher.h deleted file mode 100644 index 922d678..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherEventDispatcher.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// PTPusherEventDispatcher.h -// libPusher -// -// Created by Luke Redpath on 13/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import -#import "PTEventListener.h" - -@class PTPusherEventBinding; - -@interface PTPusherEventDispatcher : NSObject - -@property (nonatomic, readonly) NSDictionary *bindings; - -- (PTPusherEventBinding *)addEventListener:(id)listener forEventNamed:(NSString *)eventName; -- (void)removeBinding:(PTPusherEventBinding *)binding; -- (void)removeAllBindings; -@end - -@interface PTPusherEventBinding : NSObject - -/** The event this binding binds to. */ -@property (nonatomic, readonly) NSString *eventName; - -/** Returns YES if this binding is still attached to its event publisher. - - Retained references to bindings can become invalid as a result of another object - calling removeBinding: with this binding or removeAllBindings. - - You can safely discard invalid binding instances. - */ -@property (nonatomic, readonly, getter=isValid) BOOL valid; - -- (id)initWithEventListener:(id)eventListener eventName:(NSString *)eventName; -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherEventPublisher.h b/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherEventPublisher.h deleted file mode 100644 index 09939a9..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherEventPublisher.h +++ /dev/null @@ -1,84 +0,0 @@ -// -// PTPusherEventPublisher.h -// libPusher -// -// Created by Luke Redpath on 13/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import - -@class PTPusherEvent; -@class PTPusherEventBinding; - -typedef void (^PTPusherEventBlockHandler) (PTPusherEvent *); - -/** Describes an object that provides events that can be bound to. - - Events in Pusher form the basis of all communication with the service. They are - named messages that can carry arbitrary user data. All events in libPusher are - represented by the class `PTPusherEvent`. - - An object that implements this protocol allows for binding to events. There are - currently two classes that implement this protocol: `PTPusher` and `PTPusherChannel`. - - There are two primary binding mechanisms: target/action based and block-based. Which - one you use depends entirely on the requirements of your application. - */ -@protocol PTPusherEventBindings - -/** Binds to the named event using the target/action mechanism. - - When the named event is received, the specified selector will be called on target, passing - the `PTPusherEvent` as the only argument. - - The following code snippet sets up a binding for the event "new-message" on any channel: - - [pusher bindToEventNamed:@"new-message" target:self action:@selector(handleNewMessageEvent:)]; - - Then the event is triggered, the event will be dispatched to the target/action pair: - - - (void)handleNewMessageEvent:(PTPusherEvent *)event - { - // do something with event - } - */ -- (PTPusherEventBinding *)bindToEventNamed:(NSString *)eventName target:(id)target action:(SEL)selector; - -/** Binds to the named event using a block callback. - - When the event is received, the block will be called with the `PTPusherEvent` as the only block argument. - - The following code snippet sets up a binding for the event "new-message" on any channel and handles that - event when it is triggered: - - [pusher bindToEventNamed:@"new-message" handleWithBlock:^(PTPusherEvent *event) { - // do something with event - }]; - - The callback blocks will be dispatched asynchronously using Grand Central Dispatch on the main queue. - */ -- (PTPusherEventBinding *)bindToEventNamed:(NSString *)eventName handleWithBlock:(PTPusherEventBlockHandler)block; - -/** Binds to the named event using a block callback. - - Works the same as bindToEventNamed:handleWithBlock: but dispatches the callback block on the specified - Grand Central Dispatch queue. - - You can use this method if you wish to handle events in a background or custom priority queue. - */ -- (PTPusherEventBinding *)bindToEventNamed:(NSString *)eventName handleWithBlock:(PTPusherEventBlockHandler)block queue:(dispatch_queue_t)queue; - -/** Removes the specified binding. - - Any further events will not trigger any callbacks after the binding has been removed. - */ -- (void)removeBinding:(PTPusherEventBinding *)binding; - -/** Removes all bindings that have been set up. - - Any retained references to PTPusherEventBinding objects will become invalid. - */ -- (void)removeAllBindings; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherMacros.h b/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherMacros.h deleted file mode 100644 index 29245c6..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherMacros.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// PTPusherMacros.h -// libPusher -// -// Created by Luke Redpath on 10/02/2012. -// Copyright (c) 2012 LJR Software Limited. All rights reserved. -// - -#ifndef libPusher_PTPusherMacros_h -#define libPusher_PTPusherMacros_h - -#define __PUSHER_DEPRECATED__ __attribute__((deprecated)) - -#define PT_DEFINE_SHARED_INSTANCE_USING_BLOCK(block) \ -static dispatch_once_t pred = 0; \ -__strong static id _sharedObject = nil; \ -dispatch_once(&pred, ^{ \ -_sharedObject = block(); \ -}); \ -return _sharedObject; \ - -#endif diff --git a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherPresenceChannelDelegate.h b/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherPresenceChannelDelegate.h deleted file mode 100644 index f69005c..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Headers/PTPusherPresenceChannelDelegate.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// PTPusherPresenceChannelDelegate.h -// libPusher -// -// Created by Luke Redpath on 14/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import - -@class PTPusherPresenceChannel; - -@protocol PTPusherPresenceChannelDelegate - -/** Notifies the delegate that the presence channel subscribed successfully. - - Whenever you subscribe to a presence channel, a list of current subscribers will be returned by Pusher. - - The list will be an array of member IDs. Further metadata can be obtained by asking the channel object - for information about a particular member using `-[PTPusherChannel infoForMemberWithID:]`. - - @param channel The presence channel that was subscribed to. - @param members The current members subscribed to the channel. - */ -- (void)presenceChannel:(PTPusherPresenceChannel *)channel didSubscribeWithMemberList:(NSArray *)members; - -/** Notifies the delegate that a new member subscribed to the presence channel. - - The member info can contain arbitrary user data returned by the authorization server. - - @param channel The presence channel that was subscribed to. - @param memberID The ID for the new member. - @param memberInfo The custom user data for the new member. - */ -- (void)presenceChannel:(PTPusherPresenceChannel *)channel memberAddedWithID:(NSString *)memberID memberInfo:(NSDictionary *)memberInfo; - -/** Notifies the delegate that a member subscribed to the presence channel has unsubscribed. - - The member data can contain arbitrary user data returned by the authorization server. - - @param channel The presence channel that was subscribed to. - @param memberID The ID of the member removed. - @param index The internal index of the member (depends on the order joined/left or returned in the server member list) - */ -- (void)presenceChannel:(PTPusherPresenceChannel *)channel memberRemovedWithID:(NSString *)memberID atIndex:(NSInteger)index; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Headers/SRWebSocket.h b/vendor/libPusher/OS X/Pusher.framework/Headers/SRWebSocket.h deleted file mode 100644 index a7e1851..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Headers/SRWebSocket.h +++ /dev/null @@ -1,90 +0,0 @@ -// -// Copyright 2012 Square Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import -#import - -typedef enum { - SR_CONNECTING = 0, - SR_OPEN = 1, - SR_CLOSING = 2, - SR_CLOSED = 3, - -} SRReadyState; - -@class SRWebSocket; - -extern NSString *const SRWebSocketErrorDomain; - -@protocol SRWebSocketDelegate; - -@interface SRWebSocket : NSObject - -@property (nonatomic, assign) id delegate; - -@property (nonatomic, readonly) SRReadyState readyState; -@property (nonatomic, readonly, retain) NSURL *url; - -// This returns the negotiated protocol. -// It will be niluntil after the handshake completes. -@property (nonatomic, readonly, copy) NSString *protocol; - -// Protocols should be an array of strings that turn into Sec-WebSocket-Protocol -- (id)initWithURLRequest:(NSURLRequest *)request protocols:(NSArray *)protocols; -- (id)initWithURLRequest:(NSURLRequest *)request; - -// Some helper constructors -- (id)initWithURL:(NSURL *)url protocols:(NSArray *)protocols; -- (id)initWithURL:(NSURL *)url; - -// SRWebSockets are intended one-time-use only. Open should be called once and only once -- (void)open; - -- (void)close; -- (void)closeWithCode:(NSInteger)code reason:(NSString *)reason; - -// Send a UTF8 String or Data -- (void)send:(id)data; - -@end - -@protocol SRWebSocketDelegate - -// message will either be an NSString if the server is using text -// or NSData if the server is using binary -- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message; - -@optional - -- (void)webSocketDidOpen:(SRWebSocket *)webSocket; -- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error; -- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean; - -@end - - -@interface NSURLRequest (CertificateAdditions) - -@property (nonatomic, retain, readonly) NSArray *SR_SSLPinnedCertificates; - -@end - - -@interface NSMutableURLRequest (CertificateAdditions) - -@property (nonatomic, retain) NSArray *SR_SSLPinnedCertificates; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Pusher b/vendor/libPusher/OS X/Pusher.framework/Pusher deleted file mode 100755 index 6897a66..0000000 Binary files a/vendor/libPusher/OS X/Pusher.framework/Pusher and /dev/null differ diff --git a/vendor/libPusher/OS X/Pusher.framework/Resources/Info.plist b/vendor/libPusher/OS X/Pusher.framework/Resources/Info.plist deleted file mode 100644 index c540298..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Resources/Info.plist +++ /dev/null @@ -1,42 +0,0 @@ - - - - - BuildMachineOSBuild - 12B19 - CFBundleDevelopmentRegion - English - CFBundleExecutable - Pusher - CFBundleIdentifier - co.uk.lukeredpath.Pusher - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Pusher - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.1 - CFBundleSignature - ???? - CFBundleVersion - 1 - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 4G182 - DTPlatformVersion - GM - DTSDKBuild - 12C37 - DTSDKName - macosx10.8 - DTXcode - 0450 - DTXcodeBuild - 4G182 - NSHumanReadableCopyright - Copyright © 2012 LJR Software Limited. All rights reserved. - - diff --git a/vendor/libPusher/OS X/Pusher.framework/Resources/en.lproj/InfoPlist.strings b/vendor/libPusher/OS X/Pusher.framework/Resources/en.lproj/InfoPlist.strings deleted file mode 100644 index 5e45963..0000000 Binary files a/vendor/libPusher/OS X/Pusher.framework/Resources/en.lproj/InfoPlist.strings and /dev/null differ diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTEventListener.h b/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTEventListener.h deleted file mode 100644 index 90d3e27..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTEventListener.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// PTEventListener.h -// PusherEvents -// -// Created by Luke Redpath on 22/03/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import - - -@class PTPusherEvent; - -@protocol PTEventListener - -- (void)dispatchEvent:(PTPusherEvent *)event; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTJSON.h b/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTJSON.h deleted file mode 100644 index 3683320..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTJSON.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// PTJSON.h -// libPusher -// -// Created by Luke Redpath on 30/03/2012. -// Copyright (c) 2012 LJR Software Limited. All rights reserved. -// - -#import -#import "PTJSONParser.h" - -extern NSString *const PTJSONParserNotAvailable; - -@interface PTJSON : NSObject - -/** - Returns a JSON parser appropriate for the current platform. - - A runtime check is performed for the presence of NSJSONSerialization - (available on iOS 5.0 and OSX 10.7 and later). If it is available, - it will be used, otherwise it will fall back to using JSONKit. - - Important note: If you intend to support users of iOS 4.x, you must - ensure that you link JSONKit to your project as it is no longer - embedded within libPusher. - */ -+ (id)JSONParser; - -@end - -@interface PTJSONKitParser : NSObject -+ (id)JSONKitParser; -@end - -@interface PTNSJSONParser : NSObject -+ (id)NSJSONParser; -@end \ No newline at end of file diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTJSONParser.h b/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTJSONParser.h deleted file mode 100644 index b12e292..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTJSONParser.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// PTJSONParser.h -// libPusher -// -// Created by Luke Redpath on 30/03/2012. -// Copyright (c) 2012 LJR Software Limited. All rights reserved. -// - -#import - -@protocol PTJSONParser - -- (NSData *)JSONDataFromObject:(id)object; -- (NSString *)JSONStringFromObject:(id)object; -- (id)objectFromJSONData:(NSData *)data; -- (id)objectFromJSONString:(NSString *)string; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusher.h b/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusher.h deleted file mode 100644 index 81aa40a..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusher.h +++ /dev/null @@ -1,277 +0,0 @@ -// -// PTPusher.h -// PusherEvents -// -// Created by Luke Redpath on 22/03/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import -#import "PTPusherDelegate.h" -#import "PTPusherConnection.h" -#import "PTPusherEventPublisher.h" -#import "PTPusherPresenceChannelDelegate.h" - -/** The Pusher protocol version, used to determined which features - are supported. - */ -#define kPTPusherClientProtocolVersion 5 - -/** The version number of the libPusher library. - */ -#define kPTPusherClientLibraryVersion 1.0 - -/** The name of the notification posted when PTPusher receives an event. - */ -extern NSString *const PTPusherEventReceivedNotification; - -/** The key of the PTPusherEvent object in the PTPusherEventReceivedNotification userInfo dictionary. - */ -extern NSString *const PTPusherEventUserInfoKey; - -/** The error domain for all PTPusher errors. - */ -extern NSString *const PTPusherErrorDomain; - -/** The key for any underlying PTPusherEvent associated with a PTPusher error's userInfo dictionary. - */ -extern NSString *const PTPusherErrorUnderlyingEventKey; - -@class PTPusherChannel; -@class PTPusherPresenceChannel; -@class PTPusherPrivateChannel; -@class PTPusherEventDispatcher; - -/** A PTPusher object provides a high level API for communicating with the Pusher service. - - The provided API allows you to connect and disconnect from the service, subscribe and unsubscribe - from channels and bind to events. There is also beta support for sending events directly over the - connection (instead of using the Pusher REST API). - - To create an instance of PTPusher, you will need your Pusher API key. This can be obtained from your account - dashboard. - - PTPusher's delegate methods allow an object to receive important events in the client and connection's - lifecycle, such as connection, disconnection, reconnection and channel subscribe/unsubscribe events. - - Whilst PTPusher exposes it's connection object as a readonly property, there is no need to manage or - create this connection manually. The connection can be queried for it's current connection state and - socket ID if needed. - - PTPusher aims to mirror the Pusher Javascript client API as much as possible although whilst the - Javascript API uses event binding for any interesting events - not just server or other client events - - libPusher uses standard Cocoa and Objective-C patterns such as delegation and notification where - it makes sense to do so. - - Note: due to various problems people have had connecting to Pusher without SSL over a 3G connection, - it is highly recommend that you use SSL. For this reason, SSL is enabled by default. - */ -@interface PTPusher : NSObject { - PTPusherEventDispatcher *dispatcher; - NSMutableDictionary *channels; -} - -///------------------------------------------------------------------------------------/ -/// @name Properties -///------------------------------------------------------------------------------------/ - -/** The object that acts as the delegate for the receiving instance. - - The delegate must implement the PTPusherDelegate protocol. The delegate is not retained. - */ -@property (nonatomic, unsafe_unretained) id delegate; - - -/** Indicates whether the client should attempt to reconnect automatically when disconnected - or if the connection failed. - - When YES, the client will automatically attempt to re-establish a connection after a set delay. - - If the reconnection attempt fails, the client will continue to attempt to reconnect until this - property is set to NO. The delegate will be notified of each reconnection attempt; you could use - this method to disable reconnection after a number of attempts. - */ -@property (nonatomic, assign, getter=shouldReconnectAutomatically) BOOL reconnectAutomatically; - -/** Specifies the delay between reconnection attempts. Defaults to 5 seconds. - */ -@property (nonatomic, assign) NSTimeInterval reconnectDelay; - -/** The connection object for this client. - - Each instance uses a single connection only. Most clients will likely only ever need a single - PTPusher object and therefore a single connection. - - The connection is exposed to provide access to it's socketID and connection state. Clients - should not attempt to manage this connection directly. - */ -@property (nonatomic, strong, readonly) PTPusherConnection *connection; - -/** The authorization URL for private subscriptions. - - All private channels (including presence channels) require authorization in order to subscribe. - - Authorization happens on your own server. When subscribing to a private or presence channel, - an authorization POST request will be sent to the URL specified by this property. - - Attempting to subscribe to a private or presence channel without setting this property will - result in an assertion error. - - For more information on channel authorization, [see the Pusher documentation website](http://pusher.com/docs/authenticating_users). - */ -@property (nonatomic, strong) NSURL *authorizationURL; - -///------------------------------------------------------------------------------------/ -/// @name Creating new instances -///------------------------------------------------------------------------------------/ - -- (id)initWithConnection:(PTPusherConnection *)connection connectAutomatically:(BOOL)connectAutomatically; - -/** Returns a new PTPusher instance with a connection configured with the given key. - - Instances created using this method will connect automatically. Specify the delegate here - to ensure that it is notified about the connection status during connection. If you assign - a delegate using the delegate property after this method returns, it may not be notified - of connection events. - - @deprecated Use pusherWithKey:delegate:encrypted: - @param key Your application's API key. It can be found in the API Access section of your application within the Pusher user dashboard. - @param delegate The delegate for this instance - */ -+ (id)pusherWithKey:(NSString *)key delegate:(id)delegate __PUSHER_DEPRECATED__; - -/** Returns a new PTPusher instance with a connection configured with the given key. - - Instances created using this method will connect automatically. Specify the delegate here - to ensure that it is notified about the connection status during connection. If you assign - a delegate using the delegate property after this method returns, it may not be notified - of connection events. - - @param key Your application's API key. It can be found in the API Access section of your application within the Pusher user dashboard. - @param delegate The delegate for this instance - @param isEncrypted If yes, a secure connection over SSL will be established. - */ -+ (id)pusherWithKey:(NSString *)key delegate:(id)delegate encrypted:(BOOL)isEncrypted; - -/** Initialises a new PTPusher instance with a connection configured with the given key. - - If you intend to set a delegate for this instance, you are recommended to set connectAutomatically - to NO, set the delegate then manually call connect. - - @deprecated Use pusherWithKey:connectAutomatically:encrypted: - @param key Your application's API key. It can be found in the API Access section of your application within the Pusher user dashboard. - @param connect Automatically If YES, the connection will be connected on initialisation. - */ -+ (id)pusherWithKey:(NSString *)key connectAutomatically:(BOOL)connectAutomatically __PUSHER_DEPRECATED__; - -/** Initialises a new PTPusher instance with a connection configured with the given key. - - If you intend to set a delegate for this instance, you are recommended to set connectAutomatically - to NO, set the delegate then manually call connect. - - @param key Your application's API key. It can be found in the API Access section of your application within the Pusher user dashboard. - @param connectAutomatically If YES, the connection will be connected on initialisation. - @param isEncrypted If yes, a secure connection over SSL will be established. - */ -+ (id)pusherWithKey:(NSString *)key connectAutomatically:(BOOL)connectAutomatically encrypted:(BOOL)isEncrypted; - -///------------------------------------------------------------------------------------/ -/// @name Managing the connection -///------------------------------------------------------------------------------------/ - -/** Establishes a connection to the Pusher server. - - If already connected, this method does nothing. - */ -- (void)connect; - -/** Disconnects from the Pusher server. - - If already disconnected, this method does nothing. - */ -- (void)disconnect; - -///------------------------------------------------------------------------------------/ -/// @name Subscribing to channels -///------------------------------------------------------------------------------------/ - -/** Subscribes to the named channel. - - This method can be used to subscribe to any type of channel, including private and - presence channels by including the appropriate channel name prefix. - - @param name The name of the channel to subscribe to. - */ -- (PTPusherChannel *)subscribeToChannelNamed:(NSString *)name; - -/** Subscribes to the named private channel. - - The "private-" prefix should be excluded from the name; it will be added automatically. - - @param name The name of the channel (without the private prefix) to subscribe to. - */ -- (PTPusherPrivateChannel *)subscribeToPrivateChannelNamed:(NSString *)name; - -/** Subscribes to the named presence channel. - - The "presence-" prefix should be excluded from the name; it will be added automatically. - - @param name The name of the channel (without the presence prefix) to subscribe to. - */ -- (PTPusherPresenceChannel *)subscribeToPresenceChannelNamed:(NSString *)name; - -/** Subscribes to the named presence channel. - - The "presence-" prefix should be excluded from the name; it will be added automatically. - - Whilst the presence delegate can be set on the channel after it is returned, to ensure - events are not missed, it is advised that you call this method and specify a delegate. The - delegate will be assigned before subscription happens. - - @param name The name of the channel (without the presence prefix) to subscribe to. - @param presenceDelegate The presence delegate for this channel. - */ -- (PTPusherPresenceChannel *)subscribeToPresenceChannelNamed:(NSString *)name delegate:(id)presenceDelegate; - -/** Unsubscribes from the specified channel. - - This method is deprecated. You should use -[PTPusherChannel unsubscribe] instead. - - @param channel The channel to unsubscribe from. - */ -- (void)unsubscribeFromChannel:(PTPusherChannel *)channel __PUSHER_DEPRECATED__; - -/** Returns a previously subscribed channel with the given name. - - If the channel specified has not been subscribed to, this method will return nil. - - @param name The name of the channel required. - */ -- (PTPusherChannel *)channelNamed:(NSString *)name; - -///------------------------------------------------------------------------------------/ -/// @name Publishing events -///------------------------------------------------------------------------------------/ - -/** Sends an event directly over the connection's socket. - - Whilst Pusher provides a REST API for publishing events, it also supports the sending of - events directly from clients over the client's existing connection. - - Client events have the following restrictions: - - + The user must be subscribed to the channel that the event is being triggered on. - - + Client events can only be triggered on private and presence channels because they require authentication. - - + Client events must be prefixed by client-. Events with any other prefix will be rejected by the Pusher server, as will events sent to channels to which the client is not subscribed. - - This method does nothing to enforce the first two restrictions. It is instead recommended that - you use the `PTPusherChannel` event triggering API rather than calling this method directly. - - @warning Note: This Pusher feature is currently in beta and requires enabling on your account. - */ -- (void)sendEventNamed:(NSString *)name data:(id)data channel:(NSString *)channelName; - -@end - diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherAPI.h b/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherAPI.h deleted file mode 100644 index d843535..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherAPI.h +++ /dev/null @@ -1,48 +0,0 @@ -// -// PTPusherAPI.h -// libPusher -// -// Created by Luke Redpath on 14/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import - -/** A simple interface to the Pusher REST API. - - This functionality used to be part of the main PTPusher library but - has been extracted into a standalone component. - - The PTPusher client has alpha support for channel-based event triggering - but for general event triggering the API can be used. - - As well as your Pusher API key, you will also need your app ID and secret key - for signing requests. - */ -@interface PTPusherAPI : NSObject { - NSString *key, *appID, *secretKey; - NSOperationQueue *operationQueue; -} - -///------------------------------------------------------------------------------------/ -/// @name Initialisation -///------------------------------------------------------------------------------------/ - -- (id)initWithKey:(NSString *)aKey appID:(NSString *)anAppID secretKey:(NSString *)aSecretKey; - -///------------------------------------------------------------------------------------/ -/// @name Triggering events -///------------------------------------------------------------------------------------/ - -/** Triggers an event on the specified channel. - - The event data will be converted to JSON format so needs to be any object that can be - transformed into JSON (typically any plist-compatible object). - - @param eventName The name of the event to trigger. - @param channelName The channel the event should be triggered on. - @param eventData The JSON-compatible data object for the event. - */ -- (void)triggerEvent:(NSString *)eventName onChannel:(NSString *)channelName data:(id)eventData socketID:(NSString *)socketID; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherChannel.h b/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherChannel.h deleted file mode 100644 index 26da317..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherChannel.h +++ /dev/null @@ -1,184 +0,0 @@ -// -// PTPusherClient.h -// libPusher -// -// Created by Luke Redpath on 23/04/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import -#import "PTPusherEventPublisher.h" -#import "PTEventListener.h" -#import "PTPusherPresenceChannelDelegate.h" - - -@class PTPusher; -@class PTPusherEventDispatcher; - -/** A PTPusherChannel object represents a single Pusher channel. - - Channels can be used as a means of filtering or controlling access to events. - - Channels do not need to be explicitly created; they are created on demand. To obtain - an instance of a PTPusherChannel, you need to subscribe to it first. - - You should not create PTPusherChannel instances directly as they require subscription and - possibly authorization; you should instead use the subscribeTo methods provided by PTPusher. - - There are three types of channel: - - + Public channels can be subscribed to by anyone who knows their name. - - + Private channels allow you to control access to the data you are broadcasting. - - + Presence channels you to 'register' user information on subscription, and let other members of the channel know who's online. - - Channels can be subscribed to or unsubscribed to at any time, even before the initial - Pusher connection has been established. - */ -@interface PTPusherChannel : NSObject { - NSString *name; - __unsafe_unretained PTPusher *pusher; - PTPusherEventDispatcher *dispatcher; - NSMutableArray *internalBindings; -} - -///------------------------------------------------------------------------------------/ -/// @name Properties -///------------------------------------------------------------------------------------/ - -/** The channel name. - */ -@property (nonatomic, readonly) NSString *name; - -/** Indicates that this channel has been subscribed to. - - Whilst public channels are subscribed to immediately, presence and private channels require - authorization first. This property will be set to YES once an internal Pusher event has - been received indicating that the channel subscription has been registered. - */ -@property (nonatomic, readonly, getter=isSubscribed) BOOL subscribed; - -/** Indicates whether or not this is a private channel. - - The value of this property will be YES for private and presence channels. - */ -@property (nonatomic, readonly) BOOL isPrivate; - -/** Indicates whether or not this is a presence channel. - - The value of this property will be YES for presence channels only. - */ -@property (nonatomic, readonly) BOOL isPresence; - -///------------------------------------------------------------------------------------/ -/// @name Initialisation -///------------------------------------------------------------------------------------/ - -+ (id)channelWithName:(NSString *)name pusher:(PTPusher *)pusher; -- (id)initWithName:(NSString *)channelName pusher:(PTPusher *)pusher; - -///------------------------------------------------------------------------------------/ -/// @name Authorization -///------------------------------------------------------------------------------------/ - -- (void)authorizeWithCompletionHandler:(void(^)(BOOL, NSDictionary *, NSError *))completionHandler; - -///------------------------------------------------------------------------------------/ -/// @name Unsubscribing -///------------------------------------------------------------------------------------/ - -/** Unsubscribes from the channel. - */ -- (void)unsubscribe; - -@end - -/** A PTPusherPrivateChannel object represents a private Pusher channel. - - Private channels should be used when access to the channel needs to be restricted in some way. - In order for a user to subscribe to a private channel permission must be authorised. - - Private channel names always have the prefix of "private-". - - Only private and presence channels support the triggering client events. - */ -@interface PTPusherPrivateChannel : PTPusherChannel { - NSMutableArray *clientEventBuffer; -} - -///------------------------------------------------------------------------------------/ -/// @name Triggering events -///------------------------------------------------------------------------------------/ - -/** Triggers a named event directly over the connection. - - Client events have the following restrictions: - - + The user must be subscribed to the channel that the event is being triggered on. - - + Client events can only be triggered on private and presence channels because they require authentication. - - + Client events must be prefixed by client-. Events with any other prefix will be rejected by the Pusher server, as will events sent to channels to which the client is not subscribed. - - If you attempt to trigger event on a channel while isSubscribed is NO, the event will not be sent. - - If the event name does not have a prefix of "client-", it will be added automatically. - - The event data must be an object that can be serialized as JSON, typically an NSArray or NSDictionary although - it could be a simple string. - */ -- (void)triggerEventNamed:(NSString *)eventName data:(id)eventData; - -@end - -/** A PTPusherPresenceChannel object represents a Pusher presence channel. - - Presence channels build on the security of Private channels and expose the additional feature - of an awareness of who is subscribed to that channel. This makes it extremely easy to build - chat room and "who's online" type functionality to your application. - - Presence channel names always have the prefix of "presence-". - - Unlike the Pusher Javascript client API, PTPusherPresenceChannel does not use events to notify - when members are added or removed. Instead, you should assign a presenceDelegate which will - be notified of these events. - - @see PTPusherPresenceChannelDelegate - */ -@interface PTPusherPresenceChannel : PTPusherPrivateChannel { - NSMutableDictionary *members; - NSMutableArray *memberIDs; // store these separately to preserve order -} - -///------------------------------------------------------------------------------------/ -/// @name Properties -///------------------------------------------------------------------------------------/ - -/** The presence delegate for the receiver. - - The presence delegate will be notified of presence channel-specific events, such as the initial - member list on subscription and member added/removed events. - */ -@property (nonatomic, unsafe_unretained) id presenceDelegate; - -/** Returns the current list of channel members. - - Members are stored as a dictionary of dictionaries, keyed on the member's "user_id" field. - - @deprecated Use the methods below for accessing member data. - */ -@property (nonatomic, readonly) NSDictionary *members; - -/** Returns a dictionary of member metadata (email, name etc.) for the given member ID. - */ -- (NSDictionary *)infoForMemberWithID:(NSString *)memberID; - -/** Returns an array of available member IDs - */ -- (NSArray *)memberIDs; - -/** Returns the number of members currently connected to this channel. - */ -- (NSInteger)memberCount; -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherConnection.h b/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherConnection.h deleted file mode 100644 index 998ffc4..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherConnection.h +++ /dev/null @@ -1,91 +0,0 @@ -// -// PTPusherConnection.h -// libPusher -// -// Created by Luke Redpath on 13/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import -#import "SRWebSocket.h" -#import "PTPusherMacros.h" - -@class PTPusherConnection; -@class PTPusherEvent; - -@protocol PTPusherConnectionDelegate -- (void)pusherConnectionDidConnect:(PTPusherConnection *)connection; -- (void)pusherConnection:(PTPusherConnection *)connection didDisconnectWithCode:(NSInteger)errorCode reason:(NSString *)reason wasClean:(BOOL)wasClean; -- (void)pusherConnection:(PTPusherConnection *)connection didFailWithError:(NSError *)error wasConnected:(BOOL)wasConnected; -- (void)pusherConnection:(PTPusherConnection *)connection didReceiveEvent:(PTPusherEvent *)event; -@end - -extern NSString *const PTPusherConnectionEstablishedEvent; -extern NSString *const PTPusherConnectionPingEvent; - -typedef enum { - PTPusherConnectionClosing = 0, - PTPusherConnectionClosed, - PTPusherConnectionOpening, - PTPusherConnectionOpenAwaitingHandshake, - PTPusherConnectionOpenHandshakeReceived -} PTPusherConnectionState; - -@interface PTPusherConnection : NSObject - -@property (nonatomic, unsafe_unretained) id delegate; -@property (nonatomic, readonly, getter=isConnected) BOOL connected; -@property (nonatomic, copy, readonly) NSString *socketID; - -///------------------------------------------------------------------------------------/ -/// @name Initialisation -///------------------------------------------------------------------------------------/ - -/** Creates a new PTPusherConnection instance. - - Connections are not opened immediately; an explicit call to connect is required. - - @param aURL The websocket endpoint - @param delegate The delegate for this connection - */ -- (id)initWithURL:(NSURL *)aURL; - -/** Creates a new PTPusherConnection instance. - - Connections are not opened immediately; an explicit call to connect is required. - - DEPRECATED IN VERSION 1.2. The secure parameter is now ignored; secure mode will be - enabled automatically when the URL protocol is wss. - - @param aURL The websocket endpoint - @param delegate The delegate for this connection - @param secure Whether this connection should be secure (TLS) - */ -- (id)initWithURL:(NSURL *)aURL secure:(BOOL)secure __PUSHER_DEPRECATED__; - -///------------------------------------------------------------------------------------/ -/// @name Managing connections -///------------------------------------------------------------------------------------/ - -/** Establishes a web socket connection to the Pusher server. - - The delegate will only be sent a didConnect message when the web socket receives a - 'connection_established' event from Pusher, regardless of the web socket's connection state. - */ -- (void)connect; - -/** Closes the web socket connection */ -- (void)disconnect; - -///------------------------------------------------------------------------------------/ -/// @name Sending data -///------------------------------------------------------------------------------------/ - -/** Sends an object over the web socket connection. - - The object will be serialized to JSON before sending, so the object must be anything - that can be converted into JSON (typically, any plist compatible object). - */ -- (void)send:(id)object; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherDelegate.h b/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherDelegate.h deleted file mode 100644 index 9f0a8bf..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherDelegate.h +++ /dev/null @@ -1,128 +0,0 @@ -// -// PTPusherDelegate.h -// libPusher -// -// Created by Luke Redpath on 22/03/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import "PTPusherMacros.h" - -@class PTPusher; -@class PTPusherConnection; -@class PTPusherChannel; -@class PTPusherEvent; -@class PTPusherErrorEvent; - -/** The PTPusherDelegate protocol can be implemented to receive important events in a PTPusher object's lifetime. - - All of the delegate methods are optional; you only need to implement what is required for your app. - - It may be useful to assign a delegate to monitor the status of the connection; you could use this to update - your user interface accordingly. - */ -@protocol PTPusherDelegate - -@optional - -/** Notifies the delegate that the PTPusher instance has connected to the Pusher service successfully. - - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - */ -- (void)pusher:(PTPusher *)pusher connectionDidConnect:(PTPusherConnection *)connection; - -/** Notifies the delegate that the PTPusher instance has disconnected from the Pusher service. - - @deprecated Use pusher:connection:didDisconnectWithError: - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - */ -- (void)pusher:(PTPusher *)pusher connectionDidDisconnect:(PTPusherConnection *)connection __PUSHER_DEPRECATED__; - -/** Notifies the delegate that the PTPusher instance has disconnected from the Pusher service. - - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - @param error If the connection disconnected abnormally, error will be non-nil. - */ -- (void)pusher:(PTPusher *)pusher connection:(PTPusherConnection *)connection didDisconnectWithError:(NSError *)error; - -/** Notifies the delegate that the PTPusher instance failed to connect to the Pusher service. - - If reconnectAutomatically is YES, PTPusher will attempt to reconnect if the initial connection failed. - - This reconnect attempt will happen after this message is sent to the delegate, giving the delegate - a chance to inspect the connection error and disable automatic reconnection if it thinks the reconnection - attempt is likely to fail, depending on the error. - - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - @param error The connection error. - */ -- (void)pusher:(PTPusher *)pusher connection:(PTPusherConnection *)connection failedWithError:(NSError *)error; - -/** Notifies the delegate that the PTPusher instance is about to attempt reconnection. - - You may wish to use this method to keep track of the number of reconnection attempts and abort after a fixed number. - - If you do not set the `reconnectAutomatically` property of the PTPusher instance to NO, it will continue attempting - to reconnect until a successful connection has been established. - - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - */ -- (void)pusher:(PTPusher *)pusher connectionWillReconnect:(PTPusherConnection *)connection afterDelay:(NSTimeInterval)delay; - -/** Notifies the delegate of the request that will be used to authorize access to a channel. - - When using the Pusher Javascript client, authorization typically relies on an existing session cookie - on the server; when the Javascript client makes an AJAX POST to the server, the server can return - the user's credentials based on their current session. - - When using libPusher, there will likely be no existing server-side session; authorization will - need to happen by some other means (e.g. an authorization token or HTTP basic auth). - - By implementing this delegate method, you will be able to set any credentials as necessary by - modifying the request as required (such as setting POST parameters or headers). - */ -- (void)pusher:(PTPusher *)pusher willAuthorizeChannelWithRequest:(NSMutableURLRequest *)request; - -/** Notifies the delegate that the PTPusher instance has subscribed to the specified channel. - - This method will be called after any channel authorization has taken place and when a subscribe event has been received. - - @param pusher The PTPusher instance that has connected. - @param channel The channel that was subscribed to. - */ -- (void)pusher:(PTPusher *)pusher didSubscribeToChannel:(PTPusherChannel *)channel; - -/** Notifies the delegate that the PTPusher instance has unsubscribed from the specified channel. - - This method will be called immediately after unsubscribing from a channel. - - @param pusher The PTPusher instance that has connected. - @param channel The channel that was unsubscribed from. - */ -- (void)pusher:(PTPusher *)pusher didUnsubscribeFromChannel:(PTPusherChannel *)channel; - -/** Notifies the delegate that the PTPusher instance failed to subscribe to the specified channel. - - The most common reason for subscribing failing is authorization failing for private/presence channels. - - @param pusher The PTPusher instance that has connected. - @param channel The channel that was subscribed to. - @param error The error returned when attempting to subscribe. - */ -- (void)pusher:(PTPusher *)pusher didFailToSubscribeToChannel:(PTPusherChannel *)channel withError:(NSError *)error; - -/** Notifies the delegate that an error event has been received. - - If a client is binding to all events, either through the client or using NSNotificationCentre, they will also - receive notification of this event like any other. - - @param pusher The PTPusher instance that received the event. - @param errorEvent The error event. - */ -- (void)pusher:(PTPusher *)pusher didReceiveErrorEvent:(PTPusherErrorEvent *)errorEvent; -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherErrors.h b/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherErrors.h deleted file mode 100644 index a4b5f28..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherErrors.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// PTPusherErrors.h -// libPusher -// -// Created by Luke Redpath on 14/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import - -enum { - PTPusherSubscriptionError = 0, - PTPusherSubscriptionUnknownAuthorisationError -}; diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherEvent.h b/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherEvent.h deleted file mode 100644 index bcfb484..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherEvent.h +++ /dev/null @@ -1,74 +0,0 @@ -// -// PTPusherEvent.h -// PusherEvents -// -// Created by Luke Redpath on 22/03/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import - -extern NSString *const PTPusherDataKey; -extern NSString *const PTPusherEventKey; -extern NSString *const PTPusherChannelKey; - -/** A value object representing a Pusher event. - - All events dispatched by libPusher (via either bindings or notifications) will be represented - by instances of this class. - */ -@interface PTPusherEvent : NSObject { - NSString *_name; -} - -///------------------------------------------------------------------------------------/ -/// @name Properties -///------------------------------------------------------------------------------------/ - -/** The event name. - */ -@property (nonatomic, readonly) NSString *name; - -/** The channel that this event originated from. - */ -@property (strong, nonatomic, readonly) NSString *channel; - -/** The event data. - - Event data will typically be any kind of object that can be represented as JSON, often - an NSArray or NSDictionary but can be a simple string. - */ -@property (strong, nonatomic, readonly) id data; - -/** The time the event was received. - */ -@property (nonatomic, readonly, strong) NSDate *timeReceived; - -- (id)initWithEventName:(NSString *)name channel:(NSString *)channel data:(id)data; -+ (id)eventFromMessageDictionary:(NSDictionary *)dictionary; -@end - -typedef enum { - PTPusherErrorSSLRequired = 4000, - PTPusherErrorApplicationUnknown = 4001, - PTPusherErrorApplicationDisabled = 4002 -} PTPusherServerErrorCodes; - -/** A special sub-class of Pusher event, representing pusher:error events. - - This will be yielded to the Pusher client delegate as well as through the normal event - dispatch mechanism. - - This class adds some convenient properties for accessing error details. - */ -@interface PTPusherErrorEvent : PTPusherEvent - -/** A textual description of the error. - */ -@property (unsafe_unretained, nonatomic, readonly) NSString *message; - -/** The error code. See PTPusherServerErrorCodes for available errors. - */ -@property (nonatomic, readonly) NSInteger code; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherEventDispatcher.h b/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherEventDispatcher.h deleted file mode 100644 index 922d678..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherEventDispatcher.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// PTPusherEventDispatcher.h -// libPusher -// -// Created by Luke Redpath on 13/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import -#import "PTEventListener.h" - -@class PTPusherEventBinding; - -@interface PTPusherEventDispatcher : NSObject - -@property (nonatomic, readonly) NSDictionary *bindings; - -- (PTPusherEventBinding *)addEventListener:(id)listener forEventNamed:(NSString *)eventName; -- (void)removeBinding:(PTPusherEventBinding *)binding; -- (void)removeAllBindings; -@end - -@interface PTPusherEventBinding : NSObject - -/** The event this binding binds to. */ -@property (nonatomic, readonly) NSString *eventName; - -/** Returns YES if this binding is still attached to its event publisher. - - Retained references to bindings can become invalid as a result of another object - calling removeBinding: with this binding or removeAllBindings. - - You can safely discard invalid binding instances. - */ -@property (nonatomic, readonly, getter=isValid) BOOL valid; - -- (id)initWithEventListener:(id)eventListener eventName:(NSString *)eventName; -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherEventPublisher.h b/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherEventPublisher.h deleted file mode 100644 index 09939a9..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherEventPublisher.h +++ /dev/null @@ -1,84 +0,0 @@ -// -// PTPusherEventPublisher.h -// libPusher -// -// Created by Luke Redpath on 13/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import - -@class PTPusherEvent; -@class PTPusherEventBinding; - -typedef void (^PTPusherEventBlockHandler) (PTPusherEvent *); - -/** Describes an object that provides events that can be bound to. - - Events in Pusher form the basis of all communication with the service. They are - named messages that can carry arbitrary user data. All events in libPusher are - represented by the class `PTPusherEvent`. - - An object that implements this protocol allows for binding to events. There are - currently two classes that implement this protocol: `PTPusher` and `PTPusherChannel`. - - There are two primary binding mechanisms: target/action based and block-based. Which - one you use depends entirely on the requirements of your application. - */ -@protocol PTPusherEventBindings - -/** Binds to the named event using the target/action mechanism. - - When the named event is received, the specified selector will be called on target, passing - the `PTPusherEvent` as the only argument. - - The following code snippet sets up a binding for the event "new-message" on any channel: - - [pusher bindToEventNamed:@"new-message" target:self action:@selector(handleNewMessageEvent:)]; - - Then the event is triggered, the event will be dispatched to the target/action pair: - - - (void)handleNewMessageEvent:(PTPusherEvent *)event - { - // do something with event - } - */ -- (PTPusherEventBinding *)bindToEventNamed:(NSString *)eventName target:(id)target action:(SEL)selector; - -/** Binds to the named event using a block callback. - - When the event is received, the block will be called with the `PTPusherEvent` as the only block argument. - - The following code snippet sets up a binding for the event "new-message" on any channel and handles that - event when it is triggered: - - [pusher bindToEventNamed:@"new-message" handleWithBlock:^(PTPusherEvent *event) { - // do something with event - }]; - - The callback blocks will be dispatched asynchronously using Grand Central Dispatch on the main queue. - */ -- (PTPusherEventBinding *)bindToEventNamed:(NSString *)eventName handleWithBlock:(PTPusherEventBlockHandler)block; - -/** Binds to the named event using a block callback. - - Works the same as bindToEventNamed:handleWithBlock: but dispatches the callback block on the specified - Grand Central Dispatch queue. - - You can use this method if you wish to handle events in a background or custom priority queue. - */ -- (PTPusherEventBinding *)bindToEventNamed:(NSString *)eventName handleWithBlock:(PTPusherEventBlockHandler)block queue:(dispatch_queue_t)queue; - -/** Removes the specified binding. - - Any further events will not trigger any callbacks after the binding has been removed. - */ -- (void)removeBinding:(PTPusherEventBinding *)binding; - -/** Removes all bindings that have been set up. - - Any retained references to PTPusherEventBinding objects will become invalid. - */ -- (void)removeAllBindings; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherMacros.h b/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherMacros.h deleted file mode 100644 index 29245c6..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherMacros.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// PTPusherMacros.h -// libPusher -// -// Created by Luke Redpath on 10/02/2012. -// Copyright (c) 2012 LJR Software Limited. All rights reserved. -// - -#ifndef libPusher_PTPusherMacros_h -#define libPusher_PTPusherMacros_h - -#define __PUSHER_DEPRECATED__ __attribute__((deprecated)) - -#define PT_DEFINE_SHARED_INSTANCE_USING_BLOCK(block) \ -static dispatch_once_t pred = 0; \ -__strong static id _sharedObject = nil; \ -dispatch_once(&pred, ^{ \ -_sharedObject = block(); \ -}); \ -return _sharedObject; \ - -#endif diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherPresenceChannelDelegate.h b/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherPresenceChannelDelegate.h deleted file mode 100644 index f69005c..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/PTPusherPresenceChannelDelegate.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// PTPusherPresenceChannelDelegate.h -// libPusher -// -// Created by Luke Redpath on 14/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import - -@class PTPusherPresenceChannel; - -@protocol PTPusherPresenceChannelDelegate - -/** Notifies the delegate that the presence channel subscribed successfully. - - Whenever you subscribe to a presence channel, a list of current subscribers will be returned by Pusher. - - The list will be an array of member IDs. Further metadata can be obtained by asking the channel object - for information about a particular member using `-[PTPusherChannel infoForMemberWithID:]`. - - @param channel The presence channel that was subscribed to. - @param members The current members subscribed to the channel. - */ -- (void)presenceChannel:(PTPusherPresenceChannel *)channel didSubscribeWithMemberList:(NSArray *)members; - -/** Notifies the delegate that a new member subscribed to the presence channel. - - The member info can contain arbitrary user data returned by the authorization server. - - @param channel The presence channel that was subscribed to. - @param memberID The ID for the new member. - @param memberInfo The custom user data for the new member. - */ -- (void)presenceChannel:(PTPusherPresenceChannel *)channel memberAddedWithID:(NSString *)memberID memberInfo:(NSDictionary *)memberInfo; - -/** Notifies the delegate that a member subscribed to the presence channel has unsubscribed. - - The member data can contain arbitrary user data returned by the authorization server. - - @param channel The presence channel that was subscribed to. - @param memberID The ID of the member removed. - @param index The internal index of the member (depends on the order joined/left or returned in the server member list) - */ -- (void)presenceChannel:(PTPusherPresenceChannel *)channel memberRemovedWithID:(NSString *)memberID atIndex:(NSInteger)index; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/SRWebSocket.h b/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/SRWebSocket.h deleted file mode 100644 index a7e1851..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Headers/SRWebSocket.h +++ /dev/null @@ -1,90 +0,0 @@ -// -// Copyright 2012 Square Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import -#import - -typedef enum { - SR_CONNECTING = 0, - SR_OPEN = 1, - SR_CLOSING = 2, - SR_CLOSED = 3, - -} SRReadyState; - -@class SRWebSocket; - -extern NSString *const SRWebSocketErrorDomain; - -@protocol SRWebSocketDelegate; - -@interface SRWebSocket : NSObject - -@property (nonatomic, assign) id delegate; - -@property (nonatomic, readonly) SRReadyState readyState; -@property (nonatomic, readonly, retain) NSURL *url; - -// This returns the negotiated protocol. -// It will be niluntil after the handshake completes. -@property (nonatomic, readonly, copy) NSString *protocol; - -// Protocols should be an array of strings that turn into Sec-WebSocket-Protocol -- (id)initWithURLRequest:(NSURLRequest *)request protocols:(NSArray *)protocols; -- (id)initWithURLRequest:(NSURLRequest *)request; - -// Some helper constructors -- (id)initWithURL:(NSURL *)url protocols:(NSArray *)protocols; -- (id)initWithURL:(NSURL *)url; - -// SRWebSockets are intended one-time-use only. Open should be called once and only once -- (void)open; - -- (void)close; -- (void)closeWithCode:(NSInteger)code reason:(NSString *)reason; - -// Send a UTF8 String or Data -- (void)send:(id)data; - -@end - -@protocol SRWebSocketDelegate - -// message will either be an NSString if the server is using text -// or NSData if the server is using binary -- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message; - -@optional - -- (void)webSocketDidOpen:(SRWebSocket *)webSocket; -- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error; -- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean; - -@end - - -@interface NSURLRequest (CertificateAdditions) - -@property (nonatomic, retain, readonly) NSArray *SR_SSLPinnedCertificates; - -@end - - -@interface NSMutableURLRequest (CertificateAdditions) - -@property (nonatomic, retain) NSArray *SR_SSLPinnedCertificates; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Pusher b/vendor/libPusher/OS X/Pusher.framework/Versions/A/Pusher deleted file mode 100755 index 6897a66..0000000 Binary files a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Pusher and /dev/null differ diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Resources/Info.plist b/vendor/libPusher/OS X/Pusher.framework/Versions/A/Resources/Info.plist deleted file mode 100644 index c540298..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Resources/Info.plist +++ /dev/null @@ -1,42 +0,0 @@ - - - - - BuildMachineOSBuild - 12B19 - CFBundleDevelopmentRegion - English - CFBundleExecutable - Pusher - CFBundleIdentifier - co.uk.lukeredpath.Pusher - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Pusher - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.1 - CFBundleSignature - ???? - CFBundleVersion - 1 - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 4G182 - DTPlatformVersion - GM - DTSDKBuild - 12C37 - DTSDKName - macosx10.8 - DTXcode - 0450 - DTXcodeBuild - 4G182 - NSHumanReadableCopyright - Copyright © 2012 LJR Software Limited. All rights reserved. - - diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Resources/en.lproj/InfoPlist.strings b/vendor/libPusher/OS X/Pusher.framework/Versions/A/Resources/en.lproj/InfoPlist.strings deleted file mode 100644 index 5e45963..0000000 Binary files a/vendor/libPusher/OS X/Pusher.framework/Versions/A/Resources/en.lproj/InfoPlist.strings and /dev/null differ diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTEventListener.h b/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTEventListener.h deleted file mode 100644 index 90d3e27..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTEventListener.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// PTEventListener.h -// PusherEvents -// -// Created by Luke Redpath on 22/03/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import - - -@class PTPusherEvent; - -@protocol PTEventListener - -- (void)dispatchEvent:(PTPusherEvent *)event; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTJSON.h b/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTJSON.h deleted file mode 100644 index 3683320..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTJSON.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// PTJSON.h -// libPusher -// -// Created by Luke Redpath on 30/03/2012. -// Copyright (c) 2012 LJR Software Limited. All rights reserved. -// - -#import -#import "PTJSONParser.h" - -extern NSString *const PTJSONParserNotAvailable; - -@interface PTJSON : NSObject - -/** - Returns a JSON parser appropriate for the current platform. - - A runtime check is performed for the presence of NSJSONSerialization - (available on iOS 5.0 and OSX 10.7 and later). If it is available, - it will be used, otherwise it will fall back to using JSONKit. - - Important note: If you intend to support users of iOS 4.x, you must - ensure that you link JSONKit to your project as it is no longer - embedded within libPusher. - */ -+ (id)JSONParser; - -@end - -@interface PTJSONKitParser : NSObject -+ (id)JSONKitParser; -@end - -@interface PTNSJSONParser : NSObject -+ (id)NSJSONParser; -@end \ No newline at end of file diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTJSONParser.h b/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTJSONParser.h deleted file mode 100644 index b12e292..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTJSONParser.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// PTJSONParser.h -// libPusher -// -// Created by Luke Redpath on 30/03/2012. -// Copyright (c) 2012 LJR Software Limited. All rights reserved. -// - -#import - -@protocol PTJSONParser - -- (NSData *)JSONDataFromObject:(id)object; -- (NSString *)JSONStringFromObject:(id)object; -- (id)objectFromJSONData:(NSData *)data; -- (id)objectFromJSONString:(NSString *)string; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusher.h b/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusher.h deleted file mode 100644 index 81aa40a..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusher.h +++ /dev/null @@ -1,277 +0,0 @@ -// -// PTPusher.h -// PusherEvents -// -// Created by Luke Redpath on 22/03/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import -#import "PTPusherDelegate.h" -#import "PTPusherConnection.h" -#import "PTPusherEventPublisher.h" -#import "PTPusherPresenceChannelDelegate.h" - -/** The Pusher protocol version, used to determined which features - are supported. - */ -#define kPTPusherClientProtocolVersion 5 - -/** The version number of the libPusher library. - */ -#define kPTPusherClientLibraryVersion 1.0 - -/** The name of the notification posted when PTPusher receives an event. - */ -extern NSString *const PTPusherEventReceivedNotification; - -/** The key of the PTPusherEvent object in the PTPusherEventReceivedNotification userInfo dictionary. - */ -extern NSString *const PTPusherEventUserInfoKey; - -/** The error domain for all PTPusher errors. - */ -extern NSString *const PTPusherErrorDomain; - -/** The key for any underlying PTPusherEvent associated with a PTPusher error's userInfo dictionary. - */ -extern NSString *const PTPusherErrorUnderlyingEventKey; - -@class PTPusherChannel; -@class PTPusherPresenceChannel; -@class PTPusherPrivateChannel; -@class PTPusherEventDispatcher; - -/** A PTPusher object provides a high level API for communicating with the Pusher service. - - The provided API allows you to connect and disconnect from the service, subscribe and unsubscribe - from channels and bind to events. There is also beta support for sending events directly over the - connection (instead of using the Pusher REST API). - - To create an instance of PTPusher, you will need your Pusher API key. This can be obtained from your account - dashboard. - - PTPusher's delegate methods allow an object to receive important events in the client and connection's - lifecycle, such as connection, disconnection, reconnection and channel subscribe/unsubscribe events. - - Whilst PTPusher exposes it's connection object as a readonly property, there is no need to manage or - create this connection manually. The connection can be queried for it's current connection state and - socket ID if needed. - - PTPusher aims to mirror the Pusher Javascript client API as much as possible although whilst the - Javascript API uses event binding for any interesting events - not just server or other client events - - libPusher uses standard Cocoa and Objective-C patterns such as delegation and notification where - it makes sense to do so. - - Note: due to various problems people have had connecting to Pusher without SSL over a 3G connection, - it is highly recommend that you use SSL. For this reason, SSL is enabled by default. - */ -@interface PTPusher : NSObject { - PTPusherEventDispatcher *dispatcher; - NSMutableDictionary *channels; -} - -///------------------------------------------------------------------------------------/ -/// @name Properties -///------------------------------------------------------------------------------------/ - -/** The object that acts as the delegate for the receiving instance. - - The delegate must implement the PTPusherDelegate protocol. The delegate is not retained. - */ -@property (nonatomic, unsafe_unretained) id delegate; - - -/** Indicates whether the client should attempt to reconnect automatically when disconnected - or if the connection failed. - - When YES, the client will automatically attempt to re-establish a connection after a set delay. - - If the reconnection attempt fails, the client will continue to attempt to reconnect until this - property is set to NO. The delegate will be notified of each reconnection attempt; you could use - this method to disable reconnection after a number of attempts. - */ -@property (nonatomic, assign, getter=shouldReconnectAutomatically) BOOL reconnectAutomatically; - -/** Specifies the delay between reconnection attempts. Defaults to 5 seconds. - */ -@property (nonatomic, assign) NSTimeInterval reconnectDelay; - -/** The connection object for this client. - - Each instance uses a single connection only. Most clients will likely only ever need a single - PTPusher object and therefore a single connection. - - The connection is exposed to provide access to it's socketID and connection state. Clients - should not attempt to manage this connection directly. - */ -@property (nonatomic, strong, readonly) PTPusherConnection *connection; - -/** The authorization URL for private subscriptions. - - All private channels (including presence channels) require authorization in order to subscribe. - - Authorization happens on your own server. When subscribing to a private or presence channel, - an authorization POST request will be sent to the URL specified by this property. - - Attempting to subscribe to a private or presence channel without setting this property will - result in an assertion error. - - For more information on channel authorization, [see the Pusher documentation website](http://pusher.com/docs/authenticating_users). - */ -@property (nonatomic, strong) NSURL *authorizationURL; - -///------------------------------------------------------------------------------------/ -/// @name Creating new instances -///------------------------------------------------------------------------------------/ - -- (id)initWithConnection:(PTPusherConnection *)connection connectAutomatically:(BOOL)connectAutomatically; - -/** Returns a new PTPusher instance with a connection configured with the given key. - - Instances created using this method will connect automatically. Specify the delegate here - to ensure that it is notified about the connection status during connection. If you assign - a delegate using the delegate property after this method returns, it may not be notified - of connection events. - - @deprecated Use pusherWithKey:delegate:encrypted: - @param key Your application's API key. It can be found in the API Access section of your application within the Pusher user dashboard. - @param delegate The delegate for this instance - */ -+ (id)pusherWithKey:(NSString *)key delegate:(id)delegate __PUSHER_DEPRECATED__; - -/** Returns a new PTPusher instance with a connection configured with the given key. - - Instances created using this method will connect automatically. Specify the delegate here - to ensure that it is notified about the connection status during connection. If you assign - a delegate using the delegate property after this method returns, it may not be notified - of connection events. - - @param key Your application's API key. It can be found in the API Access section of your application within the Pusher user dashboard. - @param delegate The delegate for this instance - @param isEncrypted If yes, a secure connection over SSL will be established. - */ -+ (id)pusherWithKey:(NSString *)key delegate:(id)delegate encrypted:(BOOL)isEncrypted; - -/** Initialises a new PTPusher instance with a connection configured with the given key. - - If you intend to set a delegate for this instance, you are recommended to set connectAutomatically - to NO, set the delegate then manually call connect. - - @deprecated Use pusherWithKey:connectAutomatically:encrypted: - @param key Your application's API key. It can be found in the API Access section of your application within the Pusher user dashboard. - @param connect Automatically If YES, the connection will be connected on initialisation. - */ -+ (id)pusherWithKey:(NSString *)key connectAutomatically:(BOOL)connectAutomatically __PUSHER_DEPRECATED__; - -/** Initialises a new PTPusher instance with a connection configured with the given key. - - If you intend to set a delegate for this instance, you are recommended to set connectAutomatically - to NO, set the delegate then manually call connect. - - @param key Your application's API key. It can be found in the API Access section of your application within the Pusher user dashboard. - @param connectAutomatically If YES, the connection will be connected on initialisation. - @param isEncrypted If yes, a secure connection over SSL will be established. - */ -+ (id)pusherWithKey:(NSString *)key connectAutomatically:(BOOL)connectAutomatically encrypted:(BOOL)isEncrypted; - -///------------------------------------------------------------------------------------/ -/// @name Managing the connection -///------------------------------------------------------------------------------------/ - -/** Establishes a connection to the Pusher server. - - If already connected, this method does nothing. - */ -- (void)connect; - -/** Disconnects from the Pusher server. - - If already disconnected, this method does nothing. - */ -- (void)disconnect; - -///------------------------------------------------------------------------------------/ -/// @name Subscribing to channels -///------------------------------------------------------------------------------------/ - -/** Subscribes to the named channel. - - This method can be used to subscribe to any type of channel, including private and - presence channels by including the appropriate channel name prefix. - - @param name The name of the channel to subscribe to. - */ -- (PTPusherChannel *)subscribeToChannelNamed:(NSString *)name; - -/** Subscribes to the named private channel. - - The "private-" prefix should be excluded from the name; it will be added automatically. - - @param name The name of the channel (without the private prefix) to subscribe to. - */ -- (PTPusherPrivateChannel *)subscribeToPrivateChannelNamed:(NSString *)name; - -/** Subscribes to the named presence channel. - - The "presence-" prefix should be excluded from the name; it will be added automatically. - - @param name The name of the channel (without the presence prefix) to subscribe to. - */ -- (PTPusherPresenceChannel *)subscribeToPresenceChannelNamed:(NSString *)name; - -/** Subscribes to the named presence channel. - - The "presence-" prefix should be excluded from the name; it will be added automatically. - - Whilst the presence delegate can be set on the channel after it is returned, to ensure - events are not missed, it is advised that you call this method and specify a delegate. The - delegate will be assigned before subscription happens. - - @param name The name of the channel (without the presence prefix) to subscribe to. - @param presenceDelegate The presence delegate for this channel. - */ -- (PTPusherPresenceChannel *)subscribeToPresenceChannelNamed:(NSString *)name delegate:(id)presenceDelegate; - -/** Unsubscribes from the specified channel. - - This method is deprecated. You should use -[PTPusherChannel unsubscribe] instead. - - @param channel The channel to unsubscribe from. - */ -- (void)unsubscribeFromChannel:(PTPusherChannel *)channel __PUSHER_DEPRECATED__; - -/** Returns a previously subscribed channel with the given name. - - If the channel specified has not been subscribed to, this method will return nil. - - @param name The name of the channel required. - */ -- (PTPusherChannel *)channelNamed:(NSString *)name; - -///------------------------------------------------------------------------------------/ -/// @name Publishing events -///------------------------------------------------------------------------------------/ - -/** Sends an event directly over the connection's socket. - - Whilst Pusher provides a REST API for publishing events, it also supports the sending of - events directly from clients over the client's existing connection. - - Client events have the following restrictions: - - + The user must be subscribed to the channel that the event is being triggered on. - - + Client events can only be triggered on private and presence channels because they require authentication. - - + Client events must be prefixed by client-. Events with any other prefix will be rejected by the Pusher server, as will events sent to channels to which the client is not subscribed. - - This method does nothing to enforce the first two restrictions. It is instead recommended that - you use the `PTPusherChannel` event triggering API rather than calling this method directly. - - @warning Note: This Pusher feature is currently in beta and requires enabling on your account. - */ -- (void)sendEventNamed:(NSString *)name data:(id)data channel:(NSString *)channelName; - -@end - diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherAPI.h b/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherAPI.h deleted file mode 100644 index d843535..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherAPI.h +++ /dev/null @@ -1,48 +0,0 @@ -// -// PTPusherAPI.h -// libPusher -// -// Created by Luke Redpath on 14/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import - -/** A simple interface to the Pusher REST API. - - This functionality used to be part of the main PTPusher library but - has been extracted into a standalone component. - - The PTPusher client has alpha support for channel-based event triggering - but for general event triggering the API can be used. - - As well as your Pusher API key, you will also need your app ID and secret key - for signing requests. - */ -@interface PTPusherAPI : NSObject { - NSString *key, *appID, *secretKey; - NSOperationQueue *operationQueue; -} - -///------------------------------------------------------------------------------------/ -/// @name Initialisation -///------------------------------------------------------------------------------------/ - -- (id)initWithKey:(NSString *)aKey appID:(NSString *)anAppID secretKey:(NSString *)aSecretKey; - -///------------------------------------------------------------------------------------/ -/// @name Triggering events -///------------------------------------------------------------------------------------/ - -/** Triggers an event on the specified channel. - - The event data will be converted to JSON format so needs to be any object that can be - transformed into JSON (typically any plist-compatible object). - - @param eventName The name of the event to trigger. - @param channelName The channel the event should be triggered on. - @param eventData The JSON-compatible data object for the event. - */ -- (void)triggerEvent:(NSString *)eventName onChannel:(NSString *)channelName data:(id)eventData socketID:(NSString *)socketID; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherChannel.h b/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherChannel.h deleted file mode 100644 index 26da317..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherChannel.h +++ /dev/null @@ -1,184 +0,0 @@ -// -// PTPusherClient.h -// libPusher -// -// Created by Luke Redpath on 23/04/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import -#import "PTPusherEventPublisher.h" -#import "PTEventListener.h" -#import "PTPusherPresenceChannelDelegate.h" - - -@class PTPusher; -@class PTPusherEventDispatcher; - -/** A PTPusherChannel object represents a single Pusher channel. - - Channels can be used as a means of filtering or controlling access to events. - - Channels do not need to be explicitly created; they are created on demand. To obtain - an instance of a PTPusherChannel, you need to subscribe to it first. - - You should not create PTPusherChannel instances directly as they require subscription and - possibly authorization; you should instead use the subscribeTo methods provided by PTPusher. - - There are three types of channel: - - + Public channels can be subscribed to by anyone who knows their name. - - + Private channels allow you to control access to the data you are broadcasting. - - + Presence channels you to 'register' user information on subscription, and let other members of the channel know who's online. - - Channels can be subscribed to or unsubscribed to at any time, even before the initial - Pusher connection has been established. - */ -@interface PTPusherChannel : NSObject { - NSString *name; - __unsafe_unretained PTPusher *pusher; - PTPusherEventDispatcher *dispatcher; - NSMutableArray *internalBindings; -} - -///------------------------------------------------------------------------------------/ -/// @name Properties -///------------------------------------------------------------------------------------/ - -/** The channel name. - */ -@property (nonatomic, readonly) NSString *name; - -/** Indicates that this channel has been subscribed to. - - Whilst public channels are subscribed to immediately, presence and private channels require - authorization first. This property will be set to YES once an internal Pusher event has - been received indicating that the channel subscription has been registered. - */ -@property (nonatomic, readonly, getter=isSubscribed) BOOL subscribed; - -/** Indicates whether or not this is a private channel. - - The value of this property will be YES for private and presence channels. - */ -@property (nonatomic, readonly) BOOL isPrivate; - -/** Indicates whether or not this is a presence channel. - - The value of this property will be YES for presence channels only. - */ -@property (nonatomic, readonly) BOOL isPresence; - -///------------------------------------------------------------------------------------/ -/// @name Initialisation -///------------------------------------------------------------------------------------/ - -+ (id)channelWithName:(NSString *)name pusher:(PTPusher *)pusher; -- (id)initWithName:(NSString *)channelName pusher:(PTPusher *)pusher; - -///------------------------------------------------------------------------------------/ -/// @name Authorization -///------------------------------------------------------------------------------------/ - -- (void)authorizeWithCompletionHandler:(void(^)(BOOL, NSDictionary *, NSError *))completionHandler; - -///------------------------------------------------------------------------------------/ -/// @name Unsubscribing -///------------------------------------------------------------------------------------/ - -/** Unsubscribes from the channel. - */ -- (void)unsubscribe; - -@end - -/** A PTPusherPrivateChannel object represents a private Pusher channel. - - Private channels should be used when access to the channel needs to be restricted in some way. - In order for a user to subscribe to a private channel permission must be authorised. - - Private channel names always have the prefix of "private-". - - Only private and presence channels support the triggering client events. - */ -@interface PTPusherPrivateChannel : PTPusherChannel { - NSMutableArray *clientEventBuffer; -} - -///------------------------------------------------------------------------------------/ -/// @name Triggering events -///------------------------------------------------------------------------------------/ - -/** Triggers a named event directly over the connection. - - Client events have the following restrictions: - - + The user must be subscribed to the channel that the event is being triggered on. - - + Client events can only be triggered on private and presence channels because they require authentication. - - + Client events must be prefixed by client-. Events with any other prefix will be rejected by the Pusher server, as will events sent to channels to which the client is not subscribed. - - If you attempt to trigger event on a channel while isSubscribed is NO, the event will not be sent. - - If the event name does not have a prefix of "client-", it will be added automatically. - - The event data must be an object that can be serialized as JSON, typically an NSArray or NSDictionary although - it could be a simple string. - */ -- (void)triggerEventNamed:(NSString *)eventName data:(id)eventData; - -@end - -/** A PTPusherPresenceChannel object represents a Pusher presence channel. - - Presence channels build on the security of Private channels and expose the additional feature - of an awareness of who is subscribed to that channel. This makes it extremely easy to build - chat room and "who's online" type functionality to your application. - - Presence channel names always have the prefix of "presence-". - - Unlike the Pusher Javascript client API, PTPusherPresenceChannel does not use events to notify - when members are added or removed. Instead, you should assign a presenceDelegate which will - be notified of these events. - - @see PTPusherPresenceChannelDelegate - */ -@interface PTPusherPresenceChannel : PTPusherPrivateChannel { - NSMutableDictionary *members; - NSMutableArray *memberIDs; // store these separately to preserve order -} - -///------------------------------------------------------------------------------------/ -/// @name Properties -///------------------------------------------------------------------------------------/ - -/** The presence delegate for the receiver. - - The presence delegate will be notified of presence channel-specific events, such as the initial - member list on subscription and member added/removed events. - */ -@property (nonatomic, unsafe_unretained) id presenceDelegate; - -/** Returns the current list of channel members. - - Members are stored as a dictionary of dictionaries, keyed on the member's "user_id" field. - - @deprecated Use the methods below for accessing member data. - */ -@property (nonatomic, readonly) NSDictionary *members; - -/** Returns a dictionary of member metadata (email, name etc.) for the given member ID. - */ -- (NSDictionary *)infoForMemberWithID:(NSString *)memberID; - -/** Returns an array of available member IDs - */ -- (NSArray *)memberIDs; - -/** Returns the number of members currently connected to this channel. - */ -- (NSInteger)memberCount; -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherConnection.h b/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherConnection.h deleted file mode 100644 index 998ffc4..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherConnection.h +++ /dev/null @@ -1,91 +0,0 @@ -// -// PTPusherConnection.h -// libPusher -// -// Created by Luke Redpath on 13/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import -#import "SRWebSocket.h" -#import "PTPusherMacros.h" - -@class PTPusherConnection; -@class PTPusherEvent; - -@protocol PTPusherConnectionDelegate -- (void)pusherConnectionDidConnect:(PTPusherConnection *)connection; -- (void)pusherConnection:(PTPusherConnection *)connection didDisconnectWithCode:(NSInteger)errorCode reason:(NSString *)reason wasClean:(BOOL)wasClean; -- (void)pusherConnection:(PTPusherConnection *)connection didFailWithError:(NSError *)error wasConnected:(BOOL)wasConnected; -- (void)pusherConnection:(PTPusherConnection *)connection didReceiveEvent:(PTPusherEvent *)event; -@end - -extern NSString *const PTPusherConnectionEstablishedEvent; -extern NSString *const PTPusherConnectionPingEvent; - -typedef enum { - PTPusherConnectionClosing = 0, - PTPusherConnectionClosed, - PTPusherConnectionOpening, - PTPusherConnectionOpenAwaitingHandshake, - PTPusherConnectionOpenHandshakeReceived -} PTPusherConnectionState; - -@interface PTPusherConnection : NSObject - -@property (nonatomic, unsafe_unretained) id delegate; -@property (nonatomic, readonly, getter=isConnected) BOOL connected; -@property (nonatomic, copy, readonly) NSString *socketID; - -///------------------------------------------------------------------------------------/ -/// @name Initialisation -///------------------------------------------------------------------------------------/ - -/** Creates a new PTPusherConnection instance. - - Connections are not opened immediately; an explicit call to connect is required. - - @param aURL The websocket endpoint - @param delegate The delegate for this connection - */ -- (id)initWithURL:(NSURL *)aURL; - -/** Creates a new PTPusherConnection instance. - - Connections are not opened immediately; an explicit call to connect is required. - - DEPRECATED IN VERSION 1.2. The secure parameter is now ignored; secure mode will be - enabled automatically when the URL protocol is wss. - - @param aURL The websocket endpoint - @param delegate The delegate for this connection - @param secure Whether this connection should be secure (TLS) - */ -- (id)initWithURL:(NSURL *)aURL secure:(BOOL)secure __PUSHER_DEPRECATED__; - -///------------------------------------------------------------------------------------/ -/// @name Managing connections -///------------------------------------------------------------------------------------/ - -/** Establishes a web socket connection to the Pusher server. - - The delegate will only be sent a didConnect message when the web socket receives a - 'connection_established' event from Pusher, regardless of the web socket's connection state. - */ -- (void)connect; - -/** Closes the web socket connection */ -- (void)disconnect; - -///------------------------------------------------------------------------------------/ -/// @name Sending data -///------------------------------------------------------------------------------------/ - -/** Sends an object over the web socket connection. - - The object will be serialized to JSON before sending, so the object must be anything - that can be converted into JSON (typically, any plist compatible object). - */ -- (void)send:(id)object; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherDelegate.h b/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherDelegate.h deleted file mode 100644 index 9f0a8bf..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherDelegate.h +++ /dev/null @@ -1,128 +0,0 @@ -// -// PTPusherDelegate.h -// libPusher -// -// Created by Luke Redpath on 22/03/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import "PTPusherMacros.h" - -@class PTPusher; -@class PTPusherConnection; -@class PTPusherChannel; -@class PTPusherEvent; -@class PTPusherErrorEvent; - -/** The PTPusherDelegate protocol can be implemented to receive important events in a PTPusher object's lifetime. - - All of the delegate methods are optional; you only need to implement what is required for your app. - - It may be useful to assign a delegate to monitor the status of the connection; you could use this to update - your user interface accordingly. - */ -@protocol PTPusherDelegate - -@optional - -/** Notifies the delegate that the PTPusher instance has connected to the Pusher service successfully. - - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - */ -- (void)pusher:(PTPusher *)pusher connectionDidConnect:(PTPusherConnection *)connection; - -/** Notifies the delegate that the PTPusher instance has disconnected from the Pusher service. - - @deprecated Use pusher:connection:didDisconnectWithError: - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - */ -- (void)pusher:(PTPusher *)pusher connectionDidDisconnect:(PTPusherConnection *)connection __PUSHER_DEPRECATED__; - -/** Notifies the delegate that the PTPusher instance has disconnected from the Pusher service. - - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - @param error If the connection disconnected abnormally, error will be non-nil. - */ -- (void)pusher:(PTPusher *)pusher connection:(PTPusherConnection *)connection didDisconnectWithError:(NSError *)error; - -/** Notifies the delegate that the PTPusher instance failed to connect to the Pusher service. - - If reconnectAutomatically is YES, PTPusher will attempt to reconnect if the initial connection failed. - - This reconnect attempt will happen after this message is sent to the delegate, giving the delegate - a chance to inspect the connection error and disable automatic reconnection if it thinks the reconnection - attempt is likely to fail, depending on the error. - - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - @param error The connection error. - */ -- (void)pusher:(PTPusher *)pusher connection:(PTPusherConnection *)connection failedWithError:(NSError *)error; - -/** Notifies the delegate that the PTPusher instance is about to attempt reconnection. - - You may wish to use this method to keep track of the number of reconnection attempts and abort after a fixed number. - - If you do not set the `reconnectAutomatically` property of the PTPusher instance to NO, it will continue attempting - to reconnect until a successful connection has been established. - - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - */ -- (void)pusher:(PTPusher *)pusher connectionWillReconnect:(PTPusherConnection *)connection afterDelay:(NSTimeInterval)delay; - -/** Notifies the delegate of the request that will be used to authorize access to a channel. - - When using the Pusher Javascript client, authorization typically relies on an existing session cookie - on the server; when the Javascript client makes an AJAX POST to the server, the server can return - the user's credentials based on their current session. - - When using libPusher, there will likely be no existing server-side session; authorization will - need to happen by some other means (e.g. an authorization token or HTTP basic auth). - - By implementing this delegate method, you will be able to set any credentials as necessary by - modifying the request as required (such as setting POST parameters or headers). - */ -- (void)pusher:(PTPusher *)pusher willAuthorizeChannelWithRequest:(NSMutableURLRequest *)request; - -/** Notifies the delegate that the PTPusher instance has subscribed to the specified channel. - - This method will be called after any channel authorization has taken place and when a subscribe event has been received. - - @param pusher The PTPusher instance that has connected. - @param channel The channel that was subscribed to. - */ -- (void)pusher:(PTPusher *)pusher didSubscribeToChannel:(PTPusherChannel *)channel; - -/** Notifies the delegate that the PTPusher instance has unsubscribed from the specified channel. - - This method will be called immediately after unsubscribing from a channel. - - @param pusher The PTPusher instance that has connected. - @param channel The channel that was unsubscribed from. - */ -- (void)pusher:(PTPusher *)pusher didUnsubscribeFromChannel:(PTPusherChannel *)channel; - -/** Notifies the delegate that the PTPusher instance failed to subscribe to the specified channel. - - The most common reason for subscribing failing is authorization failing for private/presence channels. - - @param pusher The PTPusher instance that has connected. - @param channel The channel that was subscribed to. - @param error The error returned when attempting to subscribe. - */ -- (void)pusher:(PTPusher *)pusher didFailToSubscribeToChannel:(PTPusherChannel *)channel withError:(NSError *)error; - -/** Notifies the delegate that an error event has been received. - - If a client is binding to all events, either through the client or using NSNotificationCentre, they will also - receive notification of this event like any other. - - @param pusher The PTPusher instance that received the event. - @param errorEvent The error event. - */ -- (void)pusher:(PTPusher *)pusher didReceiveErrorEvent:(PTPusherErrorEvent *)errorEvent; -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherErrors.h b/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherErrors.h deleted file mode 100644 index a4b5f28..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherErrors.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// PTPusherErrors.h -// libPusher -// -// Created by Luke Redpath on 14/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import - -enum { - PTPusherSubscriptionError = 0, - PTPusherSubscriptionUnknownAuthorisationError -}; diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherEvent.h b/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherEvent.h deleted file mode 100644 index bcfb484..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherEvent.h +++ /dev/null @@ -1,74 +0,0 @@ -// -// PTPusherEvent.h -// PusherEvents -// -// Created by Luke Redpath on 22/03/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import - -extern NSString *const PTPusherDataKey; -extern NSString *const PTPusherEventKey; -extern NSString *const PTPusherChannelKey; - -/** A value object representing a Pusher event. - - All events dispatched by libPusher (via either bindings or notifications) will be represented - by instances of this class. - */ -@interface PTPusherEvent : NSObject { - NSString *_name; -} - -///------------------------------------------------------------------------------------/ -/// @name Properties -///------------------------------------------------------------------------------------/ - -/** The event name. - */ -@property (nonatomic, readonly) NSString *name; - -/** The channel that this event originated from. - */ -@property (strong, nonatomic, readonly) NSString *channel; - -/** The event data. - - Event data will typically be any kind of object that can be represented as JSON, often - an NSArray or NSDictionary but can be a simple string. - */ -@property (strong, nonatomic, readonly) id data; - -/** The time the event was received. - */ -@property (nonatomic, readonly, strong) NSDate *timeReceived; - -- (id)initWithEventName:(NSString *)name channel:(NSString *)channel data:(id)data; -+ (id)eventFromMessageDictionary:(NSDictionary *)dictionary; -@end - -typedef enum { - PTPusherErrorSSLRequired = 4000, - PTPusherErrorApplicationUnknown = 4001, - PTPusherErrorApplicationDisabled = 4002 -} PTPusherServerErrorCodes; - -/** A special sub-class of Pusher event, representing pusher:error events. - - This will be yielded to the Pusher client delegate as well as through the normal event - dispatch mechanism. - - This class adds some convenient properties for accessing error details. - */ -@interface PTPusherErrorEvent : PTPusherEvent - -/** A textual description of the error. - */ -@property (unsafe_unretained, nonatomic, readonly) NSString *message; - -/** The error code. See PTPusherServerErrorCodes for available errors. - */ -@property (nonatomic, readonly) NSInteger code; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherEventDispatcher.h b/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherEventDispatcher.h deleted file mode 100644 index 922d678..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherEventDispatcher.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// PTPusherEventDispatcher.h -// libPusher -// -// Created by Luke Redpath on 13/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import -#import "PTEventListener.h" - -@class PTPusherEventBinding; - -@interface PTPusherEventDispatcher : NSObject - -@property (nonatomic, readonly) NSDictionary *bindings; - -- (PTPusherEventBinding *)addEventListener:(id)listener forEventNamed:(NSString *)eventName; -- (void)removeBinding:(PTPusherEventBinding *)binding; -- (void)removeAllBindings; -@end - -@interface PTPusherEventBinding : NSObject - -/** The event this binding binds to. */ -@property (nonatomic, readonly) NSString *eventName; - -/** Returns YES if this binding is still attached to its event publisher. - - Retained references to bindings can become invalid as a result of another object - calling removeBinding: with this binding or removeAllBindings. - - You can safely discard invalid binding instances. - */ -@property (nonatomic, readonly, getter=isValid) BOOL valid; - -- (id)initWithEventListener:(id)eventListener eventName:(NSString *)eventName; -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherEventPublisher.h b/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherEventPublisher.h deleted file mode 100644 index 09939a9..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherEventPublisher.h +++ /dev/null @@ -1,84 +0,0 @@ -// -// PTPusherEventPublisher.h -// libPusher -// -// Created by Luke Redpath on 13/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import - -@class PTPusherEvent; -@class PTPusherEventBinding; - -typedef void (^PTPusherEventBlockHandler) (PTPusherEvent *); - -/** Describes an object that provides events that can be bound to. - - Events in Pusher form the basis of all communication with the service. They are - named messages that can carry arbitrary user data. All events in libPusher are - represented by the class `PTPusherEvent`. - - An object that implements this protocol allows for binding to events. There are - currently two classes that implement this protocol: `PTPusher` and `PTPusherChannel`. - - There are two primary binding mechanisms: target/action based and block-based. Which - one you use depends entirely on the requirements of your application. - */ -@protocol PTPusherEventBindings - -/** Binds to the named event using the target/action mechanism. - - When the named event is received, the specified selector will be called on target, passing - the `PTPusherEvent` as the only argument. - - The following code snippet sets up a binding for the event "new-message" on any channel: - - [pusher bindToEventNamed:@"new-message" target:self action:@selector(handleNewMessageEvent:)]; - - Then the event is triggered, the event will be dispatched to the target/action pair: - - - (void)handleNewMessageEvent:(PTPusherEvent *)event - { - // do something with event - } - */ -- (PTPusherEventBinding *)bindToEventNamed:(NSString *)eventName target:(id)target action:(SEL)selector; - -/** Binds to the named event using a block callback. - - When the event is received, the block will be called with the `PTPusherEvent` as the only block argument. - - The following code snippet sets up a binding for the event "new-message" on any channel and handles that - event when it is triggered: - - [pusher bindToEventNamed:@"new-message" handleWithBlock:^(PTPusherEvent *event) { - // do something with event - }]; - - The callback blocks will be dispatched asynchronously using Grand Central Dispatch on the main queue. - */ -- (PTPusherEventBinding *)bindToEventNamed:(NSString *)eventName handleWithBlock:(PTPusherEventBlockHandler)block; - -/** Binds to the named event using a block callback. - - Works the same as bindToEventNamed:handleWithBlock: but dispatches the callback block on the specified - Grand Central Dispatch queue. - - You can use this method if you wish to handle events in a background or custom priority queue. - */ -- (PTPusherEventBinding *)bindToEventNamed:(NSString *)eventName handleWithBlock:(PTPusherEventBlockHandler)block queue:(dispatch_queue_t)queue; - -/** Removes the specified binding. - - Any further events will not trigger any callbacks after the binding has been removed. - */ -- (void)removeBinding:(PTPusherEventBinding *)binding; - -/** Removes all bindings that have been set up. - - Any retained references to PTPusherEventBinding objects will become invalid. - */ -- (void)removeAllBindings; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherMacros.h b/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherMacros.h deleted file mode 100644 index 29245c6..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherMacros.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// PTPusherMacros.h -// libPusher -// -// Created by Luke Redpath on 10/02/2012. -// Copyright (c) 2012 LJR Software Limited. All rights reserved. -// - -#ifndef libPusher_PTPusherMacros_h -#define libPusher_PTPusherMacros_h - -#define __PUSHER_DEPRECATED__ __attribute__((deprecated)) - -#define PT_DEFINE_SHARED_INSTANCE_USING_BLOCK(block) \ -static dispatch_once_t pred = 0; \ -__strong static id _sharedObject = nil; \ -dispatch_once(&pred, ^{ \ -_sharedObject = block(); \ -}); \ -return _sharedObject; \ - -#endif diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherPresenceChannelDelegate.h b/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherPresenceChannelDelegate.h deleted file mode 100644 index f69005c..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/PTPusherPresenceChannelDelegate.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// PTPusherPresenceChannelDelegate.h -// libPusher -// -// Created by Luke Redpath on 14/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import - -@class PTPusherPresenceChannel; - -@protocol PTPusherPresenceChannelDelegate - -/** Notifies the delegate that the presence channel subscribed successfully. - - Whenever you subscribe to a presence channel, a list of current subscribers will be returned by Pusher. - - The list will be an array of member IDs. Further metadata can be obtained by asking the channel object - for information about a particular member using `-[PTPusherChannel infoForMemberWithID:]`. - - @param channel The presence channel that was subscribed to. - @param members The current members subscribed to the channel. - */ -- (void)presenceChannel:(PTPusherPresenceChannel *)channel didSubscribeWithMemberList:(NSArray *)members; - -/** Notifies the delegate that a new member subscribed to the presence channel. - - The member info can contain arbitrary user data returned by the authorization server. - - @param channel The presence channel that was subscribed to. - @param memberID The ID for the new member. - @param memberInfo The custom user data for the new member. - */ -- (void)presenceChannel:(PTPusherPresenceChannel *)channel memberAddedWithID:(NSString *)memberID memberInfo:(NSDictionary *)memberInfo; - -/** Notifies the delegate that a member subscribed to the presence channel has unsubscribed. - - The member data can contain arbitrary user data returned by the authorization server. - - @param channel The presence channel that was subscribed to. - @param memberID The ID of the member removed. - @param index The internal index of the member (depends on the order joined/left or returned in the server member list) - */ -- (void)presenceChannel:(PTPusherPresenceChannel *)channel memberRemovedWithID:(NSString *)memberID atIndex:(NSInteger)index; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/SRWebSocket.h b/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/SRWebSocket.h deleted file mode 100644 index a7e1851..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Headers/SRWebSocket.h +++ /dev/null @@ -1,90 +0,0 @@ -// -// Copyright 2012 Square Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import -#import - -typedef enum { - SR_CONNECTING = 0, - SR_OPEN = 1, - SR_CLOSING = 2, - SR_CLOSED = 3, - -} SRReadyState; - -@class SRWebSocket; - -extern NSString *const SRWebSocketErrorDomain; - -@protocol SRWebSocketDelegate; - -@interface SRWebSocket : NSObject - -@property (nonatomic, assign) id delegate; - -@property (nonatomic, readonly) SRReadyState readyState; -@property (nonatomic, readonly, retain) NSURL *url; - -// This returns the negotiated protocol. -// It will be niluntil after the handshake completes. -@property (nonatomic, readonly, copy) NSString *protocol; - -// Protocols should be an array of strings that turn into Sec-WebSocket-Protocol -- (id)initWithURLRequest:(NSURLRequest *)request protocols:(NSArray *)protocols; -- (id)initWithURLRequest:(NSURLRequest *)request; - -// Some helper constructors -- (id)initWithURL:(NSURL *)url protocols:(NSArray *)protocols; -- (id)initWithURL:(NSURL *)url; - -// SRWebSockets are intended one-time-use only. Open should be called once and only once -- (void)open; - -- (void)close; -- (void)closeWithCode:(NSInteger)code reason:(NSString *)reason; - -// Send a UTF8 String or Data -- (void)send:(id)data; - -@end - -@protocol SRWebSocketDelegate - -// message will either be an NSString if the server is using text -// or NSData if the server is using binary -- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message; - -@optional - -- (void)webSocketDidOpen:(SRWebSocket *)webSocket; -- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error; -- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean; - -@end - - -@interface NSURLRequest (CertificateAdditions) - -@property (nonatomic, retain, readonly) NSArray *SR_SSLPinnedCertificates; - -@end - - -@interface NSMutableURLRequest (CertificateAdditions) - -@property (nonatomic, retain) NSArray *SR_SSLPinnedCertificates; - -@end diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Pusher b/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Pusher deleted file mode 100755 index 6897a66..0000000 Binary files a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Pusher and /dev/null differ diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Resources/Info.plist b/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Resources/Info.plist deleted file mode 100644 index c540298..0000000 --- a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Resources/Info.plist +++ /dev/null @@ -1,42 +0,0 @@ - - - - - BuildMachineOSBuild - 12B19 - CFBundleDevelopmentRegion - English - CFBundleExecutable - Pusher - CFBundleIdentifier - co.uk.lukeredpath.Pusher - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Pusher - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.1 - CFBundleSignature - ???? - CFBundleVersion - 1 - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 4G182 - DTPlatformVersion - GM - DTSDKBuild - 12C37 - DTSDKName - macosx10.8 - DTXcode - 0450 - DTXcodeBuild - 4G182 - NSHumanReadableCopyright - Copyright © 2012 LJR Software Limited. All rights reserved. - - diff --git a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Resources/en.lproj/InfoPlist.strings b/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Resources/en.lproj/InfoPlist.strings deleted file mode 100644 index 5e45963..0000000 Binary files a/vendor/libPusher/OS X/Pusher.framework/Versions/Current/Resources/en.lproj/InfoPlist.strings and /dev/null differ diff --git a/vendor/libPusher/iOS/README.txt b/vendor/libPusher/iOS/README.txt deleted file mode 100644 index f75c6c4..0000000 --- a/vendor/libPusher/iOS/README.txt +++ /dev/null @@ -1,52 +0,0 @@ -=============================================================================== -README: libPusher distribution build -=============================================================================== - -This package contains three static libraries: - -* libPusher-iphoneosXXa -* libPusher-iphonesimulatorXX.a -* libPusher-combined.a - -Where XX is the version of the SDK that the library was compiled with. - -It also contains a number of public headers that you will need in order to use the library in your project. - -The iphoneos library is compiled for armv7 devices and the iphonesimulator library is compiled for the simulator. You may use these if you wish to link to them separately for different targets in your project. - -Most people will want to use the combined library, which is a fat static library that will run on both the simulator and the device. - -=============================================================================== -Installation -=============================================================================== - -These instructions use the combined library: - -1. Copy the libPusher-combined.a library in to your project. - -2. In your target settings, under the Build Phases tab, expand "Link Binary With Libraries" and check that libPusher-combined.a appears there. If it does not, click the "+" symbol and add it. This links your target with the static library. - -3. In your target build settings, locate the "Other Linker Flags" setting and add "-all_load". - -4. Drag the contents of the headers directory into your project. - -5. Link with the following libraries/frameworks: - -* libicucore.dylib -* CFNetwork.framework -* Security.framework -* SystemConfiguration.framework - -6. You should now be able to #import "PTPusher.h" and compile. - -=============================================================================== -Notes -=============================================================================== - -If you are upgrading, libPusher no longer uses the JSONKit library and the static library no longer contains a compiled version of JSONKit.m. - -By default, libPusher now uses NSJSONSerialization which is available on iOS 5.0 or OSX 10.7 and later. If you require support for older platforms, libPusher still has support for JSONKit as a fallback option, but you are required to link JSONKit to your app separately. - -For more information, see: -https://github.com/lukeredpath/libPusher/wiki/Adding-libPusher-to-your-project - diff --git a/vendor/libPusher/iOS/headers/PTEventListener.h b/vendor/libPusher/iOS/headers/PTEventListener.h deleted file mode 100644 index 90d3e27..0000000 --- a/vendor/libPusher/iOS/headers/PTEventListener.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// PTEventListener.h -// PusherEvents -// -// Created by Luke Redpath on 22/03/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import - - -@class PTPusherEvent; - -@protocol PTEventListener - -- (void)dispatchEvent:(PTPusherEvent *)event; - -@end diff --git a/vendor/libPusher/iOS/headers/PTJSON.h b/vendor/libPusher/iOS/headers/PTJSON.h deleted file mode 100644 index 3683320..0000000 --- a/vendor/libPusher/iOS/headers/PTJSON.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// PTJSON.h -// libPusher -// -// Created by Luke Redpath on 30/03/2012. -// Copyright (c) 2012 LJR Software Limited. All rights reserved. -// - -#import -#import "PTJSONParser.h" - -extern NSString *const PTJSONParserNotAvailable; - -@interface PTJSON : NSObject - -/** - Returns a JSON parser appropriate for the current platform. - - A runtime check is performed for the presence of NSJSONSerialization - (available on iOS 5.0 and OSX 10.7 and later). If it is available, - it will be used, otherwise it will fall back to using JSONKit. - - Important note: If you intend to support users of iOS 4.x, you must - ensure that you link JSONKit to your project as it is no longer - embedded within libPusher. - */ -+ (id)JSONParser; - -@end - -@interface PTJSONKitParser : NSObject -+ (id)JSONKitParser; -@end - -@interface PTNSJSONParser : NSObject -+ (id)NSJSONParser; -@end \ No newline at end of file diff --git a/vendor/libPusher/iOS/headers/PTJSONParser.h b/vendor/libPusher/iOS/headers/PTJSONParser.h deleted file mode 100644 index b12e292..0000000 --- a/vendor/libPusher/iOS/headers/PTJSONParser.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// PTJSONParser.h -// libPusher -// -// Created by Luke Redpath on 30/03/2012. -// Copyright (c) 2012 LJR Software Limited. All rights reserved. -// - -#import - -@protocol PTJSONParser - -- (NSData *)JSONDataFromObject:(id)object; -- (NSString *)JSONStringFromObject:(id)object; -- (id)objectFromJSONData:(NSData *)data; -- (id)objectFromJSONString:(NSString *)string; - -@end diff --git a/vendor/libPusher/iOS/headers/PTPusher.h b/vendor/libPusher/iOS/headers/PTPusher.h deleted file mode 100644 index 81aa40a..0000000 --- a/vendor/libPusher/iOS/headers/PTPusher.h +++ /dev/null @@ -1,277 +0,0 @@ -// -// PTPusher.h -// PusherEvents -// -// Created by Luke Redpath on 22/03/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import -#import "PTPusherDelegate.h" -#import "PTPusherConnection.h" -#import "PTPusherEventPublisher.h" -#import "PTPusherPresenceChannelDelegate.h" - -/** The Pusher protocol version, used to determined which features - are supported. - */ -#define kPTPusherClientProtocolVersion 5 - -/** The version number of the libPusher library. - */ -#define kPTPusherClientLibraryVersion 1.0 - -/** The name of the notification posted when PTPusher receives an event. - */ -extern NSString *const PTPusherEventReceivedNotification; - -/** The key of the PTPusherEvent object in the PTPusherEventReceivedNotification userInfo dictionary. - */ -extern NSString *const PTPusherEventUserInfoKey; - -/** The error domain for all PTPusher errors. - */ -extern NSString *const PTPusherErrorDomain; - -/** The key for any underlying PTPusherEvent associated with a PTPusher error's userInfo dictionary. - */ -extern NSString *const PTPusherErrorUnderlyingEventKey; - -@class PTPusherChannel; -@class PTPusherPresenceChannel; -@class PTPusherPrivateChannel; -@class PTPusherEventDispatcher; - -/** A PTPusher object provides a high level API for communicating with the Pusher service. - - The provided API allows you to connect and disconnect from the service, subscribe and unsubscribe - from channels and bind to events. There is also beta support for sending events directly over the - connection (instead of using the Pusher REST API). - - To create an instance of PTPusher, you will need your Pusher API key. This can be obtained from your account - dashboard. - - PTPusher's delegate methods allow an object to receive important events in the client and connection's - lifecycle, such as connection, disconnection, reconnection and channel subscribe/unsubscribe events. - - Whilst PTPusher exposes it's connection object as a readonly property, there is no need to manage or - create this connection manually. The connection can be queried for it's current connection state and - socket ID if needed. - - PTPusher aims to mirror the Pusher Javascript client API as much as possible although whilst the - Javascript API uses event binding for any interesting events - not just server or other client events - - libPusher uses standard Cocoa and Objective-C patterns such as delegation and notification where - it makes sense to do so. - - Note: due to various problems people have had connecting to Pusher without SSL over a 3G connection, - it is highly recommend that you use SSL. For this reason, SSL is enabled by default. - */ -@interface PTPusher : NSObject { - PTPusherEventDispatcher *dispatcher; - NSMutableDictionary *channels; -} - -///------------------------------------------------------------------------------------/ -/// @name Properties -///------------------------------------------------------------------------------------/ - -/** The object that acts as the delegate for the receiving instance. - - The delegate must implement the PTPusherDelegate protocol. The delegate is not retained. - */ -@property (nonatomic, unsafe_unretained) id delegate; - - -/** Indicates whether the client should attempt to reconnect automatically when disconnected - or if the connection failed. - - When YES, the client will automatically attempt to re-establish a connection after a set delay. - - If the reconnection attempt fails, the client will continue to attempt to reconnect until this - property is set to NO. The delegate will be notified of each reconnection attempt; you could use - this method to disable reconnection after a number of attempts. - */ -@property (nonatomic, assign, getter=shouldReconnectAutomatically) BOOL reconnectAutomatically; - -/** Specifies the delay between reconnection attempts. Defaults to 5 seconds. - */ -@property (nonatomic, assign) NSTimeInterval reconnectDelay; - -/** The connection object for this client. - - Each instance uses a single connection only. Most clients will likely only ever need a single - PTPusher object and therefore a single connection. - - The connection is exposed to provide access to it's socketID and connection state. Clients - should not attempt to manage this connection directly. - */ -@property (nonatomic, strong, readonly) PTPusherConnection *connection; - -/** The authorization URL for private subscriptions. - - All private channels (including presence channels) require authorization in order to subscribe. - - Authorization happens on your own server. When subscribing to a private or presence channel, - an authorization POST request will be sent to the URL specified by this property. - - Attempting to subscribe to a private or presence channel without setting this property will - result in an assertion error. - - For more information on channel authorization, [see the Pusher documentation website](http://pusher.com/docs/authenticating_users). - */ -@property (nonatomic, strong) NSURL *authorizationURL; - -///------------------------------------------------------------------------------------/ -/// @name Creating new instances -///------------------------------------------------------------------------------------/ - -- (id)initWithConnection:(PTPusherConnection *)connection connectAutomatically:(BOOL)connectAutomatically; - -/** Returns a new PTPusher instance with a connection configured with the given key. - - Instances created using this method will connect automatically. Specify the delegate here - to ensure that it is notified about the connection status during connection. If you assign - a delegate using the delegate property after this method returns, it may not be notified - of connection events. - - @deprecated Use pusherWithKey:delegate:encrypted: - @param key Your application's API key. It can be found in the API Access section of your application within the Pusher user dashboard. - @param delegate The delegate for this instance - */ -+ (id)pusherWithKey:(NSString *)key delegate:(id)delegate __PUSHER_DEPRECATED__; - -/** Returns a new PTPusher instance with a connection configured with the given key. - - Instances created using this method will connect automatically. Specify the delegate here - to ensure that it is notified about the connection status during connection. If you assign - a delegate using the delegate property after this method returns, it may not be notified - of connection events. - - @param key Your application's API key. It can be found in the API Access section of your application within the Pusher user dashboard. - @param delegate The delegate for this instance - @param isEncrypted If yes, a secure connection over SSL will be established. - */ -+ (id)pusherWithKey:(NSString *)key delegate:(id)delegate encrypted:(BOOL)isEncrypted; - -/** Initialises a new PTPusher instance with a connection configured with the given key. - - If you intend to set a delegate for this instance, you are recommended to set connectAutomatically - to NO, set the delegate then manually call connect. - - @deprecated Use pusherWithKey:connectAutomatically:encrypted: - @param key Your application's API key. It can be found in the API Access section of your application within the Pusher user dashboard. - @param connect Automatically If YES, the connection will be connected on initialisation. - */ -+ (id)pusherWithKey:(NSString *)key connectAutomatically:(BOOL)connectAutomatically __PUSHER_DEPRECATED__; - -/** Initialises a new PTPusher instance with a connection configured with the given key. - - If you intend to set a delegate for this instance, you are recommended to set connectAutomatically - to NO, set the delegate then manually call connect. - - @param key Your application's API key. It can be found in the API Access section of your application within the Pusher user dashboard. - @param connectAutomatically If YES, the connection will be connected on initialisation. - @param isEncrypted If yes, a secure connection over SSL will be established. - */ -+ (id)pusherWithKey:(NSString *)key connectAutomatically:(BOOL)connectAutomatically encrypted:(BOOL)isEncrypted; - -///------------------------------------------------------------------------------------/ -/// @name Managing the connection -///------------------------------------------------------------------------------------/ - -/** Establishes a connection to the Pusher server. - - If already connected, this method does nothing. - */ -- (void)connect; - -/** Disconnects from the Pusher server. - - If already disconnected, this method does nothing. - */ -- (void)disconnect; - -///------------------------------------------------------------------------------------/ -/// @name Subscribing to channels -///------------------------------------------------------------------------------------/ - -/** Subscribes to the named channel. - - This method can be used to subscribe to any type of channel, including private and - presence channels by including the appropriate channel name prefix. - - @param name The name of the channel to subscribe to. - */ -- (PTPusherChannel *)subscribeToChannelNamed:(NSString *)name; - -/** Subscribes to the named private channel. - - The "private-" prefix should be excluded from the name; it will be added automatically. - - @param name The name of the channel (without the private prefix) to subscribe to. - */ -- (PTPusherPrivateChannel *)subscribeToPrivateChannelNamed:(NSString *)name; - -/** Subscribes to the named presence channel. - - The "presence-" prefix should be excluded from the name; it will be added automatically. - - @param name The name of the channel (without the presence prefix) to subscribe to. - */ -- (PTPusherPresenceChannel *)subscribeToPresenceChannelNamed:(NSString *)name; - -/** Subscribes to the named presence channel. - - The "presence-" prefix should be excluded from the name; it will be added automatically. - - Whilst the presence delegate can be set on the channel after it is returned, to ensure - events are not missed, it is advised that you call this method and specify a delegate. The - delegate will be assigned before subscription happens. - - @param name The name of the channel (without the presence prefix) to subscribe to. - @param presenceDelegate The presence delegate for this channel. - */ -- (PTPusherPresenceChannel *)subscribeToPresenceChannelNamed:(NSString *)name delegate:(id)presenceDelegate; - -/** Unsubscribes from the specified channel. - - This method is deprecated. You should use -[PTPusherChannel unsubscribe] instead. - - @param channel The channel to unsubscribe from. - */ -- (void)unsubscribeFromChannel:(PTPusherChannel *)channel __PUSHER_DEPRECATED__; - -/** Returns a previously subscribed channel with the given name. - - If the channel specified has not been subscribed to, this method will return nil. - - @param name The name of the channel required. - */ -- (PTPusherChannel *)channelNamed:(NSString *)name; - -///------------------------------------------------------------------------------------/ -/// @name Publishing events -///------------------------------------------------------------------------------------/ - -/** Sends an event directly over the connection's socket. - - Whilst Pusher provides a REST API for publishing events, it also supports the sending of - events directly from clients over the client's existing connection. - - Client events have the following restrictions: - - + The user must be subscribed to the channel that the event is being triggered on. - - + Client events can only be triggered on private and presence channels because they require authentication. - - + Client events must be prefixed by client-. Events with any other prefix will be rejected by the Pusher server, as will events sent to channels to which the client is not subscribed. - - This method does nothing to enforce the first two restrictions. It is instead recommended that - you use the `PTPusherChannel` event triggering API rather than calling this method directly. - - @warning Note: This Pusher feature is currently in beta and requires enabling on your account. - */ -- (void)sendEventNamed:(NSString *)name data:(id)data channel:(NSString *)channelName; - -@end - diff --git a/vendor/libPusher/iOS/headers/PTPusherAPI.h b/vendor/libPusher/iOS/headers/PTPusherAPI.h deleted file mode 100644 index d843535..0000000 --- a/vendor/libPusher/iOS/headers/PTPusherAPI.h +++ /dev/null @@ -1,48 +0,0 @@ -// -// PTPusherAPI.h -// libPusher -// -// Created by Luke Redpath on 14/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import - -/** A simple interface to the Pusher REST API. - - This functionality used to be part of the main PTPusher library but - has been extracted into a standalone component. - - The PTPusher client has alpha support for channel-based event triggering - but for general event triggering the API can be used. - - As well as your Pusher API key, you will also need your app ID and secret key - for signing requests. - */ -@interface PTPusherAPI : NSObject { - NSString *key, *appID, *secretKey; - NSOperationQueue *operationQueue; -} - -///------------------------------------------------------------------------------------/ -/// @name Initialisation -///------------------------------------------------------------------------------------/ - -- (id)initWithKey:(NSString *)aKey appID:(NSString *)anAppID secretKey:(NSString *)aSecretKey; - -///------------------------------------------------------------------------------------/ -/// @name Triggering events -///------------------------------------------------------------------------------------/ - -/** Triggers an event on the specified channel. - - The event data will be converted to JSON format so needs to be any object that can be - transformed into JSON (typically any plist-compatible object). - - @param eventName The name of the event to trigger. - @param channelName The channel the event should be triggered on. - @param eventData The JSON-compatible data object for the event. - */ -- (void)triggerEvent:(NSString *)eventName onChannel:(NSString *)channelName data:(id)eventData socketID:(NSString *)socketID; - -@end diff --git a/vendor/libPusher/iOS/headers/PTPusherChannel.h b/vendor/libPusher/iOS/headers/PTPusherChannel.h deleted file mode 100644 index 26da317..0000000 --- a/vendor/libPusher/iOS/headers/PTPusherChannel.h +++ /dev/null @@ -1,184 +0,0 @@ -// -// PTPusherClient.h -// libPusher -// -// Created by Luke Redpath on 23/04/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import -#import "PTPusherEventPublisher.h" -#import "PTEventListener.h" -#import "PTPusherPresenceChannelDelegate.h" - - -@class PTPusher; -@class PTPusherEventDispatcher; - -/** A PTPusherChannel object represents a single Pusher channel. - - Channels can be used as a means of filtering or controlling access to events. - - Channels do not need to be explicitly created; they are created on demand. To obtain - an instance of a PTPusherChannel, you need to subscribe to it first. - - You should not create PTPusherChannel instances directly as they require subscription and - possibly authorization; you should instead use the subscribeTo methods provided by PTPusher. - - There are three types of channel: - - + Public channels can be subscribed to by anyone who knows their name. - - + Private channels allow you to control access to the data you are broadcasting. - - + Presence channels you to 'register' user information on subscription, and let other members of the channel know who's online. - - Channels can be subscribed to or unsubscribed to at any time, even before the initial - Pusher connection has been established. - */ -@interface PTPusherChannel : NSObject { - NSString *name; - __unsafe_unretained PTPusher *pusher; - PTPusherEventDispatcher *dispatcher; - NSMutableArray *internalBindings; -} - -///------------------------------------------------------------------------------------/ -/// @name Properties -///------------------------------------------------------------------------------------/ - -/** The channel name. - */ -@property (nonatomic, readonly) NSString *name; - -/** Indicates that this channel has been subscribed to. - - Whilst public channels are subscribed to immediately, presence and private channels require - authorization first. This property will be set to YES once an internal Pusher event has - been received indicating that the channel subscription has been registered. - */ -@property (nonatomic, readonly, getter=isSubscribed) BOOL subscribed; - -/** Indicates whether or not this is a private channel. - - The value of this property will be YES for private and presence channels. - */ -@property (nonatomic, readonly) BOOL isPrivate; - -/** Indicates whether or not this is a presence channel. - - The value of this property will be YES for presence channels only. - */ -@property (nonatomic, readonly) BOOL isPresence; - -///------------------------------------------------------------------------------------/ -/// @name Initialisation -///------------------------------------------------------------------------------------/ - -+ (id)channelWithName:(NSString *)name pusher:(PTPusher *)pusher; -- (id)initWithName:(NSString *)channelName pusher:(PTPusher *)pusher; - -///------------------------------------------------------------------------------------/ -/// @name Authorization -///------------------------------------------------------------------------------------/ - -- (void)authorizeWithCompletionHandler:(void(^)(BOOL, NSDictionary *, NSError *))completionHandler; - -///------------------------------------------------------------------------------------/ -/// @name Unsubscribing -///------------------------------------------------------------------------------------/ - -/** Unsubscribes from the channel. - */ -- (void)unsubscribe; - -@end - -/** A PTPusherPrivateChannel object represents a private Pusher channel. - - Private channels should be used when access to the channel needs to be restricted in some way. - In order for a user to subscribe to a private channel permission must be authorised. - - Private channel names always have the prefix of "private-". - - Only private and presence channels support the triggering client events. - */ -@interface PTPusherPrivateChannel : PTPusherChannel { - NSMutableArray *clientEventBuffer; -} - -///------------------------------------------------------------------------------------/ -/// @name Triggering events -///------------------------------------------------------------------------------------/ - -/** Triggers a named event directly over the connection. - - Client events have the following restrictions: - - + The user must be subscribed to the channel that the event is being triggered on. - - + Client events can only be triggered on private and presence channels because they require authentication. - - + Client events must be prefixed by client-. Events with any other prefix will be rejected by the Pusher server, as will events sent to channels to which the client is not subscribed. - - If you attempt to trigger event on a channel while isSubscribed is NO, the event will not be sent. - - If the event name does not have a prefix of "client-", it will be added automatically. - - The event data must be an object that can be serialized as JSON, typically an NSArray or NSDictionary although - it could be a simple string. - */ -- (void)triggerEventNamed:(NSString *)eventName data:(id)eventData; - -@end - -/** A PTPusherPresenceChannel object represents a Pusher presence channel. - - Presence channels build on the security of Private channels and expose the additional feature - of an awareness of who is subscribed to that channel. This makes it extremely easy to build - chat room and "who's online" type functionality to your application. - - Presence channel names always have the prefix of "presence-". - - Unlike the Pusher Javascript client API, PTPusherPresenceChannel does not use events to notify - when members are added or removed. Instead, you should assign a presenceDelegate which will - be notified of these events. - - @see PTPusherPresenceChannelDelegate - */ -@interface PTPusherPresenceChannel : PTPusherPrivateChannel { - NSMutableDictionary *members; - NSMutableArray *memberIDs; // store these separately to preserve order -} - -///------------------------------------------------------------------------------------/ -/// @name Properties -///------------------------------------------------------------------------------------/ - -/** The presence delegate for the receiver. - - The presence delegate will be notified of presence channel-specific events, such as the initial - member list on subscription and member added/removed events. - */ -@property (nonatomic, unsafe_unretained) id presenceDelegate; - -/** Returns the current list of channel members. - - Members are stored as a dictionary of dictionaries, keyed on the member's "user_id" field. - - @deprecated Use the methods below for accessing member data. - */ -@property (nonatomic, readonly) NSDictionary *members; - -/** Returns a dictionary of member metadata (email, name etc.) for the given member ID. - */ -- (NSDictionary *)infoForMemberWithID:(NSString *)memberID; - -/** Returns an array of available member IDs - */ -- (NSArray *)memberIDs; - -/** Returns the number of members currently connected to this channel. - */ -- (NSInteger)memberCount; -@end diff --git a/vendor/libPusher/iOS/headers/PTPusherConnection.h b/vendor/libPusher/iOS/headers/PTPusherConnection.h deleted file mode 100644 index 998ffc4..0000000 --- a/vendor/libPusher/iOS/headers/PTPusherConnection.h +++ /dev/null @@ -1,91 +0,0 @@ -// -// PTPusherConnection.h -// libPusher -// -// Created by Luke Redpath on 13/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import -#import "SRWebSocket.h" -#import "PTPusherMacros.h" - -@class PTPusherConnection; -@class PTPusherEvent; - -@protocol PTPusherConnectionDelegate -- (void)pusherConnectionDidConnect:(PTPusherConnection *)connection; -- (void)pusherConnection:(PTPusherConnection *)connection didDisconnectWithCode:(NSInteger)errorCode reason:(NSString *)reason wasClean:(BOOL)wasClean; -- (void)pusherConnection:(PTPusherConnection *)connection didFailWithError:(NSError *)error wasConnected:(BOOL)wasConnected; -- (void)pusherConnection:(PTPusherConnection *)connection didReceiveEvent:(PTPusherEvent *)event; -@end - -extern NSString *const PTPusherConnectionEstablishedEvent; -extern NSString *const PTPusherConnectionPingEvent; - -typedef enum { - PTPusherConnectionClosing = 0, - PTPusherConnectionClosed, - PTPusherConnectionOpening, - PTPusherConnectionOpenAwaitingHandshake, - PTPusherConnectionOpenHandshakeReceived -} PTPusherConnectionState; - -@interface PTPusherConnection : NSObject - -@property (nonatomic, unsafe_unretained) id delegate; -@property (nonatomic, readonly, getter=isConnected) BOOL connected; -@property (nonatomic, copy, readonly) NSString *socketID; - -///------------------------------------------------------------------------------------/ -/// @name Initialisation -///------------------------------------------------------------------------------------/ - -/** Creates a new PTPusherConnection instance. - - Connections are not opened immediately; an explicit call to connect is required. - - @param aURL The websocket endpoint - @param delegate The delegate for this connection - */ -- (id)initWithURL:(NSURL *)aURL; - -/** Creates a new PTPusherConnection instance. - - Connections are not opened immediately; an explicit call to connect is required. - - DEPRECATED IN VERSION 1.2. The secure parameter is now ignored; secure mode will be - enabled automatically when the URL protocol is wss. - - @param aURL The websocket endpoint - @param delegate The delegate for this connection - @param secure Whether this connection should be secure (TLS) - */ -- (id)initWithURL:(NSURL *)aURL secure:(BOOL)secure __PUSHER_DEPRECATED__; - -///------------------------------------------------------------------------------------/ -/// @name Managing connections -///------------------------------------------------------------------------------------/ - -/** Establishes a web socket connection to the Pusher server. - - The delegate will only be sent a didConnect message when the web socket receives a - 'connection_established' event from Pusher, regardless of the web socket's connection state. - */ -- (void)connect; - -/** Closes the web socket connection */ -- (void)disconnect; - -///------------------------------------------------------------------------------------/ -/// @name Sending data -///------------------------------------------------------------------------------------/ - -/** Sends an object over the web socket connection. - - The object will be serialized to JSON before sending, so the object must be anything - that can be converted into JSON (typically, any plist compatible object). - */ -- (void)send:(id)object; - -@end diff --git a/vendor/libPusher/iOS/headers/PTPusherDelegate.h b/vendor/libPusher/iOS/headers/PTPusherDelegate.h deleted file mode 100644 index 9f0a8bf..0000000 --- a/vendor/libPusher/iOS/headers/PTPusherDelegate.h +++ /dev/null @@ -1,128 +0,0 @@ -// -// PTPusherDelegate.h -// libPusher -// -// Created by Luke Redpath on 22/03/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import "PTPusherMacros.h" - -@class PTPusher; -@class PTPusherConnection; -@class PTPusherChannel; -@class PTPusherEvent; -@class PTPusherErrorEvent; - -/** The PTPusherDelegate protocol can be implemented to receive important events in a PTPusher object's lifetime. - - All of the delegate methods are optional; you only need to implement what is required for your app. - - It may be useful to assign a delegate to monitor the status of the connection; you could use this to update - your user interface accordingly. - */ -@protocol PTPusherDelegate - -@optional - -/** Notifies the delegate that the PTPusher instance has connected to the Pusher service successfully. - - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - */ -- (void)pusher:(PTPusher *)pusher connectionDidConnect:(PTPusherConnection *)connection; - -/** Notifies the delegate that the PTPusher instance has disconnected from the Pusher service. - - @deprecated Use pusher:connection:didDisconnectWithError: - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - */ -- (void)pusher:(PTPusher *)pusher connectionDidDisconnect:(PTPusherConnection *)connection __PUSHER_DEPRECATED__; - -/** Notifies the delegate that the PTPusher instance has disconnected from the Pusher service. - - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - @param error If the connection disconnected abnormally, error will be non-nil. - */ -- (void)pusher:(PTPusher *)pusher connection:(PTPusherConnection *)connection didDisconnectWithError:(NSError *)error; - -/** Notifies the delegate that the PTPusher instance failed to connect to the Pusher service. - - If reconnectAutomatically is YES, PTPusher will attempt to reconnect if the initial connection failed. - - This reconnect attempt will happen after this message is sent to the delegate, giving the delegate - a chance to inspect the connection error and disable automatic reconnection if it thinks the reconnection - attempt is likely to fail, depending on the error. - - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - @param error The connection error. - */ -- (void)pusher:(PTPusher *)pusher connection:(PTPusherConnection *)connection failedWithError:(NSError *)error; - -/** Notifies the delegate that the PTPusher instance is about to attempt reconnection. - - You may wish to use this method to keep track of the number of reconnection attempts and abort after a fixed number. - - If you do not set the `reconnectAutomatically` property of the PTPusher instance to NO, it will continue attempting - to reconnect until a successful connection has been established. - - @param pusher The PTPusher instance that has connected. - @param connection The connection for the pusher instance. - */ -- (void)pusher:(PTPusher *)pusher connectionWillReconnect:(PTPusherConnection *)connection afterDelay:(NSTimeInterval)delay; - -/** Notifies the delegate of the request that will be used to authorize access to a channel. - - When using the Pusher Javascript client, authorization typically relies on an existing session cookie - on the server; when the Javascript client makes an AJAX POST to the server, the server can return - the user's credentials based on their current session. - - When using libPusher, there will likely be no existing server-side session; authorization will - need to happen by some other means (e.g. an authorization token or HTTP basic auth). - - By implementing this delegate method, you will be able to set any credentials as necessary by - modifying the request as required (such as setting POST parameters or headers). - */ -- (void)pusher:(PTPusher *)pusher willAuthorizeChannelWithRequest:(NSMutableURLRequest *)request; - -/** Notifies the delegate that the PTPusher instance has subscribed to the specified channel. - - This method will be called after any channel authorization has taken place and when a subscribe event has been received. - - @param pusher The PTPusher instance that has connected. - @param channel The channel that was subscribed to. - */ -- (void)pusher:(PTPusher *)pusher didSubscribeToChannel:(PTPusherChannel *)channel; - -/** Notifies the delegate that the PTPusher instance has unsubscribed from the specified channel. - - This method will be called immediately after unsubscribing from a channel. - - @param pusher The PTPusher instance that has connected. - @param channel The channel that was unsubscribed from. - */ -- (void)pusher:(PTPusher *)pusher didUnsubscribeFromChannel:(PTPusherChannel *)channel; - -/** Notifies the delegate that the PTPusher instance failed to subscribe to the specified channel. - - The most common reason for subscribing failing is authorization failing for private/presence channels. - - @param pusher The PTPusher instance that has connected. - @param channel The channel that was subscribed to. - @param error The error returned when attempting to subscribe. - */ -- (void)pusher:(PTPusher *)pusher didFailToSubscribeToChannel:(PTPusherChannel *)channel withError:(NSError *)error; - -/** Notifies the delegate that an error event has been received. - - If a client is binding to all events, either through the client or using NSNotificationCentre, they will also - receive notification of this event like any other. - - @param pusher The PTPusher instance that received the event. - @param errorEvent The error event. - */ -- (void)pusher:(PTPusher *)pusher didReceiveErrorEvent:(PTPusherErrorEvent *)errorEvent; -@end diff --git a/vendor/libPusher/iOS/headers/PTPusherErrors.h b/vendor/libPusher/iOS/headers/PTPusherErrors.h deleted file mode 100644 index a4b5f28..0000000 --- a/vendor/libPusher/iOS/headers/PTPusherErrors.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// PTPusherErrors.h -// libPusher -// -// Created by Luke Redpath on 14/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import - -enum { - PTPusherSubscriptionError = 0, - PTPusherSubscriptionUnknownAuthorisationError -}; diff --git a/vendor/libPusher/iOS/headers/PTPusherEvent.h b/vendor/libPusher/iOS/headers/PTPusherEvent.h deleted file mode 100644 index bcfb484..0000000 --- a/vendor/libPusher/iOS/headers/PTPusherEvent.h +++ /dev/null @@ -1,74 +0,0 @@ -// -// PTPusherEvent.h -// PusherEvents -// -// Created by Luke Redpath on 22/03/2010. -// Copyright 2010 LJR Software Limited. All rights reserved. -// - -#import - -extern NSString *const PTPusherDataKey; -extern NSString *const PTPusherEventKey; -extern NSString *const PTPusherChannelKey; - -/** A value object representing a Pusher event. - - All events dispatched by libPusher (via either bindings or notifications) will be represented - by instances of this class. - */ -@interface PTPusherEvent : NSObject { - NSString *_name; -} - -///------------------------------------------------------------------------------------/ -/// @name Properties -///------------------------------------------------------------------------------------/ - -/** The event name. - */ -@property (nonatomic, readonly) NSString *name; - -/** The channel that this event originated from. - */ -@property (strong, nonatomic, readonly) NSString *channel; - -/** The event data. - - Event data will typically be any kind of object that can be represented as JSON, often - an NSArray or NSDictionary but can be a simple string. - */ -@property (strong, nonatomic, readonly) id data; - -/** The time the event was received. - */ -@property (nonatomic, readonly, strong) NSDate *timeReceived; - -- (id)initWithEventName:(NSString *)name channel:(NSString *)channel data:(id)data; -+ (id)eventFromMessageDictionary:(NSDictionary *)dictionary; -@end - -typedef enum { - PTPusherErrorSSLRequired = 4000, - PTPusherErrorApplicationUnknown = 4001, - PTPusherErrorApplicationDisabled = 4002 -} PTPusherServerErrorCodes; - -/** A special sub-class of Pusher event, representing pusher:error events. - - This will be yielded to the Pusher client delegate as well as through the normal event - dispatch mechanism. - - This class adds some convenient properties for accessing error details. - */ -@interface PTPusherErrorEvent : PTPusherEvent - -/** A textual description of the error. - */ -@property (unsafe_unretained, nonatomic, readonly) NSString *message; - -/** The error code. See PTPusherServerErrorCodes for available errors. - */ -@property (nonatomic, readonly) NSInteger code; - -@end diff --git a/vendor/libPusher/iOS/headers/PTPusherEventDispatcher.h b/vendor/libPusher/iOS/headers/PTPusherEventDispatcher.h deleted file mode 100644 index 922d678..0000000 --- a/vendor/libPusher/iOS/headers/PTPusherEventDispatcher.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// PTPusherEventDispatcher.h -// libPusher -// -// Created by Luke Redpath on 13/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import -#import "PTEventListener.h" - -@class PTPusherEventBinding; - -@interface PTPusherEventDispatcher : NSObject - -@property (nonatomic, readonly) NSDictionary *bindings; - -- (PTPusherEventBinding *)addEventListener:(id)listener forEventNamed:(NSString *)eventName; -- (void)removeBinding:(PTPusherEventBinding *)binding; -- (void)removeAllBindings; -@end - -@interface PTPusherEventBinding : NSObject - -/** The event this binding binds to. */ -@property (nonatomic, readonly) NSString *eventName; - -/** Returns YES if this binding is still attached to its event publisher. - - Retained references to bindings can become invalid as a result of another object - calling removeBinding: with this binding or removeAllBindings. - - You can safely discard invalid binding instances. - */ -@property (nonatomic, readonly, getter=isValid) BOOL valid; - -- (id)initWithEventListener:(id)eventListener eventName:(NSString *)eventName; -@end diff --git a/vendor/libPusher/iOS/headers/PTPusherEventPublisher.h b/vendor/libPusher/iOS/headers/PTPusherEventPublisher.h deleted file mode 100644 index 09939a9..0000000 --- a/vendor/libPusher/iOS/headers/PTPusherEventPublisher.h +++ /dev/null @@ -1,84 +0,0 @@ -// -// PTPusherEventPublisher.h -// libPusher -// -// Created by Luke Redpath on 13/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import - -@class PTPusherEvent; -@class PTPusherEventBinding; - -typedef void (^PTPusherEventBlockHandler) (PTPusherEvent *); - -/** Describes an object that provides events that can be bound to. - - Events in Pusher form the basis of all communication with the service. They are - named messages that can carry arbitrary user data. All events in libPusher are - represented by the class `PTPusherEvent`. - - An object that implements this protocol allows for binding to events. There are - currently two classes that implement this protocol: `PTPusher` and `PTPusherChannel`. - - There are two primary binding mechanisms: target/action based and block-based. Which - one you use depends entirely on the requirements of your application. - */ -@protocol PTPusherEventBindings - -/** Binds to the named event using the target/action mechanism. - - When the named event is received, the specified selector will be called on target, passing - the `PTPusherEvent` as the only argument. - - The following code snippet sets up a binding for the event "new-message" on any channel: - - [pusher bindToEventNamed:@"new-message" target:self action:@selector(handleNewMessageEvent:)]; - - Then the event is triggered, the event will be dispatched to the target/action pair: - - - (void)handleNewMessageEvent:(PTPusherEvent *)event - { - // do something with event - } - */ -- (PTPusherEventBinding *)bindToEventNamed:(NSString *)eventName target:(id)target action:(SEL)selector; - -/** Binds to the named event using a block callback. - - When the event is received, the block will be called with the `PTPusherEvent` as the only block argument. - - The following code snippet sets up a binding for the event "new-message" on any channel and handles that - event when it is triggered: - - [pusher bindToEventNamed:@"new-message" handleWithBlock:^(PTPusherEvent *event) { - // do something with event - }]; - - The callback blocks will be dispatched asynchronously using Grand Central Dispatch on the main queue. - */ -- (PTPusherEventBinding *)bindToEventNamed:(NSString *)eventName handleWithBlock:(PTPusherEventBlockHandler)block; - -/** Binds to the named event using a block callback. - - Works the same as bindToEventNamed:handleWithBlock: but dispatches the callback block on the specified - Grand Central Dispatch queue. - - You can use this method if you wish to handle events in a background or custom priority queue. - */ -- (PTPusherEventBinding *)bindToEventNamed:(NSString *)eventName handleWithBlock:(PTPusherEventBlockHandler)block queue:(dispatch_queue_t)queue; - -/** Removes the specified binding. - - Any further events will not trigger any callbacks after the binding has been removed. - */ -- (void)removeBinding:(PTPusherEventBinding *)binding; - -/** Removes all bindings that have been set up. - - Any retained references to PTPusherEventBinding objects will become invalid. - */ -- (void)removeAllBindings; - -@end diff --git a/vendor/libPusher/iOS/headers/PTPusherMacros.h b/vendor/libPusher/iOS/headers/PTPusherMacros.h deleted file mode 100644 index 29245c6..0000000 --- a/vendor/libPusher/iOS/headers/PTPusherMacros.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// PTPusherMacros.h -// libPusher -// -// Created by Luke Redpath on 10/02/2012. -// Copyright (c) 2012 LJR Software Limited. All rights reserved. -// - -#ifndef libPusher_PTPusherMacros_h -#define libPusher_PTPusherMacros_h - -#define __PUSHER_DEPRECATED__ __attribute__((deprecated)) - -#define PT_DEFINE_SHARED_INSTANCE_USING_BLOCK(block) \ -static dispatch_once_t pred = 0; \ -__strong static id _sharedObject = nil; \ -dispatch_once(&pred, ^{ \ -_sharedObject = block(); \ -}); \ -return _sharedObject; \ - -#endif diff --git a/vendor/libPusher/iOS/headers/PTPusherPresenceChannelDelegate.h b/vendor/libPusher/iOS/headers/PTPusherPresenceChannelDelegate.h deleted file mode 100644 index f69005c..0000000 --- a/vendor/libPusher/iOS/headers/PTPusherPresenceChannelDelegate.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// PTPusherPresenceChannelDelegate.h -// libPusher -// -// Created by Luke Redpath on 14/08/2011. -// Copyright 2011 LJR Software Limited. All rights reserved. -// - -#import - -@class PTPusherPresenceChannel; - -@protocol PTPusherPresenceChannelDelegate - -/** Notifies the delegate that the presence channel subscribed successfully. - - Whenever you subscribe to a presence channel, a list of current subscribers will be returned by Pusher. - - The list will be an array of member IDs. Further metadata can be obtained by asking the channel object - for information about a particular member using `-[PTPusherChannel infoForMemberWithID:]`. - - @param channel The presence channel that was subscribed to. - @param members The current members subscribed to the channel. - */ -- (void)presenceChannel:(PTPusherPresenceChannel *)channel didSubscribeWithMemberList:(NSArray *)members; - -/** Notifies the delegate that a new member subscribed to the presence channel. - - The member info can contain arbitrary user data returned by the authorization server. - - @param channel The presence channel that was subscribed to. - @param memberID The ID for the new member. - @param memberInfo The custom user data for the new member. - */ -- (void)presenceChannel:(PTPusherPresenceChannel *)channel memberAddedWithID:(NSString *)memberID memberInfo:(NSDictionary *)memberInfo; - -/** Notifies the delegate that a member subscribed to the presence channel has unsubscribed. - - The member data can contain arbitrary user data returned by the authorization server. - - @param channel The presence channel that was subscribed to. - @param memberID The ID of the member removed. - @param index The internal index of the member (depends on the order joined/left or returned in the server member list) - */ -- (void)presenceChannel:(PTPusherPresenceChannel *)channel memberRemovedWithID:(NSString *)memberID atIndex:(NSInteger)index; - -@end diff --git a/vendor/libPusher/iOS/headers/SRWebSocket.h b/vendor/libPusher/iOS/headers/SRWebSocket.h deleted file mode 100644 index a7e1851..0000000 --- a/vendor/libPusher/iOS/headers/SRWebSocket.h +++ /dev/null @@ -1,90 +0,0 @@ -// -// Copyright 2012 Square Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import -#import - -typedef enum { - SR_CONNECTING = 0, - SR_OPEN = 1, - SR_CLOSING = 2, - SR_CLOSED = 3, - -} SRReadyState; - -@class SRWebSocket; - -extern NSString *const SRWebSocketErrorDomain; - -@protocol SRWebSocketDelegate; - -@interface SRWebSocket : NSObject - -@property (nonatomic, assign) id delegate; - -@property (nonatomic, readonly) SRReadyState readyState; -@property (nonatomic, readonly, retain) NSURL *url; - -// This returns the negotiated protocol. -// It will be niluntil after the handshake completes. -@property (nonatomic, readonly, copy) NSString *protocol; - -// Protocols should be an array of strings that turn into Sec-WebSocket-Protocol -- (id)initWithURLRequest:(NSURLRequest *)request protocols:(NSArray *)protocols; -- (id)initWithURLRequest:(NSURLRequest *)request; - -// Some helper constructors -- (id)initWithURL:(NSURL *)url protocols:(NSArray *)protocols; -- (id)initWithURL:(NSURL *)url; - -// SRWebSockets are intended one-time-use only. Open should be called once and only once -- (void)open; - -- (void)close; -- (void)closeWithCode:(NSInteger)code reason:(NSString *)reason; - -// Send a UTF8 String or Data -- (void)send:(id)data; - -@end - -@protocol SRWebSocketDelegate - -// message will either be an NSString if the server is using text -// or NSData if the server is using binary -- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message; - -@optional - -- (void)webSocketDidOpen:(SRWebSocket *)webSocket; -- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error; -- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean; - -@end - - -@interface NSURLRequest (CertificateAdditions) - -@property (nonatomic, retain, readonly) NSArray *SR_SSLPinnedCertificates; - -@end - - -@interface NSMutableURLRequest (CertificateAdditions) - -@property (nonatomic, retain) NSArray *SR_SSLPinnedCertificates; - -@end diff --git a/vendor/libPusher/iOS/libPusher-combined.a b/vendor/libPusher/iOS/libPusher-combined.a deleted file mode 100644 index 0e351ce..0000000 Binary files a/vendor/libPusher/iOS/libPusher-combined.a and /dev/null differ