From 35cd48231abe35203b06bf4c2c71abfdf6c8ab52 Mon Sep 17 00:00:00 2001 From: Lindsay-Needs-Sleep Date: Fri, 24 Jan 2020 18:20:31 -0700 Subject: [PATCH] (ios) Fix imports and usage after file + class rename --- src/ios/MLPCastRequestDelegate.h | 7 +-- src/ios/MLPCastRequestDelegate.m | 9 ++-- src/ios/MLPCastUtilities.h | 7 +-- src/ios/MLPCastUtilities.m | 81 +++++++++++++++----------------- src/ios/MLPChromecast.h | 13 ++--- src/ios/MLPChromecast.m | 31 ++++++------ src/ios/MLPChromecastSession.h | 9 ++-- src/ios/MLPChromecastSession.m | 55 ++++++++++------------ 8 files changed, 94 insertions(+), 118 deletions(-) diff --git a/src/ios/MLPCastRequestDelegate.h b/src/ios/MLPCastRequestDelegate.h index ac0b2c0..5c8bf79 100644 --- a/src/ios/MLPCastRequestDelegate.h +++ b/src/ios/MLPCastRequestDelegate.h @@ -1,9 +1,6 @@ // -// CastRequestDelegate.h +// MLPCastRequestDelegate.h // ChromeCast -// -// Created by mac on 2019/9/30. -// #import #import @@ -36,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithReceiverAvailableUpdate:(void(^)(BOOL available))onReceiverAvailableUpdate onSessionRejoin:(void(^)(NSDictionary* session))onSessionRejoin onMediaLoaded:(void(^)(NSDictionary* m))onMediaLoaded onMediaUpdated:(void(^)(NSDictionary* media))onMediaUpdated onSessionUpdated:(void(^)(NSDictionary* session))onSessionUpdated onSessionEnd:(void(^)(NSDictionary* session))onSessionEnd onMessageReceived:(void(^)(NSDictionary* session,NSString* namespace,NSString* message))onMessageReceived ; @end -@interface CastRequestDelegate : NSObject +@interface MLPCastRequestDelegate : NSObject { void (^didSuccess)(void); void (^didFail)(GCKError*); diff --git a/src/ios/MLPCastRequestDelegate.m b/src/ios/MLPCastRequestDelegate.m index e6f441b..b33bf49 100644 --- a/src/ios/MLPCastRequestDelegate.m +++ b/src/ios/MLPCastRequestDelegate.m @@ -1,11 +1,8 @@ // -// CastRequestDelegate.m +// MLPCastRequestDelegate.m // ChromeCast -// -// Created by mac on 2019/9/30. -// -#import "CastRequestDelegate.h" +#import "MLPCastRequestDelegate.h" @implementation CastConnectionListener @@ -67,7 +64,7 @@ - (void)onMessageReceived:(NSDictionary *)session namespace:(NSString *)namespac @end -@implementation CastRequestDelegate +@implementation MLPCastRequestDelegate - (instancetype)initWithSuccess:(void(^)(void))success failure:(void(^)(GCKError*))failure abortion:(void(^)(GCKRequestAbortReason))abortion { diff --git a/src/ios/MLPCastUtilities.h b/src/ios/MLPCastUtilities.h index a79c1c8..741031f 100644 --- a/src/ios/MLPCastUtilities.h +++ b/src/ios/MLPCastUtilities.h @@ -1,16 +1,13 @@ // -// CastUtilities.h +// MLPCastUtilities.h // ChromeCast -// -// Created by mac on 2019/9/30. -// #import #import NS_ASSUME_NONNULL_BEGIN -@interface CastUtilities : NSObject +@interface MLPCastUtilities : NSObject +(GCKMediaInformation *)buildMediaInformation:(NSString *)contentUrl customData:(id )customData contentType:(NSString *)contentType duration:(double)duration streamType:(NSString *)streamType startTime:(double)startTime metaData:(NSDictionary *)metaData textTrackStyle:(NSDictionary *)textTrackStyle; +(GCKMediaQueueItem *)buildMediaQueueItem:(NSDictionary *)item; diff --git a/src/ios/MLPCastUtilities.m b/src/ios/MLPCastUtilities.m index ac570f6..8df3abc 100644 --- a/src/ios/MLPCastUtilities.m +++ b/src/ios/MLPCastUtilities.m @@ -1,13 +1,10 @@ // -// CastUtilities.m +// MLPCastUtilities.m // ChromeCast -// -// Created by mac on 2019/9/30. -// -#import "CastUtilities.h" +#import "MLPCastUtilities.h" -@implementation CastUtilities +@implementation MLPCastUtilities NSDictionary* queueOrderIDsByItemId = nil; @@ -27,8 +24,8 @@ + (GCKMediaInformation *)buildMediaInformation:(NSString *)contentUrl customData mediaInfoBuilder.streamType = GCKMediaStreamTypeNone; } mediaInfoBuilder.startAbsoluteTime = startTime; - mediaInfoBuilder.metadata = [CastUtilities buildMediaMetadata:metaData]; - mediaInfoBuilder.textTrackStyle = [CastUtilities buildTextTrackStyle:textTrackStyle]; + mediaInfoBuilder.metadata = [MLPCastUtilities buildMediaMetadata:metaData]; + mediaInfoBuilder.textTrackStyle = [MLPCastUtilities buildTextTrackStyle:textTrackStyle]; return [mediaInfoBuilder build]; } @@ -45,7 +42,7 @@ + (GCKMediaQueueItem *)buildMediaQueueItem:(NSDictionary *)item { queueItemBuilder.startTime = startTime; queueItemBuilder.preloadTime = [item[@"preloadTime"] doubleValue]; - queueItemBuilder.mediaInformation = [CastUtilities buildMediaInformation:media[@"contentId"] customData:media[@"customData"] contentType:media[@"contentType"] duration:duration streamType:media[@"streamType"] startTime:startTime metaData:media[@"metadata"] textTrackStyle:item[@"textTrackStyle"]]; + queueItemBuilder.mediaInformation = [MLPCastUtilities buildMediaInformation:media[@"contentId"] customData:media[@"customData"] contentType:media[@"contentType"] duration:duration streamType:media[@"streamType"] startTime:startTime metaData:media[@"metadata"] textTrackStyle:item[@"textTrackStyle"]]; return [queueItemBuilder build]; } @@ -75,7 +72,7 @@ + (GCKMediaTextTrackStyle *)buildTextTrackStyle:(NSDictionary *)data { NSString* edgeType = data[@"edgeType"]; if (edgeType != nil) { - mediaTextTrackStyle.edgeType = [CastUtilities parseEdgeType:edgeType]; + mediaTextTrackStyle.edgeType = [MLPCastUtilities parseEdgeType:edgeType]; } NSString* fontFamily = data[@"fontFamily"]; @@ -85,7 +82,7 @@ + (GCKMediaTextTrackStyle *)buildTextTrackStyle:(NSDictionary *)data { NSString* fontGenericFamily = data[@"fontGenericFamily"]; if (fontGenericFamily != nil) { - mediaTextTrackStyle.fontGenericFamily = [CastUtilities parseFontGenericFamily:fontGenericFamily]; + mediaTextTrackStyle.fontGenericFamily = [MLPCastUtilities parseFontGenericFamily:fontGenericFamily]; } CGFloat fontScale = (CGFloat)[data[@"fontScale"] floatValue]; @@ -95,7 +92,7 @@ + (GCKMediaTextTrackStyle *)buildTextTrackStyle:(NSDictionary *)data { NSString* fontStyle = data[@"fontStyle"]; if (fontFamily != nil) { - mediaTextTrackStyle.fontStyle = [CastUtilities parseFontStyle:fontStyle]; + mediaTextTrackStyle.fontStyle = [MLPCastUtilities parseFontStyle:fontStyle]; } NSString* foregroundColor = data[@"foregroundColor"]; if (fontFamily != nil) { @@ -114,7 +111,7 @@ + (GCKMediaTextTrackStyle *)buildTextTrackStyle:(NSDictionary *)data { NSString* windowType = data[@"windowType"]; if (windowType != nil) { - mediaTextTrackStyle.windowType = [CastUtilities parseWindowType:windowType]; + mediaTextTrackStyle.windowType = [MLPCastUtilities parseWindowType:windowType]; } } return mediaTextTrackStyle; @@ -129,7 +126,7 @@ +(GCKMediaMetadata*)buildMediaMetadata:(NSDictionary*)data { } NSData* imagesRaw = data[@"images"]; if (imagesRaw != nil) { - NSArray* images = [CastUtilities getMetadataImages:imagesRaw]; + NSArray* images = [MLPCastUtilities getMetadataImages:imagesRaw]; for (GCKImage* image in images) { [mediaMetaData addImage:image]; } @@ -140,8 +137,8 @@ +(GCKMediaMetadata*)buildMediaMetadata:(NSDictionary*)data { if ([key isEqualToString:@"metadataType"] || [key isEqualToString:@"images"] || [key isEqualToString:@"type"]) { continue; } - NSString* convertedKey = [CastUtilities getiOSMetadataName:key]; - NSString* dataType = [CastUtilities getMetadataType:convertedKey]; + NSString* convertedKey = [MLPCastUtilities getiOSMetadataName:key]; + NSString* dataType = [MLPCastUtilities getMetadataType:convertedKey]; if ([dataType isEqualToString:@"string"]) { if (data[key]) { [mediaMetaData setString:data[key] forKey:convertedKey]; @@ -471,7 +468,7 @@ +(NSString*)getClientMetadataName:(NSString*)iOSName { } + (NSDictionary*)createSessionObject:(GCKCastSession *)session { - return [CastUtilities createSessionObject:session status:@""]; + return [MLPCastUtilities createSessionObject:session status:@""]; } + (NSDictionary*)createSessionObject:(GCKCastSession *)session status:(NSString*)status { @@ -488,10 +485,10 @@ + (NSDictionary*)createSessionObject:(GCKCastSession *)session status:(NSString* @"muted" : @(session.currentDeviceMuted) } }; - sessionOut[@"status"] = ![status isEqual: @""]? status : [CastUtilities getConnectionStatus:session.connectionState]; + sessionOut[@"status"] = ![status isEqual: @""]? status : [MLPCastUtilities getConnectionStatus:session.connectionState]; NSMutableArray* mediaArray = [[NSMutableArray alloc] init]; - NSDictionary* mediaObj = [CastUtilities createMediaObject:session]; + NSDictionary* mediaObj = [MLPCastUtilities createMediaObject:session]; if (![mediaObj isEqual: @{}]) { [mediaArray addObject:mediaObj]; } @@ -524,7 +521,7 @@ + (NSDictionary *)createMediaObject:(GCKCastSession *)session { for (int i=0; i #import #import -#import "ChromecastSession.h" -#import "CastUtilities.h" +#import "MLPChromecastSession.h" +#import "MLPCastUtilities.h" NS_ASSUME_NONNULL_BEGIN -@interface Chromecast : CDVPlugin +@interface MLPChromecast : CDVPlugin @property (nonatomic, strong) NSMutableArray* devicesAvailable; -@property (nonatomic, strong) ChromecastSession* currentSession; +@property (nonatomic, strong) MLPChromecastSession* currentSession; @property (nonatomic, strong) CDVInvokedUrlCommand* eventCommand; - (void)onReset; diff --git a/src/ios/MLPChromecast.m b/src/ios/MLPChromecast.m index 732a737..7db8d5d 100644 --- a/src/ios/MLPChromecast.m +++ b/src/ios/MLPChromecast.m @@ -1,27 +1,24 @@ // -// Chromecast.m +// MLPChromecast.m // ChromeCast -// -// Created by mac on 2019/9/30. -// -#import "Chromecast.h" -#import "CastUtilities.h" +#import "MLPChromecast.h" +#import "MLPCastUtilities.h" #define IDIOM UI_USER_INTERFACE_IDIOM() #define IPAD UIUserInterfaceIdiomPad -@interface Chromecast() +@interface MLPChromecast() @end -@implementation Chromecast +@implementation MLPChromecast NSString* appId = nil; CDVInvokedUrlCommand* scanCommand = nil; int scansRunning = 0; - (void)pluginInitialize { [super pluginInitialize]; - self.currentSession = [ChromecastSession alloc]; + self.currentSession = [MLPChromecastSession alloc]; NSString* applicationId = [NSUserDefaults.standardUserDefaults stringForKey:@"appId"]; if (applicationId == nil) { @@ -102,7 +99,7 @@ -(void) initialize:(CDVInvokedUrlCommand*)command { - (void)findAvailableReceiver:(void(^)(void))successCallback { // Ensure the scan is running [self startRouteScan]; - [CastUtilities retry:^BOOL{ + [MLPCastUtilities retry:^BOOL{ // Did we find any devices? if ([GCKCastContext.sharedInstance.discoveryManager hasDiscoveredDevices]) { [self sendReceiverAvailable:YES]; @@ -168,7 +165,7 @@ - (void)sendScanUpdate { return; } - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:[CastUtilities createDeviceArray]]; + CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:[MLPCastUtilities createDeviceArray]]; [pluginResult setKeepCallback:@(true)]; [self.commandDelegate sendPluginResult:pluginResult callbackId:scanCommand.callbackId]; } @@ -220,7 +217,7 @@ - (void)queueLoad:(CDVInvokedUrlCommand *)command { NSMutableArray *queueItems = [[NSMutableArray alloc] init]; for (NSDictionary *item in items) { - [queueItems addObject: [CastUtilities buildMediaQueueItem:item]]; + [queueItems addObject: [MLPCastUtilities buildMediaQueueItem:item]]; } [self.currentSession queueLoadItemsWithCommand:command queueItems:queueItems startIndex:startIndex repeatMode:repeatMode]; } @@ -270,7 +267,7 @@ - (void)loadMedia:(CDVInvokedUrlCommand*) command { double currentTime = [command.arguments[6] doubleValue]; NSDictionary* metadata = command.arguments[7]; NSDictionary* textTrackStyle = command.arguments[8]; - GCKMediaInformation* mediaInfo = [CastUtilities buildMediaInformation:contentId customData:customData contentType:contentType duration:duration streamType:streamType startTime:currentTime metaData:metadata textTrackStyle:textTrackStyle]; + GCKMediaInformation* mediaInfo = [MLPCastUtilities buildMediaInformation:contentId customData:customData contentType:contentType duration:duration streamType:streamType startTime:currentTime metaData:metadata textTrackStyle:textTrackStyle]; [self.currentSession loadMediaWithCommand:command mediaInfo:mediaInfo autoPlay:autoplay currentTime:currentTime]; } @@ -298,7 +295,7 @@ - (void)mediaPause:(CDVInvokedUrlCommand*)command { - (void)mediaSeek:(CDVInvokedUrlCommand*)command { int currentTime = [command.arguments[0] doubleValue]; NSString* resumeState = command.arguments[1]; - GCKMediaResumeState resumeStateObj = [CastUtilities parseResumeState:resumeState]; + GCKMediaResumeState resumeStateObj = [MLPCastUtilities parseResumeState:resumeState]; [self.currentSession mediaSeekWithCommand:command position:currentTime resumeState:resumeStateObj]; } @@ -310,7 +307,7 @@ - (void)mediaEditTracksInfo:(CDVInvokedUrlCommand*)command { NSArray* activeTrackIds = command.arguments[0]; NSData* textTrackStyle = command.arguments[1]; - GCKMediaTextTrackStyle* textTrackStyleObject = [CastUtilities buildTextTrackStyle:textTrackStyle]; + GCKMediaTextTrackStyle* textTrackStyleObject = [MLPCastUtilities buildTextTrackStyle:textTrackStyle]; [self.currentSession setActiveTracksWithCommand:command activeTrackIds:activeTrackIds textTrackStyle:textTrackStyleObject]; } @@ -326,7 +323,7 @@ - (void)selectRoute:(CDVInvokedUrlCommand*)command { // Ensure the scan is running [self startRouteScan]; - [CastUtilities retry:^BOOL{ + [MLPCastUtilities retry:^BOOL{ GCKDevice* device = [[GCKCastContext sharedInstance].discoveryManager deviceWithUniqueID:routeID]; if (device != nil) { [self.currentSession joinDevice:device cdvCommand:command]; @@ -410,7 +407,7 @@ - (void)sendEvent:(NSString *)eventName args:(NSArray *)args{ - (void)sendError:(NSString *)code message:(NSString *)message command:(CDVInvokedUrlCommand*)command{ - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:[CastUtilities createError:code message:message]]; + CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:[MLPCastUtilities createError:code message:message]]; [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; } diff --git a/src/ios/MLPChromecastSession.h b/src/ios/MLPChromecastSession.h index cf97261..27ef93d 100644 --- a/src/ios/MLPChromecastSession.h +++ b/src/ios/MLPChromecastSession.h @@ -1,18 +1,15 @@ // -// ChromecastSession.h +// MLPChromecastSession.h // ChromeCast -// -// Created by mac on 2019/9/30. -// #import #import #import -#import "CastRequestDelegate.h" +#import "MLPCastRequestDelegate.h" NS_ASSUME_NONNULL_BEGIN -@interface ChromecastSession : NSObject +@interface MLPChromecastSession : NSObject @property (nonatomic, retain) id commandDelegate; @property (nonatomic, retain) GCKSessionManager* sessionManager; diff --git a/src/ios/MLPChromecastSession.m b/src/ios/MLPChromecastSession.m index b9af250..28e72b5 100644 --- a/src/ios/MLPChromecastSession.m +++ b/src/ios/MLPChromecastSession.m @@ -1,14 +1,11 @@ // -// ChromecastSession.m +// MLPChromecastSession.m // ChromeCast -// -// Created by mac on 2019/9/30. -// -#import "ChromecastSession.h" -#import "CastUtilities.h" +#import "MLPChromecastSession.h" +#import "MLPCastUtilities.h" -@implementation ChromecastSession +@implementation MLPChromecastSession GCKCastSession* currentSession; CDVInvokedUrlCommand* joinSessionCommand; NSDictionary* lastMedia = nil; @@ -17,7 +14,7 @@ @implementation ChromecastSession BOOL isQueueJumping = NO; BOOL isDisconnecting = NO; NSMutableArray* endSessionCallbacks; -NSMutableArray* requestDelegates; +NSMutableArray* requestDelegates; - (instancetype)initWithListener:(id)listener cordovaDelegate:(id)cordovaDelegate { @@ -50,7 +47,7 @@ - (void)tryRejoin { // Only if the session exists, is connected, and we are not already resuming the session if (currentSession != nil && currentSession.connectionState != GCKConnectionStateDisconnected && isResumingSession == NO) { // Trigger the SESSION_LISTENER - [self.sessionListener onSessionRejoin:[CastUtilities createSessionObject:currentSession]]; + [self.sessionListener onSessionRejoin:[MLPCastUtilities createSessionObject:currentSession]]; } } @@ -63,13 +60,13 @@ - (void)joinDevice:(GCKDevice*)device cdvCommand:(CDVInvokedUrlCommand*)command } } --(CastRequestDelegate*)createLoadMediaRequestDelegate:(CDVInvokedUrlCommand*)command { +-(MLPCastRequestDelegate*)createLoadMediaRequestDelegate:(CDVInvokedUrlCommand*)command { loadMediaCallback = ^(NSString* error) { if (error) { CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:error]; [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; } else { - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:[CastUtilities createMediaObject:currentSession]]; + CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:[MLPCastUtilities createMediaObject:currentSession]]; [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; } }; @@ -85,23 +82,23 @@ -(CastRequestDelegate*)createLoadMediaRequestDelegate:(CDVInvokedUrlCommand*)com }]; } --(CastRequestDelegate*)createSessionUpdateRequestDelegate:(CDVInvokedUrlCommand*)command { +-(MLPCastRequestDelegate*)createSessionUpdateRequestDelegate:(CDVInvokedUrlCommand*)command { return [self createRequestDelegate:command success:^{ - [self.sessionListener onSessionUpdated:[CastUtilities createSessionObject:currentSession]]; + [self.sessionListener onSessionUpdated:[MLPCastUtilities createSessionObject:currentSession]]; CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; } failure:nil abortion:nil]; } --(CastRequestDelegate*)createMediaUpdateRequestDelegate:(CDVInvokedUrlCommand*)command { +-(MLPCastRequestDelegate*)createMediaUpdateRequestDelegate:(CDVInvokedUrlCommand*)command { return [self createRequestDelegate:command success:^{ - [self.sessionListener onMediaUpdated:[CastUtilities createMediaObject:currentSession]]; + [self.sessionListener onMediaUpdated:[MLPCastUtilities createMediaObject:currentSession]]; CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; } failure:nil abortion:nil]; } --(CastRequestDelegate*)createRequestDelegate:(CDVInvokedUrlCommand*)command success:(void(^)(void))success failure:(void(^)(GCKError*))failure abortion:(void(^)(GCKRequestAbortReason))abortion { +-(MLPCastRequestDelegate*)createRequestDelegate:(CDVInvokedUrlCommand*)command success:(void(^)(void))success failure:(void(^)(GCKError*))failure abortion:(void(^)(GCKRequestAbortReason))abortion { // set up any required defaults if (success == nil) { success = ^{ @@ -121,7 +118,7 @@ -(CastRequestDelegate*)createRequestDelegate:(CDVInvokedUrlCommand*)command succ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; }; } - CastRequestDelegate* delegate = [[CastRequestDelegate alloc] initWithSuccess:^{ + MLPCastRequestDelegate* delegate = [[MLPCastRequestDelegate alloc] initWithSuccess:^{ [self checkFinishDelegates]; success(); } failure:^(GCKError * error) { @@ -163,7 +160,7 @@ - (void)setMediaMutedAndVolumeWithCommand:(CDVInvokedUrlCommand*)command { muted = [command.arguments[1] boolValue]; } - __weak ChromecastSession* weakSelf = self; + __weak MLPChromecastSession* weakSelf = self; void (^setMuted)(void) = ^{ // Now set the volume @@ -286,8 +283,8 @@ - (void)queueLoadItemsWithCommand:(CDVInvokedUrlCommand *)command queueItems:(NS } - (void) checkFinishDelegates { - NSMutableArray* tempArray = [NSMutableArray new]; - for (CastRequestDelegate* delegate in requestDelegates) { + NSMutableArray* tempArray = [NSMutableArray new]; + for (MLPCastRequestDelegate* delegate in requestDelegates) { if (!delegate.finished ) { [tempArray addObject:delegate]; } @@ -301,7 +298,7 @@ - (void)sessionManager:(GCKSessionManager *)sessionManager didStartCastSession:( self.remoteMediaClient = session.remoteMediaClient; [self.remoteMediaClient addListener:self]; if (joinSessionCommand != nil) { - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary: [CastUtilities createSessionObject:session] ]; + CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary: [MLPCastUtilities createSessionObject:session] ]; [self.commandDelegate sendPluginResult:pluginResult callbackId:joinSessionCommand.callbackId]; joinSessionCommand = nil; } @@ -330,9 +327,9 @@ - (void)sessionManager:(GCKSessionManager *)sessionManager didEndCastSession:(GC if (isDisconnecting) { // Clear isDisconnecting isDisconnecting = NO; - [self.sessionListener onSessionUpdated:[CastUtilities createSessionObject:session status:@"disconnected"]]; + [self.sessionListener onSessionUpdated:[MLPCastUtilities createSessionObject:session status:@"disconnected"]]; } else { - [self.sessionListener onSessionUpdated:[CastUtilities createSessionObject:session]]; + [self.sessionListener onSessionUpdated:[MLPCastUtilities createSessionObject:session]]; } } @@ -349,7 +346,7 @@ - (void)sessionManager:(GCKSessionManager *)sessionManager didResumeCastSession: // Delay returning the resumed session, so that ios has a chance to get any media first // If we return immediately, the session may be sent out without media even though there should be // The case where a session is resumed that has no media will have to wait the full 2s before being sent - [CastUtilities retry:^BOOL{ + [MLPCastUtilities retry:^BOOL{ // Did we find any media? if (session.remoteMediaClient.mediaStatus != nil) { // No need to wait any longer @@ -358,7 +355,7 @@ - (void)sessionManager:(GCKSessionManager *)sessionManager didResumeCastSession: return NO; } forTries:2 callback:^(BOOL passed){ // trigger the SESSION_LISTENER event - [self.sessionListener onSessionRejoin:[CastUtilities createSessionObject:session]]; + [self.sessionListener onSessionRejoin:[MLPCastUtilities createSessionObject:session]]; // We are done resuming isResumingSession = NO; }]; @@ -392,7 +389,7 @@ - (void)remoteMediaClient:(GCKRemoteMediaClient *)client didUpdateMediaStatus:(G } // update the last media now - lastMedia = [CastUtilities createMediaObject:currentSession]; + lastMedia = [MLPCastUtilities createMediaObject:currentSession]; // Only send updates if we aren't loading media if (!loadMediaCallback && !isResumingSession) { [self.sessionListener onMediaUpdated:lastMedia]; @@ -403,14 +400,14 @@ - (void)remoteMediaClient:(GCKRemoteMediaClient *)client didReceiveQueueItemIDs: // New media has been loaded, wipe any lastMedia reference lastMedia = nil; // Save the queueItemIDs in cast utilities so it can be used when building queue items - [CastUtilities setQueueItemIDs:queueItemIDs]; + [MLPCastUtilities setQueueItemIDs:queueItemIDs]; // If we do not have a loadMediaCallback that means this was an external media load if (!loadMediaCallback) { // So set the callback to trigger the MEDIA_LOAD event loadMediaCallback = ^(NSString* error) { if (!error) { - [self.sessionListener onMediaLoaded:[CastUtilities createMediaObject:currentSession]]; + [self.sessionListener onMediaLoaded:[MLPCastUtilities createMediaObject:currentSession]]; } }; } @@ -430,7 +427,7 @@ - (void)remoteMediaClient:(GCKRemoteMediaClient *)client didReceiveQueueItemIDs: #pragma -- GCKGenericChannelDelegate - (void)castChannel:(GCKGenericChannel *)channel didReceiveTextMessage:(NSString *)message withNamespace:(NSString *)protocolNamespace { - NSDictionary* session = [CastUtilities createSessionObject:currentSession]; + NSDictionary* session = [MLPCastUtilities createSessionObject:currentSession]; [self.sessionListener onMessageReceived:session namespace:protocolNamespace message:message]; } @end