// Autogenerated from Pigeon (v3.1.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "PlatformBridgeApis.h" #import #if !__has_feature(objc_arc) #error File requires ARC to be enabled. #endif static NSDictionary *wrapResult(id result, FlutterError *error) { NSDictionary *errorDict = (NSDictionary *)[NSNull null]; if (error) { errorDict = @{ @"code": (error.code ?: [NSNull null]), @"message": (error.message ?: [NSNull null]), @"details": (error.details ?: [NSNull null]), }; } return @{ @"result": (result ?: [NSNull null]), @"error": errorDict, }; } static id GetNullableObject(NSDictionary* dict, id key) { id result = dict[key]; return (result == [NSNull null]) ? nil : result; } static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { id result = array[key]; return (result == [NSNull null]) ? nil : result; } @interface MediaLoadRequestData () + (MediaLoadRequestData *)fromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface MediaInfo () + (MediaInfo *)fromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface MediaMetadata () + (MediaMetadata *)fromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface WebImage () + (WebImage *)fromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface MediaTrack () + (MediaTrack *)fromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface MediaStatus () + (MediaStatus *)fromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface AdBreakStatus () + (AdBreakStatus *)fromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface AdBreakClipInfo () + (AdBreakClipInfo *)fromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface MediaQueueItem () + (MediaQueueItem *)fromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface CastDevice () + (CastDevice *)fromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @interface CastMessage () + (CastMessage *)fromMap:(NSDictionary *)dict; - (NSDictionary *)toMap; @end @implementation MediaLoadRequestData + (instancetype)makeWithShouldAutoplay:(nullable NSNumber *)shouldAutoplay currentTime:(nullable NSNumber *)currentTime mediaInfo:(nullable MediaInfo *)mediaInfo { MediaLoadRequestData* pigeonResult = [[MediaLoadRequestData alloc] init]; pigeonResult.shouldAutoplay = shouldAutoplay; pigeonResult.currentTime = currentTime; pigeonResult.mediaInfo = mediaInfo; return pigeonResult; } + (MediaLoadRequestData *)fromMap:(NSDictionary *)dict { MediaLoadRequestData *pigeonResult = [[MediaLoadRequestData alloc] init]; pigeonResult.shouldAutoplay = GetNullableObject(dict, @"shouldAutoplay"); pigeonResult.currentTime = GetNullableObject(dict, @"currentTime"); pigeonResult.mediaInfo = [MediaInfo fromMap:GetNullableObject(dict, @"mediaInfo")]; return pigeonResult; } - (NSDictionary *)toMap { return @{ @"shouldAutoplay" : (self.shouldAutoplay ?: [NSNull null]), @"currentTime" : (self.currentTime ?: [NSNull null]), @"mediaInfo" : (self.mediaInfo ? [self.mediaInfo toMap] : [NSNull null]), }; } @end @implementation MediaInfo + (instancetype)makeWithContentId:(nullable NSString *)contentId streamType:(StreamType)streamType contentType:(nullable NSString *)contentType mediaMetadata:(nullable MediaMetadata *)mediaMetadata mediaTracks:(nullable NSArray *)mediaTracks streamDuration:(nullable NSNumber *)streamDuration adBreakClips:(nullable NSArray *)adBreakClips customDataAsJson:(nullable NSString *)customDataAsJson { MediaInfo* pigeonResult = [[MediaInfo alloc] init]; pigeonResult.contentId = contentId; pigeonResult.streamType = streamType; pigeonResult.contentType = contentType; pigeonResult.mediaMetadata = mediaMetadata; pigeonResult.mediaTracks = mediaTracks; pigeonResult.streamDuration = streamDuration; pigeonResult.adBreakClips = adBreakClips; pigeonResult.customDataAsJson = customDataAsJson; return pigeonResult; } + (MediaInfo *)fromMap:(NSDictionary *)dict { MediaInfo *pigeonResult = [[MediaInfo alloc] init]; pigeonResult.contentId = GetNullableObject(dict, @"contentId"); pigeonResult.streamType = [GetNullableObject(dict, @"streamType") integerValue]; pigeonResult.contentType = GetNullableObject(dict, @"contentType"); pigeonResult.mediaMetadata = [MediaMetadata fromMap:GetNullableObject(dict, @"mediaMetadata")]; pigeonResult.mediaTracks = GetNullableObject(dict, @"mediaTracks"); pigeonResult.streamDuration = GetNullableObject(dict, @"streamDuration"); pigeonResult.adBreakClips = GetNullableObject(dict, @"adBreakClips"); pigeonResult.customDataAsJson = GetNullableObject(dict, @"customDataAsJson"); return pigeonResult; } - (NSDictionary *)toMap { return @{ @"contentId" : (self.contentId ?: [NSNull null]), @"streamType" : @(self.streamType), @"contentType" : (self.contentType ?: [NSNull null]), @"mediaMetadata" : (self.mediaMetadata ? [self.mediaMetadata toMap] : [NSNull null]), @"mediaTracks" : (self.mediaTracks ?: [NSNull null]), @"streamDuration" : (self.streamDuration ?: [NSNull null]), @"adBreakClips" : (self.adBreakClips ?: [NSNull null]), @"customDataAsJson" : (self.customDataAsJson ?: [NSNull null]), }; } @end @implementation MediaMetadata + (instancetype)makeWithMediaType:(MediaType)mediaType webImages:(nullable NSArray *)webImages { MediaMetadata* pigeonResult = [[MediaMetadata alloc] init]; pigeonResult.mediaType = mediaType; pigeonResult.webImages = webImages; return pigeonResult; } + (MediaMetadata *)fromMap:(NSDictionary *)dict { MediaMetadata *pigeonResult = [[MediaMetadata alloc] init]; pigeonResult.mediaType = [GetNullableObject(dict, @"mediaType") integerValue]; pigeonResult.webImages = GetNullableObject(dict, @"webImages"); return pigeonResult; } - (NSDictionary *)toMap { return @{ @"mediaType" : @(self.mediaType), @"webImages" : (self.webImages ?: [NSNull null]), }; } @end @implementation WebImage + (instancetype)makeWithUrl:(nullable NSString *)url { WebImage* pigeonResult = [[WebImage alloc] init]; pigeonResult.url = url; return pigeonResult; } + (WebImage *)fromMap:(NSDictionary *)dict { WebImage *pigeonResult = [[WebImage alloc] init]; pigeonResult.url = GetNullableObject(dict, @"url"); return pigeonResult; } - (NSDictionary *)toMap { return @{ @"url" : (self.url ?: [NSNull null]), }; } @end @implementation MediaTrack + (instancetype)makeWithId:(nullable NSNumber *)id trackType:(TrackType)trackType name:(nullable NSString *)name trackSubtype:(TrackSubtype)trackSubtype contentId:(nullable NSString *)contentId language:(nullable NSString *)language { MediaTrack* pigeonResult = [[MediaTrack alloc] init]; pigeonResult.id = id; pigeonResult.trackType = trackType; pigeonResult.name = name; pigeonResult.trackSubtype = trackSubtype; pigeonResult.contentId = contentId; pigeonResult.language = language; return pigeonResult; } + (MediaTrack *)fromMap:(NSDictionary *)dict { MediaTrack *pigeonResult = [[MediaTrack alloc] init]; pigeonResult.id = GetNullableObject(dict, @"id"); pigeonResult.trackType = [GetNullableObject(dict, @"trackType") integerValue]; pigeonResult.name = GetNullableObject(dict, @"name"); pigeonResult.trackSubtype = [GetNullableObject(dict, @"trackSubtype") integerValue]; pigeonResult.contentId = GetNullableObject(dict, @"contentId"); pigeonResult.language = GetNullableObject(dict, @"language"); return pigeonResult; } - (NSDictionary *)toMap { return @{ @"id" : (self.id ?: [NSNull null]), @"trackType" : @(self.trackType), @"name" : (self.name ?: [NSNull null]), @"trackSubtype" : @(self.trackSubtype), @"contentId" : (self.contentId ?: [NSNull null]), @"language" : (self.language ?: [NSNull null]), }; } @end @implementation MediaStatus + (instancetype)makeWithPlayerState:(PlayerState)playerState isPlayingAd:(nullable NSNumber *)isPlayingAd mediaInfo:(nullable MediaInfo *)mediaInfo adBreakStatus:(nullable AdBreakStatus *)adBreakStatus { MediaStatus* pigeonResult = [[MediaStatus alloc] init]; pigeonResult.playerState = playerState; pigeonResult.isPlayingAd = isPlayingAd; pigeonResult.mediaInfo = mediaInfo; pigeonResult.adBreakStatus = adBreakStatus; return pigeonResult; } + (MediaStatus *)fromMap:(NSDictionary *)dict { MediaStatus *pigeonResult = [[MediaStatus alloc] init]; pigeonResult.playerState = [GetNullableObject(dict, @"playerState") integerValue]; pigeonResult.isPlayingAd = GetNullableObject(dict, @"isPlayingAd"); pigeonResult.mediaInfo = [MediaInfo fromMap:GetNullableObject(dict, @"mediaInfo")]; pigeonResult.adBreakStatus = [AdBreakStatus fromMap:GetNullableObject(dict, @"adBreakStatus")]; return pigeonResult; } - (NSDictionary *)toMap { return @{ @"playerState" : @(self.playerState), @"isPlayingAd" : (self.isPlayingAd ?: [NSNull null]), @"mediaInfo" : (self.mediaInfo ? [self.mediaInfo toMap] : [NSNull null]), @"adBreakStatus" : (self.adBreakStatus ? [self.adBreakStatus toMap] : [NSNull null]), }; } @end @implementation AdBreakStatus + (instancetype)makeWithAdBreakId:(nullable NSString *)adBreakId adBreakClipId:(nullable NSString *)adBreakClipId whenSkippableMs:(nullable NSNumber *)whenSkippableMs { AdBreakStatus* pigeonResult = [[AdBreakStatus alloc] init]; pigeonResult.adBreakId = adBreakId; pigeonResult.adBreakClipId = adBreakClipId; pigeonResult.whenSkippableMs = whenSkippableMs; return pigeonResult; } + (AdBreakStatus *)fromMap:(NSDictionary *)dict { AdBreakStatus *pigeonResult = [[AdBreakStatus alloc] init]; pigeonResult.adBreakId = GetNullableObject(dict, @"adBreakId"); pigeonResult.adBreakClipId = GetNullableObject(dict, @"adBreakClipId"); pigeonResult.whenSkippableMs = GetNullableObject(dict, @"whenSkippableMs"); return pigeonResult; } - (NSDictionary *)toMap { return @{ @"adBreakId" : (self.adBreakId ?: [NSNull null]), @"adBreakClipId" : (self.adBreakClipId ?: [NSNull null]), @"whenSkippableMs" : (self.whenSkippableMs ?: [NSNull null]), }; } @end @implementation AdBreakClipInfo + (instancetype)makeWithId:(nullable NSString *)id title:(nullable NSString *)title contentId:(nullable NSString *)contentId contentUrl:(nullable NSString *)contentUrl clickThroughUrl:(nullable NSString *)clickThroughUrl durationMs:(nullable NSNumber *)durationMs imageUrl:(nullable NSString *)imageUrl mimeType:(nullable NSString *)mimeType whenSkippableMs:(nullable NSNumber *)whenSkippableMs { AdBreakClipInfo* pigeonResult = [[AdBreakClipInfo alloc] init]; pigeonResult.id = id; pigeonResult.title = title; pigeonResult.contentId = contentId; pigeonResult.contentUrl = contentUrl; pigeonResult.clickThroughUrl = clickThroughUrl; pigeonResult.durationMs = durationMs; pigeonResult.imageUrl = imageUrl; pigeonResult.mimeType = mimeType; pigeonResult.whenSkippableMs = whenSkippableMs; return pigeonResult; } + (AdBreakClipInfo *)fromMap:(NSDictionary *)dict { AdBreakClipInfo *pigeonResult = [[AdBreakClipInfo alloc] init]; pigeonResult.id = GetNullableObject(dict, @"id"); pigeonResult.title = GetNullableObject(dict, @"title"); pigeonResult.contentId = GetNullableObject(dict, @"contentId"); pigeonResult.contentUrl = GetNullableObject(dict, @"contentUrl"); pigeonResult.clickThroughUrl = GetNullableObject(dict, @"clickThroughUrl"); pigeonResult.durationMs = GetNullableObject(dict, @"durationMs"); pigeonResult.imageUrl = GetNullableObject(dict, @"imageUrl"); pigeonResult.mimeType = GetNullableObject(dict, @"mimeType"); pigeonResult.whenSkippableMs = GetNullableObject(dict, @"whenSkippableMs"); return pigeonResult; } - (NSDictionary *)toMap { return @{ @"id" : (self.id ?: [NSNull null]), @"title" : (self.title ?: [NSNull null]), @"contentId" : (self.contentId ?: [NSNull null]), @"contentUrl" : (self.contentUrl ?: [NSNull null]), @"clickThroughUrl" : (self.clickThroughUrl ?: [NSNull null]), @"durationMs" : (self.durationMs ?: [NSNull null]), @"imageUrl" : (self.imageUrl ?: [NSNull null]), @"mimeType" : (self.mimeType ?: [NSNull null]), @"whenSkippableMs" : (self.whenSkippableMs ?: [NSNull null]), }; } @end @implementation MediaQueueItem + (instancetype)makeWithItemId:(nullable NSNumber *)itemId playbackDuration:(nullable NSNumber *)playbackDuration startTime:(nullable NSNumber *)startTime media:(nullable MediaInfo *)media autoplay:(nullable NSNumber *)autoplay preloadTime:(nullable NSNumber *)preloadTime { MediaQueueItem* pigeonResult = [[MediaQueueItem alloc] init]; pigeonResult.itemId = itemId; pigeonResult.playbackDuration = playbackDuration; pigeonResult.startTime = startTime; pigeonResult.media = media; pigeonResult.autoplay = autoplay; pigeonResult.preloadTime = preloadTime; return pigeonResult; } + (MediaQueueItem *)fromMap:(NSDictionary *)dict { MediaQueueItem *pigeonResult = [[MediaQueueItem alloc] init]; pigeonResult.itemId = GetNullableObject(dict, @"itemId"); pigeonResult.playbackDuration = GetNullableObject(dict, @"playbackDuration"); pigeonResult.startTime = GetNullableObject(dict, @"startTime"); pigeonResult.media = [MediaInfo fromMap:GetNullableObject(dict, @"media")]; pigeonResult.autoplay = GetNullableObject(dict, @"autoplay"); pigeonResult.preloadTime = GetNullableObject(dict, @"preloadTime"); return pigeonResult; } - (NSDictionary *)toMap { return @{ @"itemId" : (self.itemId ?: [NSNull null]), @"playbackDuration" : (self.playbackDuration ?: [NSNull null]), @"startTime" : (self.startTime ?: [NSNull null]), @"media" : (self.media ? [self.media toMap] : [NSNull null]), @"autoplay" : (self.autoplay ?: [NSNull null]), @"preloadTime" : (self.preloadTime ?: [NSNull null]), }; } @end @implementation CastDevice + (instancetype)makeWithDeviceId:(nullable NSString *)deviceId friendlyName:(nullable NSString *)friendlyName modelName:(nullable NSString *)modelName { CastDevice* pigeonResult = [[CastDevice alloc] init]; pigeonResult.deviceId = deviceId; pigeonResult.friendlyName = friendlyName; pigeonResult.modelName = modelName; return pigeonResult; } + (CastDevice *)fromMap:(NSDictionary *)dict { CastDevice *pigeonResult = [[CastDevice alloc] init]; pigeonResult.deviceId = GetNullableObject(dict, @"deviceId"); pigeonResult.friendlyName = GetNullableObject(dict, @"friendlyName"); pigeonResult.modelName = GetNullableObject(dict, @"modelName"); return pigeonResult; } - (NSDictionary *)toMap { return @{ @"deviceId" : (self.deviceId ?: [NSNull null]), @"friendlyName" : (self.friendlyName ?: [NSNull null]), @"modelName" : (self.modelName ?: [NSNull null]), }; } @end @implementation CastMessage + (instancetype)makeWithNamespace:(nullable NSString *)namespace message:(nullable NSString *)message { CastMessage* pigeonResult = [[CastMessage alloc] init]; pigeonResult.namespace = namespace; pigeonResult.message = message; return pigeonResult; } + (CastMessage *)fromMap:(NSDictionary *)dict { CastMessage *pigeonResult = [[CastMessage alloc] init]; pigeonResult.namespace = GetNullableObject(dict, @"namespace"); pigeonResult.message = GetNullableObject(dict, @"message"); return pigeonResult; } - (NSDictionary *)toMap { return @{ @"namespace" : (self.namespace ?: [NSNull null]), @"message" : (self.message ?: [NSNull null]), }; } @end @interface CastHostApiCodecReader : FlutterStandardReader @end @implementation CastHostApiCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 128: return [AdBreakClipInfo fromMap:[self readValue]]; case 129: return [CastDevice fromMap:[self readValue]]; case 130: return [CastMessage fromMap:[self readValue]]; case 131: return [MediaInfo fromMap:[self readValue]]; case 132: return [MediaLoadRequestData fromMap:[self readValue]]; case 133: return [MediaMetadata fromMap:[self readValue]]; case 134: return [MediaQueueItem fromMap:[self readValue]]; case 135: return [MediaTrack fromMap:[self readValue]]; case 136: return [WebImage fromMap:[self readValue]]; default: return [super readValueOfType:type]; } } @end @interface CastHostApiCodecWriter : FlutterStandardWriter @end @implementation CastHostApiCodecWriter - (void)writeValue:(id)value { if ([value isKindOfClass:[AdBreakClipInfo class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; } else if ([value isKindOfClass:[CastDevice class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; } else if ([value isKindOfClass:[CastMessage class]]) { [self writeByte:130]; [self writeValue:[value toMap]]; } else if ([value isKindOfClass:[MediaInfo class]]) { [self writeByte:131]; [self writeValue:[value toMap]]; } else if ([value isKindOfClass:[MediaLoadRequestData class]]) { [self writeByte:132]; [self writeValue:[value toMap]]; } else if ([value isKindOfClass:[MediaMetadata class]]) { [self writeByte:133]; [self writeValue:[value toMap]]; } else if ([value isKindOfClass:[MediaQueueItem class]]) { [self writeByte:134]; [self writeValue:[value toMap]]; } else if ([value isKindOfClass:[MediaTrack class]]) { [self writeByte:135]; [self writeValue:[value toMap]]; } else if ([value isKindOfClass:[WebImage class]]) { [self writeByte:136]; [self writeValue:[value toMap]]; } else { [super writeValue:value]; } } @end @interface CastHostApiCodecReaderWriter : FlutterStandardReaderWriter @end @implementation CastHostApiCodecReaderWriter - (FlutterStandardWriter *)writerWithData:(NSMutableData *)data { return [[CastHostApiCodecWriter alloc] initWithData:data]; } - (FlutterStandardReader *)readerWithData:(NSData *)data { return [[CastHostApiCodecReader alloc] initWithData:data]; } @end NSObject *CastHostApiGetCodec() { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ CastHostApiCodecReaderWriter *readerWriter = [[CastHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } void CastHostApiSetup(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:@"dev.flutter.pigeon.CastHostApi.sendMessage" binaryMessenger:binaryMessenger codec:CastHostApiGetCodec() ]; if (api) { NSCAssert([api respondsToSelector:@selector(sendMessageMessage:error:)], @"CastHostApi api (%@) doesn't respond to @selector(sendMessageMessage:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; CastMessage *arg_message = GetNullableObjectAtIndex(args, 0); FlutterError *error; [api sendMessageMessage:arg_message error:&error]; callback(wrapResult(nil, error)); }]; } else { [channel setMessageHandler:nil]; } } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:@"dev.flutter.pigeon.CastHostApi.showCastDialog" binaryMessenger:binaryMessenger codec:CastHostApiGetCodec() ]; if (api) { NSCAssert([api respondsToSelector:@selector(showCastDialogWithError:)], @"CastHostApi api (%@) doesn't respond to @selector(showCastDialogWithError:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; [api showCastDialogWithError:&error]; callback(wrapResult(nil, error)); }]; } else { [channel setMessageHandler:nil]; } } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:@"dev.flutter.pigeon.CastHostApi.setMute" binaryMessenger:binaryMessenger codec:CastHostApiGetCodec() ]; if (api) { NSCAssert([api respondsToSelector:@selector(setMuteMuted:error:)], @"CastHostApi api (%@) doesn't respond to @selector(setMuteMuted:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_muted = GetNullableObjectAtIndex(args, 0); FlutterError *error; [api setMuteMuted:arg_muted error:&error]; callback(wrapResult(nil, error)); }]; } else { [channel setMessageHandler:nil]; } } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:@"dev.flutter.pigeon.CastHostApi.getCastDevice" binaryMessenger:binaryMessenger codec:CastHostApiGetCodec() ]; if (api) { NSCAssert([api respondsToSelector:@selector(getCastDeviceWithError:)], @"CastHostApi api (%@) doesn't respond to @selector(getCastDeviceWithError:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; CastDevice *output = [api getCastDeviceWithError:&error]; callback(wrapResult(output, error)); }]; } else { [channel setMessageHandler:nil]; } } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:@"dev.flutter.pigeon.CastHostApi.loadMediaLoadRequestData" binaryMessenger:binaryMessenger codec:CastHostApiGetCodec() ]; if (api) { NSCAssert([api respondsToSelector:@selector(loadMediaLoadRequestDataRequest:error:)], @"CastHostApi api (%@) doesn't respond to @selector(loadMediaLoadRequestDataRequest:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; MediaLoadRequestData *arg_request = GetNullableObjectAtIndex(args, 0); FlutterError *error; [api loadMediaLoadRequestDataRequest:arg_request error:&error]; callback(wrapResult(nil, error)); }]; } else { [channel setMessageHandler:nil]; } } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:@"dev.flutter.pigeon.CastHostApi.getMediaInfo" binaryMessenger:binaryMessenger codec:CastHostApiGetCodec() ]; if (api) { NSCAssert([api respondsToSelector:@selector(getMediaInfoWithError:)], @"CastHostApi api (%@) doesn't respond to @selector(getMediaInfoWithError:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; MediaInfo *output = [api getMediaInfoWithError:&error]; callback(wrapResult(output, error)); }]; } else { [channel setMessageHandler:nil]; } } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:@"dev.flutter.pigeon.CastHostApi.play" binaryMessenger:binaryMessenger codec:CastHostApiGetCodec() ]; if (api) { NSCAssert([api respondsToSelector:@selector(playWithError:)], @"CastHostApi api (%@) doesn't respond to @selector(playWithError:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; [api playWithError:&error]; callback(wrapResult(nil, error)); }]; } else { [channel setMessageHandler:nil]; } } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:@"dev.flutter.pigeon.CastHostApi.pause" binaryMessenger:binaryMessenger codec:CastHostApiGetCodec() ]; if (api) { NSCAssert([api respondsToSelector:@selector(pauseWithError:)], @"CastHostApi api (%@) doesn't respond to @selector(pauseWithError:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; [api pauseWithError:&error]; callback(wrapResult(nil, error)); }]; } else { [channel setMessageHandler:nil]; } } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:@"dev.flutter.pigeon.CastHostApi.stop" binaryMessenger:binaryMessenger codec:CastHostApiGetCodec() ]; if (api) { NSCAssert([api respondsToSelector:@selector(stopWithError:)], @"CastHostApi api (%@) doesn't respond to @selector(stopWithError:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; [api stopWithError:&error]; callback(wrapResult(nil, error)); }]; } else { [channel setMessageHandler:nil]; } } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:@"dev.flutter.pigeon.CastHostApi.showTracksChooserDialog" binaryMessenger:binaryMessenger codec:CastHostApiGetCodec() ]; if (api) { NSCAssert([api respondsToSelector:@selector(showTracksChooserDialogWithError:)], @"CastHostApi api (%@) doesn't respond to @selector(showTracksChooserDialogWithError:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; [api showTracksChooserDialogWithError:&error]; callback(wrapResult(nil, error)); }]; } else { [channel setMessageHandler:nil]; } } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:@"dev.flutter.pigeon.CastHostApi.skipAd" binaryMessenger:binaryMessenger codec:CastHostApiGetCodec() ]; if (api) { NSCAssert([api respondsToSelector:@selector(skipAdWithError:)], @"CastHostApi api (%@) doesn't respond to @selector(skipAdWithError:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; [api skipAdWithError:&error]; callback(wrapResult(nil, error)); }]; } else { [channel setMessageHandler:nil]; } } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:@"dev.flutter.pigeon.CastHostApi.queueAppendItem" binaryMessenger:binaryMessenger codec:CastHostApiGetCodec() ]; if (api) { NSCAssert([api respondsToSelector:@selector(queueAppendItemItem:error:)], @"CastHostApi api (%@) doesn't respond to @selector(queueAppendItemItem:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; MediaQueueItem *arg_item = GetNullableObjectAtIndex(args, 0); FlutterError *error; [api queueAppendItemItem:arg_item error:&error]; callback(wrapResult(nil, error)); }]; } else { [channel setMessageHandler:nil]; } } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:@"dev.flutter.pigeon.CastHostApi.queueNextItem" binaryMessenger:binaryMessenger codec:CastHostApiGetCodec() ]; if (api) { NSCAssert([api respondsToSelector:@selector(queueNextItemWithError:)], @"CastHostApi api (%@) doesn't respond to @selector(queueNextItemWithError:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; [api queueNextItemWithError:&error]; callback(wrapResult(nil, error)); }]; } else { [channel setMessageHandler:nil]; } } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:@"dev.flutter.pigeon.CastHostApi.queuePrevItem" binaryMessenger:binaryMessenger codec:CastHostApiGetCodec() ]; if (api) { NSCAssert([api respondsToSelector:@selector(queuePrevItemWithError:)], @"CastHostApi api (%@) doesn't respond to @selector(queuePrevItemWithError:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; [api queuePrevItemWithError:&error]; callback(wrapResult(nil, error)); }]; } else { [channel setMessageHandler:nil]; } } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:@"dev.flutter.pigeon.CastHostApi.getQueueItemCount" binaryMessenger:binaryMessenger codec:CastHostApiGetCodec() ]; if (api) { NSCAssert([api respondsToSelector:@selector(getQueueItemCountWithError:)], @"CastHostApi api (%@) doesn't respond to @selector(getQueueItemCountWithError:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; NSNumber *output = [api getQueueItemCountWithError:&error]; callback(wrapResult(output, error)); }]; } else { [channel setMessageHandler:nil]; } } { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:@"dev.flutter.pigeon.CastHostApi.getQueueItemAtIndex" binaryMessenger:binaryMessenger codec:CastHostApiGetCodec() ]; if (api) { NSCAssert([api respondsToSelector:@selector(getQueueItemAtIndexIndex:error:)], @"CastHostApi api (%@) doesn't respond to @selector(getQueueItemAtIndexIndex:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSNumber *arg_index = GetNullableObjectAtIndex(args, 0); FlutterError *error; MediaQueueItem *output = [api getQueueItemAtIndexIndex:arg_index error:&error]; callback(wrapResult(output, error)); }]; } else { [channel setMessageHandler:nil]; } } } @interface CastFlutterApiCodecReader : FlutterStandardReader @end @implementation CastFlutterApiCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 128: return [AdBreakClipInfo fromMap:[self readValue]]; case 129: return [AdBreakStatus fromMap:[self readValue]]; case 130: return [CastMessage fromMap:[self readValue]]; case 131: return [MediaInfo fromMap:[self readValue]]; case 132: return [MediaMetadata fromMap:[self readValue]]; case 133: return [MediaStatus fromMap:[self readValue]]; case 134: return [MediaTrack fromMap:[self readValue]]; case 135: return [WebImage fromMap:[self readValue]]; default: return [super readValueOfType:type]; } } @end @interface CastFlutterApiCodecWriter : FlutterStandardWriter @end @implementation CastFlutterApiCodecWriter - (void)writeValue:(id)value { if ([value isKindOfClass:[AdBreakClipInfo class]]) { [self writeByte:128]; [self writeValue:[value toMap]]; } else if ([value isKindOfClass:[AdBreakStatus class]]) { [self writeByte:129]; [self writeValue:[value toMap]]; } else if ([value isKindOfClass:[CastMessage class]]) { [self writeByte:130]; [self writeValue:[value toMap]]; } else if ([value isKindOfClass:[MediaInfo class]]) { [self writeByte:131]; [self writeValue:[value toMap]]; } else if ([value isKindOfClass:[MediaMetadata class]]) { [self writeByte:132]; [self writeValue:[value toMap]]; } else if ([value isKindOfClass:[MediaStatus class]]) { [self writeByte:133]; [self writeValue:[value toMap]]; } else if ([value isKindOfClass:[MediaTrack class]]) { [self writeByte:134]; [self writeValue:[value toMap]]; } else if ([value isKindOfClass:[WebImage class]]) { [self writeByte:135]; [self writeValue:[value toMap]]; } else { [super writeValue:value]; } } @end @interface CastFlutterApiCodecReaderWriter : FlutterStandardReaderWriter @end @implementation CastFlutterApiCodecReaderWriter - (FlutterStandardWriter *)writerWithData:(NSMutableData *)data { return [[CastFlutterApiCodecWriter alloc] initWithData:data]; } - (FlutterStandardReader *)readerWithData:(NSData *)data { return [[CastFlutterApiCodecReader alloc] initWithData:data]; } @end NSObject *CastFlutterApiGetCodec() { static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; dispatch_once(&sPred, ^{ CastFlutterApiCodecReaderWriter *readerWriter = [[CastFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } @interface CastFlutterApi () @property (nonatomic, strong) NSObject *binaryMessenger; @end @implementation CastFlutterApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { self = [super init]; if (self) { _binaryMessenger = binaryMessenger; } return self; } - (void)getSessionMessageNamespacesWithCompletion:(void(^)(NSArray *_Nullable, NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.getSessionMessageNamespaces" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:nil reply:^(id reply) { NSArray *output = reply; completion(output, nil); }]; } - (void)onCastStateChangedCastState:(NSNumber *)arg_castState completion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onCastStateChanged" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:@[arg_castState ?: [NSNull null]] reply:^(id reply) { completion(nil); }]; } - (void)onMessageReceivedMessage:(CastMessage *)arg_message completion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onMessageReceived" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:@[arg_message ?: [NSNull null]] reply:^(id reply) { completion(nil); }]; } - (void)onSessionStartingWithCompletion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionStarting" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:nil reply:^(id reply) { completion(nil); }]; } - (void)onSessionStartedWithCompletion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionStarted" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:nil reply:^(id reply) { completion(nil); }]; } - (void)onSessionStartFailedWithCompletion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionStartFailed" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:nil reply:^(id reply) { completion(nil); }]; } - (void)onSessionEndingWithCompletion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionEnding" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:nil reply:^(id reply) { completion(nil); }]; } - (void)onSessionEndedWithCompletion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionEnded" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:nil reply:^(id reply) { completion(nil); }]; } - (void)onSessionResumingWithCompletion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionResuming" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:nil reply:^(id reply) { completion(nil); }]; } - (void)onSessionResumedWithCompletion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionResumed" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:nil reply:^(id reply) { completion(nil); }]; } - (void)onSessionResumeFailedWithCompletion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionResumeFailed" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:nil reply:^(id reply) { completion(nil); }]; } - (void)onSessionSuspendedWithCompletion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionSuspended" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:nil reply:^(id reply) { completion(nil); }]; } - (void)onStatusUpdatedMediaStatus:(MediaStatus *)arg_mediaStatus completion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onStatusUpdated" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:@[arg_mediaStatus ?: [NSNull null]] reply:^(id reply) { completion(nil); }]; } - (void)onMetadataUpdatedWithCompletion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onMetadataUpdated" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:nil reply:^(id reply) { completion(nil); }]; } - (void)onQueueStatusUpdatedWithCompletion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onQueueStatusUpdated" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:nil reply:^(id reply) { completion(nil); }]; } - (void)onPreloadStatusUpdatedWithCompletion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onPreloadStatusUpdated" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:nil reply:^(id reply) { completion(nil); }]; } - (void)onSendingRemoteMediaRequestWithCompletion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSendingRemoteMediaRequest" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:nil reply:^(id reply) { completion(nil); }]; } - (void)onAdBreakStatusUpdatedMediaStatus:(MediaStatus *)arg_mediaStatus completion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onAdBreakStatusUpdated" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:@[arg_mediaStatus ?: [NSNull null]] reply:^(id reply) { completion(nil); }]; } - (void)onMediaErrorWithCompletion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onMediaError" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:nil reply:^(id reply) { completion(nil); }]; } - (void)onProgressUpdatedProgressMs:(NSNumber *)arg_progressMs durationMs:(NSNumber *)arg_durationMs completion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onProgressUpdated" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:@[arg_progressMs ?: [NSNull null], arg_durationMs ?: [NSNull null]] reply:^(id reply) { completion(nil); }]; } - (void)onAdBreakClipProgressUpdatedAdBreakId:(NSString *)arg_adBreakId adBreakClipId:(NSString *)arg_adBreakClipId progressMs:(NSNumber *)arg_progressMs durationMs:(NSNumber *)arg_durationMs whenSkippableMs:(NSNumber *)arg_whenSkippableMs completion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onAdBreakClipProgressUpdated" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:@[arg_adBreakId ?: [NSNull null], arg_adBreakClipId ?: [NSNull null], arg_progressMs ?: [NSNull null], arg_durationMs ?: [NSNull null], arg_whenSkippableMs ?: [NSNull null]] reply:^(id reply) { completion(nil); }]; } - (void)itemsInsertedInRangeInsertIndex:(NSNumber *)arg_insertIndex insertCount:(NSNumber *)arg_insertCount completion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.itemsInsertedInRange" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:@[arg_insertIndex ?: [NSNull null], arg_insertCount ?: [NSNull null]] reply:^(id reply) { completion(nil); }]; } - (void)itemsReloadedWithCompletion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.itemsReloaded" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:nil reply:^(id reply) { completion(nil); }]; } - (void)itemsRemovedAtIndexesIndexes:(NSArray *)arg_indexes completion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.itemsRemovedAtIndexes" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:@[arg_indexes ?: [NSNull null]] reply:^(id reply) { completion(nil); }]; } - (void)itemsReorderedAtIndexesIndexes:(NSArray *)arg_indexes insertBeforeIndex:(NSNumber *)arg_insertBeforeIndex completion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.itemsReorderedAtIndexes" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:@[arg_indexes ?: [NSNull null], arg_insertBeforeIndex ?: [NSNull null]] reply:^(id reply) { completion(nil); }]; } - (void)itemsUpdatedAtIndexesIndexes:(NSArray *)arg_indexes completion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.itemsUpdatedAtIndexes" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:@[arg_indexes ?: [NSNull null]] reply:^(id reply) { completion(nil); }]; } - (void)mediaQueueChangedWithCompletion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.mediaQueueChanged" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:nil reply:^(id reply) { completion(nil); }]; } - (void)mediaQueueWillChangeWithCompletion:(void(^)(NSError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.mediaQueueWillChange" binaryMessenger:self.binaryMessenger codec:CastFlutterApiGetCodec()]; [channel sendMessage:nil reply:^(id reply) { completion(nil); }]; } @end