From 15429df0d2de2154422fcfc0f18fd1defdb9014b Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 1 Aug 2024 16:31:14 -0400 Subject: [PATCH 01/14] update list of events --- .../lib/src/android/android_ads_manager.dart | 12 ++- .../lib/src/android/enum_converter_utils.dart | 26 +++++- .../lib/src/ios/enum_converter_utils.dart | 25 +++++- .../lib/src/ios/ios_ads_manager_delegate.dart | 12 ++- .../lib/src/platform_interface/ad_event.dart | 81 ++++++++++++++++++- 5 files changed, 137 insertions(+), 19 deletions(-) diff --git a/packages/interactive_media_ads/lib/src/android/android_ads_manager.dart b/packages/interactive_media_ads/lib/src/android/android_ads_manager.dart index bca0a69f55a1..eadfe39eafa8 100644 --- a/packages/interactive_media_ads/lib/src/android/android_ads_manager.dart +++ b/packages/interactive_media_ads/lib/src/android/android_ads_manager.dart @@ -57,13 +57,11 @@ class AndroidAdsManager extends PlatformAdsManager { weakThis.target?._manager.addAdEventListener( proxy.newAdEventListener( onAdEvent: (_, ima.AdEvent event) { - late final AdEventType? eventType = toInterfaceEventType(event.type); - if (eventType == null) { - return; - } - - weakThis.target?._managerDelegate?.params.onAdEvent - ?.call(AdEvent(type: eventType)); + weakThis.target?._managerDelegate?.params.onAdEvent?.call( + AdEvent( + type: toInterfaceEventType(event.type), + ), + ); }, ), ); diff --git a/packages/interactive_media_ads/lib/src/android/enum_converter_utils.dart b/packages/interactive_media_ads/lib/src/android/enum_converter_utils.dart index 75882b93e2b1..46fbe72ec204 100644 --- a/packages/interactive_media_ads/lib/src/android/enum_converter_utils.dart +++ b/packages/interactive_media_ads/lib/src/android/enum_converter_utils.dart @@ -17,7 +17,7 @@ AdErrorType toInterfaceErrorType(ima.AdErrorType type) { /// Attempts to convert an [ima.AdEventType] to [AdEventType]. /// /// Returns null is the type is not supported by the platform interface. -AdEventType? toInterfaceEventType(ima.AdEventType type) { +AdEventType toInterfaceEventType(ima.AdEventType type) { return switch (type) { ima.AdEventType.allAdsCompleted => AdEventType.allAdsCompleted, ima.AdEventType.completed => AdEventType.complete, @@ -26,7 +26,29 @@ AdEventType? toInterfaceEventType(ima.AdEventType type) { AdEventType.contentResumeRequested, ima.AdEventType.loaded => AdEventType.loaded, ima.AdEventType.clicked => AdEventType.clicked, - _ => null, + ima.AdEventType.adBreakEnded => AdEventType.adBreakEnded, + ima.AdEventType.adBreakFetchError => AdEventType.adBreakFetchError, + ima.AdEventType.adBreakReady => AdEventType.adBreakReady, + ima.AdEventType.adBreakStarted => AdEventType.adBreakStarted, + ima.AdEventType.adBuffering => AdEventType.adBuffering, + ima.AdEventType.adPeriodEnded => AdEventType.adPeriodEnded, + ima.AdEventType.adPeriodStarted => AdEventType.adPeriodStarted, + ima.AdEventType.adProgress => AdEventType.adProgress, + ima.AdEventType.cuepointsChanged => AdEventType.cuepointsChanged, + ima.AdEventType.firstQuartile => AdEventType.firstQuartile, + ima.AdEventType.iconFallbackImageClosed => + AdEventType.iconFallbackImageClosed, + ima.AdEventType.iconTapped => AdEventType.iconTapped, + ima.AdEventType.log => AdEventType.log, + ima.AdEventType.midpoint => AdEventType.midpoint, + ima.AdEventType.paused => AdEventType.paused, + ima.AdEventType.resumed => AdEventType.resumed, + ima.AdEventType.skippableStateChanged => AdEventType.skippableStateChanged, + ima.AdEventType.skipped => AdEventType.skipped, + ima.AdEventType.started => AdEventType.started, + ima.AdEventType.tapped => AdEventType.tapped, + ima.AdEventType.thirdQuartile => AdEventType.thirdQuartile, + ima.AdEventType.unknown => AdEventType.unknown, }; } diff --git a/packages/interactive_media_ads/lib/src/ios/enum_converter_utils.dart b/packages/interactive_media_ads/lib/src/ios/enum_converter_utils.dart index 6ce8f06b1f66..46c7a4e9a6bf 100644 --- a/packages/interactive_media_ads/lib/src/ios/enum_converter_utils.dart +++ b/packages/interactive_media_ads/lib/src/ios/enum_converter_utils.dart @@ -17,13 +17,34 @@ AdErrorType toInterfaceErrorType(ima.AdErrorType type) { /// Attempts to convert an [ima.AdEventType] to [AdEventType]. /// /// Returns null is the type is not supported by the platform interface. -AdEventType? toInterfaceEventType(ima.AdEventType type) { +AdEventType toInterfaceEventType(ima.AdEventType type) { return switch (type) { ima.AdEventType.allAdsCompleted => AdEventType.allAdsCompleted, ima.AdEventType.completed => AdEventType.complete, ima.AdEventType.loaded => AdEventType.loaded, ima.AdEventType.clicked => AdEventType.clicked, - _ => null, + ima.AdEventType.adBreakEnded => AdEventType.adBreakEnded, + ima.AdEventType.adBreakFetchError => AdEventType.adBreakFetchError, + ima.AdEventType.adBreakReady => AdEventType.adBreakReady, + ima.AdEventType.adBreakStarted => AdEventType.adBreakStarted, + ima.AdEventType.adPeriodEnded => AdEventType.adPeriodEnded, + ima.AdEventType.adPeriodStarted => AdEventType.adPeriodStarted, + ima.AdEventType.cuepointsChanged => AdEventType.cuepointsChanged, + ima.AdEventType.firstQuartile => AdEventType.firstQuartile, + ima.AdEventType.iconFallbackImageClosed => + AdEventType.iconFallbackImageClosed, + ima.AdEventType.iconTapped => AdEventType.iconTapped, + ima.AdEventType.log => AdEventType.log, + ima.AdEventType.midpoint => AdEventType.midpoint, + ima.AdEventType.pause => AdEventType.paused, + ima.AdEventType.resume => AdEventType.resumed, + ima.AdEventType.skipped => AdEventType.skipped, + ima.AdEventType.started => AdEventType.started, + ima.AdEventType.streamLoaded => AdEventType.streamLoaded, + ima.AdEventType.streamStarted => AdEventType.streamStarted, + ima.AdEventType.tapped => AdEventType.tapped, + ima.AdEventType.thirdQuartile => AdEventType.thirdQuartile, + ima.AdEventType.unknown => AdEventType.unknown, }; } diff --git a/packages/interactive_media_ads/lib/src/ios/ios_ads_manager_delegate.dart b/packages/interactive_media_ads/lib/src/ios/ios_ads_manager_delegate.dart index 438d8c9d8a18..a45afe1dc81f 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_ads_manager_delegate.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_ads_manager_delegate.dart @@ -64,13 +64,11 @@ final class IOSAdsManagerDelegate extends PlatformAdsManagerDelegate { ) { return interfaceDelegate.target!._iosParams._proxy.newIMAAdsManagerDelegate( didReceiveAdEvent: (_, __, ima.IMAAdEvent event) { - late final AdEventType? eventType = toInterfaceEventType(event.type); - if (eventType == null) { - return; - } - - interfaceDelegate.target?.params.onAdEvent - ?.call(AdEvent(type: eventType)); + interfaceDelegate.target?.params.onAdEvent?.call( + AdEvent( + type: toInterfaceEventType(event.type), + ), + ); }, didReceiveAdError: (_, __, ima.IMAAdError event) { interfaceDelegate.target?.params.onAdErrorEvent?.call( diff --git a/packages/interactive_media_ads/lib/src/platform_interface/ad_event.dart b/packages/interactive_media_ads/lib/src/platform_interface/ad_event.dart index 9824d9915fb3..e8798ac5595c 100644 --- a/packages/interactive_media_ads/lib/src/platform_interface/ad_event.dart +++ b/packages/interactive_media_ads/lib/src/platform_interface/ad_event.dart @@ -8,6 +8,31 @@ import 'ad_error.dart'; /// Types of events that can occur during ad playback. enum AdEventType { + /// Fired when an ad break in a stream ends. + adBreakEnded, + + /// Fired when an ad break will not play back any ads. + adBreakFetchError, + + /// Fired when an ad break is ready from VMAP or ad rule ads. + adBreakReady, + + /// Fired when an ad break in a stream starts. + adBreakStarted, + + /// Fired when playback stalls while the ad buffers. + adBuffering, + + /// Fired when an ad period in a stream ends. + adPeriodEnded, + + /// Fired when an ad period in a stream starts. + adPeriodStarted, + + /// Fired to inform of ad progress and can be used by publisher to display a + /// countdown timer. + adProgress, + /// Fired when the ads manager is done playing all the valid ads in the ads /// response, or when the response doesn't return any valid ads. allAdsCompleted, @@ -28,18 +53,72 @@ enum AdEventType { /// This usually happens when an ad finishes or collapses. contentResumeRequested, + /// Fired when VOD stream cuepoints have changed. + cuepointsChanged, + + /// Fired when the ad playhead crosses first quartile. + firstQuartile, + + /// The user has closed the icon fallback image dialog. + iconFallbackImageClosed, + + /// The user has tapped an ad icon. + iconTapped, + /// Fired when the VAST response has been received. loaded, + + /// Fired to enable the SDK to communicate a message to be logged, which is + /// stored in adData. + log, + + /// Fired when the ad playhead crosses midpoint. + midpoint, + + /// Fired when an ad is paused. + paused, + + /// Fired when an ad is resumed. + resumed, + + /// Fired when an ad changes its skippable state. + skippableStateChanged, + + /// Fired when an ad was skipped. + skipped, + + /// Fired when an ad starts playing. + started, + + /// Stream request has loaded (only used for dynamic ad insertion). + streamLoaded, + + /// Stream has started playing (only used for dynamic ad insertion). + streamStarted, + + /// Fired when a non-clickthrough portion of a video ad is clicked. + tapped, + + /// Fired when the ad playhead crosses third quartile. + thirdQuartile, + + /// An unexpected event occurred and the type is not know. + /// + /// Refer to the inner error for more information. + unknown, } /// Simple data class used to transport ad playback information. @immutable class AdEvent { /// Creates an [AdEvent]. - const AdEvent({required this.type}); + const AdEvent({required this.type, this.adData = const {}}); /// The type of event that occurred. final AdEventType type; + + /// A map containing any extra ad data for the event, if needed. + final Map adData; } /// An event raised when there is an error loading or playing ads. From d611fe87cf1cc28496626a009692e32882ef54db Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 1 Aug 2024 17:13:17 -0400 Subject: [PATCH 02/14] android impl --- .../interactive_media_ads/AdEventProxyApi.kt | 4 + .../InteractiveMediaAdsLibrary.g.kt | 2694 ++++++++--------- .../InteractiveMediaAdsPlugin.kt | 2 +- .../ProxyApiRegistrar.kt | 6 +- .../AdEventProxyApiTest.kt | 10 + .../lib/src/android/android_ads_manager.dart | 1 + .../src/android/interactive_media_ads.g.dart | 271 +- .../interactive_media_ads_android.dart | 1434 ++++----- packages/interactive_media_ads/pubspec.yaml | 5 + .../test/android/ads_manager_tests.dart | 6 +- 10 files changed, 2099 insertions(+), 2334 deletions(-) diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdEventProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdEventProxyApi.kt index c490a1643c9a..f4c6eed04f6a 100644 --- a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdEventProxyApi.kt +++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdEventProxyApi.kt @@ -46,4 +46,8 @@ class AdEventProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) : else -> AdEventType.UNKNOWN } } + + override fun adData(pigeon_instance: AdEvent): Map { + return pigeon_instance.adData + } } diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt index 49d21f7b51eb..7f4eb6f5b319 100644 --- a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt +++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt @@ -1,9 +1,9 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v19.1.0), do not edit directly. +// Autogenerated from Pigeon (v21.2.0), do not edit directly. // See also: https://pub.dev/packages/pigeon -@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass", "SyntheticAccessor") +@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") package dev.flutter.packages.interactive_media_ads @@ -21,50 +21,52 @@ private fun wrapResult(result: Any?): List { private fun wrapError(exception: Throwable): List { return if (exception is FlutterError) { - listOf(exception.code, exception.message, exception.details) + listOf( + exception.code, + exception.message, + exception.details + ) } else { listOf( - exception.javaClass.simpleName, - exception.toString(), - "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) + exception.javaClass.simpleName, + exception.toString(), + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) + ) } } private fun createConnectionError(channelName: String): FlutterError { - return FlutterError( - "channel-error", "Unable to establish connection on channel: '$channelName'.", "") -} + return FlutterError("channel-error", "Unable to establish connection on channel: '$channelName'.", "")} /** * Error class for passing custom error details to Flutter via a thrown PlatformException. - * * @property code The error code. * @property message The error message. * @property details The error details. Must be a datatype supported by the api codec. */ -class FlutterError( - val code: String, - override val message: String? = null, - val details: Any? = null +class FlutterError ( + val code: String, + override val message: String? = null, + val details: Any? = null ) : Throwable() /** * Maintains instances used to communicate with the corresponding objects in Dart. * - *

Objects stored in this container are represented by an object in Dart that is also stored in + * Objects stored in this container are represented by an object in Dart that is also stored in * an InstanceManager with the same identifier. * - *

When an instance is added with an identifier, either can be used to retrieve the other. + * When an instance is added with an identifier, either can be used to retrieve the other. * - *

Added instances are added as a weak reference and a strong reference. When the strong + * Added instances are added as a weak reference and a strong reference. When the strong * reference is removed with [remove] and the weak reference is deallocated, the - * `finalizationListener` is made with the instance's identifier. However, if the strong reference - * is removed and then the identifier is retrieved with the intention to pass the identifier to Dart - * (e.g. calling [getIdentifierForStrongReference]), the strong reference to the instance is - * recreated. The strong reference will then need to be removed manually again. + * `finalizationListener.onFinalize` is called with the instance's identifier. However, if the strong + * reference is removed and then the identifier is retrieved with the intention to pass the identifier + * to Dart (e.g. calling [getIdentifierForStrongReference]), the strong reference to the instance + * is recreated. The strong reference will then need to be removed manually again. */ -@Suppress("UNCHECKED_CAST", "MemberVisibilityCanBePrivate", "unused") -class PigeonInstanceManager(private val finalizationListener: PigeonFinalizationListener) { - /** Interface for listening when a weak reference of an instance is removed from the manager. */ +@Suppress("UNCHECKED_CAST", "MemberVisibilityCanBePrivate") +class InteractiveMediaAdsLibraryPigeonInstanceManager(private val finalizationListener: PigeonFinalizationListener) { + /** Interface for listening when a weak reference of an instance is removed from the manager. */ interface PigeonFinalizationListener { fun onFinalize(identifier: Long) } @@ -90,7 +92,10 @@ class PigeonInstanceManager(private val finalizationListener: PigeonFinalization } init { - handler.postDelayed({ releaseAllFinalizedInstances() }, clearFinalizedWeakReferencesInterval) + handler.postDelayed( + { releaseAllFinalizedInstances() }, + clearFinalizedWeakReferencesInterval + ) } companion object { @@ -102,26 +107,19 @@ class PigeonInstanceManager(private val finalizationListener: PigeonFinalization private const val tag = "PigeonInstanceManager" /** - * Instantiate a new manager. + * Instantiate a new manager with a listener for garbage collected weak + * references. * * When the manager is no longer needed, [stopFinalizationListener] must be called. - * - * @param finalizationListener the listener for garbage collected weak references. - * @return a new `PigeonInstanceManager`. */ - fun create(finalizationListener: PigeonFinalizationListener): PigeonInstanceManager { - return PigeonInstanceManager(finalizationListener) + fun create(finalizationListener: PigeonFinalizationListener): InteractiveMediaAdsLibraryPigeonInstanceManager { + return InteractiveMediaAdsLibraryPigeonInstanceManager(finalizationListener) } } /** - * Removes `identifier` and its associated strongly referenced instance, if present, from the - * manager. - * - * @param identifier the identifier paired to an instance. - * @param the expected return type. - * @return the removed instance if the manager contains the given identifier, otherwise `null` if - * the manager doesn't contain the value. + * Removes `identifier` and return its associated strongly referenced instance, if present, + * from the manager. */ fun remove(identifier: Long): T? { logWarningIfFinalizationListenerHasStopped() @@ -129,19 +127,17 @@ class PigeonInstanceManager(private val finalizationListener: PigeonFinalization } /** - * Retrieves the identifier paired with an instance. + * Retrieves the identifier paired with an instance, if present, otherwise `null`. + * * * If the manager contains a strong reference to `instance`, it will return the identifier * associated with `instance`. If the manager contains only a weak reference to `instance`, a new * strong reference to `instance` will be added and will need to be removed again with [remove]. * + * * If this method returns a nonnull identifier, this method also expects the Dart - * `PigeonInstanceManager` to have, or recreate, a weak reference to the Dart instance the + * `InteractiveMediaAdsLibraryPigeonInstanceManager` to have, or recreate, a weak reference to the Dart instance the * identifier is associated with. - * - * @param instance an instance that may be stored in the manager. - * @return the identifier associated with `instance` if the manager contains the value, otherwise - * `null` if the manager doesn't contain the value. */ fun getIdentifierForStrongReference(instance: Any?): Long? { logWarningIfFinalizationListenerHasStopped() @@ -155,13 +151,11 @@ class PigeonInstanceManager(private val finalizationListener: PigeonFinalization /** * Adds a new instance that was instantiated from Dart. * - * The same instance can be added multiple times, but each identifier must be unique. This allows - * two objects that are equivalent (e.g. the `equals` method returns true and their hashcodes are - * equal) to both be added. + * The same instance can be added multiple times, but each identifier must be unique. This + * allows two objects that are equivalent (e.g. the `equals` method returns true and their + * hashcodes are equal) to both be added. * - * @param instance the instance to be stored. - * @param identifier the identifier to be paired with instance. This value must be >= 0 and - * unique. + * [identifier] must be >= 0 and unique. */ fun addDartCreatedInstance(instance: Any, identifier: Long) { logWarningIfFinalizationListenerHasStopped() @@ -169,48 +163,33 @@ class PigeonInstanceManager(private val finalizationListener: PigeonFinalization } /** - * Adds a new instance that was instantiated from the host platform. + * Adds a new unique instance that was instantiated from the host platform. * - * @param instance the instance to be stored. This must be unique to all other added instances. - * @return the unique identifier (>= 0) stored with instance. + * [identifier] must be >= 0 and unique. */ fun addHostCreatedInstance(instance: Any): Long { logWarningIfFinalizationListenerHasStopped() - require(!containsInstance(instance)) { - "Instance of ${instance.javaClass} has already been added." - } + require(!containsInstance(instance)) { "Instance of ${instance.javaClass} has already been added." } val identifier = nextIdentifier++ addInstance(instance, identifier) return identifier } - /** - * Retrieves the instance associated with identifier. - * - * @param identifier the identifier associated with an instance. - * @param the expected return type. - * @return the instance associated with `identifier` if the manager contains the value, otherwise - * `null` if the manager doesn't contain the value. - */ + /** Retrieves the instance associated with identifier, if present, otherwise `null`. */ fun getInstance(identifier: Long): T? { logWarningIfFinalizationListenerHasStopped() val instance = weakInstances[identifier] as java.lang.ref.WeakReference? return instance?.get() } - /** - * Returns whether this manager contains the given `instance`. - * - * @param instance the instance whose presence in this manager is to be tested. - * @return whether this manager contains the given `instance`. - */ + /** Returns whether this manager contains the given `instance`. */ fun containsInstance(instance: Any?): Boolean { logWarningIfFinalizationListenerHasStopped() return identifiers.containsKey(instance) } /** - * Stop the periodic run of the [PigeonFinalizationListener] for instances that have been garbage + * Stops the periodic run of the [PigeonFinalizationListener] for instances that have been garbage * collected. * * The InstanceManager can continue to be used, but the [PigeonFinalizationListener] will no @@ -248,8 +227,7 @@ class PigeonInstanceManager(private val finalizationListener: PigeonFinalization return } var reference: java.lang.ref.WeakReference? - while ((referenceQueue.poll() as java.lang.ref.WeakReference?).also { reference = it } != - null) { + while ((referenceQueue.poll() as java.lang.ref.WeakReference?).also { reference = it } != null) { val identifier = weakReferencesToIdentifiers.remove(reference) if (identifier != null) { weakInstances.remove(identifier) @@ -257,7 +235,10 @@ class PigeonInstanceManager(private val finalizationListener: PigeonFinalization finalizationListener.onFinalize(identifier) } } - handler.postDelayed({ releaseAllFinalizedInstances() }, clearFinalizedWeakReferencesInterval) + handler.postDelayed( + { releaseAllFinalizedInstances() }, + clearFinalizedWeakReferencesInterval + ) } private fun addInstance(instance: Any, identifier: Long) { @@ -275,43 +256,39 @@ class PigeonInstanceManager(private val finalizationListener: PigeonFinalization private fun logWarningIfFinalizationListenerHasStopped() { if (hasFinalizationListenerStopped()) { Log.w( - tag, - "The manager was used after calls to the PigeonFinalizationListener has been stopped.") + tag, + "The manager was used after calls to the PigeonFinalizationListener has been stopped." + ) } } } -/** Generated API for managing the Dart and native `PigeonInstanceManager`s. */ -private class PigeonInstanceManagerApi(val binaryMessenger: BinaryMessenger) { + +/**Generated API for managing the Dart and native `PigeonInstanceManager`s. */ +private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi(val binaryMessenger: BinaryMessenger) { companion object { - /** The codec used by PigeonInstanceManagerApi. */ - val codec: MessageCodec by lazy { StandardMessageCodec() } + /**The codec used by InteractiveMediaAdsLibraryPigeonInstanceManagerApi. */ + val codec: MessageCodec by lazy { + StandardMessageCodec() + } /** - * Sets up an instance of `PigeonInstanceManagerApi` to handle messages from the + * Sets up an instance of `InteractiveMediaAdsLibraryPigeonInstanceManagerApi` to handle messages from the * `binaryMessenger`. */ - fun setUpMessageHandlers( - binaryMessenger: BinaryMessenger, - instanceManager: PigeonInstanceManager? - ) { + fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, instanceManager: InteractiveMediaAdsLibraryPigeonInstanceManager?) { run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.removeStrongReference", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.removeStrongReference", codec) if (instanceManager != null) { channel.setMessageHandler { message, reply -> val args = message as List val identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = - try { - instanceManager.remove(identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + instanceManager.remove(identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -319,20 +296,15 @@ private class PigeonInstanceManagerApi(val binaryMessenger: BinaryMessenger) { } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.clear", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.clear", codec) if (instanceManager != null) { channel.setMessageHandler { _, reply -> - val wrapped: List = - try { - instanceManager.clear() - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + instanceManager.clear() + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -342,9 +314,9 @@ private class PigeonInstanceManagerApi(val binaryMessenger: BinaryMessenger) { } } - fun removeStrongReference(identifierArg: Long, callback: (Result) -> Unit) { - val channelName = - "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.removeStrongReference" + fun removeStrongReference(identifierArg: Long, callback: (Result) -> Unit) +{ + val channelName = "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.removeStrongReference" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(identifierArg)) { if (it is List<*>) { @@ -355,47 +327,50 @@ private class PigeonInstanceManagerApi(val binaryMessenger: BinaryMessenger) { } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } } /** - * Provides implementations for each ProxyApi implementation and provides access to resources needed - * by any implementation. + * Provides implementations for each ProxyApi implementation and provides access to resources + * needed by any implementation. */ -abstract class PigeonProxyApiRegistrar(val binaryMessenger: BinaryMessenger) { - val instanceManager: PigeonInstanceManager +abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(val binaryMessenger: BinaryMessenger) { + /** Whether APIs should ignore calling to Dart. */ + public var ignoreCallsToDart = false + val instanceManager: InteractiveMediaAdsLibraryPigeonInstanceManager private var _codec: StandardMessageCodec? = null val codec: StandardMessageCodec get() { if (_codec == null) { - _codec = PigeonProxyApiBaseCodec(this) + _codec = InteractiveMediaAdsLibraryPigeonProxyApiBaseCodec(this) } return _codec!! } init { - val api = PigeonInstanceManagerApi(binaryMessenger) - instanceManager = - PigeonInstanceManager.create( - object : PigeonInstanceManager.PigeonFinalizationListener { - override fun onFinalize(identifier: Long) { - api.removeStrongReference(identifier) { - if (it.isFailure) { - Log.e( - "PigeonProxyApiRegistrar", - "Failed to remove Dart strong reference with identifier: $identifier") - } - } - } - }) + val api = InteractiveMediaAdsLibraryPigeonInstanceManagerApi(binaryMessenger) + instanceManager = InteractiveMediaAdsLibraryPigeonInstanceManager.create( + object : InteractiveMediaAdsLibraryPigeonInstanceManager.PigeonFinalizationListener { + override fun onFinalize(identifier: Long) { + api.removeStrongReference(identifier) { + if (it.isFailure) { + Log.e( + "PigeonProxyApiRegistrar", + "Failed to remove Dart strong reference with identifier: $identifier" + ) + } + } + } + } + ) } - /** * An implementation of [PigeonApiBaseDisplayContainer] used to add a new Dart instance of * `BaseDisplayContainer` to the Dart `InstanceManager`. */ - open fun getPigeonApiBaseDisplayContainer(): PigeonApiBaseDisplayContainer { + open fun getPigeonApiBaseDisplayContainer(): PigeonApiBaseDisplayContainer + { return PigeonApiBaseDisplayContainer(this) } @@ -403,13 +378,14 @@ abstract class PigeonProxyApiRegistrar(val binaryMessenger: BinaryMessenger) { * An implementation of [PigeonApiAdDisplayContainer] used to add a new Dart instance of * `AdDisplayContainer` to the Dart `InstanceManager`. */ - open fun getPigeonApiAdDisplayContainer(): PigeonApiAdDisplayContainer { + open fun getPigeonApiAdDisplayContainer(): PigeonApiAdDisplayContainer + { return PigeonApiAdDisplayContainer(this) } /** - * An implementation of [PigeonApiAdsLoader] used to add a new Dart instance of `AdsLoader` to the - * Dart `InstanceManager`. + * An implementation of [PigeonApiAdsLoader] used to add a new Dart instance of + * `AdsLoader` to the Dart `InstanceManager`. */ abstract fun getPigeonApiAdsLoader(): PigeonApiAdsLoader @@ -420,20 +396,20 @@ abstract class PigeonProxyApiRegistrar(val binaryMessenger: BinaryMessenger) { abstract fun getPigeonApiAdsManagerLoadedEvent(): PigeonApiAdsManagerLoadedEvent /** - * An implementation of [PigeonApiAdErrorEvent] used to add a new Dart instance of `AdErrorEvent` - * to the Dart `InstanceManager`. + * An implementation of [PigeonApiAdErrorEvent] used to add a new Dart instance of + * `AdErrorEvent` to the Dart `InstanceManager`. */ abstract fun getPigeonApiAdErrorEvent(): PigeonApiAdErrorEvent /** - * An implementation of [PigeonApiAdError] used to add a new Dart instance of `AdError` to the - * Dart `InstanceManager`. + * An implementation of [PigeonApiAdError] used to add a new Dart instance of + * `AdError` to the Dart `InstanceManager`. */ abstract fun getPigeonApiAdError(): PigeonApiAdError /** - * An implementation of [PigeonApiAdsRequest] used to add a new Dart instance of `AdsRequest` to - * the Dart `InstanceManager`. + * An implementation of [PigeonApiAdsRequest] used to add a new Dart instance of + * `AdsRequest` to the Dart `InstanceManager`. */ abstract fun getPigeonApiAdsRequest(): PigeonApiAdsRequest @@ -441,25 +417,26 @@ abstract class PigeonProxyApiRegistrar(val binaryMessenger: BinaryMessenger) { * An implementation of [PigeonApiContentProgressProvider] used to add a new Dart instance of * `ContentProgressProvider` to the Dart `InstanceManager`. */ - open fun getPigeonApiContentProgressProvider(): PigeonApiContentProgressProvider { + open fun getPigeonApiContentProgressProvider(): PigeonApiContentProgressProvider + { return PigeonApiContentProgressProvider(this) } /** - * An implementation of [PigeonApiAdsManager] used to add a new Dart instance of `AdsManager` to - * the Dart `InstanceManager`. + * An implementation of [PigeonApiAdsManager] used to add a new Dart instance of + * `AdsManager` to the Dart `InstanceManager`. */ abstract fun getPigeonApiAdsManager(): PigeonApiAdsManager /** - * An implementation of [PigeonApiBaseManager] used to add a new Dart instance of `BaseManager` to - * the Dart `InstanceManager`. + * An implementation of [PigeonApiBaseManager] used to add a new Dart instance of + * `BaseManager` to the Dart `InstanceManager`. */ abstract fun getPigeonApiBaseManager(): PigeonApiBaseManager /** - * An implementation of [PigeonApiAdEvent] used to add a new Dart instance of `AdEvent` to the - * Dart `InstanceManager`. + * An implementation of [PigeonApiAdEvent] used to add a new Dart instance of + * `AdEvent` to the Dart `InstanceManager`. */ abstract fun getPigeonApiAdEvent(): PigeonApiAdEvent @@ -473,7 +450,8 @@ abstract class PigeonProxyApiRegistrar(val binaryMessenger: BinaryMessenger) { * An implementation of [PigeonApiImaSdkSettings] used to add a new Dart instance of * `ImaSdkSettings` to the Dart `InstanceManager`. */ - open fun getPigeonApiImaSdkSettings(): PigeonApiImaSdkSettings { + open fun getPigeonApiImaSdkSettings(): PigeonApiImaSdkSettings + { return PigeonApiImaSdkSettings(this) } @@ -484,46 +462,47 @@ abstract class PigeonProxyApiRegistrar(val binaryMessenger: BinaryMessenger) { abstract fun getPigeonApiVideoProgressUpdate(): PigeonApiVideoProgressUpdate /** - * An implementation of [PigeonApiAdMediaInfo] used to add a new Dart instance of `AdMediaInfo` to - * the Dart `InstanceManager`. + * An implementation of [PigeonApiAdMediaInfo] used to add a new Dart instance of + * `AdMediaInfo` to the Dart `InstanceManager`. */ abstract fun getPigeonApiAdMediaInfo(): PigeonApiAdMediaInfo /** - * An implementation of [PigeonApiAdPodInfo] used to add a new Dart instance of `AdPodInfo` to the - * Dart `InstanceManager`. + * An implementation of [PigeonApiAdPodInfo] used to add a new Dart instance of + * `AdPodInfo` to the Dart `InstanceManager`. */ abstract fun getPigeonApiAdPodInfo(): PigeonApiAdPodInfo /** - * An implementation of [PigeonApiFrameLayout] used to add a new Dart instance of `FrameLayout` to - * the Dart `InstanceManager`. + * An implementation of [PigeonApiFrameLayout] used to add a new Dart instance of + * `FrameLayout` to the Dart `InstanceManager`. */ abstract fun getPigeonApiFrameLayout(): PigeonApiFrameLayout /** - * An implementation of [PigeonApiViewGroup] used to add a new Dart instance of `ViewGroup` to the - * Dart `InstanceManager`. + * An implementation of [PigeonApiViewGroup] used to add a new Dart instance of + * `ViewGroup` to the Dart `InstanceManager`. */ abstract fun getPigeonApiViewGroup(): PigeonApiViewGroup /** - * An implementation of [PigeonApiVideoView] used to add a new Dart instance of `VideoView` to the - * Dart `InstanceManager`. + * An implementation of [PigeonApiVideoView] used to add a new Dart instance of + * `VideoView` to the Dart `InstanceManager`. */ abstract fun getPigeonApiVideoView(): PigeonApiVideoView /** - * An implementation of [PigeonApiView] used to add a new Dart instance of `View` to the Dart - * `InstanceManager`. + * An implementation of [PigeonApiView] used to add a new Dart instance of + * `View` to the Dart `InstanceManager`. */ - open fun getPigeonApiView(): PigeonApiView { + open fun getPigeonApiView(): PigeonApiView + { return PigeonApiView(this) } /** - * An implementation of [PigeonApiMediaPlayer] used to add a new Dart instance of `MediaPlayer` to - * the Dart `InstanceManager`. + * An implementation of [PigeonApiMediaPlayer] used to add a new Dart instance of + * `MediaPlayer` to the Dart `InstanceManager`. */ abstract fun getPigeonApiMediaPlayer(): PigeonApiMediaPlayer @@ -558,29 +537,25 @@ abstract class PigeonProxyApiRegistrar(val binaryMessenger: BinaryMessenger) { abstract fun getPigeonApiAdEventListener(): PigeonApiAdEventListener fun setUp() { - PigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger, instanceManager) + InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger, instanceManager) PigeonApiAdsLoader.setUpMessageHandlers(binaryMessenger, getPigeonApiAdsLoader()) PigeonApiAdsRequest.setUpMessageHandlers(binaryMessenger, getPigeonApiAdsRequest()) PigeonApiAdsManager.setUpMessageHandlers(binaryMessenger, getPigeonApiAdsManager()) PigeonApiBaseManager.setUpMessageHandlers(binaryMessenger, getPigeonApiBaseManager()) PigeonApiImaSdkFactory.setUpMessageHandlers(binaryMessenger, getPigeonApiImaSdkFactory()) - PigeonApiVideoProgressUpdate.setUpMessageHandlers( - binaryMessenger, getPigeonApiVideoProgressUpdate()) + PigeonApiVideoProgressUpdate.setUpMessageHandlers(binaryMessenger, getPigeonApiVideoProgressUpdate()) PigeonApiFrameLayout.setUpMessageHandlers(binaryMessenger, getPigeonApiFrameLayout()) PigeonApiViewGroup.setUpMessageHandlers(binaryMessenger, getPigeonApiViewGroup()) PigeonApiVideoView.setUpMessageHandlers(binaryMessenger, getPigeonApiVideoView()) PigeonApiMediaPlayer.setUpMessageHandlers(binaryMessenger, getPigeonApiMediaPlayer()) - PigeonApiVideoAdPlayerCallback.setUpMessageHandlers( - binaryMessenger, getPigeonApiVideoAdPlayerCallback()) + PigeonApiVideoAdPlayerCallback.setUpMessageHandlers(binaryMessenger, getPigeonApiVideoAdPlayerCallback()) PigeonApiVideoAdPlayer.setUpMessageHandlers(binaryMessenger, getPigeonApiVideoAdPlayer()) - PigeonApiAdsLoadedListener.setUpMessageHandlers( - binaryMessenger, getPigeonApiAdsLoadedListener()) + PigeonApiAdsLoadedListener.setUpMessageHandlers(binaryMessenger, getPigeonApiAdsLoadedListener()) PigeonApiAdErrorListener.setUpMessageHandlers(binaryMessenger, getPigeonApiAdErrorListener()) PigeonApiAdEventListener.setUpMessageHandlers(binaryMessenger, getPigeonApiAdEventListener()) } - fun tearDown() { - PigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger, null) + InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger, null) PigeonApiAdsLoader.setUpMessageHandlers(binaryMessenger, null) PigeonApiAdsRequest.setUpMessageHandlers(binaryMessenger, null) PigeonApiAdsManager.setUpMessageHandlers(binaryMessenger, null) @@ -598,9 +573,7 @@ abstract class PigeonProxyApiRegistrar(val binaryMessenger: BinaryMessenger) { PigeonApiAdEventListener.setUpMessageHandlers(binaryMessenger, null) } } - -private class PigeonProxyApiBaseCodec(val registrar: PigeonProxyApiRegistrar) : - StandardMessageCodec() { +private class InteractiveMediaAdsLibraryPigeonProxyApiBaseCodec(val registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) : InteractiveMediaAdsLibraryPigeonCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { 128.toByte() -> { @@ -612,59 +585,88 @@ private class PigeonProxyApiBaseCodec(val registrar: PigeonProxyApiRegistrar) : } override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { + if (value is Boolean || value is ByteArray || value is Double || value is DoubleArray || value is FloatArray || value is Int || value is IntArray || value is List<*> || value is Long || value is LongArray || value is Map<*, *> || value is String || value is AdErrorCode || value is AdErrorType || value is AdEventType || value == null) { + super.writeValue(stream, value) + return + } + if (value is com.google.ads.interactivemedia.v3.api.AdDisplayContainer) { - registrar.getPigeonApiAdDisplayContainer().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.BaseDisplayContainer) { - registrar.getPigeonApiBaseDisplayContainer().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.AdsLoader) { - registrar.getPigeonApiAdsLoader().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent) { - registrar.getPigeonApiAdsManagerLoadedEvent().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.AdErrorEvent) { - registrar.getPigeonApiAdErrorEvent().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.AdError) { - registrar.getPigeonApiAdError().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.AdsRequest) { - registrar.getPigeonApiAdsRequest().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider) { - registrar.getPigeonApiContentProgressProvider().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.AdsManager) { - registrar.getPigeonApiAdsManager().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.BaseManager) { - registrar.getPigeonApiBaseManager().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.AdEvent) { - registrar.getPigeonApiAdEvent().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.ImaSdkFactory) { - registrar.getPigeonApiImaSdkFactory().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.ImaSdkSettings) { - registrar.getPigeonApiImaSdkSettings().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate) { - registrar.getPigeonApiVideoProgressUpdate().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.player.AdMediaInfo) { - registrar.getPigeonApiAdMediaInfo().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.AdPodInfo) { - registrar.getPigeonApiAdPodInfo().pigeon_newInstance(value) {} - } else if (value is android.widget.FrameLayout) { - registrar.getPigeonApiFrameLayout().pigeon_newInstance(value) {} - } else if (value is android.view.ViewGroup) { - registrar.getPigeonApiViewGroup().pigeon_newInstance(value) {} - } else if (value is android.widget.VideoView) { - registrar.getPigeonApiVideoView().pigeon_newInstance(value) {} - } else if (value is android.view.View) { - registrar.getPigeonApiView().pigeon_newInstance(value) {} - } else if (value is android.media.MediaPlayer) { - registrar.getPigeonApiMediaPlayer().pigeon_newInstance(value) {} - } else if (value - is com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback) { - registrar.getPigeonApiVideoAdPlayerCallback().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer) { - registrar.getPigeonApiVideoAdPlayer().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener) { - registrar.getPigeonApiAdsLoadedListener().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener) { - registrar.getPigeonApiAdErrorListener().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener) { - registrar.getPigeonApiAdEventListener().pigeon_newInstance(value) {} + registrar.getPigeonApiAdDisplayContainer().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.BaseDisplayContainer) { + registrar.getPigeonApiBaseDisplayContainer().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.AdsLoader) { + registrar.getPigeonApiAdsLoader().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent) { + registrar.getPigeonApiAdsManagerLoadedEvent().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.AdErrorEvent) { + registrar.getPigeonApiAdErrorEvent().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.AdError) { + registrar.getPigeonApiAdError().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.AdsRequest) { + registrar.getPigeonApiAdsRequest().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider) { + registrar.getPigeonApiContentProgressProvider().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.AdsManager) { + registrar.getPigeonApiAdsManager().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.BaseManager) { + registrar.getPigeonApiBaseManager().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.AdEvent) { + registrar.getPigeonApiAdEvent().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.ImaSdkFactory) { + registrar.getPigeonApiImaSdkFactory().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.ImaSdkSettings) { + registrar.getPigeonApiImaSdkSettings().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate) { + registrar.getPigeonApiVideoProgressUpdate().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.player.AdMediaInfo) { + registrar.getPigeonApiAdMediaInfo().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.AdPodInfo) { + registrar.getPigeonApiAdPodInfo().pigeon_newInstance(value) { } + } + else if (value is android.widget.FrameLayout) { + registrar.getPigeonApiFrameLayout().pigeon_newInstance(value) { } + } + else if (value is android.view.ViewGroup) { + registrar.getPigeonApiViewGroup().pigeon_newInstance(value) { } + } + else if (value is android.widget.VideoView) { + registrar.getPigeonApiVideoView().pigeon_newInstance(value) { } + } + else if (value is android.view.View) { + registrar.getPigeonApiView().pigeon_newInstance(value) { } + } + else if (value is android.media.MediaPlayer) { + registrar.getPigeonApiMediaPlayer().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback) { + registrar.getPigeonApiVideoAdPlayerCallback().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer) { + registrar.getPigeonApiVideoAdPlayer().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener) { + registrar.getPigeonApiAdsLoadedListener().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener) { + registrar.getPigeonApiAdErrorListener().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener) { + registrar.getPigeonApiAdEventListener().pigeon_newInstance(value) { } } when { @@ -672,7 +674,7 @@ private class PigeonProxyApiBaseCodec(val registrar: PigeonProxyApiRegistrar) : stream.write(128) writeValue(stream, registrar.instanceManager.getIdentifierForStrongReference(value)) } - else -> super.writeValue(stream, value) + else -> throw IllegalArgumentException("Unsupported value: '$value' of type '${value.javaClass.name}'") } } } @@ -680,8 +682,7 @@ private class PigeonProxyApiBaseCodec(val registrar: PigeonProxyApiRegistrar) : /** * The types of error that can be encountered. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorCode.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorCode.html. */ enum class AdErrorCode(val raw: Int) { /** Ads player was not provided. */ @@ -713,13 +714,13 @@ enum class AdErrorCode(val raw: Int) { /** A VAST response containing a single `` tag with no child tags. */ VAST_EMPTY_RESPONSE(13), /** - * Assets were found in the VAST ad response for a linear ad, but none of them matched the video - * player's capabilities. + * Assets were found in the VAST ad response for a linear ad, but none of + * them matched the video player's capabilities. */ VAST_LINEAR_ASSET_MISMATCH(14), /** - * At least one VAST wrapper ad loaded successfully and a subsequent wrapper or inline ad load has - * timed out. + * At least one VAST wrapper ad loaded successfully and a subsequent wrapper + * or inline ad load has timed out. */ VAST_LOAD_TIMEOUT(15), /** The ad response was not recognized as a valid VAST ad. */ @@ -727,8 +728,8 @@ enum class AdErrorCode(val raw: Int) { /** Failed to load media assets from a VAST response. */ VAST_MEDIA_LOAD_TIMEOUT(17), /** - * Assets were found in the VAST ad response for a nonlinear ad, but none of them matched the - * video player's capabilities. + * Assets were found in the VAST ad response for a nonlinear ad, but none of + * them matched the video player's capabilities. */ VAST_NONLINEAR_ASSET_MISMATCH(18), /** No Ads VAST response after one or more wrappers. */ @@ -738,7 +739,8 @@ enum class AdErrorCode(val raw: Int) { /** * Trafficking error. * - * Video player received an ad type that it was not expecting and/or cannot display. + * Video player received an ad type that it was not expecting and/or cannot + * display. */ VAST_TRAFFICKING_ERROR(21), /** There was an error playing the video ad. */ @@ -756,8 +758,7 @@ enum class AdErrorCode(val raw: Int) { /** * Specifies when the error was encountered, during either ad loading or playback. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorType.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorType.html. */ enum class AdErrorType(val raw: Int) { /** Indicates that the error was encountered when the ad was being loaded. */ @@ -777,8 +778,7 @@ enum class AdErrorType(val raw: Int) { /** * Types of events that can occur during ad playback. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventType.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventType.html. */ enum class AdEventType(val raw: Int) { /** Fired when an ad break in a stream ends. */ @@ -795,11 +795,14 @@ enum class AdEventType(val raw: Int) { AD_PERIOD_ENDED(5), /** Fired when an ad period in a stream starts. */ AD_PERIOD_STARTED(6), - /** Fired to inform of ad progress and can be used by publisher to display a countdown timer. */ + /** + * Fired to inform of ad progress and can be used by publisher to display a + * countdown timer. + */ AD_PROGRESS(7), /** - * Fired when the ads manager is done playing all the valid ads in the ads response, or when the - * response doesn't return any valid ads. + * Fired when the ads manager is done playing all the valid ads in the ads + * response, or when the response doesn't return any valid ads. */ ALL_ADS_COMPLETED(8), /** Fired when an ad is clicked. */ @@ -820,7 +823,10 @@ enum class AdEventType(val raw: Int) { ICON_TAPPED(16), /** Fired when the VAST response has been received. */ LOADED(17), - /** Fired to enable the SDK to communicate a message to be logged, which is stored in adData. */ + /** + * Fired to enable the SDK to communicate a message to be logged, which is + * stored in adData. + */ LOG(18), /** Fired when the ad playhead crosses midpoint. */ MIDPOINT(19), @@ -847,30 +853,71 @@ enum class AdEventType(val raw: Int) { } } } +private open class InteractiveMediaAdsLibraryPigeonCodec : StandardMessageCodec() { + override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { + return when (type) { + 129.toByte() -> { + return (readValue(buffer) as Int?)?.let { + AdErrorCode.ofRaw(it) + } + } + 130.toByte() -> { + return (readValue(buffer) as Int?)?.let { + AdErrorType.ofRaw(it) + } + } + 131.toByte() -> { + return (readValue(buffer) as Int?)?.let { + AdEventType.ofRaw(it) + } + } + else -> super.readValueOfType(type, buffer) + } + } + override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { + when (value) { + is AdErrorCode -> { + stream.write(129) + writeValue(stream, value.raw) + } + is AdErrorType -> { + stream.write(130) + writeValue(stream, value.raw) + } + is AdEventType -> { + stream.write(131) + writeValue(stream, value.raw) + } + else -> super.writeValue(stream, value) + } + } +} + /** * A base class for more specialized container interfaces. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseDisplayContainer.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseDisplayContainer.html. */ @Suppress("UNCHECKED_CAST") -open class PigeonApiBaseDisplayContainer(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +open class PigeonApiBaseDisplayContainer(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of BaseDisplayContainer and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.BaseDisplayContainer, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of BaseDisplayContainer and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.BaseDisplayContainer, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.interactive_media_ads.BaseDisplayContainer.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.interactive_media_ads.BaseDisplayContainer.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { @@ -881,34 +928,36 @@ open class PigeonApiBaseDisplayContainer(open val pigeonRegistrar: PigeonProxyAp } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } + } /** * A container in which to display the ads. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdDisplayContainer. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdDisplayContainer. */ @Suppress("UNCHECKED_CAST") -open class PigeonApiAdDisplayContainer(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +open class PigeonApiAdDisplayContainer(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of AdDisplayContainer and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdDisplayContainer, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of AdDisplayContainer and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdDisplayContainer, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.interactive_media_ads.AdDisplayContainer.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.interactive_media_ads.AdDisplayContainer.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { @@ -919,66 +968,52 @@ open class PigeonApiAdDisplayContainer(open val pigeonRegistrar: PigeonProxyApiR } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } @Suppress("FunctionName") - /** An implementation of [PigeonApiBaseDisplayContainer] used to access callback methods */ - fun pigeon_getPigeonApiBaseDisplayContainer(): PigeonApiBaseDisplayContainer { + /**An implementation of [PigeonApiBaseDisplayContainer] used to access callback methods */ + fun pigeon_getPigeonApiBaseDisplayContainer(): PigeonApiBaseDisplayContainer + { return pigeonRegistrar.getPigeonApiBaseDisplayContainer() } + } /** - * An object which allows publishers to request ads from ad servers or a dynamic ad insertion - * stream. + * An object which allows publishers to request ads from ad servers or a + * dynamic ad insertion stream. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdsLoader(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +abstract class PigeonApiAdsLoader(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { /** Registers a listener for errors that occur during the ads request. */ - abstract fun addAdErrorListener( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsLoader, - listener: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener - ) + abstract fun addAdErrorListener(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsLoader, listener: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener) /** Registers a listener for the ads manager loaded event. */ - abstract fun addAdsLoadedListener( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsLoader, - listener: com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener - ) + abstract fun addAdsLoadedListener(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsLoader, listener: com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener) /** Requests ads from a server. */ - abstract fun requestAds( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsLoader, - request: com.google.ads.interactivemedia.v3.api.AdsRequest - ) + abstract fun requestAds(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsLoader, request: com.google.ads.interactivemedia.v3.api.AdsRequest) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAdsLoader?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsLoader.addAdErrorListener", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsLoader.addAdErrorListener", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsLoader - val listenerArg = - args[1] as com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener - val wrapped: List = - try { - api.addAdErrorListener(pigeon_instanceArg, listenerArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val listenerArg = args[1] as com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener + val wrapped: List = try { + api.addAdErrorListener(pigeon_instanceArg, listenerArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -986,24 +1021,18 @@ abstract class PigeonApiAdsLoader(open val pigeonRegistrar: PigeonProxyApiRegist } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsLoader.addAdsLoadedListener", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsLoader.addAdsLoadedListener", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsLoader - val listenerArg = - args[1] as com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener - val wrapped: List = - try { - api.addAdsLoadedListener(pigeon_instanceArg, listenerArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val listenerArg = args[1] as com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener + val wrapped: List = try { + api.addAdsLoadedListener(pigeon_instanceArg, listenerArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1011,23 +1040,18 @@ abstract class PigeonApiAdsLoader(open val pigeonRegistrar: PigeonProxyApiRegist } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsLoader.requestAds", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsLoader.requestAds", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsLoader val requestArg = args[1] as com.google.ads.interactivemedia.v3.api.AdsRequest - val wrapped: List = - try { - api.requestAds(pigeon_instanceArg, requestArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.requestAds(pigeon_instanceArg, requestArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1038,17 +1062,20 @@ abstract class PigeonApiAdsLoader(open val pigeonRegistrar: PigeonProxyApiRegist } @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of AdsLoader and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsLoader, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of AdsLoader and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsLoader, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.AdsLoader.pigeon_newInstance" @@ -1062,43 +1089,43 @@ abstract class PigeonApiAdsLoader(open val pigeonRegistrar: PigeonProxyApiRegist } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } + } /** * An event raised when ads are successfully loaded from the ad server through an AdsLoader. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManagerLoadedEvent.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManagerLoadedEvent.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdsManagerLoadedEvent(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +abstract class PigeonApiAdsManagerLoadedEvent(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { /** - * The ads manager that will control playback of the loaded ads, or null when using dynamic ad - * insertion. + * The ads manager that will control playback of the loaded ads, or null when + * using dynamic ad insertion. */ - abstract fun manager( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent - ): com.google.ads.interactivemedia.v3.api.AdsManager + abstract fun manager(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent): com.google.ads.interactivemedia.v3.api.AdsManager @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of AdsManagerLoadedEvent and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of AdsManagerLoadedEvent and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val managerArg = manager(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.interactive_media_ads.AdsManagerLoadedEvent.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.interactive_media_ads.AdsManagerLoadedEvent.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg, managerArg)) { if (it is List<*>) { @@ -1109,35 +1136,36 @@ abstract class PigeonApiAdsManagerLoadedEvent(open val pigeonRegistrar: PigeonPr } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } + } /** * An event raised when there is an error loading or playing ads. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdErrorEvent(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +abstract class PigeonApiAdErrorEvent(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { /** The AdError that caused this event. */ - abstract fun error( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdErrorEvent - ): com.google.ads.interactivemedia.v3.api.AdError + abstract fun error(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdErrorEvent): com.google.ads.interactivemedia.v3.api.AdError @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of AdErrorEvent and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdErrorEvent, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of AdErrorEvent and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdErrorEvent, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val errorArg = error(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec @@ -1152,48 +1180,45 @@ abstract class PigeonApiAdErrorEvent(open val pigeonRegistrar: PigeonProxyApiReg } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } + } /** * An error that occurred in the SDK. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdError(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +abstract class PigeonApiAdError(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { /** The error's code. */ - abstract fun errorCode( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdError - ): AdErrorCode + abstract fun errorCode(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdError): AdErrorCode /** The error code's number. */ - abstract fun errorCodeNumber( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdError - ): Long + abstract fun errorCodeNumber(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdError): Long /** The error's type. */ - abstract fun errorType( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdError - ): AdErrorType + abstract fun errorType(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdError): AdErrorType /** A human-readable summary of the error. */ abstract fun message(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdError): String @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of AdError and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdError, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of AdError and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdError, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val errorCodeArg = errorCode(pigeon_instanceArg) val errorCodeNumberArg = errorCodeNumber(pigeon_instanceArg) val errorTypeArg = errorType(pigeon_instanceArg) @@ -1202,71 +1227,53 @@ abstract class PigeonApiAdError(open val pigeonRegistrar: PigeonProxyApiRegistra val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.AdError.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send( - listOf( - pigeon_identifierArg, - errorCodeArg.raw, - errorCodeNumberArg, - errorTypeArg.raw, - messageArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) - } - } else { - callback(Result.failure(createConnectionError(channelName))) - } + channel.send(listOf(pigeon_identifierArg, errorCodeArg, errorCodeNumberArg, errorTypeArg, messageArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) } + } else { + callback(Result.failure(createConnectionError(channelName))) + } + } } + } /** * An object containing the data used to request ads from the server. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsRequest. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsRequest. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdsRequest(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +abstract class PigeonApiAdsRequest(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { /** Sets the URL from which ads will be requested. */ - abstract fun setAdTagUrl( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRequest, - adTagUrl: String - ) + abstract fun setAdTagUrl(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRequest, adTagUrl: String) /** - * Attaches a ContentProgressProvider instance to allow scheduling ad breaks based on content - * progress (cue points). + * Attaches a ContentProgressProvider instance to allow scheduling ad breaks + * based on content progress (cue points). */ - abstract fun setContentProgressProvider( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRequest, - provider: com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider - ) + abstract fun setContentProgressProvider(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRequest, provider: com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAdsRequest?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsRequest.setAdTagUrl", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRequest.setAdTagUrl", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsRequest val adTagUrlArg = args[1] as String - val wrapped: List = - try { - api.setAdTagUrl(pigeon_instanceArg, adTagUrlArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setAdTagUrl(pigeon_instanceArg, adTagUrlArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1274,24 +1281,18 @@ abstract class PigeonApiAdsRequest(open val pigeonRegistrar: PigeonProxyApiRegis } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsRequest.setContentProgressProvider", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRequest.setContentProgressProvider", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsRequest - val providerArg = - args[1] as com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider - val wrapped: List = - try { - api.setContentProgressProvider(pigeon_instanceArg, providerArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val providerArg = args[1] as com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider + val wrapped: List = try { + api.setContentProgressProvider(pigeon_instanceArg, providerArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1302,17 +1303,20 @@ abstract class PigeonApiAdsRequest(open val pigeonRegistrar: PigeonProxyApiRegis } @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of AdsRequest and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsRequest, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of AdsRequest and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsRequest, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.AdsRequest.pigeon_newInstance" @@ -1326,34 +1330,36 @@ abstract class PigeonApiAdsRequest(open val pigeonRegistrar: PigeonProxyApiRegis } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } + } /** * Defines an interface to allow SDK to track progress of the content video. * - * See - * https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/android/api/reference/com/google/ads/interactivemedia/v3/api/player/ContentProgressProvider.html. + * See https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/android/api/reference/com/google/ads/interactivemedia/v3/api/player/ContentProgressProvider.html. */ @Suppress("UNCHECKED_CAST") -open class PigeonApiContentProgressProvider(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +open class PigeonApiContentProgressProvider(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of ContentProgressProvider and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of ContentProgressProvider and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.interactive_media_ads.ContentProgressProvider.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.interactive_media_ads.ContentProgressProvider.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { @@ -1364,18 +1370,19 @@ open class PigeonApiContentProgressProvider(open val pigeonRegistrar: PigeonProx } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } + } /** - * An object which handles playing ads after they've been received from the server. + * An object which handles playing ads after they've been received from the + * server. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManager. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManager. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdsManager(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +abstract class PigeonApiAdsManager(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { /** Discards current ad break and resumes content. */ abstract fun discardAdBreak(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsManager) @@ -1390,22 +1397,17 @@ abstract class PigeonApiAdsManager(open val pigeonRegistrar: PigeonProxyApiRegis fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAdsManager?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsManager.discardAdBreak", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.discardAdBreak", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsManager - val wrapped: List = - try { - api.discardAdBreak(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.discardAdBreak(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1413,20 +1415,17 @@ abstract class PigeonApiAdsManager(open val pigeonRegistrar: PigeonProxyApiRegis } } run { - val channel = - BasicMessageChannel( - binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.pause", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.pause", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsManager - val wrapped: List = - try { - api.pause(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.pause(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1434,20 +1433,17 @@ abstract class PigeonApiAdsManager(open val pigeonRegistrar: PigeonProxyApiRegis } } run { - val channel = - BasicMessageChannel( - binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.start", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.start", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsManager - val wrapped: List = - try { - api.start(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.start(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1458,17 +1454,20 @@ abstract class PigeonApiAdsManager(open val pigeonRegistrar: PigeonProxyApiRegis } @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of AdsManager and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsManager, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of AdsManager and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsManager, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.AdsManager.pigeon_newInstance" @@ -1482,41 +1481,41 @@ abstract class PigeonApiAdsManager(open val pigeonRegistrar: PigeonProxyApiRegis } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } @Suppress("FunctionName") - /** An implementation of [PigeonApiBaseManager] used to access callback methods */ - fun pigeon_getPigeonApiBaseManager(): PigeonApiBaseManager { + /**An implementation of [PigeonApiBaseManager] used to access callback methods */ + fun pigeon_getPigeonApiBaseManager(): PigeonApiBaseManager + { return pigeonRegistrar.getPigeonApiBaseManager() } + } /** * Base interface for managing ads.. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseManager.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseManager.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiBaseManager(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +abstract class PigeonApiBaseManager(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { /** - * Registers a listener for errors that occur during the ad or stream initialization and playback. + * Registers a listener for errors that occur during the ad or stream + * initialization and playback. */ - abstract fun addAdErrorListener( - pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, - errorListener: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener - ) + abstract fun addAdErrorListener(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, errorListener: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener) /** - * Registers a listener for ad events that occur during ad or stream initialization and playback. + * Registers a listener for ad events that occur during ad or stream + * initialization and playback. */ - abstract fun addAdEventListener( - pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, - adEventListener: com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener - ) + abstract fun addAdEventListener(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, adEventListener: com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener) - /** Stops the ad and all tracking, then releases all assets that were loaded to play the ad. */ + /** + * Stops the ad and all tracking, then releases all assets that were loaded + * to play the ad. + */ abstract fun destroy(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager) /** Initializes the ad experience using default rendering settings */ @@ -1527,24 +1526,18 @@ abstract class PigeonApiBaseManager(open val pigeonRegistrar: PigeonProxyApiRegi fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiBaseManager?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.BaseManager.addAdErrorListener", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.addAdErrorListener", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.BaseManager - val errorListenerArg = - args[1] as com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener - val wrapped: List = - try { - api.addAdErrorListener(pigeon_instanceArg, errorListenerArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val errorListenerArg = args[1] as com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener + val wrapped: List = try { + api.addAdErrorListener(pigeon_instanceArg, errorListenerArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1552,24 +1545,18 @@ abstract class PigeonApiBaseManager(open val pigeonRegistrar: PigeonProxyApiRegi } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.BaseManager.addAdEventListener", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.addAdEventListener", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.BaseManager - val adEventListenerArg = - args[1] as com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener - val wrapped: List = - try { - api.addAdEventListener(pigeon_instanceArg, adEventListenerArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val adEventListenerArg = args[1] as com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener + val wrapped: List = try { + api.addAdEventListener(pigeon_instanceArg, adEventListenerArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1577,22 +1564,17 @@ abstract class PigeonApiBaseManager(open val pigeonRegistrar: PigeonProxyApiRegi } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.BaseManager.destroy", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.destroy", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.BaseManager - val wrapped: List = - try { - api.destroy(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.destroy(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1600,20 +1582,17 @@ abstract class PigeonApiBaseManager(open val pigeonRegistrar: PigeonProxyApiRegi } } run { - val channel = - BasicMessageChannel( - binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.init", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.init", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.BaseManager - val wrapped: List = - try { - api.init(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.init(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1624,17 +1603,20 @@ abstract class PigeonApiBaseManager(open val pigeonRegistrar: PigeonProxyApiRegi } @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of BaseManager and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.BaseManager, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of BaseManager and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.BaseManager, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.BaseManager.pigeon_newInstance" @@ -1648,39 +1630,45 @@ abstract class PigeonApiBaseManager(open val pigeonRegistrar: PigeonProxyApiRegi } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } + } /** * Event to notify publisher that an event occurred with an Ad. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdEvent(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +abstract class PigeonApiAdEvent(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { /** The type of event that occurred. */ abstract fun type(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdEvent): AdEventType + abstract fun adData(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdEvent): Map + @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of AdEvent and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdEvent, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of AdEvent and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdEvent, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val typeArg = type(pigeon_instanceArg) + val adDataArg = adData(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.AdEvent.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(listOf(pigeon_identifierArg, typeArg.raw)) { + channel.send(listOf(pigeon_identifierArg, typeArg, adDataArg)) { if (it is List<*>) { if (it.size > 1) { callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) @@ -1689,65 +1677,50 @@ abstract class PigeonApiAdEvent(open val pigeonRegistrar: PigeonProxyApiRegistra } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } + } /** * Factory class for creating SDK objects. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkFactory. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkFactory. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { abstract fun instance(): com.google.ads.interactivemedia.v3.api.ImaSdkFactory - abstract fun createAdDisplayContainer( - container: android.view.ViewGroup, - player: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer - ): com.google.ads.interactivemedia.v3.api.AdDisplayContainer + abstract fun createAdDisplayContainer(container: android.view.ViewGroup, player: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer): com.google.ads.interactivemedia.v3.api.AdDisplayContainer /** Creates an `ImaSdkSettings` object for configuring the IMA SDK. */ - abstract fun createImaSdkSettings( - pigeon_instance: com.google.ads.interactivemedia.v3.api.ImaSdkFactory - ): com.google.ads.interactivemedia.v3.api.ImaSdkSettings + abstract fun createImaSdkSettings(pigeon_instance: com.google.ads.interactivemedia.v3.api.ImaSdkFactory): com.google.ads.interactivemedia.v3.api.ImaSdkSettings - /** Creates an `AdsLoader` for requesting ads using the specified settings object. */ - abstract fun createAdsLoader( - pigeon_instance: com.google.ads.interactivemedia.v3.api.ImaSdkFactory, - settings: com.google.ads.interactivemedia.v3.api.ImaSdkSettings, - container: com.google.ads.interactivemedia.v3.api.AdDisplayContainer - ): com.google.ads.interactivemedia.v3.api.AdsLoader + /** + * Creates an `AdsLoader` for requesting ads using the specified settings + * object. + */ + abstract fun createAdsLoader(pigeon_instance: com.google.ads.interactivemedia.v3.api.ImaSdkFactory, settings: com.google.ads.interactivemedia.v3.api.ImaSdkSettings, container: com.google.ads.interactivemedia.v3.api.AdDisplayContainer): com.google.ads.interactivemedia.v3.api.AdsLoader /** Creates an AdsRequest object to contain the data used to request ads. */ - abstract fun createAdsRequest( - pigeon_instance: com.google.ads.interactivemedia.v3.api.ImaSdkFactory - ): com.google.ads.interactivemedia.v3.api.AdsRequest + abstract fun createAdsRequest(pigeon_instance: com.google.ads.interactivemedia.v3.api.ImaSdkFactory): com.google.ads.interactivemedia.v3.api.AdsRequest companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiImaSdkFactory?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.instance", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.instance", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_identifierArg = - args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.instance(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.instance(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1755,22 +1728,17 @@ abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: PigeonProxyApiRe } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createAdDisplayContainer", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createAdDisplayContainer", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val containerArg = args[0] as android.view.ViewGroup val playerArg = args[1] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer - val wrapped: List = - try { - listOf(api.createAdDisplayContainer(containerArg, playerArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.createAdDisplayContainer(containerArg, playerArg)) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1778,21 +1746,16 @@ abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: PigeonProxyApiRe } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createImaSdkSettings", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createImaSdkSettings", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.ImaSdkFactory - val wrapped: List = - try { - listOf(api.createImaSdkSettings(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.createImaSdkSettings(pigeon_instanceArg)) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1800,23 +1763,18 @@ abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: PigeonProxyApiRe } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createAdsLoader", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createAdsLoader", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.ImaSdkFactory val settingsArg = args[1] as com.google.ads.interactivemedia.v3.api.ImaSdkSettings val containerArg = args[2] as com.google.ads.interactivemedia.v3.api.AdDisplayContainer - val wrapped: List = - try { - listOf(api.createAdsLoader(pigeon_instanceArg, settingsArg, containerArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.createAdsLoader(pigeon_instanceArg, settingsArg, containerArg)) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1824,21 +1782,16 @@ abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: PigeonProxyApiRe } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createAdsRequest", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createAdsRequest", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.ImaSdkFactory - val wrapped: List = - try { - listOf(api.createAdsRequest(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.createAdsRequest(pigeon_instanceArg)) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1849,17 +1802,20 @@ abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: PigeonProxyApiRe } @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of ImaSdkFactory and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.ImaSdkFactory, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of ImaSdkFactory and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.ImaSdkFactory, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.pigeon_newInstance" @@ -1873,30 +1829,33 @@ abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: PigeonProxyApiRe } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } + } /** * Defines general SDK settings that are used when creating an `AdsLoader`. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkSettings.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkSettings.html. */ @Suppress("UNCHECKED_CAST") -open class PigeonApiImaSdkSettings(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +open class PigeonApiImaSdkSettings(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of ImaSdkSettings and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.ImaSdkSettings, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of ImaSdkSettings and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.ImaSdkSettings, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.ImaSdkSettings.pigeon_newInstance" @@ -1910,54 +1869,44 @@ open class PigeonApiImaSdkSettings(open val pigeonRegistrar: PigeonProxyApiRegis } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } + } /** * Defines an update to the video's progress. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoProgressUpdate.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoProgressUpdate.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiVideoProgressUpdate(open val pigeonRegistrar: PigeonProxyApiRegistrar) { - abstract fun pigeon_defaultConstructor( - currentTimeMs: Long, - durationMs: Long - ): com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate +abstract class PigeonApiVideoProgressUpdate(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { + abstract fun pigeon_defaultConstructor(currentTimeMs: Long, durationMs: Long): com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate - /** Value to use for cases when progress is not yet defined, such as video initialization. */ - abstract fun videoTimeNotReady(): - com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate + /** + * Value to use for cases when progress is not yet defined, such as video + * initialization. + */ + abstract fun videoTimeNotReady(): com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiVideoProgressUpdate?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.VideoProgressUpdate.pigeon_defaultConstructor", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoProgressUpdate.pigeon_defaultConstructor", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_identifierArg = - args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val currentTimeMsArg = - args[1].let { num -> if (num is Int) num.toLong() else num as Long } + val pigeon_identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } + val currentTimeMsArg = args[1].let { num -> if (num is Int) num.toLong() else num as Long } val durationMsArg = args[2].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(currentTimeMsArg, durationMsArg), - pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(currentTimeMsArg,durationMsArg), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1965,24 +1914,17 @@ abstract class PigeonApiVideoProgressUpdate(open val pigeonRegistrar: PigeonProx } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.VideoProgressUpdate.videoTimeNotReady", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoProgressUpdate.videoTimeNotReady", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_identifierArg = - args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.videoTimeNotReady(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.videoTimeNotReady(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1993,21 +1935,23 @@ abstract class PigeonApiVideoProgressUpdate(open val pigeonRegistrar: PigeonProx } @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of VideoProgressUpdate and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of VideoProgressUpdate and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.interactive_media_ads.VideoProgressUpdate.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoProgressUpdate.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { @@ -2018,34 +1962,35 @@ abstract class PigeonApiVideoProgressUpdate(open val pigeonRegistrar: PigeonProx } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } + } /** * The minimal information required to play an ad. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/AdMediaInfo.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/AdMediaInfo.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdMediaInfo(open val pigeonRegistrar: PigeonProxyApiRegistrar) { - abstract fun url( - pigeon_instance: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - ): String +abstract class PigeonApiAdMediaInfo(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { + abstract fun url(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo): String @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of AdMediaInfo and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of AdMediaInfo and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val urlArg = url(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec @@ -2060,23 +2005,23 @@ abstract class PigeonApiAdMediaInfo(open val pigeonRegistrar: PigeonProxyApiRegi } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } + } /** * An ad may be part of a pod of ads. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdPodInfo.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdPodInfo.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdPodInfo(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +abstract class PigeonApiAdPodInfo(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { /** * The position of the ad within the pod. * - * The value returned is one-based, for example, 1 of 2, 2 of 2, etc. If the ad is not part of a - * pod, this will return 1. + * The value returned is one-based, for example, 1 of 2, 2 of 2, etc. If the + * ad is not part of a pod, this will return 1. */ abstract fun adPosition(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdPodInfo): Long @@ -2085,9 +2030,7 @@ abstract class PigeonApiAdPodInfo(open val pigeonRegistrar: PigeonProxyApiRegist * * For unknown duration, -1 is returned. */ - abstract fun maxDuration( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdPodInfo - ): Double + abstract fun maxDuration(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdPodInfo): Double /** Client side and DAI VOD: Returns the index of the ad pod. */ abstract fun podIndex(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdPodInfo): Long @@ -2095,9 +2038,9 @@ abstract class PigeonApiAdPodInfo(open val pigeonRegistrar: PigeonProxyApiRegist /** * The content time offset at which the current ad pod was scheduled. * - * For preroll pod, 0 is returned. For midrolls, the scheduled time is returned in seconds. For - * postroll, -1 is returned. Defaults to 0 if this ad is not part of a pod, or the pod is not part - * of an ad playlist. + * For preroll pod, 0 is returned. For midrolls, the scheduled time is + * returned in seconds. For postroll, -1 is returned. Defaults to 0 if this + * ad is not part of a pod, or the pod is not part of an ad playlist. */ abstract fun timeOffset(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdPodInfo): Double @@ -2108,17 +2051,20 @@ abstract class PigeonApiAdPodInfo(open val pigeonRegistrar: PigeonProxyApiRegist abstract fun isBumper(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdPodInfo): Boolean @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of AdPodInfo and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdPodInfo, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of AdPodInfo and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdPodInfo, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val adPositionArg = adPosition(pigeon_instanceArg) val maxDurationArg = maxDuration(pigeon_instanceArg) val podIndexArg = podIndex(pigeon_instanceArg) @@ -2129,35 +2075,28 @@ abstract class PigeonApiAdPodInfo(open val pigeonRegistrar: PigeonProxyApiRegist val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.AdPodInfo.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send( - listOf( - pigeon_identifierArg, - adPositionArg, - maxDurationArg, - podIndexArg, - timeOffsetArg, - totalAdsArg, - isBumperArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) - } - } else { - callback(Result.failure(createConnectionError(channelName))) - } + channel.send(listOf(pigeon_identifierArg, adPositionArg, maxDurationArg, podIndexArg, timeOffsetArg, totalAdsArg, isBumperArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) } + } else { + callback(Result.failure(createConnectionError(channelName))) + } + } } + } /** - * FrameLayout is designed to block out an area on the screen to display a single item. + * FrameLayout is designed to block out an area on the screen to display a + * single item. * * See https://developer.android.com/reference/android/widget/FrameLayout. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiFrameLayout(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +abstract class PigeonApiFrameLayout(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { abstract fun pigeon_defaultConstructor(): android.widget.FrameLayout companion object { @@ -2165,24 +2104,17 @@ abstract class PigeonApiFrameLayout(open val pigeonRegistrar: PigeonProxyApiRegi fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiFrameLayout?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.FrameLayout.pigeon_defaultConstructor", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.FrameLayout.pigeon_defaultConstructor", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_identifierArg = - args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2193,17 +2125,20 @@ abstract class PigeonApiFrameLayout(open val pigeonRegistrar: PigeonProxyApiRegi } @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of FrameLayout and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.widget.FrameLayout, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of FrameLayout and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: android.widget.FrameLayout, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.FrameLayout.pigeon_newInstance" @@ -2217,15 +2152,17 @@ abstract class PigeonApiFrameLayout(open val pigeonRegistrar: PigeonProxyApiRegi } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } @Suppress("FunctionName") - /** An implementation of [PigeonApiViewGroup] used to access callback methods */ - fun pigeon_getPigeonApiViewGroup(): PigeonApiViewGroup { + /**An implementation of [PigeonApiViewGroup] used to access callback methods */ + fun pigeon_getPigeonApiViewGroup(): PigeonApiViewGroup + { return pigeonRegistrar.getPigeonApiViewGroup() } + } /** * A special view that can contain other views (called children.) @@ -2233,7 +2170,7 @@ abstract class PigeonApiFrameLayout(open val pigeonRegistrar: PigeonProxyApiRegi * See https://developer.android.com/reference/android/view/ViewGroup. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiViewGroup(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +abstract class PigeonApiViewGroup(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { abstract fun addView(pigeon_instance: android.view.ViewGroup, view: android.view.View) companion object { @@ -2241,23 +2178,18 @@ abstract class PigeonApiViewGroup(open val pigeonRegistrar: PigeonProxyApiRegist fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiViewGroup?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.ViewGroup.addView", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ViewGroup.addView", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.view.ViewGroup val viewArg = args[1] as android.view.View - val wrapped: List = - try { - api.addView(pigeon_instanceArg, viewArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.addView(pigeon_instanceArg, viewArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2268,17 +2200,20 @@ abstract class PigeonApiViewGroup(open val pigeonRegistrar: PigeonProxyApiRegist } @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of ViewGroup and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.view.ViewGroup, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of ViewGroup and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: android.view.ViewGroup, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.ViewGroup.pigeon_newInstance" @@ -2292,15 +2227,17 @@ abstract class PigeonApiViewGroup(open val pigeonRegistrar: PigeonProxyApiRegist } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } @Suppress("FunctionName") - /** An implementation of [PigeonApiView] used to access callback methods */ - fun pigeon_getPigeonApiView(): PigeonApiView { + /**An implementation of [PigeonApiView] used to access callback methods */ + fun pigeon_getPigeonApiView(): PigeonApiView + { return pigeonRegistrar.getPigeonApiView() } + } /** * Displays a video file. @@ -2308,7 +2245,7 @@ abstract class PigeonApiViewGroup(open val pigeonRegistrar: PigeonProxyApiRegist * See https://developer.android.com/reference/android/widget/VideoView. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiVideoView(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +abstract class PigeonApiVideoView(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { abstract fun pigeon_defaultConstructor(): android.widget.VideoView /** Sets the URI of the video. */ @@ -2326,24 +2263,17 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: PigeonProxyApiRegist fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiVideoView?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.VideoView.pigeon_defaultConstructor", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoView.pigeon_defaultConstructor", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_identifierArg = - args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2351,23 +2281,18 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: PigeonProxyApiRegist } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.VideoView.setVideoUri", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoView.setVideoUri", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.widget.VideoView val uriArg = args[1] as String - val wrapped: List = - try { - api.setVideoUri(pigeon_instanceArg, uriArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setVideoUri(pigeon_instanceArg, uriArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2375,21 +2300,16 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: PigeonProxyApiRegist } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.VideoView.getCurrentPosition", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoView.getCurrentPosition", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.widget.VideoView - val wrapped: List = - try { - listOf(api.getCurrentPosition(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.getCurrentPosition(pigeon_instanceArg)) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2400,25 +2320,31 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: PigeonProxyApiRegist } @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of VideoView and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.widget.VideoView, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of VideoView and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: android.widget.VideoView, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - throw IllegalStateException( - "Attempting to create a new Dart instance of VideoView, but the class has a nonnull callback method.") + throw IllegalStateException("Attempting to create a new Dart instance of VideoView, but the class has a nonnull callback method.") } /** Callback to be invoked when the media source is ready for playback. */ - fun onPrepared( - pigeon_instanceArg: android.widget.VideoView, - playerArg: android.media.MediaPlayer, - callback: (Result) -> Unit - ) { + fun onPrepared(pigeon_instanceArg: android.widget.VideoView, playerArg: android.media.MediaPlayer, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoView.onPrepared" @@ -2432,16 +2358,19 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: PigeonProxyApiRegist } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } /** Callback to be invoked when playback of a media source has completed. */ - fun onCompletion( - pigeon_instanceArg: android.widget.VideoView, - playerArg: android.media.MediaPlayer, - callback: (Result) -> Unit - ) { + fun onCompletion(pigeon_instanceArg: android.widget.VideoView, playerArg: android.media.MediaPlayer, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoView.onCompletion" @@ -2455,18 +2384,22 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: PigeonProxyApiRegist } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - /** Callback to be invoked when there has been an error during an asynchronous operation. */ - fun onError( - pigeon_instanceArg: android.widget.VideoView, - playerArg: android.media.MediaPlayer, - whatArg: Long, - extraArg: Long, - callback: (Result) -> Unit - ) { + /** + * Callback to be invoked when there has been an error during an asynchronous + * operation. + */ + fun onError(pigeon_instanceArg: android.widget.VideoView, playerArg: android.media.MediaPlayer, whatArg: Long, extraArg: Long, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoView.onError" @@ -2480,15 +2413,17 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: PigeonProxyApiRegist } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } @Suppress("FunctionName") - /** An implementation of [PigeonApiView] used to access callback methods */ - fun pigeon_getPigeonApiView(): PigeonApiView { + /**An implementation of [PigeonApiView] used to access callback methods */ + fun pigeon_getPigeonApiView(): PigeonApiView + { return pigeonRegistrar.getPigeonApiView() } + } /** * This class represents the basic building block for user interface components. @@ -2496,16 +2431,22 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: PigeonProxyApiRegist * See https://developer.android.com/reference/android/view/View. */ @Suppress("UNCHECKED_CAST") -open class PigeonApiView(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +open class PigeonApiView(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of View and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.view.View, callback: (Result) -> Unit) { + /**Creates a Dart instance of View and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: android.view.View, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.View.pigeon_newInstance" @@ -2519,17 +2460,19 @@ open class PigeonApiView(open val pigeonRegistrar: PigeonProxyApiRegistrar) { } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } + } /** - * MediaPlayer class can be used to control playback of audio/video files and streams. + * MediaPlayer class can be used to control playback of audio/video files and + * streams. * * See https://developer.android.com/reference/android/media/MediaPlayer. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { /** Gets the duration of the file. */ abstract fun getDuration(pigeon_instance: android.media.MediaPlayer): Long @@ -2550,21 +2493,16 @@ abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: PigeonProxyApiRegi fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiMediaPlayer?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.getDuration", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.getDuration", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.media.MediaPlayer - val wrapped: List = - try { - listOf(api.getDuration(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.getDuration(pigeon_instanceArg)) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2572,23 +2510,18 @@ abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: PigeonProxyApiRegi } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.seekTo", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.seekTo", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.media.MediaPlayer val mSecArg = args[1].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = - try { - api.seekTo(pigeon_instanceArg, mSecArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.seekTo(pigeon_instanceArg, mSecArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2596,22 +2529,17 @@ abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: PigeonProxyApiRegi } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.start", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.start", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.media.MediaPlayer - val wrapped: List = - try { - api.start(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.start(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2619,22 +2547,17 @@ abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: PigeonProxyApiRegi } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.pause", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.pause", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.media.MediaPlayer - val wrapped: List = - try { - api.pause(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.pause(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2642,20 +2565,17 @@ abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: PigeonProxyApiRegi } } run { - val channel = - BasicMessageChannel( - binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.stop", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.stop", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.media.MediaPlayer - val wrapped: List = - try { - api.stop(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.stop(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2666,17 +2586,20 @@ abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: PigeonProxyApiRegi } @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of MediaPlayer and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.media.MediaPlayer, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of MediaPlayer and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: android.media.MediaPlayer, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.pigeon_newInstance" @@ -2690,120 +2613,66 @@ abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: PigeonProxyApiRegi } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } + } /** * Callbacks that the player must fire. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.VideoAdPlayerCallback.html + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.VideoAdPlayerCallback.html */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: PigeonProxyApiRegistrar) { +abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { /** Fire this callback periodically as ad playback occurs. */ - abstract fun onAdProgress( - pigeon_instance: - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, - adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, - videoProgressUpdate: com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate - ) + abstract fun onAdProgress(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, videoProgressUpdate: com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate) /** Fire this callback when video playback stalls waiting for data. */ - abstract fun onBuffering( - pigeon_instance: - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, - adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - ) + abstract fun onBuffering(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo) /** Fire this callback when all content has finished playing. */ - abstract fun onContentComplete( - pigeon_instance: - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - ) + abstract fun onContentComplete(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback) /** Fire this callback when the video finishes playing. */ - abstract fun onEnded( - pigeon_instance: - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, - adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - ) + abstract fun onEnded(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo) /** Fire this callback when the video has encountered an error. */ - abstract fun onError( - pigeon_instance: - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, - adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - ) + abstract fun onError(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo) /** Fire this callback when the video is ready to begin playback. */ - abstract fun onLoaded( - pigeon_instance: - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, - adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - ) + abstract fun onLoaded(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo) /** Fire this callback when the video is paused. */ - abstract fun onPause( - pigeon_instance: - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, - adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - ) + abstract fun onPause(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo) /** Fire this callback when the player begins playing a video. */ - abstract fun onPlay( - pigeon_instance: - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, - adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - ) + abstract fun onPlay(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo) /** Fire this callback when the video is unpaused. */ - abstract fun onResume( - pigeon_instance: - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, - adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - ) + abstract fun onResume(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo) /** Fire this callback when the playback volume changes. */ - abstract fun onVolumeChanged( - pigeon_instance: - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, - adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, - percentage: Long - ) + abstract fun onVolumeChanged(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, percentage: Long) companion object { @Suppress("LocalVariableName") - fun setUpMessageHandlers( - binaryMessenger: BinaryMessenger, - api: PigeonApiVideoAdPlayerCallback? - ) { + fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiVideoAdPlayerCallback?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onAdProgress", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onAdProgress", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = - args[0] - as - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val adMediaInfoArg = - args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - val videoProgressUpdateArg = - args[2] as com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate - val wrapped: List = - try { - api.onAdProgress(pigeon_instanceArg, adMediaInfoArg, videoProgressUpdateArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val adMediaInfoArg = args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + val videoProgressUpdateArg = args[2] as com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate + val wrapped: List = try { + api.onAdProgress(pigeon_instanceArg, adMediaInfoArg, videoProgressUpdateArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2811,27 +2680,18 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: PigeonPr } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onBuffering", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onBuffering", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = - args[0] - as - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val adMediaInfoArg = - args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - val wrapped: List = - try { - api.onBuffering(pigeon_instanceArg, adMediaInfoArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val adMediaInfoArg = args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + val wrapped: List = try { + api.onBuffering(pigeon_instanceArg, adMediaInfoArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2839,25 +2699,17 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: PigeonPr } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onContentComplete", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onContentComplete", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = - args[0] - as - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val wrapped: List = - try { - api.onContentComplete(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val wrapped: List = try { + api.onContentComplete(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2865,27 +2717,18 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: PigeonPr } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onEnded", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onEnded", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = - args[0] - as - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val adMediaInfoArg = - args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - val wrapped: List = - try { - api.onEnded(pigeon_instanceArg, adMediaInfoArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val adMediaInfoArg = args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + val wrapped: List = try { + api.onEnded(pigeon_instanceArg, adMediaInfoArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2893,27 +2736,18 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: PigeonPr } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onError", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onError", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = - args[0] - as - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val adMediaInfoArg = - args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - val wrapped: List = - try { - api.onError(pigeon_instanceArg, adMediaInfoArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val adMediaInfoArg = args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + val wrapped: List = try { + api.onError(pigeon_instanceArg, adMediaInfoArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2921,27 +2755,18 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: PigeonPr } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onLoaded", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onLoaded", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = - args[0] - as - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val adMediaInfoArg = - args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - val wrapped: List = - try { - api.onLoaded(pigeon_instanceArg, adMediaInfoArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val adMediaInfoArg = args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + val wrapped: List = try { + api.onLoaded(pigeon_instanceArg, adMediaInfoArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2949,27 +2774,18 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: PigeonPr } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onPause", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onPause", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = - args[0] - as - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val adMediaInfoArg = - args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - val wrapped: List = - try { - api.onPause(pigeon_instanceArg, adMediaInfoArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val adMediaInfoArg = args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + val wrapped: List = try { + api.onPause(pigeon_instanceArg, adMediaInfoArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2977,27 +2793,18 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: PigeonPr } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onPlay", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onPlay", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = - args[0] - as - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val adMediaInfoArg = - args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - val wrapped: List = - try { - api.onPlay(pigeon_instanceArg, adMediaInfoArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val adMediaInfoArg = args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + val wrapped: List = try { + api.onPlay(pigeon_instanceArg, adMediaInfoArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3005,27 +2812,18 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: PigeonPr } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onResume", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onResume", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = - args[0] - as - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val adMediaInfoArg = - args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - val wrapped: List = - try { - api.onResume(pigeon_instanceArg, adMediaInfoArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val adMediaInfoArg = args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + val wrapped: List = try { + api.onResume(pigeon_instanceArg, adMediaInfoArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3033,28 +2831,19 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: PigeonPr } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onVolumeChanged", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onVolumeChanged", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = - args[0] - as - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val adMediaInfoArg = - args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val adMediaInfoArg = args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo val percentageArg = args[2].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = - try { - api.onVolumeChanged(pigeon_instanceArg, adMediaInfoArg, percentageArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.onVolumeChanged(pigeon_instanceArg, adMediaInfoArg, percentageArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3065,22 +2854,23 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: PigeonPr } @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of VideoAdPlayerCallback and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of VideoAdPlayerCallback and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { @@ -3091,57 +2881,46 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: PigeonPr } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } + } /** - * Defines the set of methods that a video player must implement to be used by the IMA SDK, as well - * as a set of callbacks that it must fire. + * Defines the set of methods that a video player must implement to be used by + * the IMA SDK, as well as a set of callbacks that it must fire. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: PigeonProxyApiRegistrar) { - abstract fun pigeon_defaultConstructor(): - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer +abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { + abstract fun pigeon_defaultConstructor(): com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer /** The volume of the player as a percentage from 0 to 100. */ - abstract fun setVolume( - pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, - value: Long - ) + abstract fun setVolume(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, value: Long) - /** The `VideoProgressUpdate` describing playback progress of the current video. */ - abstract fun setAdProgress( - pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, - progress: com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate - ) + /** + * The `VideoProgressUpdate` describing playback progress of the current + * video. + */ + abstract fun setAdProgress(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, progress: com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiVideoAdPlayer?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.pigeon_defaultConstructor", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.pigeon_defaultConstructor", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_identifierArg = - args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3149,24 +2928,18 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: PigeonProxyApiRe } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.setVolume", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.setVolume", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = - args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer val valueArg = args[1].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = - try { - api.setVolume(pigeon_instanceArg, valueArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setVolume(pigeon_instanceArg, valueArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3174,25 +2947,18 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: PigeonProxyApiRe } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.setAdProgress", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.setAdProgress", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = - args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer - val progressArg = - args[1] as com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate - val wrapped: List = - try { - api.setAdProgress(pigeon_instanceArg, progressArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer + val progressArg = args[1] as com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate + val wrapped: List = try { + api.setAdProgress(pigeon_instanceArg, progressArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3203,26 +2969,31 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: PigeonProxyApiRe } @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of VideoAdPlayer and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of VideoAdPlayer and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - throw IllegalStateException( - "Attempting to create a new Dart instance of VideoAdPlayer, but the class has a nonnull callback method.") + throw IllegalStateException("Attempting to create a new Dart instance of VideoAdPlayer, but the class has a nonnull callback method.") } /** Adds a callback. */ - fun addCallback( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, - callbackArg: - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, - callback: (Result) -> Unit - ) { + fun addCallback(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, callbackArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.addCallback" @@ -3236,17 +3007,19 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: PigeonProxyApiRe } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } /** Loads a video ad hosted at AdMediaInfo. */ - fun loadAd( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, - adMediaInfoArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, - adPodInfoArg: com.google.ads.interactivemedia.v3.api.AdPodInfo, - callback: (Result) -> Unit - ) { + fun loadAd(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, adMediaInfoArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, adPodInfoArg: com.google.ads.interactivemedia.v3.api.AdPodInfo, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.loadAd" @@ -3260,16 +3033,19 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: PigeonProxyApiRe } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } /** Pauses playing the current ad. */ - fun pauseAd( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, - adMediaInfoArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, - callback: (Result) -> Unit - ) { + fun pauseAd(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, adMediaInfoArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.pauseAd" @@ -3283,19 +3059,22 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: PigeonProxyApiRe } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } /** - * Starts or resumes playing the video ad referenced by the AdMediaInfo, provided loadAd has - * already been called for it. + * Starts or resumes playing the video ad referenced by the AdMediaInfo, + * provided loadAd has already been called for it. */ - fun playAd( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, - adMediaInfoArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, - callback: (Result) -> Unit - ) { + fun playAd(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, adMediaInfoArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.playAd" @@ -3309,15 +3088,19 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: PigeonProxyApiRe } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } /** Cleans up and releases all resources used by the `VideoAdPlayer`. */ - fun release( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, - callback: (Result) -> Unit - ) { + fun release(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.release" @@ -3331,17 +3114,19 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: PigeonProxyApiRe } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } /** Removes a callback. */ - fun removeCallback( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, - callbackArg: - com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, - callback: (Result) -> Unit - ) { + fun removeCallback(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, callbackArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.removeCallback" @@ -3355,16 +3140,19 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: PigeonProxyApiRe } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } /** Stops playing the current ad. */ - fun stopAd( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, - adMediaInfoArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, - callback: (Result) -> Unit - ) { + fun stopAd(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, adMediaInfoArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.stopAd" @@ -3378,44 +3166,36 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: PigeonProxyApiRe } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } + } /** * Listener interface for notification of ad load or stream load completion. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader.AdsLoadedListener.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader.AdsLoadedListener.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdsLoadedListener(open val pigeonRegistrar: PigeonProxyApiRegistrar) { - abstract fun pigeon_defaultConstructor(): - com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener +abstract class PigeonApiAdsLoadedListener(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { + abstract fun pigeon_defaultConstructor(): com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAdsLoadedListener?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsLoadedListener.pigeon_defaultConstructor", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsLoadedListener.pigeon_defaultConstructor", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_identifierArg = - args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3426,29 +3206,34 @@ abstract class PigeonApiAdsLoadedListener(open val pigeonRegistrar: PigeonProxyA } @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of AdsLoadedListener and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of AdsLoadedListener and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - throw IllegalStateException( - "Attempting to create a new Dart instance of AdsLoadedListener, but the class has a nonnull callback method.") + throw IllegalStateException("Attempting to create a new Dart instance of AdsLoadedListener, but the class has a nonnull callback method.") } /** Called once the AdsManager or StreamManager has been loaded. */ - fun onAdsManagerLoaded( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener, - eventArg: com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent, - callback: (Result) -> Unit - ) { + fun onAdsManagerLoaded(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener, eventArg: com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.interactive_media_ads.AdsLoadedListener.onAdsManagerLoaded" + val channelName = "dev.flutter.pigeon.interactive_media_ads.AdsLoadedListener.onAdsManagerLoaded" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg, eventArg)) { if (it is List<*>) { @@ -3459,44 +3244,36 @@ abstract class PigeonApiAdsLoadedListener(open val pigeonRegistrar: PigeonProxyA } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } + } /** * Interface for classes that will listen to AdErrorEvents. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.AdErrorListener.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.AdErrorListener.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdErrorListener(open val pigeonRegistrar: PigeonProxyApiRegistrar) { - abstract fun pigeon_defaultConstructor(): - com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener +abstract class PigeonApiAdErrorListener(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { + abstract fun pigeon_defaultConstructor(): com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAdErrorListener?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdErrorListener.pigeon_defaultConstructor", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdErrorListener.pigeon_defaultConstructor", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_identifierArg = - args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3507,25 +3284,31 @@ abstract class PigeonApiAdErrorListener(open val pigeonRegistrar: PigeonProxyApi } @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of AdErrorListener and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of AdErrorListener and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - throw IllegalStateException( - "Attempting to create a new Dart instance of AdErrorListener, but the class has a nonnull callback method.") + throw IllegalStateException("Attempting to create a new Dart instance of AdErrorListener, but the class has a nonnull callback method.") } /** Called when an error occurs. */ - fun onAdError( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener, - eventArg: com.google.ads.interactivemedia.v3.api.AdErrorEvent, - callback: (Result) -> Unit - ) { + fun onAdError(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener, eventArg: com.google.ads.interactivemedia.v3.api.AdErrorEvent, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.AdErrorListener.onAdError" @@ -3539,44 +3322,36 @@ abstract class PigeonApiAdErrorListener(open val pigeonRegistrar: PigeonProxyApi } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } + } /** * Listener interface for ad events. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventListener.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventListener.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdEventListener(open val pigeonRegistrar: PigeonProxyApiRegistrar) { - abstract fun pigeon_defaultConstructor(): - com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener +abstract class PigeonApiAdEventListener(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { + abstract fun pigeon_defaultConstructor(): com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAdEventListener?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdEventListener.pigeon_defaultConstructor", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdEventListener.pigeon_defaultConstructor", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_identifierArg = - args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3587,25 +3362,31 @@ abstract class PigeonApiAdEventListener(open val pigeonRegistrar: PigeonProxyApi } @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of AdEventListener and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener, - callback: (Result) -> Unit - ) { + /**Creates a Dart instance of AdEventListener and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { Result.success(Unit) return } - throw IllegalStateException( - "Attempting to create a new Dart instance of AdEventListener, but the class has a nonnull callback method.") + throw IllegalStateException("Attempting to create a new Dart instance of AdEventListener, but the class has a nonnull callback method.") } /** Respond to an occurrence of an AdEvent. */ - fun onAdEvent( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener, - eventArg: com.google.ads.interactivemedia.v3.api.AdEvent, - callback: (Result) -> Unit - ) { + fun onAdEvent(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener, eventArg: com.google.ads.interactivemedia.v3.api.AdEvent, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.AdEventListener.onAdEvent" @@ -3619,7 +3400,8 @@ abstract class PigeonApiAdEventListener(open val pigeonRegistrar: PigeonProxyApi } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } + } diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsPlugin.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsPlugin.kt index 5dd456e0d723..1e829f9a16d7 100644 --- a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsPlugin.kt +++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsPlugin.kt @@ -52,7 +52,7 @@ class InteractiveMediaAdsPlugin : FlutterPlugin, ActivityAware { } } -internal class FlutterViewFactory(private val instanceManager: PigeonInstanceManager) : +internal class FlutterViewFactory(private val instanceManager: InteractiveMediaAdsLibraryPigeonInstanceManager) : PlatformViewFactory(StandardMessageCodec.INSTANCE) { override fun create(context: Context, viewId: Int, args: Any?): PlatformView { diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ProxyApiRegistrar.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ProxyApiRegistrar.kt index ee15a91c2f35..fe80589b199e 100644 --- a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ProxyApiRegistrar.kt +++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ProxyApiRegistrar.kt @@ -10,11 +10,11 @@ import android.os.Looper import io.flutter.plugin.common.BinaryMessenger /** - * Implementation of [PigeonProxyApiRegistrar] that provides each ProxyApi implementation and any - * additional resources needed by an implementation. + * Implementation of [InteractiveMediaAdsLibraryPigeonProxyApiRegistrar] that provides each ProxyApi + * implementation and any additional resources needed by an implementation. */ open class ProxyApiRegistrar(binaryMessenger: BinaryMessenger, var context: Context) : - PigeonProxyApiRegistrar(binaryMessenger) { + InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(binaryMessenger) { // Added to be overriden for tests. The test implementation calls `callback` immediately, instead // of waiting for the main thread to run it. diff --git a/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/AdEventProxyApiTest.kt b/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/AdEventProxyApiTest.kt index fbab52be0080..974ad7b5f3ef 100644 --- a/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/AdEventProxyApiTest.kt +++ b/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/AdEventProxyApiTest.kt @@ -20,4 +20,14 @@ class AdEventProxyApiTest { assertEquals(AdEventType.PAUSED, api.type(instance)) } + + @Test + fun adData() { + val api = TestProxyApiRegistrar().getPigeonApiAdEvent() + + val instance = Mockito.mock() + whenever(instance.adData).thenReturn(mapOf("a" to "b", "c" to "d")) + + assertEquals(mapOf("a" to "b", "c" to "d"), api.adData(instance)) + } } diff --git a/packages/interactive_media_ads/lib/src/android/android_ads_manager.dart b/packages/interactive_media_ads/lib/src/android/android_ads_manager.dart index eadfe39eafa8..69e7fcd067eb 100644 --- a/packages/interactive_media_ads/lib/src/android/android_ads_manager.dart +++ b/packages/interactive_media_ads/lib/src/android/android_ads_manager.dart @@ -60,6 +60,7 @@ class AndroidAdsManager extends PlatformAdsManager { weakThis.target?._managerDelegate?.params.onAdEvent?.call( AdEvent( type: toInterfaceEventType(event.type), + adData: event.adData.cast(), ), ); }, diff --git a/packages/interactive_media_ads/lib/src/android/interactive_media_ads.g.dart b/packages/interactive_media_ads/lib/src/android/interactive_media_ads.g.dart index 5ba85481c3bf..a228dd5f2d6c 100644 --- a/packages/interactive_media_ads/lib/src/android/interactive_media_ads.g.dart +++ b/packages/interactive_media_ads/lib/src/android/interactive_media_ads.g.dart @@ -1,15 +1,14 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v19.1.0), do not edit directly. +// Autogenerated from Pigeon (v21.2.0), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; -import 'package:flutter/foundation.dart' - show ReadBuffer, WriteBuffer, immutable, protected; +import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer, immutable, protected; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart' show WidgetsFlutterBinding; @@ -20,8 +19,7 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse( - {Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -30,7 +28,6 @@ List wrapResponse( } return [error.code, error.message, error.details]; } - /// An immutable object that serves as the base class for all ProxyApis and /// can provide functional copies of itself. /// @@ -116,8 +113,7 @@ class PigeonInstanceManager { final Expando _identifiers = Expando(); final Map> _weakInstances = >{}; - final Map _strongInstances = - {}; + final Map _strongInstances = {}; late final Finalizer _finalizer; int _nextIdentifier = 0; @@ -135,59 +131,33 @@ class PigeonInstanceManager { api.removeStrongReference(identifier); }, ); - _PigeonInstanceManagerApi.setUpMessageHandlers( - instanceManager: instanceManager); - BaseDisplayContainer.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - AdDisplayContainer.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - AdsLoader.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - AdsManagerLoadedEvent.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - AdErrorEvent.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - AdError.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - AdsRequest.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - ContentProgressProvider.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - AdsManager.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - BaseManager.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - AdEvent.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - ImaSdkFactory.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - ImaSdkSettings.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - VideoProgressUpdate.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - AdMediaInfo.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - AdPodInfo.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - FrameLayout.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - ViewGroup.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - VideoView.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); + _PigeonInstanceManagerApi.setUpMessageHandlers(instanceManager: instanceManager); + BaseDisplayContainer.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + AdDisplayContainer.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + AdsLoader.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + AdsManagerLoadedEvent.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + AdErrorEvent.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + AdError.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + AdsRequest.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + ContentProgressProvider.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + AdsManager.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + BaseManager.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + AdEvent.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + ImaSdkFactory.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + ImaSdkSettings.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + VideoProgressUpdate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + AdMediaInfo.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + AdPodInfo.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + FrameLayout.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + ViewGroup.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + VideoView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); View.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - MediaPlayer.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - VideoAdPlayerCallback.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - VideoAdPlayer.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - AdsLoadedListener.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - AdErrorListener.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - AdEventListener.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); + MediaPlayer.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + VideoAdPlayerCallback.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + VideoAdPlayer.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + AdsLoadedListener.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + AdErrorListener.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + AdEventListener.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); return instanceManager; } @@ -251,19 +221,15 @@ class PigeonInstanceManager { /// /// This method also expects the host `InstanceManager` to have a strong /// reference to the instance the identifier is associated with. - T? getInstanceWithWeakReference( - int identifier) { - final PigeonProxyApiBaseClass? weakInstance = - _weakInstances[identifier]?.target; + T? getInstanceWithWeakReference(int identifier) { + final PigeonProxyApiBaseClass? weakInstance = _weakInstances[identifier]?.target; if (weakInstance == null) { - final PigeonProxyApiBaseClass? strongInstance = - _strongInstances[identifier]; + final PigeonProxyApiBaseClass? strongInstance = _strongInstances[identifier]; if (strongInstance != null) { final PigeonProxyApiBaseClass copy = strongInstance.pigeon_copy(); _identifiers[copy] = identifier; - _weakInstances[identifier] = - WeakReference(copy); + _weakInstances[identifier] = WeakReference(copy); _finalizer.attach(copy, identifier, detach: copy); return copy as T; } @@ -287,20 +253,17 @@ class PigeonInstanceManager { /// added. /// /// Returns unique identifier of the [instance] added. - void addHostCreatedInstance( - PigeonProxyApiBaseClass instance, int identifier) { + void addHostCreatedInstance(PigeonProxyApiBaseClass instance, int identifier) { _addInstanceWithIdentifier(instance, identifier); } - void _addInstanceWithIdentifier( - PigeonProxyApiBaseClass instance, int identifier) { + void _addInstanceWithIdentifier(PigeonProxyApiBaseClass instance, int identifier) { assert(!containsIdentifier(identifier)); assert(getIdentifier(instance) == null); assert(identifier >= 0); _identifiers[instance] = identifier; - _weakInstances[identifier] = - WeakReference(instance); + _weakInstances[identifier] = WeakReference(instance); _finalizer.attach(instance, identifier, detach: instance); final PigeonProxyApiBaseClass copy = instance.pigeon_copy(); @@ -423,110 +386,87 @@ class _PigeonInstanceManagerApi { } } -class _PigeonProxyApiBaseCodec extends StandardMessageCodec { - const _PigeonProxyApiBaseCodec(this.instanceManager); - final PigeonInstanceManager instanceManager; - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is PigeonProxyApiBaseClass) { - buffer.putUint8(128); - writeValue(buffer, instanceManager.getIdentifier(value)); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return instanceManager - .getInstanceWithWeakReference(readValue(buffer)! as int); - default: - return super.readValueOfType(type, buffer); - } - } +class _PigeonProxyApiBaseCodec extends _PigeonCodec { + const _PigeonProxyApiBaseCodec(this.instanceManager); + final PigeonInstanceManager instanceManager; + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is PigeonProxyApiBaseClass) { + buffer.putUint8(128); + writeValue(buffer, instanceManager.getIdentifier(value)); + } else { + super.writeValue(buffer, value); + } + } + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return instanceManager + .getInstanceWithWeakReference(readValue(buffer)! as int); + default: + return super.readValueOfType(type, buffer); + } + } } + /// The types of error that can be encountered. /// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorCode.html. enum AdErrorCode { /// Ads player was not provided. adsPlayerWasNotProvided, - /// There was a problem requesting ads from the server. adsRequestNetworkError, - /// A companion ad failed to load or render. companionAdLoadingFailed, - /// There was a problem requesting ads from the server. failedToRequestAds, - /// An error internal to the SDK occurred. internalError, - /// Invalid arguments were provided to SDK methods. invalidArguments, - /// An overlay ad failed to load. overlayAdLoadingFailed, - /// An overlay ad failed to render. overlayAdPlayingFailed, - /// Ads list was returned but ContentProgressProvider was not configured. playlistNoContentTracking, - /// Ads loader sent ads loaded event when it was not expected. unexpectedAdsLoadedEvent, - /// The ad response was not understood and cannot be parsed. unknownAdResponse, - /// An unexpected error occurred and the cause is not known. unknownError, - /// No assets were found in the VAST ad response. vastAssetNotFound, - /// A VAST response containing a single `` tag with no child tags. vastEmptyResponse, - /// Assets were found in the VAST ad response for a linear ad, but none of /// them matched the video player's capabilities. vastLinearAssetMismatch, - /// At least one VAST wrapper ad loaded successfully and a subsequent wrapper /// or inline ad load has timed out. vastLoadTimeout, - /// The ad response was not recognized as a valid VAST ad. vastMalformedResponse, - /// Failed to load media assets from a VAST response. vastMediaLoadTimeout, - /// Assets were found in the VAST ad response for a nonlinear ad, but none of /// them matched the video player's capabilities. vastNonlinearAssetMismatch, - /// No Ads VAST response after one or more wrappers. vastNoAdsAfterWrapper, - /// The maximum number of VAST wrapper redirects has been reached. vastTooManyRedirects, - /// Trafficking error. /// /// Video player received an ad type that it was not expecting and/or cannot /// display. vastTraffickingError, - /// There was an error playing the video ad. videoPlayError, - /// The error code is not recognized by this wrapper. unknown, } @@ -537,10 +477,8 @@ enum AdErrorCode { enum AdErrorType { /// Indicates that the error was encountered when the ad was being loaded. load, - /// Indicates that the error was encountered after the ad loaded, during ad play. play, - /// The error is not recognized by this wrapper. unknown, } @@ -551,92 +489,101 @@ enum AdErrorType { enum AdEventType { /// Fired when an ad break in a stream ends. adBreakEnded, - /// Fired when an ad break will not play back any ads. adBreakFetchError, - /// Fired when an ad break is ready from VMAP or ad rule ads. adBreakReady, - /// Fired when an ad break in a stream starts. adBreakStarted, - /// Fired when playback stalls while the ad buffers. adBuffering, - /// Fired when an ad period in a stream ends. adPeriodEnded, - /// Fired when an ad period in a stream starts. adPeriodStarted, - /// Fired to inform of ad progress and can be used by publisher to display a /// countdown timer. adProgress, - /// Fired when the ads manager is done playing all the valid ads in the ads /// response, or when the response doesn't return any valid ads. allAdsCompleted, - /// Fired when an ad is clicked. clicked, - /// Fired when an ad completes playing. completed, - /// Fired when content should be paused. contentPauseRequested, - /// Fired when content should be resumed. contentResumeRequested, - /// Fired when VOD stream cuepoints have changed. cuepointsChanged, - /// Fired when the ad playhead crosses first quartile. firstQuartile, - /// The user has closed the icon fallback image dialog. iconFallbackImageClosed, - /// The user has tapped an ad icon. iconTapped, - /// Fired when the VAST response has been received. loaded, - /// Fired to enable the SDK to communicate a message to be logged, which is /// stored in adData. log, - /// Fired when the ad playhead crosses midpoint. midpoint, - /// Fired when an ad is paused. paused, - /// Fired when an ad is resumed. resumed, - /// Fired when an ad changes its skippable state. skippableStateChanged, - /// Fired when an ad was skipped. skipped, - /// Fired when an ad starts playing. started, - /// Fired when a non-clickthrough portion of a video ad is clicked. tapped, - /// Fired when the ad playhead crosses third quartile. thirdQuartile, - /// The event type is not recognized by this wrapper. unknown, } + +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is AdErrorCode) { + buffer.putUint8(129); + writeValue(buffer, value.index); + } else if (value is AdErrorType) { + buffer.putUint8(130); + writeValue(buffer, value.index); + } else if (value is AdEventType) { + buffer.putUint8(131); + writeValue(buffer, value.index); + } else { + super.writeValue(buffer, value); + } + } + + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 129: + final int? value = readValue(buffer) as int?; + return value == null ? null : AdErrorCode.values[value]; + case 130: + final int? value = readValue(buffer) as int?; + return value == null ? null : AdErrorType.values[value]; + case 131: + final int? value = readValue(buffer) as int?; + return value == null ? null : AdEventType.values[value]; + default: + return super.readValueOfType(type, buffer); + } + } +} /// A base class for more specialized container interfaces. /// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseDisplayContainer.html. @@ -1158,15 +1105,13 @@ class AdError extends PigeonProxyApiBaseClass { final int? arg_pigeon_instanceIdentifier = (args[0] as int?); assert(arg_pigeon_instanceIdentifier != null, 'Argument for dev.flutter.pigeon.interactive_media_ads.AdError.pigeon_newInstance was null, expected non-null int.'); - final AdErrorCode? arg_errorCode = - args[1] == null ? null : AdErrorCode.values[args[1]! as int]; + final AdErrorCode? arg_errorCode = (args[1] as AdErrorCode?); assert(arg_errorCode != null, 'Argument for dev.flutter.pigeon.interactive_media_ads.AdError.pigeon_newInstance was null, expected non-null AdErrorCode.'); final int? arg_errorCodeNumber = (args[2] as int?); assert(arg_errorCodeNumber != null, 'Argument for dev.flutter.pigeon.interactive_media_ads.AdError.pigeon_newInstance was null, expected non-null int.'); - final AdErrorType? arg_errorType = - args[3] == null ? null : AdErrorType.values[args[3]! as int]; + final AdErrorType? arg_errorType = (args[3] as AdErrorType?); assert(arg_errorType != null, 'Argument for dev.flutter.pigeon.interactive_media_ads.AdError.pigeon_newInstance was null, expected non-null AdErrorType.'); final String? arg_message = (args[4] as String?); @@ -1776,16 +1721,22 @@ class AdEvent extends PigeonProxyApiBaseClass { super.pigeon_binaryMessenger, super.pigeon_instanceManager, required this.type, + required this.adData, }); /// The type of event that occurred. final AdEventType type; + final Map adData; + static void pigeon_setUpMessageHandlers({ bool pigeon_clearHandlers = false, BinaryMessenger? pigeon_binaryMessenger, PigeonInstanceManager? pigeon_instanceManager, - AdEvent Function(AdEventType type)? pigeon_newInstance, + AdEvent Function( + AdEventType type, + Map adData, + )? pigeon_newInstance, }) { final _PigeonProxyApiBaseCodec pigeonChannelCodec = _PigeonProxyApiBaseCodec( @@ -1807,18 +1758,22 @@ class AdEvent extends PigeonProxyApiBaseClass { final int? arg_pigeon_instanceIdentifier = (args[0] as int?); assert(arg_pigeon_instanceIdentifier != null, 'Argument for dev.flutter.pigeon.interactive_media_ads.AdEvent.pigeon_newInstance was null, expected non-null int.'); - final AdEventType? arg_type = - args[1] == null ? null : AdEventType.values[args[1]! as int]; + final AdEventType? arg_type = (args[1] as AdEventType?); assert(arg_type != null, 'Argument for dev.flutter.pigeon.interactive_media_ads.AdEvent.pigeon_newInstance was null, expected non-null AdEventType.'); + final Map? arg_adData = + (args[2] as Map?)?.cast(); + assert(arg_adData != null, + 'Argument for dev.flutter.pigeon.interactive_media_ads.AdEvent.pigeon_newInstance was null, expected non-null Map.'); try { (pigeon_instanceManager ?? PigeonInstanceManager.instance) .addHostCreatedInstance( - pigeon_newInstance?.call(arg_type!) ?? + pigeon_newInstance?.call(arg_type!, arg_adData!) ?? AdEvent.pigeon_detached( pigeon_binaryMessenger: pigeon_binaryMessenger, pigeon_instanceManager: pigeon_instanceManager, type: arg_type!, + adData: arg_adData!, ), arg_pigeon_instanceIdentifier!, ); @@ -1840,6 +1795,7 @@ class AdEvent extends PigeonProxyApiBaseClass { pigeon_binaryMessenger: pigeon_binaryMessenger, pigeon_instanceManager: pigeon_instanceManager, type: type, + adData: adData, ); } } @@ -4724,3 +4680,4 @@ class AdEventListener extends PigeonProxyApiBaseClass { ); } } + diff --git a/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart b/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart index 972a1e6818c4..e7034fe1510f 100644 --- a/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart +++ b/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart @@ -1,723 +1,725 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - +// // TODO(bparrishMines): Uncomment this file once // https://github.com/flutter/packages/pull/6371 lands. This file uses the // Kotlin ProxyApi feature from pigeon. // ignore_for_file: avoid_unused_constructor_parameters -// -// import 'package:pigeon/pigeon.dart'; -// -// @ConfigurePigeon( -// PigeonOptions( -// copyrightHeader: 'pigeons/copyright.txt', -// dartOut: 'lib/src/android/interactive_media_ads.g.dart', -// kotlinOut: -// 'android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt', -// kotlinOptions: KotlinOptions( -// package: 'dev.flutter.packages.interactive_media_ads', -// ), -// ), -// ) -// -// /// The types of error that can be encountered. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorCode.html. -// enum AdErrorCode { -// /// Ads player was not provided. -// adsPlayerWasNotProvided, -// -// /// There was a problem requesting ads from the server. -// adsRequestNetworkError, -// -// /// A companion ad failed to load or render. -// companionAdLoadingFailed, -// -// /// There was a problem requesting ads from the server. -// failedToRequestAds, -// -// /// An error internal to the SDK occurred. -// internalError, -// -// /// Invalid arguments were provided to SDK methods. -// invalidArguments, -// -// /// An overlay ad failed to load. -// overlayAdLoadingFailed, -// -// /// An overlay ad failed to render. -// overlayAdPlayingFailed, -// -// /// Ads list was returned but ContentProgressProvider was not configured. -// playlistNoContentTracking, -// -// /// Ads loader sent ads loaded event when it was not expected. -// unexpectedAdsLoadedEvent, -// -// /// The ad response was not understood and cannot be parsed. -// unknownAdResponse, -// -// /// An unexpected error occurred and the cause is not known. -// unknownError, -// -// /// No assets were found in the VAST ad response. -// vastAssetNotFound, -// -// /// A VAST response containing a single `` tag with no child tags. -// vastEmptyResponse, -// -// /// Assets were found in the VAST ad response for a linear ad, but none of -// /// them matched the video player's capabilities. -// vastLinearAssetMismatch, -// -// /// At least one VAST wrapper ad loaded successfully and a subsequent wrapper -// /// or inline ad load has timed out. -// vastLoadTimeout, -// -// /// The ad response was not recognized as a valid VAST ad. -// vastMalformedResponse, -// -// /// Failed to load media assets from a VAST response. -// vastMediaLoadTimeout, -// -// /// Assets were found in the VAST ad response for a nonlinear ad, but none of -// /// them matched the video player's capabilities. -// vastNonlinearAssetMismatch, -// -// /// No Ads VAST response after one or more wrappers. -// vastNoAdsAfterWrapper, -// -// /// The maximum number of VAST wrapper redirects has been reached. -// vastTooManyRedirects, -// -// /// Trafficking error. -// /// -// /// Video player received an ad type that it was not expecting and/or cannot -// /// display. -// vastTraffickingError, -// -// /// There was an error playing the video ad. -// videoPlayError, -// -// /// The error code is not recognized by this wrapper. -// unknown, -// } -// -// /// Specifies when the error was encountered, during either ad loading or playback. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorType.html. -// enum AdErrorType { -// /// Indicates that the error was encountered when the ad was being loaded. -// load, -// -// /// Indicates that the error was encountered after the ad loaded, during ad play. -// play, -// -// /// The error is not recognized by this wrapper. -// unknown, -// } -// -// /// Types of events that can occur during ad playback. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventType.html. -// enum AdEventType { -// /// Fired when an ad break in a stream ends. -// adBreakEnded, -// -// /// Fired when an ad break will not play back any ads. -// adBreakFetchError, -// -// /// Fired when an ad break is ready from VMAP or ad rule ads. -// adBreakReady, -// -// /// Fired when an ad break in a stream starts. -// adBreakStarted, -// -// /// Fired when playback stalls while the ad buffers. -// adBuffering, -// -// /// Fired when an ad period in a stream ends. -// adPeriodEnded, -// -// /// Fired when an ad period in a stream starts. -// adPeriodStarted, -// -// /// Fired to inform of ad progress and can be used by publisher to display a -// /// countdown timer. -// adProgress, -// -// /// Fired when the ads manager is done playing all the valid ads in the ads -// /// response, or when the response doesn't return any valid ads. -// allAdsCompleted, -// -// /// Fired when an ad is clicked. -// clicked, -// -// /// Fired when an ad completes playing. -// completed, -// -// /// Fired when content should be paused. -// contentPauseRequested, -// -// /// Fired when content should be resumed. -// contentResumeRequested, -// -// /// Fired when VOD stream cuepoints have changed. -// cuepointsChanged, -// -// /// Fired when the ad playhead crosses first quartile. -// firstQuartile, -// -// /// The user has closed the icon fallback image dialog. -// iconFallbackImageClosed, -// -// /// The user has tapped an ad icon. -// iconTapped, -// -// /// Fired when the VAST response has been received. -// loaded, -// -// /// Fired to enable the SDK to communicate a message to be logged, which is -// /// stored in adData. -// log, -// -// /// Fired when the ad playhead crosses midpoint. -// midpoint, -// -// /// Fired when an ad is paused. -// paused, -// -// /// Fired when an ad is resumed. -// resumed, -// -// /// Fired when an ad changes its skippable state. -// skippableStateChanged, -// -// /// Fired when an ad was skipped. -// skipped, -// -// /// Fired when an ad starts playing. -// started, -// -// /// Fired when a non-clickthrough portion of a video ad is clicked. -// tapped, -// -// /// Fired when the ad playhead crosses third quartile. -// thirdQuartile, -// -// /// The event type is not recognized by this wrapper. -// unknown, -// } -// -// /// A base class for more specialized container interfaces. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseDisplayContainer.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: -// 'com.google.ads.interactivemedia.v3.api.BaseDisplayContainer', -// ), -// ) -// abstract class BaseDisplayContainer {} -// -// /// A container in which to display the ads. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdDisplayContainer. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdDisplayContainer', -// ), -// ) -// abstract class AdDisplayContainer implements BaseDisplayContainer {} -// -// /// An object which allows publishers to request ads from ad servers or a -// /// dynamic ad insertion stream. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdsLoader', -// ), -// ) -// abstract class AdsLoader { -// /// Registers a listener for errors that occur during the ads request. -// void addAdErrorListener(AdErrorListener listener); -// -// /// Registers a listener for the ads manager loaded event. -// void addAdsLoadedListener(AdsLoadedListener listener); -// -// /// Requests ads from a server. -// void requestAds(AdsRequest request); -// } -// -// /// An event raised when ads are successfully loaded from the ad server through an AdsLoader. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManagerLoadedEvent.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: -// 'com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent', -// ), -// ) -// abstract class AdsManagerLoadedEvent { -// /// The ads manager that will control playback of the loaded ads, or null when -// /// using dynamic ad insertion. -// late final AdsManager manager; -// } -// -// /// An event raised when there is an error loading or playing ads. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdErrorEvent', -// ), -// ) -// abstract class AdErrorEvent { -// /// The AdError that caused this event. -// late final AdError error; -// } -// -// /// An error that occurred in the SDK. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdError', -// ), -// ) -// abstract class AdError { -// /// The error's code. -// late final AdErrorCode errorCode; -// -// /// The error code's number. -// late final int errorCodeNumber; -// -// /// The error's type. -// late final AdErrorType errorType; -// -// /// A human-readable summary of the error. -// late final String message; -// } -// -// /// An object containing the data used to request ads from the server. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsRequest. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdsRequest', -// ), -// ) -// abstract class AdsRequest { -// /// Sets the URL from which ads will be requested. -// void setAdTagUrl(String adTagUrl); -// -// /// Attaches a ContentProgressProvider instance to allow scheduling ad breaks -// /// based on content progress (cue points). -// void setContentProgressProvider(ContentProgressProvider provider); -// } -// -// /// Defines an interface to allow SDK to track progress of the content video. -// /// -// /// See https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/android/api/reference/com/google/ads/interactivemedia/v3/api/player/ContentProgressProvider.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: -// 'com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider', -// ), -// ) -// abstract class ContentProgressProvider {} -// -// /// An object which handles playing ads after they've been received from the -// /// server. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManager. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdsManager', -// ), -// ) -// abstract class AdsManager extends BaseManager { -// /// Discards current ad break and resumes content. -// void discardAdBreak(); -// -// /// Pauses the current ad. -// void pause(); -// -// /// Starts playing the ads. -// void start(); -// } -// -// /// Base interface for managing ads.. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseManager.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.BaseManager', -// ), -// ) -// abstract class BaseManager { -// /// Registers a listener for errors that occur during the ad or stream -// /// initialization and playback. -// void addAdErrorListener(AdErrorListener errorListener); -// -// /// Registers a listener for ad events that occur during ad or stream -// /// initialization and playback. -// void addAdEventListener(AdEventListener adEventListener); -// -// /// Stops the ad and all tracking, then releases all assets that were loaded -// /// to play the ad. -// void destroy(); -// -// /// Initializes the ad experience using default rendering settings -// void init(); -// } -// -// /// Event to notify publisher that an event occurred with an Ad. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdEvent', -// ), -// ) -// abstract class AdEvent { -// /// The type of event that occurred. -// late final AdEventType type; -// } -// -// /// Factory class for creating SDK objects. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkFactory. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.ImaSdkFactory', -// ), -// ) -// abstract class ImaSdkFactory { -// @static -// @attached -// late final ImaSdkFactory instance; -// -// @static -// AdDisplayContainer createAdDisplayContainer( -// ViewGroup container, -// VideoAdPlayer player, -// ); -// -// /// Creates an `ImaSdkSettings` object for configuring the IMA SDK. -// ImaSdkSettings createImaSdkSettings(); -// -// /// Creates an `AdsLoader` for requesting ads using the specified settings -// /// object. -// AdsLoader createAdsLoader( -// ImaSdkSettings settings, -// AdDisplayContainer container, -// ); -// -// /// Creates an AdsRequest object to contain the data used to request ads. -// AdsRequest createAdsRequest(); -// } -// -// /// Defines general SDK settings that are used when creating an `AdsLoader`. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkSettings.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.ImaSdkSettings', -// ), -// ) -// abstract class ImaSdkSettings {} -// -// /// Defines an update to the video's progress. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoProgressUpdate.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: -// 'com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate', -// ), -// ) -// abstract class VideoProgressUpdate { -// VideoProgressUpdate(int currentTimeMs, int durationMs); -// -// /// Value to use for cases when progress is not yet defined, such as video -// /// initialization. -// @static -// @attached -// late final VideoProgressUpdate videoTimeNotReady; -// } -// -// /// The minimal information required to play an ad. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/AdMediaInfo.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.player.AdMediaInfo', -// ), -// ) -// abstract class AdMediaInfo { -// late final String url; -// } -// -// /// An ad may be part of a pod of ads. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdPodInfo.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdPodInfo', -// ), -// ) -// abstract class AdPodInfo { -// /// The position of the ad within the pod. -// /// -// /// The value returned is one-based, for example, 1 of 2, 2 of 2, etc. If the -// /// ad is not part of a pod, this will return 1. -// late final int adPosition; -// -// /// The maximum duration of the pod in seconds. -// /// -// /// For unknown duration, -1 is returned. -// late final double maxDuration; -// -// /// Client side and DAI VOD: Returns the index of the ad pod. -// late final int podIndex; -// -// /// The content time offset at which the current ad pod was scheduled. -// /// -// /// For preroll pod, 0 is returned. For midrolls, the scheduled time is -// /// returned in seconds. For postroll, -1 is returned. Defaults to 0 if this -// /// ad is not part of a pod, or the pod is not part of an ad playlist. -// late final double timeOffset; -// -// /// The total number of ads contained within this pod, including bumpers. -// late final int totalAds; -// -// /// Returns true if the ad is a bumper ad. -// late final bool isBumper; -// } -// -// /// FrameLayout is designed to block out an area on the screen to display a -// /// single item. -// /// -// /// See https://developer.android.com/reference/android/widget/FrameLayout. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'android.widget.FrameLayout', -// ), -// ) -// abstract class FrameLayout extends ViewGroup { -// FrameLayout(); -// } -// -// /// A special view that can contain other views (called children.) -// /// -// /// See https://developer.android.com/reference/android/view/ViewGroup. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'android.view.ViewGroup', -// ), -// ) -// abstract class ViewGroup extends View { -// void addView(View view); -// } -// -// /// Displays a video file. -// /// -// /// See https://developer.android.com/reference/android/widget/VideoView. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'android.widget.VideoView', -// ), -// ) -// abstract class VideoView extends View { -// VideoView(); -// -// /// Callback to be invoked when the media source is ready for playback. -// late final void Function(MediaPlayer player)? onPrepared; -// -// /// Callback to be invoked when playback of a media source has completed. -// late final void Function(MediaPlayer player)? onCompletion; -// -// /// Callback to be invoked when there has been an error during an asynchronous -// /// operation. -// late final void Function(MediaPlayer player, int what, int extra) onError; -// -// /// Sets the URI of the video. -// void setVideoUri(String uri); -// -// /// The current position of the playing video. -// /// -// /// In milliseconds. -// int getCurrentPosition(); -// } -// -// /// This class represents the basic building block for user interface components. -// /// -// /// See https://developer.android.com/reference/android/view/View. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions(fullClassName: 'android.view.View'), -// ) -// abstract class View {} -// -// /// MediaPlayer class can be used to control playback of audio/video files and -// /// streams. -// /// -// /// See https://developer.android.com/reference/android/media/MediaPlayer. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'android.media.MediaPlayer', -// ), -// ) -// abstract class MediaPlayer { -// /// Gets the duration of the file. -// int getDuration(); -// -// /// Seeks to specified time position. -// void seekTo(int mSec); -// -// /// Starts or resumes playback. -// void start(); -// -// /// Pauses playback. -// void pause(); -// -// /// Stops playback after playback has been started or paused. -// void stop(); -// } -// -// /// Callbacks that the player must fire. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.VideoAdPlayerCallback.html -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: -// 'com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback', -// ), -// ) -// abstract class VideoAdPlayerCallback { -// /// Fire this callback periodically as ad playback occurs. -// void onAdProgress( -// AdMediaInfo adMediaInfo, -// VideoProgressUpdate videoProgressUpdate, -// ); -// -// /// Fire this callback when video playback stalls waiting for data. -// void onBuffering(AdMediaInfo adMediaInfo); -// -// /// Fire this callback when all content has finished playing. -// void onContentComplete(); -// -// /// Fire this callback when the video finishes playing. -// void onEnded(AdMediaInfo adMediaInfo); -// -// /// Fire this callback when the video has encountered an error. -// void onError(AdMediaInfo adMediaInfo); -// -// /// Fire this callback when the video is ready to begin playback. -// void onLoaded(AdMediaInfo adMediaInfo); -// -// /// Fire this callback when the video is paused. -// void onPause(AdMediaInfo adMediaInfo); -// -// /// Fire this callback when the player begins playing a video. -// void onPlay(AdMediaInfo adMediaInfo); -// -// /// Fire this callback when the video is unpaused. -// void onResume(AdMediaInfo adMediaInfo); -// -// /// Fire this callback when the playback volume changes. -// void onVolumeChanged(AdMediaInfo adMediaInfo, int percentage); -// } -// -// /// Defines the set of methods that a video player must implement to be used by -// /// the IMA SDK, as well as a set of callbacks that it must fire. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: -// 'com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer', -// ), -// ) -// abstract class VideoAdPlayer { -// VideoAdPlayer(); -// -// /// Adds a callback. -// late final void Function(VideoAdPlayerCallback callback) addCallback; -// -// /// Loads a video ad hosted at AdMediaInfo. -// late final void Function(AdMediaInfo adMediaInfo, AdPodInfo adPodInfo) loadAd; -// -// /// Pauses playing the current ad. -// late final void Function(AdMediaInfo adMediaInfo) pauseAd; -// -// /// Starts or resumes playing the video ad referenced by the AdMediaInfo, -// /// provided loadAd has already been called for it. -// late final void Function(AdMediaInfo adMediaInfo) playAd; -// -// /// Cleans up and releases all resources used by the `VideoAdPlayer`. -// late final void Function() release; -// -// /// Removes a callback. -// late final void Function(VideoAdPlayerCallback callback) removeCallback; -// -// /// Stops playing the current ad. -// late final void Function(AdMediaInfo adMediaInfo) stopAd; -// -// /// The volume of the player as a percentage from 0 to 100. -// void setVolume(int value); -// -// /// The `VideoProgressUpdate` describing playback progress of the current -// /// video. -// void setAdProgress(VideoProgressUpdate progress); -// } -// -// /// Listener interface for notification of ad load or stream load completion. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader.AdsLoadedListener.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: -// 'com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener', -// ), -// ) -// abstract class AdsLoadedListener { -// AdsLoadedListener(); -// -// /// Called once the AdsManager or StreamManager has been loaded. -// late final void Function(AdsManagerLoadedEvent event) onAdsManagerLoaded; -// } -// -// /// Interface for classes that will listen to AdErrorEvents. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.AdErrorListener.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: -// 'com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener', -// ), -// ) -// abstract class AdErrorListener { -// AdErrorListener(); -// -// /// Called when an error occurs. -// late final void Function(AdErrorEvent event) onAdError; -// } -// -// /// Listener interface for ad events. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventListener.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: -// 'com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener', -// ), -// ) -// abstract class AdEventListener { -// AdEventListener(); -// -// /// Respond to an occurrence of an AdEvent. -// late final void Function(AdEvent event) onAdEvent; -// } + +import 'package:pigeon/pigeon.dart'; + +@ConfigurePigeon( + PigeonOptions( + copyrightHeader: 'pigeons/copyright.txt', + dartOut: 'lib/src/android/interactive_media_ads.g.dart', + kotlinOut: + 'android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt', + kotlinOptions: KotlinOptions( + package: 'dev.flutter.packages.interactive_media_ads', + ), + ), +) + +/// The types of error that can be encountered. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorCode.html. +enum AdErrorCode { + /// Ads player was not provided. + adsPlayerWasNotProvided, + + /// There was a problem requesting ads from the server. + adsRequestNetworkError, + + /// A companion ad failed to load or render. + companionAdLoadingFailed, + + /// There was a problem requesting ads from the server. + failedToRequestAds, + + /// An error internal to the SDK occurred. + internalError, + + /// Invalid arguments were provided to SDK methods. + invalidArguments, + + /// An overlay ad failed to load. + overlayAdLoadingFailed, + + /// An overlay ad failed to render. + overlayAdPlayingFailed, + + /// Ads list was returned but ContentProgressProvider was not configured. + playlistNoContentTracking, + + /// Ads loader sent ads loaded event when it was not expected. + unexpectedAdsLoadedEvent, + + /// The ad response was not understood and cannot be parsed. + unknownAdResponse, + + /// An unexpected error occurred and the cause is not known. + unknownError, + + /// No assets were found in the VAST ad response. + vastAssetNotFound, + + /// A VAST response containing a single `` tag with no child tags. + vastEmptyResponse, + + /// Assets were found in the VAST ad response for a linear ad, but none of + /// them matched the video player's capabilities. + vastLinearAssetMismatch, + + /// At least one VAST wrapper ad loaded successfully and a subsequent wrapper + /// or inline ad load has timed out. + vastLoadTimeout, + + /// The ad response was not recognized as a valid VAST ad. + vastMalformedResponse, + + /// Failed to load media assets from a VAST response. + vastMediaLoadTimeout, + + /// Assets were found in the VAST ad response for a nonlinear ad, but none of + /// them matched the video player's capabilities. + vastNonlinearAssetMismatch, + + /// No Ads VAST response after one or more wrappers. + vastNoAdsAfterWrapper, + + /// The maximum number of VAST wrapper redirects has been reached. + vastTooManyRedirects, + + /// Trafficking error. + /// + /// Video player received an ad type that it was not expecting and/or cannot + /// display. + vastTraffickingError, + + /// There was an error playing the video ad. + videoPlayError, + + /// The error code is not recognized by this wrapper. + unknown, +} + +/// Specifies when the error was encountered, during either ad loading or playback. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorType.html. +enum AdErrorType { + /// Indicates that the error was encountered when the ad was being loaded. + load, + + /// Indicates that the error was encountered after the ad loaded, during ad play. + play, + + /// The error is not recognized by this wrapper. + unknown, +} + +/// Types of events that can occur during ad playback. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventType.html. +enum AdEventType { + /// Fired when an ad break in a stream ends. + adBreakEnded, + + /// Fired when an ad break will not play back any ads. + adBreakFetchError, + + /// Fired when an ad break is ready from VMAP or ad rule ads. + adBreakReady, + + /// Fired when an ad break in a stream starts. + adBreakStarted, + + /// Fired when playback stalls while the ad buffers. + adBuffering, + + /// Fired when an ad period in a stream ends. + adPeriodEnded, + + /// Fired when an ad period in a stream starts. + adPeriodStarted, + + /// Fired to inform of ad progress and can be used by publisher to display a + /// countdown timer. + adProgress, + + /// Fired when the ads manager is done playing all the valid ads in the ads + /// response, or when the response doesn't return any valid ads. + allAdsCompleted, + + /// Fired when an ad is clicked. + clicked, + + /// Fired when an ad completes playing. + completed, + + /// Fired when content should be paused. + contentPauseRequested, + + /// Fired when content should be resumed. + contentResumeRequested, + + /// Fired when VOD stream cuepoints have changed. + cuepointsChanged, + + /// Fired when the ad playhead crosses first quartile. + firstQuartile, + + /// The user has closed the icon fallback image dialog. + iconFallbackImageClosed, + + /// The user has tapped an ad icon. + iconTapped, + + /// Fired when the VAST response has been received. + loaded, + + /// Fired to enable the SDK to communicate a message to be logged, which is + /// stored in adData. + log, + + /// Fired when the ad playhead crosses midpoint. + midpoint, + + /// Fired when an ad is paused. + paused, + + /// Fired when an ad is resumed. + resumed, + + /// Fired when an ad changes its skippable state. + skippableStateChanged, + + /// Fired when an ad was skipped. + skipped, + + /// Fired when an ad starts playing. + started, + + /// Fired when a non-clickthrough portion of a video ad is clicked. + tapped, + + /// Fired when the ad playhead crosses third quartile. + thirdQuartile, + + /// The event type is not recognized by this wrapper. + unknown, +} + +/// A base class for more specialized container interfaces. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseDisplayContainer.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: + 'com.google.ads.interactivemedia.v3.api.BaseDisplayContainer', + ), +) +abstract class BaseDisplayContainer {} + +/// A container in which to display the ads. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdDisplayContainer. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.AdDisplayContainer', + ), +) +abstract class AdDisplayContainer implements BaseDisplayContainer {} + +/// An object which allows publishers to request ads from ad servers or a +/// dynamic ad insertion stream. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.AdsLoader', + ), +) +abstract class AdsLoader { + /// Registers a listener for errors that occur during the ads request. + void addAdErrorListener(AdErrorListener listener); + + /// Registers a listener for the ads manager loaded event. + void addAdsLoadedListener(AdsLoadedListener listener); + + /// Requests ads from a server. + void requestAds(AdsRequest request); +} + +/// An event raised when ads are successfully loaded from the ad server through an AdsLoader. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManagerLoadedEvent.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: + 'com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent', + ), +) +abstract class AdsManagerLoadedEvent { + /// The ads manager that will control playback of the loaded ads, or null when + /// using dynamic ad insertion. + late final AdsManager manager; +} + +/// An event raised when there is an error loading or playing ads. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.AdErrorEvent', + ), +) +abstract class AdErrorEvent { + /// The AdError that caused this event. + late final AdError error; +} + +/// An error that occurred in the SDK. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.AdError', + ), +) +abstract class AdError { + /// The error's code. + late final AdErrorCode errorCode; + + /// The error code's number. + late final int errorCodeNumber; + + /// The error's type. + late final AdErrorType errorType; + + /// A human-readable summary of the error. + late final String message; +} + +/// An object containing the data used to request ads from the server. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsRequest. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.AdsRequest', + ), +) +abstract class AdsRequest { + /// Sets the URL from which ads will be requested. + void setAdTagUrl(String adTagUrl); + + /// Attaches a ContentProgressProvider instance to allow scheduling ad breaks + /// based on content progress (cue points). + void setContentProgressProvider(ContentProgressProvider provider); +} + +/// Defines an interface to allow SDK to track progress of the content video. +/// +/// See https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/android/api/reference/com/google/ads/interactivemedia/v3/api/player/ContentProgressProvider.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: + 'com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider', + ), +) +abstract class ContentProgressProvider {} + +/// An object which handles playing ads after they've been received from the +/// server. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManager. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.AdsManager', + ), +) +abstract class AdsManager extends BaseManager { + /// Discards current ad break and resumes content. + void discardAdBreak(); + + /// Pauses the current ad. + void pause(); + + /// Starts playing the ads. + void start(); +} + +/// Base interface for managing ads.. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseManager.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.BaseManager', + ), +) +abstract class BaseManager { + /// Registers a listener for errors that occur during the ad or stream + /// initialization and playback. + void addAdErrorListener(AdErrorListener errorListener); + + /// Registers a listener for ad events that occur during ad or stream + /// initialization and playback. + void addAdEventListener(AdEventListener adEventListener); + + /// Stops the ad and all tracking, then releases all assets that were loaded + /// to play the ad. + void destroy(); + + /// Initializes the ad experience using default rendering settings + void init(); +} + +/// Event to notify publisher that an event occurred with an Ad. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.AdEvent', + ), +) +abstract class AdEvent { + /// The type of event that occurred. + late final AdEventType type; + + late final Map adData; +} + +/// Factory class for creating SDK objects. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkFactory. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.ImaSdkFactory', + ), +) +abstract class ImaSdkFactory { + @static + @attached + late final ImaSdkFactory instance; + + @static + AdDisplayContainer createAdDisplayContainer( + ViewGroup container, + VideoAdPlayer player, + ); + + /// Creates an `ImaSdkSettings` object for configuring the IMA SDK. + ImaSdkSettings createImaSdkSettings(); + + /// Creates an `AdsLoader` for requesting ads using the specified settings + /// object. + AdsLoader createAdsLoader( + ImaSdkSettings settings, + AdDisplayContainer container, + ); + + /// Creates an AdsRequest object to contain the data used to request ads. + AdsRequest createAdsRequest(); +} + +/// Defines general SDK settings that are used when creating an `AdsLoader`. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkSettings.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.ImaSdkSettings', + ), +) +abstract class ImaSdkSettings {} + +/// Defines an update to the video's progress. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoProgressUpdate.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: + 'com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate', + ), +) +abstract class VideoProgressUpdate { + VideoProgressUpdate(int currentTimeMs, int durationMs); + + /// Value to use for cases when progress is not yet defined, such as video + /// initialization. + @static + @attached + late final VideoProgressUpdate videoTimeNotReady; +} + +/// The minimal information required to play an ad. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/AdMediaInfo.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.player.AdMediaInfo', + ), +) +abstract class AdMediaInfo { + late final String url; +} + +/// An ad may be part of a pod of ads. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdPodInfo.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.AdPodInfo', + ), +) +abstract class AdPodInfo { + /// The position of the ad within the pod. + /// + /// The value returned is one-based, for example, 1 of 2, 2 of 2, etc. If the + /// ad is not part of a pod, this will return 1. + late final int adPosition; + + /// The maximum duration of the pod in seconds. + /// + /// For unknown duration, -1 is returned. + late final double maxDuration; + + /// Client side and DAI VOD: Returns the index of the ad pod. + late final int podIndex; + + /// The content time offset at which the current ad pod was scheduled. + /// + /// For preroll pod, 0 is returned. For midrolls, the scheduled time is + /// returned in seconds. For postroll, -1 is returned. Defaults to 0 if this + /// ad is not part of a pod, or the pod is not part of an ad playlist. + late final double timeOffset; + + /// The total number of ads contained within this pod, including bumpers. + late final int totalAds; + + /// Returns true if the ad is a bumper ad. + late final bool isBumper; +} + +/// FrameLayout is designed to block out an area on the screen to display a +/// single item. +/// +/// See https://developer.android.com/reference/android/widget/FrameLayout. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'android.widget.FrameLayout', + ), +) +abstract class FrameLayout extends ViewGroup { + FrameLayout(); +} + +/// A special view that can contain other views (called children.) +/// +/// See https://developer.android.com/reference/android/view/ViewGroup. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'android.view.ViewGroup', + ), +) +abstract class ViewGroup extends View { + void addView(View view); +} + +/// Displays a video file. +/// +/// See https://developer.android.com/reference/android/widget/VideoView. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'android.widget.VideoView', + ), +) +abstract class VideoView extends View { + VideoView(); + + /// Callback to be invoked when the media source is ready for playback. + late final void Function(MediaPlayer player)? onPrepared; + + /// Callback to be invoked when playback of a media source has completed. + late final void Function(MediaPlayer player)? onCompletion; + + /// Callback to be invoked when there has been an error during an asynchronous + /// operation. + late final void Function(MediaPlayer player, int what, int extra) onError; + + /// Sets the URI of the video. + void setVideoUri(String uri); + + /// The current position of the playing video. + /// + /// In milliseconds. + int getCurrentPosition(); +} + +/// This class represents the basic building block for user interface components. +/// +/// See https://developer.android.com/reference/android/view/View. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions(fullClassName: 'android.view.View'), +) +abstract class View {} + +/// MediaPlayer class can be used to control playback of audio/video files and +/// streams. +/// +/// See https://developer.android.com/reference/android/media/MediaPlayer. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'android.media.MediaPlayer', + ), +) +abstract class MediaPlayer { + /// Gets the duration of the file. + int getDuration(); + + /// Seeks to specified time position. + void seekTo(int mSec); + + /// Starts or resumes playback. + void start(); + + /// Pauses playback. + void pause(); + + /// Stops playback after playback has been started or paused. + void stop(); +} + +/// Callbacks that the player must fire. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.VideoAdPlayerCallback.html +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: + 'com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback', + ), +) +abstract class VideoAdPlayerCallback { + /// Fire this callback periodically as ad playback occurs. + void onAdProgress( + AdMediaInfo adMediaInfo, + VideoProgressUpdate videoProgressUpdate, + ); + + /// Fire this callback when video playback stalls waiting for data. + void onBuffering(AdMediaInfo adMediaInfo); + + /// Fire this callback when all content has finished playing. + void onContentComplete(); + + /// Fire this callback when the video finishes playing. + void onEnded(AdMediaInfo adMediaInfo); + + /// Fire this callback when the video has encountered an error. + void onError(AdMediaInfo adMediaInfo); + + /// Fire this callback when the video is ready to begin playback. + void onLoaded(AdMediaInfo adMediaInfo); + + /// Fire this callback when the video is paused. + void onPause(AdMediaInfo adMediaInfo); + + /// Fire this callback when the player begins playing a video. + void onPlay(AdMediaInfo adMediaInfo); + + /// Fire this callback when the video is unpaused. + void onResume(AdMediaInfo adMediaInfo); + + /// Fire this callback when the playback volume changes. + void onVolumeChanged(AdMediaInfo adMediaInfo, int percentage); +} + +/// Defines the set of methods that a video player must implement to be used by +/// the IMA SDK, as well as a set of callbacks that it must fire. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: + 'com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer', + ), +) +abstract class VideoAdPlayer { + VideoAdPlayer(); + + /// Adds a callback. + late final void Function(VideoAdPlayerCallback callback) addCallback; + + /// Loads a video ad hosted at AdMediaInfo. + late final void Function(AdMediaInfo adMediaInfo, AdPodInfo adPodInfo) loadAd; + + /// Pauses playing the current ad. + late final void Function(AdMediaInfo adMediaInfo) pauseAd; + + /// Starts or resumes playing the video ad referenced by the AdMediaInfo, + /// provided loadAd has already been called for it. + late final void Function(AdMediaInfo adMediaInfo) playAd; + + /// Cleans up and releases all resources used by the `VideoAdPlayer`. + late final void Function() release; + + /// Removes a callback. + late final void Function(VideoAdPlayerCallback callback) removeCallback; + + /// Stops playing the current ad. + late final void Function(AdMediaInfo adMediaInfo) stopAd; + + /// The volume of the player as a percentage from 0 to 100. + void setVolume(int value); + + /// The `VideoProgressUpdate` describing playback progress of the current + /// video. + void setAdProgress(VideoProgressUpdate progress); +} + +/// Listener interface for notification of ad load or stream load completion. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader.AdsLoadedListener.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: + 'com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener', + ), +) +abstract class AdsLoadedListener { + AdsLoadedListener(); + + /// Called once the AdsManager or StreamManager has been loaded. + late final void Function(AdsManagerLoadedEvent event) onAdsManagerLoaded; +} + +/// Interface for classes that will listen to AdErrorEvents. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.AdErrorListener.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: + 'com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener', + ), +) +abstract class AdErrorListener { + AdErrorListener(); + + /// Called when an error occurs. + late final void Function(AdErrorEvent event) onAdError; +} + +/// Listener interface for ad events. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventListener.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: + 'com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener', + ), +) +abstract class AdEventListener { + AdEventListener(); + + /// Respond to an occurrence of an AdEvent. + late final void Function(AdEvent event) onAdEvent; +} diff --git a/packages/interactive_media_ads/pubspec.yaml b/packages/interactive_media_ads/pubspec.yaml index 1c9dcbb586eb..a95135ea53d5 100644 --- a/packages/interactive_media_ads/pubspec.yaml +++ b/packages/interactive_media_ads/pubspec.yaml @@ -31,6 +31,11 @@ dev_dependencies: flutter_test: sdk: flutter mockito: 5.4.4 + pigeon: + git: + url: https://github.com/bparrishMines/packages.git + ref: pigeon_kotlin_split + path: packages/pigeon topics: - ads diff --git a/packages/interactive_media_ads/test/android/ads_manager_tests.dart b/packages/interactive_media_ads/test/android/ads_manager_tests.dart index b05811102cad..029b6daacaf4 100644 --- a/packages/interactive_media_ads/test/android/ads_manager_tests.dart +++ b/packages/interactive_media_ads/test/android/ads_manager_tests.dart @@ -78,13 +78,17 @@ void main() { await adsManager.setAdsManagerDelegate( AndroidAdsManagerDelegate( PlatformAdsManagerDelegateCreationParams( - onAdEvent: expectAsync1((_) {}), + onAdEvent: expectAsync1((AdEvent event) { + expect(event.type, AdEventType.allAdsCompleted); + expect(event.adData, {'shrek': 'donkey'}); + }), ), ), ); final MockAdEvent mockAdEvent = MockAdEvent(); when(mockAdEvent.type).thenReturn(ima.AdEventType.allAdsCompleted); + when(mockAdEvent.adData).thenReturn({'shrek': 'donkey'}); onAdEventCallback(MockAdEventListener(), mockAdEvent); }); From 9fe7b675669553b15a6521015eece1111bdf79f7 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 1 Aug 2024 19:04:27 -0400 Subject: [PATCH 03/14] ios impl --- .../ios/RunnerTests/AdEventTests.swift | 15 + .../example/lib/main.dart | 3 + .../AdEventProxyAPIDelegate.swift | 4 + .../InteractiveMediaAdsLibrary.g.swift | 974 ++++------- .../lib/src/ios/interactive_media_ads.g.dart | 220 +-- .../lib/src/ios/ios_ads_manager_delegate.dart | 6 + .../interactive_media_ads_android.dart | 1433 +++++++++-------- .../pigeons/interactive_media_ads_ios.dart | 5 +- packages/interactive_media_ads/pubspec.yaml | 2 +- .../test/ios/ads_manager_delegate_tests.dart | 2 + 10 files changed, 1126 insertions(+), 1538 deletions(-) diff --git a/packages/interactive_media_ads/example/ios/RunnerTests/AdEventTests.swift b/packages/interactive_media_ads/example/ios/RunnerTests/AdEventTests.swift index 301ba3129303..0c5082cc1598 100644 --- a/packages/interactive_media_ads/example/ios/RunnerTests/AdEventTests.swift +++ b/packages/interactive_media_ads/example/ios/RunnerTests/AdEventTests.swift @@ -30,6 +30,17 @@ final class AdEventTests: XCTestCase { XCTAssertEqual(value, "message") } + + func testAdData() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiIMAAdEvent(registrar) + + let instance = TestAdEvent.customInit() + + let value = try? api.pigeonDelegate.adData(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value as! [String : String], ["my": "string"]) + } } class TestAdEvent: IMAAdEvent { @@ -47,4 +58,8 @@ class TestAdEvent: IMAAdEvent { override var typeString: String { return "message" } + + override var adData: [String : Any]? { + return ["my": "string"] + } } diff --git a/packages/interactive_media_ads/example/lib/main.dart b/packages/interactive_media_ads/example/lib/main.dart index 8cac5c867b88..83cfc4676c0f 100644 --- a/packages/interactive_media_ads/example/lib/main.dart +++ b/packages/interactive_media_ads/example/lib/main.dart @@ -105,7 +105,10 @@ class _AdExampleWidgetState extends State { _adsManager = null; case AdEventType.clicked: case AdEventType.complete: + case _: } + + return; }, onAdErrorEvent: (AdErrorEvent event) { debugPrint('AdErrorEvent: ${event.error.message}'); diff --git a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdEventProxyAPIDelegate.swift b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdEventProxyAPIDelegate.swift index 7548c61bd297..195b625b12a0 100644 --- a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdEventProxyAPIDelegate.swift +++ b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdEventProxyAPIDelegate.swift @@ -10,6 +10,10 @@ import GoogleInteractiveMediaAds /// This class may handle instantiating native object instances that are attached to a Dart /// instance or handle method calls on the associated native class or an instance of that class. class AdEventProxyAPIDelegate: PigeonApiDelegateIMAAdEvent { + func adData(pigeonApi: PigeonApiIMAAdEvent, pigeonInstance: IMAAdEvent) throws -> [String : Any]? { + return pigeonInstance.adData + } + func type(pigeonApi: PigeonApiIMAAdEvent, pigeonInstance: IMAAdEvent) throws -> AdEventType { switch pigeonInstance.type { case .AD_BREAK_READY: diff --git a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/InteractiveMediaAdsLibrary.g.swift b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/InteractiveMediaAdsLibrary.g.swift index 782f2f14cd85..47b303232b1c 100644 --- a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/InteractiveMediaAdsLibrary.g.swift +++ b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/InteractiveMediaAdsLibrary.g.swift @@ -31,7 +31,7 @@ final class PigeonError: Error { var localizedDescription: String { return "PigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? "")" - } + } } private func wrapResult(_ result: Any?) -> [Any?] { @@ -61,9 +61,7 @@ private func wrapError(_ error: Any) -> [Any?] { } private func createConnectionError(withChannelName channelName: String) -> PigeonError { - return PigeonError( - code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", - details: "") + return PigeonError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") } private func isNullish(_ value: Any?) -> Bool { @@ -80,6 +78,7 @@ protocol InteractiveMediaAdsLibraryPigeonFinalizerDelegate: AnyObject { func onDeinit(identifier: Int64) } + // Attaches to an object to receive a callback when the object is deallocated. internal final class InteractiveMediaAdsLibraryPigeonFinalizer { private static let associatedObjectKey = malloc(1)! @@ -95,11 +94,9 @@ internal final class InteractiveMediaAdsLibraryPigeonFinalizer { } internal static func attach( - to instance: AnyObject, identifier: Int64, - delegate: InteractiveMediaAdsLibraryPigeonFinalizerDelegate + to instance: AnyObject, identifier: Int64, delegate: InteractiveMediaAdsLibraryPigeonFinalizerDelegate ) { - let finalizer = InteractiveMediaAdsLibraryPigeonFinalizer( - identifier: identifier, delegate: delegate) + let finalizer = InteractiveMediaAdsLibraryPigeonFinalizer(identifier: identifier, delegate: delegate) objc_setAssociatedObject(instance, associatedObjectKey, finalizer, .OBJC_ASSOCIATION_RETAIN) } @@ -112,6 +109,7 @@ internal final class InteractiveMediaAdsLibraryPigeonFinalizer { } } + /// Maintains instances used to communicate with the corresponding objects in Dart. /// /// Objects stored in this container are represented by an object in Dart that is also stored in @@ -215,8 +213,7 @@ final class InteractiveMediaAdsLibraryPigeonInstanceManager { identifiers.setObject(NSNumber(value: identifier), forKey: instance) weakInstances.setObject(instance, forKey: NSNumber(value: identifier)) strongInstances.setObject(instance, forKey: NSNumber(value: identifier)) - InteractiveMediaAdsLibraryPigeonFinalizer.attach( - to: instance, identifier: identifier, delegate: finalizerDelegate) + InteractiveMediaAdsLibraryPigeonFinalizer.attach(to: instance, identifier: identifier, delegate: finalizerDelegate) } /// Retrieves the identifier paired with an instance. @@ -293,6 +290,7 @@ final class InteractiveMediaAdsLibraryPigeonInstanceManager { } } + private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi { /// The codec used for serializing messages. let codec = FlutterStandardMessageCodec.sharedInstance() @@ -305,15 +303,9 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi { } /// Sets up an instance of `InteractiveMediaAdsLibraryPigeonInstanceManagerApi` to handle messages through the `binaryMessenger`. - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, - instanceManager: InteractiveMediaAdsLibraryPigeonInstanceManager? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, instanceManager: InteractiveMediaAdsLibraryPigeonInstanceManager?) { let codec = FlutterStandardMessageCodec.sharedInstance() - let removeStrongReferenceChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.removeStrongReference", - binaryMessenger: binaryMessenger, codec: codec) + let removeStrongReferenceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.removeStrongReference", binaryMessenger: binaryMessenger, codec: codec) if let instanceManager = instanceManager { removeStrongReferenceChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -328,9 +320,7 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi { } else { removeStrongReferenceChannel.setMessageHandler(nil) } - let clearChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.clear", - binaryMessenger: binaryMessenger, codec: codec) + let clearChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.clear", binaryMessenger: binaryMessenger, codec: codec) if let instanceManager = instanceManager { clearChannel.setMessageHandler { _, reply in do { @@ -346,13 +336,9 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi { } /// Sends a message to the Dart `InstanceManager` to remove the strong reference of the instance associated with `identifier`. - func removeStrongReference( - identifier identifierArg: Int64, completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.removeStrongReference" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func removeStrongReference(identifier identifierArg: Int64, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.removeStrongReference" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([identifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -372,89 +358,62 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi { protocol InteractiveMediaAdsLibraryPigeonProxyApiDelegate { /// An implementation of [PigeonApiIMAAdDisplayContainer] used to add a new Dart instance of /// `IMAAdDisplayContainer` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdDisplayContainer( - _ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar - ) -> PigeonApiIMAAdDisplayContainer + func pigeonApiIMAAdDisplayContainer(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdDisplayContainer /// An implementation of [PigeonApiUIView] used to add a new Dart instance of /// `UIView` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiUIView(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiUIView + func pigeonApiUIView(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiUIView /// An implementation of [PigeonApiUIViewController] used to add a new Dart instance of /// `UIViewController` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiUIViewController(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiUIViewController + func pigeonApiUIViewController(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiUIViewController /// An implementation of [PigeonApiIMAContentPlayhead] used to add a new Dart instance of /// `IMAContentPlayhead` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAContentPlayhead(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiIMAContentPlayhead + func pigeonApiIMAContentPlayhead(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAContentPlayhead /// An implementation of [PigeonApiIMAAdsLoader] used to add a new Dart instance of /// `IMAAdsLoader` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdsLoader(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiIMAAdsLoader + func pigeonApiIMAAdsLoader(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdsLoader /// An implementation of [PigeonApiIMASettings] used to add a new Dart instance of /// `IMASettings` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMASettings(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiIMASettings + func pigeonApiIMASettings(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMASettings /// An implementation of [PigeonApiIMAAdsRequest] used to add a new Dart instance of /// `IMAAdsRequest` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdsRequest(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiIMAAdsRequest + func pigeonApiIMAAdsRequest(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdsRequest /// An implementation of [PigeonApiIMAAdsLoaderDelegate] used to add a new Dart instance of /// `IMAAdsLoaderDelegate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdsLoaderDelegate(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiIMAAdsLoaderDelegate + func pigeonApiIMAAdsLoaderDelegate(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdsLoaderDelegate /// An implementation of [PigeonApiIMAAdsLoadedData] used to add a new Dart instance of /// `IMAAdsLoadedData` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdsLoadedData(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiIMAAdsLoadedData + func pigeonApiIMAAdsLoadedData(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdsLoadedData /// An implementation of [PigeonApiIMAAdLoadingErrorData] used to add a new Dart instance of /// `IMAAdLoadingErrorData` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdLoadingErrorData( - _ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar - ) -> PigeonApiIMAAdLoadingErrorData + func pigeonApiIMAAdLoadingErrorData(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdLoadingErrorData /// An implementation of [PigeonApiIMAAdError] used to add a new Dart instance of /// `IMAAdError` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdError(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiIMAAdError + func pigeonApiIMAAdError(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdError /// An implementation of [PigeonApiIMAAdsManager] used to add a new Dart instance of /// `IMAAdsManager` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdsManager(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiIMAAdsManager + func pigeonApiIMAAdsManager(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdsManager /// An implementation of [PigeonApiIMAAdsManagerDelegate] used to add a new Dart instance of /// `IMAAdsManagerDelegate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdsManagerDelegate( - _ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar - ) -> PigeonApiIMAAdsManagerDelegate + func pigeonApiIMAAdsManagerDelegate(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdsManagerDelegate /// An implementation of [PigeonApiIMAAdEvent] used to add a new Dart instance of /// `IMAAdEvent` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdEvent(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiIMAAdEvent + func pigeonApiIMAAdEvent(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdEvent /// An implementation of [PigeonApiIMAAdsRenderingSettings] used to add a new Dart instance of /// `IMAAdsRenderingSettings` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdsRenderingSettings( - _ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar - ) -> PigeonApiIMAAdsRenderingSettings + func pigeonApiIMAAdsRenderingSettings(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdsRenderingSettings /// An implementation of [PigeonApiNSObject] used to add a new Dart instance of /// `NSObject` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiNSObject(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiNSObject + func pigeonApiNSObject(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiNSObject } extension InteractiveMediaAdsLibraryPigeonProxyApiDelegate { - func pigeonApiUIView(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiUIView - { + func pigeonApiUIView(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiUIView { return PigeonApiUIView(pigeonRegistrar: registrar, delegate: PigeonApiDelegateUIView()) } - func pigeonApiIMASettings(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiIMASettings - { - return PigeonApiIMASettings( - pigeonRegistrar: registrar, delegate: PigeonApiDelegateIMASettings()) + func pigeonApiIMASettings(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMASettings { + return PigeonApiIMASettings(pigeonRegistrar: registrar, delegate: PigeonApiDelegateIMASettings()) } - func pigeonApiNSObject(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiNSObject - { + func pigeonApiNSObject(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiNSObject { return PigeonApiNSObject(pigeonRegistrar: registrar, delegate: PigeonApiDelegateNSObject()) } } @@ -469,15 +428,12 @@ open class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar { var codec: FlutterStandardMessageCodec { if _codec == nil { _codec = FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( - pigeonRegistrar: self)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: self)) } return _codec! } - private class InstanceManagerApiFinalizerDelegate: - InteractiveMediaAdsLibraryPigeonFinalizerDelegate - { + private class InstanceManagerApiFinalizerDelegate: InteractiveMediaAdsLibraryPigeonFinalizerDelegate { let api: InteractiveMediaAdsLibraryPigeonInstanceManagerApi init(_ api: InteractiveMediaAdsLibraryPigeonInstanceManagerApi) { @@ -491,10 +447,7 @@ open class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar { } } - init( - binaryMessenger: FlutterBinaryMessenger, - apiDelegate: InteractiveMediaAdsLibraryPigeonProxyApiDelegate - ) { + init(binaryMessenger: FlutterBinaryMessenger, apiDelegate: InteractiveMediaAdsLibraryPigeonProxyApiDelegate) { self.binaryMessenger = binaryMessenger self.apiDelegate = apiDelegate self.instanceManager = InteractiveMediaAdsLibraryPigeonInstanceManager( @@ -503,30 +456,19 @@ open class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar { } func setUp() { - InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers( - binaryMessenger: binaryMessenger, instanceManager: instanceManager) - PigeonApiIMAAdDisplayContainer.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdDisplayContainer(self)) - PigeonApiUIViewController.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIViewController(self)) - PigeonApiIMAContentPlayhead.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAContentPlayhead(self)) - PigeonApiIMAAdsLoader.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsLoader(self)) - PigeonApiIMAAdsRequest.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsRequest(self)) - PigeonApiIMAAdsLoaderDelegate.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsLoaderDelegate(self)) - PigeonApiIMAAdsManager.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsManager(self)) - PigeonApiIMAAdsManagerDelegate.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsManagerDelegate(self)) - PigeonApiIMAAdsRenderingSettings.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsRenderingSettings(self)) + InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger: binaryMessenger, instanceManager: instanceManager) + PigeonApiIMAAdDisplayContainer.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdDisplayContainer(self)) + PigeonApiUIViewController.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIViewController(self)) + PigeonApiIMAContentPlayhead.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAContentPlayhead(self)) + PigeonApiIMAAdsLoader.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsLoader(self)) + PigeonApiIMAAdsRequest.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsRequest(self)) + PigeonApiIMAAdsLoaderDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsLoaderDelegate(self)) + PigeonApiIMAAdsManager.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsManager(self)) + PigeonApiIMAAdsManagerDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsManagerDelegate(self)) + PigeonApiIMAAdsRenderingSettings.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsRenderingSettings(self)) } func tearDown() { - InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers( - binaryMessenger: binaryMessenger, instanceManager: nil) + InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger: binaryMessenger, instanceManager: nil) PigeonApiIMAAdDisplayContainer.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiUIViewController.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiIMAContentPlayhead.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) @@ -535,17 +477,13 @@ open class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar { PigeonApiIMAAdsLoaderDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiIMAAdsManager.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiIMAAdsManagerDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) - PigeonApiIMAAdsRenderingSettings.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: nil) + PigeonApiIMAAdsRenderingSettings.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) } } -private class InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter: FlutterStandardReaderWriter -{ +private class InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter: FlutterStandardReaderWriter { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar - private class InteractiveMediaAdsLibraryPigeonProxyApiCodecReader: - InteractiveMediaAdsLibraryPigeonCodecReader - { + private class InteractiveMediaAdsLibraryPigeonProxyApiCodecReader: InteractiveMediaAdsLibraryPigeonCodecReader { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar init(data: Data, pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { @@ -566,9 +504,7 @@ private class InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter: Flutter } } - private class InteractiveMediaAdsLibraryPigeonProxyApiCodecWriter: - InteractiveMediaAdsLibraryPigeonCodecWriter - { + private class InteractiveMediaAdsLibraryPigeonProxyApiCodecWriter: InteractiveMediaAdsLibraryPigeonCodecWriter { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar init(data: NSMutableData, pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { @@ -577,199 +513,189 @@ private class InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter: Flutter } override func writeValue(_ value: Any) { - if value is [Any] || value is Bool || value is Data || value is [AnyHashable: Any] - || value is Double || value is FlutterStandardTypedData || value is Int64 || value is String - || value is AdErrorType || value is AdErrorCode || value is AdEventType - || value is KeyValueObservingOptions || value is KeyValueChange - || value is KeyValueChangeKey - { + if value is [Any] || value is Bool || value is Data || value is [AnyHashable: Any] || value is Double || value is FlutterStandardTypedData || value is Int64 || value is String || value is AdErrorType || value is AdErrorCode || value is AdEventType || value is KeyValueObservingOptions || value is KeyValueChange || value is KeyValueChangeKey { super.writeValue(value) return } + if let instance = value as? IMAAdDisplayContainer { - pigeonRegistrar.apiDelegate.pigeonApiIMAAdDisplayContainer(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiIMAAdDisplayContainer(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? UIView { pigeonRegistrar.apiDelegate.pigeonApiUIView(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? UIViewController { pigeonRegistrar.apiDelegate.pigeonApiUIViewController(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? IMAContentPlayhead { pigeonRegistrar.apiDelegate.pigeonApiIMAContentPlayhead(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? IMAAdsLoader { pigeonRegistrar.apiDelegate.pigeonApiIMAAdsLoader(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? IMASettings { pigeonRegistrar.apiDelegate.pigeonApiIMASettings(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? IMAAdsRequest { pigeonRegistrar.apiDelegate.pigeonApiIMAAdsRequest(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? IMAAdsLoaderDelegate { - pigeonRegistrar.apiDelegate.pigeonApiIMAAdsLoaderDelegate(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiIMAAdsLoaderDelegate(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? IMAAdsLoadedData { pigeonRegistrar.apiDelegate.pigeonApiIMAAdsLoadedData(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? IMAAdLoadingErrorData { - pigeonRegistrar.apiDelegate.pigeonApiIMAAdLoadingErrorData(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiIMAAdLoadingErrorData(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? IMAAdError { pigeonRegistrar.apiDelegate.pigeonApiIMAAdError(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? IMAAdsManager { pigeonRegistrar.apiDelegate.pigeonApiIMAAdsManager(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? IMAAdsManagerDelegate { - pigeonRegistrar.apiDelegate.pigeonApiIMAAdsManagerDelegate(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiIMAAdsManagerDelegate(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? IMAAdEvent { pigeonRegistrar.apiDelegate.pigeonApiIMAAdEvent(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? IMAAdsRenderingSettings { - pigeonRegistrar.apiDelegate.pigeonApiIMAAdsRenderingSettings(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiIMAAdsRenderingSettings(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? NSObject { pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } - if let instance = value as AnyObject?, - pigeonRegistrar.instanceManager.containsInstance(instance) + + if let instance = value as AnyObject?, pigeonRegistrar.instanceManager.containsInstance(instance) { super.writeByte(128) super.writeValue( @@ -787,13 +713,11 @@ private class InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter: Flutter } override func reader(with data: Data) -> FlutterStandardReader { - return InteractiveMediaAdsLibraryPigeonProxyApiCodecReader( - data: data, pigeonRegistrar: pigeonRegistrar) + return InteractiveMediaAdsLibraryPigeonProxyApiCodecReader(data: data, pigeonRegistrar: pigeonRegistrar) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return InteractiveMediaAdsLibraryPigeonProxyApiCodecWriter( - data: data, pigeonRegistrar: pigeonRegistrar) + return InteractiveMediaAdsLibraryPigeonProxyApiCodecWriter(data: data, pigeonRegistrar: pigeonRegistrar) } } @@ -1080,21 +1004,17 @@ private class InteractiveMediaAdsLibraryPigeonCodecReaderWriter: FlutterStandard } class InteractiveMediaAdsLibraryPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { - static let shared = InteractiveMediaAdsLibraryPigeonCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonCodecReaderWriter()) + static let shared = InteractiveMediaAdsLibraryPigeonCodec(readerWriter: InteractiveMediaAdsLibraryPigeonCodecReaderWriter()) } protocol PigeonApiDelegateIMAAdDisplayContainer { - func pigeonDefaultConstructor( - pigeonApi: PigeonApiIMAAdDisplayContainer, adContainer: UIView, - adContainerViewController: UIViewController? - ) throws -> IMAAdDisplayContainer + func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdDisplayContainer, adContainer: UIView, adContainerViewController: UIViewController?) throws -> IMAAdDisplayContainer } protocol PigeonApiProtocolIMAAdDisplayContainer { } -final class PigeonApiIMAAdDisplayContainer: PigeonApiProtocolIMAAdDisplayContainer { +final class PigeonApiIMAAdDisplayContainer: PigeonApiProtocolIMAAdDisplayContainer { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdDisplayContainer ///An implementation of [NSObject] used to access callback methods @@ -1102,26 +1022,17 @@ final class PigeonApiIMAAdDisplayContainer: PigeonApiProtocolIMAAdDisplayContain return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateIMAAdDisplayContainer - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdDisplayContainer) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdDisplayContainer? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdDisplayContainer?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1130,10 +1041,8 @@ final class PigeonApiIMAAdDisplayContainer: PigeonApiProtocolIMAAdDisplayContain let adContainerViewControllerArg: UIViewController? = nilOrValue(args[2]) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor( - pigeonApi: api, adContainer: adContainerArg, - adContainerViewController: adContainerViewControllerArg), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, adContainer: adContainerArg, adContainerViewController: adContainerViewControllerArg), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1145,9 +1054,7 @@ final class PigeonApiIMAAdDisplayContainer: PigeonApiProtocolIMAAdDisplayContain } ///Creates a Dart instance of IMAAdDisplayContainer and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: IMAAdDisplayContainer, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: IMAAdDisplayContainer, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1160,14 +1067,11 @@ final class PigeonApiIMAAdDisplayContainer: PigeonApiProtocolIMAAdDisplayContain completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.pigeon_newInstance" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1190,7 +1094,7 @@ open class PigeonApiDelegateUIView { protocol PigeonApiProtocolUIView { } -final class PigeonApiUIView: PigeonApiProtocolUIView { +final class PigeonApiUIView: PigeonApiProtocolUIView { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIView ///An implementation of [NSObject] used to access callback methods @@ -1198,17 +1102,12 @@ final class PigeonApiUIView: PigeonApiProtocolUIView { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateUIView - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIView) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of UIView and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: UIView, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: UIView, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1221,13 +1120,11 @@ final class PigeonApiUIView: PigeonApiProtocolUIView { completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec let channelName: String = "dev.flutter.pigeon.interactive_media_ads.UIView.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1257,12 +1154,10 @@ protocol PigeonApiDelegateUIViewController { protocol PigeonApiProtocolUIViewController { /// Notifies the view controller that its view was added to a view hierarchy. - func viewDidAppear( - pigeonInstance pigeonInstanceArg: UIViewController, animated animatedArg: Bool, - completion: @escaping (Result) -> Void) + func viewDidAppear(pigeonInstance pigeonInstanceArg: UIViewController, animated animatedArg: Bool, completion: @escaping (Result) -> Void) } -final class PigeonApiUIViewController: PigeonApiProtocolUIViewController { +final class PigeonApiUIViewController: PigeonApiProtocolUIViewController { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIViewController ///An implementation of [NSObject] used to access callback methods @@ -1270,33 +1165,25 @@ final class PigeonApiUIViewController: PigeonApiProtocolUIViewController { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateUIViewController - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIViewController) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIViewController? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIViewController?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.UIViewController.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.UIViewController.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1305,18 +1192,14 @@ final class PigeonApiUIViewController: PigeonApiProtocolUIViewController { } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let viewChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.UIViewController.view", - binaryMessenger: binaryMessenger, codec: codec) + let viewChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.UIViewController.view", binaryMessenger: binaryMessenger, codec: codec) if let api = api { viewChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! UIViewController let pigeonIdentifierArg = args[1] is Int64 ? args[1] as! Int64 : Int64(args[1] as! Int32) do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.view(pigeonApi: api, pigeonInstance: pigeonInstanceArg), - withIdentifier: pigeonIdentifierArg) + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.view(pigeonApi: api, pigeonInstance: pigeonInstanceArg), withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1328,9 +1211,7 @@ final class PigeonApiUIViewController: PigeonApiProtocolUIViewController { } ///Creates a Dart instance of UIViewController and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: UIViewController, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: UIViewController, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1343,14 +1224,11 @@ final class PigeonApiUIViewController: PigeonApiProtocolUIViewController { completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.UIViewController.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.UIViewController.pigeon_newInstance" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1367,10 +1245,7 @@ final class PigeonApiUIViewController: PigeonApiProtocolUIViewController { } } /// Notifies the view controller that its view was added to a view hierarchy. - func viewDidAppear( - pigeonInstance pigeonInstanceArg: UIViewController, animated animatedArg: Bool, - completion: @escaping (Result) -> Void - ) { + func viewDidAppear(pigeonInstance pigeonInstanceArg: UIViewController, animated animatedArg: Bool, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1381,10 +1256,8 @@ final class PigeonApiUIViewController: PigeonApiProtocolUIViewController { } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.UIViewController.viewDidAppear" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.UIViewController.viewDidAppear" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, animatedArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1405,15 +1278,13 @@ final class PigeonApiUIViewController: PigeonApiProtocolUIViewController { protocol PigeonApiDelegateIMAContentPlayhead { func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAContentPlayhead) throws -> IMAContentPlayhead /// Reflects the current playback time in seconds for the content. - func setCurrentTime( - pigeonApi: PigeonApiIMAContentPlayhead, pigeonInstance: IMAContentPlayhead, timeInterval: Double - ) throws + func setCurrentTime(pigeonApi: PigeonApiIMAContentPlayhead, pigeonInstance: IMAContentPlayhead, timeInterval: Double) throws } protocol PigeonApiProtocolIMAContentPlayhead { } -final class PigeonApiIMAContentPlayhead: PigeonApiProtocolIMAContentPlayhead { +final class PigeonApiIMAContentPlayhead: PigeonApiProtocolIMAContentPlayhead { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAContentPlayhead ///An implementation of [NSObject] used to access callback methods @@ -1421,33 +1292,25 @@ final class PigeonApiIMAContentPlayhead: PigeonApiProtocolIMAContentPlayhead { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateIMAContentPlayhead - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAContentPlayhead) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAContentPlayhead? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAContentPlayhead?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAContentPlayhead.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAContentPlayhead.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1456,17 +1319,14 @@ final class PigeonApiIMAContentPlayhead: PigeonApiProtocolIMAContentPlayhead { } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let setCurrentTimeChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAContentPlayhead.setCurrentTime", - binaryMessenger: binaryMessenger, codec: codec) + let setCurrentTimeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAContentPlayhead.setCurrentTime", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setCurrentTimeChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAContentPlayhead let timeIntervalArg = args[1] as! Double do { - try api.pigeonDelegate.setCurrentTime( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, timeInterval: timeIntervalArg) + try api.pigeonDelegate.setCurrentTime(pigeonApi: api, pigeonInstance: pigeonInstanceArg, timeInterval: timeIntervalArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1478,9 +1338,7 @@ final class PigeonApiIMAContentPlayhead: PigeonApiProtocolIMAContentPlayhead { } ///Creates a Dart instance of IMAContentPlayhead and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: IMAContentPlayhead, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: IMAContentPlayhead, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1493,14 +1351,11 @@ final class PigeonApiIMAContentPlayhead: PigeonApiProtocolIMAContentPlayhead { completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMAContentPlayhead.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAContentPlayhead.pigeon_newInstance" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1518,25 +1373,21 @@ final class PigeonApiIMAContentPlayhead: PigeonApiProtocolIMAContentPlayhead { } } protocol PigeonApiDelegateIMAAdsLoader { - func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsLoader, settings: IMASettings?) throws - -> IMAAdsLoader + func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsLoader, settings: IMASettings?) throws -> IMAAdsLoader /// Signal to the SDK that the content has completed. func contentComplete(pigeonApi: PigeonApiIMAAdsLoader, pigeonInstance: IMAAdsLoader) throws /// Request ads from the ad server. - func requestAds( - pigeonApi: PigeonApiIMAAdsLoader, pigeonInstance: IMAAdsLoader, request: IMAAdsRequest) throws + func requestAds(pigeonApi: PigeonApiIMAAdsLoader, pigeonInstance: IMAAdsLoader, request: IMAAdsRequest) throws /// Delegate that receives `IMAAdsLoaderDelegate` callbacks. /// /// Note that this sets to a `weak` property in Swift. - func setDelegate( - pigeonApi: PigeonApiIMAAdsLoader, pigeonInstance: IMAAdsLoader, delegate: IMAAdsLoaderDelegate?) - throws + func setDelegate(pigeonApi: PigeonApiIMAAdsLoader, pigeonInstance: IMAAdsLoader, delegate: IMAAdsLoaderDelegate?) throws } protocol PigeonApiProtocolIMAAdsLoader { } -final class PigeonApiIMAAdsLoader: PigeonApiProtocolIMAAdsLoader { +final class PigeonApiIMAAdsLoader: PigeonApiProtocolIMAAdsLoader { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdsLoader ///An implementation of [NSObject] used to access callback methods @@ -1544,25 +1395,17 @@ final class PigeonApiIMAAdsLoader: PigeonApiProtocolIMAAdsLoader { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateIMAAdsLoader - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdsLoader) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsLoader? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsLoader?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1570,8 +1413,8 @@ final class PigeonApiIMAAdsLoader: PigeonApiProtocolIMAAdsLoader { let settingsArg: IMASettings? = nilOrValue(args[1]) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, settings: settingsArg), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, settings: settingsArg), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1580,9 +1423,7 @@ final class PigeonApiIMAAdsLoader: PigeonApiProtocolIMAAdsLoader { } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let contentCompleteChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.contentComplete", - binaryMessenger: binaryMessenger, codec: codec) + let contentCompleteChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.contentComplete", binaryMessenger: binaryMessenger, codec: codec) if let api = api { contentCompleteChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1597,17 +1438,14 @@ final class PigeonApiIMAAdsLoader: PigeonApiProtocolIMAAdsLoader { } else { contentCompleteChannel.setMessageHandler(nil) } - let requestAdsChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.requestAds", - binaryMessenger: binaryMessenger, codec: codec) + let requestAdsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.requestAds", binaryMessenger: binaryMessenger, codec: codec) if let api = api { requestAdsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsLoader let requestArg = args[1] as! IMAAdsRequest do { - try api.pigeonDelegate.requestAds( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) + try api.pigeonDelegate.requestAds(pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1616,17 +1454,14 @@ final class PigeonApiIMAAdsLoader: PigeonApiProtocolIMAAdsLoader { } else { requestAdsChannel.setMessageHandler(nil) } - let setDelegateChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.setDelegate", - binaryMessenger: binaryMessenger, codec: codec) + let setDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.setDelegate", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setDelegateChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsLoader let delegateArg: IMAAdsLoaderDelegate? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setDelegate( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + try api.pigeonDelegate.setDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1638,9 +1473,7 @@ final class PigeonApiIMAAdsLoader: PigeonApiProtocolIMAAdsLoader { } ///Creates a Dart instance of IMAAdsLoader and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: IMAAdsLoader, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: IMAAdsLoader, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1653,14 +1486,11 @@ final class PigeonApiIMAAdsLoader: PigeonApiProtocolIMAAdsLoader { completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.pigeon_newInstance" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1683,7 +1513,7 @@ open class PigeonApiDelegateIMASettings { protocol PigeonApiProtocolIMASettings { } -final class PigeonApiIMASettings: PigeonApiProtocolIMASettings { +final class PigeonApiIMASettings: PigeonApiProtocolIMASettings { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMASettings ///An implementation of [NSObject] used to access callback methods @@ -1691,17 +1521,12 @@ final class PigeonApiIMASettings: PigeonApiProtocolIMASettings { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateIMASettings - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMASettings) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of IMASettings and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: IMASettings, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: IMASettings, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1714,14 +1539,11 @@ final class PigeonApiIMASettings: PigeonApiProtocolIMASettings { completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMASettings.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMASettings.pigeon_newInstance" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1741,16 +1563,13 @@ final class PigeonApiIMASettings: PigeonApiProtocolIMASettings { protocol PigeonApiDelegateIMAAdsRequest { /// Initializes an ads request instance with the given ad tag URL and ad /// display container. - func pigeonDefaultConstructor( - pigeonApi: PigeonApiIMAAdsRequest, adTagUrl: String, adDisplayContainer: IMAAdDisplayContainer, - contentPlayhead: IMAContentPlayhead? - ) throws -> IMAAdsRequest + func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsRequest, adTagUrl: String, adDisplayContainer: IMAAdDisplayContainer, contentPlayhead: IMAContentPlayhead?) throws -> IMAAdsRequest } protocol PigeonApiProtocolIMAAdsRequest { } -final class PigeonApiIMAAdsRequest: PigeonApiProtocolIMAAdsRequest { +final class PigeonApiIMAAdsRequest: PigeonApiProtocolIMAAdsRequest { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdsRequest ///An implementation of [NSObject] used to access callback methods @@ -1758,25 +1577,17 @@ final class PigeonApiIMAAdsRequest: PigeonApiProtocolIMAAdsRequest { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateIMAAdsRequest - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdsRequest) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsRequest? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsRequest?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRequest.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRequest.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1786,10 +1597,8 @@ final class PigeonApiIMAAdsRequest: PigeonApiProtocolIMAAdsRequest { let contentPlayheadArg: IMAContentPlayhead? = nilOrValue(args[3]) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor( - pigeonApi: api, adTagUrl: adTagUrlArg, adDisplayContainer: adDisplayContainerArg, - contentPlayhead: contentPlayheadArg), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, adTagUrl: adTagUrlArg, adDisplayContainer: adDisplayContainerArg, contentPlayhead: contentPlayheadArg), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1801,9 +1610,7 @@ final class PigeonApiIMAAdsRequest: PigeonApiProtocolIMAAdsRequest { } ///Creates a Dart instance of IMAAdsRequest and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: IMAAdsRequest, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: IMAAdsRequest, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1816,14 +1623,11 @@ final class PigeonApiIMAAdsRequest: PigeonApiProtocolIMAAdsRequest { completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMAAdsRequest.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsRequest.pigeon_newInstance" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1841,24 +1645,17 @@ final class PigeonApiIMAAdsRequest: PigeonApiProtocolIMAAdsRequest { } } protocol PigeonApiDelegateIMAAdsLoaderDelegate { - func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsLoaderDelegate) throws - -> IMAAdsLoaderDelegate + func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsLoaderDelegate) throws -> IMAAdsLoaderDelegate } protocol PigeonApiProtocolIMAAdsLoaderDelegate { /// Called when ads are successfully loaded from the ad servers by the loader. - func adLoaderLoadedWith( - pigeonInstance pigeonInstanceArg: IMAAdsLoaderDelegate, loader loaderArg: IMAAdsLoader, - adsLoadedData adsLoadedDataArg: IMAAdsLoadedData, - completion: @escaping (Result) -> Void) + func adLoaderLoadedWith(pigeonInstance pigeonInstanceArg: IMAAdsLoaderDelegate, loader loaderArg: IMAAdsLoader, adsLoadedData adsLoadedDataArg: IMAAdsLoadedData, completion: @escaping (Result) -> Void) /// Error reported by the ads loader when loading or requesting an ad fails. - func adsLoaderFailedWithErrorData( - pigeonInstance pigeonInstanceArg: IMAAdsLoaderDelegate, loader loaderArg: IMAAdsLoader, - adErrorData adErrorDataArg: IMAAdLoadingErrorData, - completion: @escaping (Result) -> Void) + func adsLoaderFailedWithErrorData(pigeonInstance pigeonInstanceArg: IMAAdsLoaderDelegate, loader loaderArg: IMAAdsLoader, adErrorData adErrorDataArg: IMAAdLoadingErrorData, completion: @escaping (Result) -> Void) } -final class PigeonApiIMAAdsLoaderDelegate: PigeonApiProtocolIMAAdsLoaderDelegate { +final class PigeonApiIMAAdsLoaderDelegate: PigeonApiProtocolIMAAdsLoaderDelegate { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdsLoaderDelegate ///An implementation of [NSObject] used to access callback methods @@ -1866,34 +1663,25 @@ final class PigeonApiIMAAdsLoaderDelegate: PigeonApiProtocolIMAAdsLoaderDelegate return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateIMAAdsLoaderDelegate - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdsLoaderDelegate) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsLoaderDelegate? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsLoaderDelegate?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoaderDelegate.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoaderDelegate.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1905,9 +1693,7 @@ final class PigeonApiIMAAdsLoaderDelegate: PigeonApiProtocolIMAAdsLoaderDelegate } ///Creates a Dart instance of IMAAdsLoaderDelegate and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: IMAAdsLoaderDelegate, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: IMAAdsLoaderDelegate, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1920,16 +1706,10 @@ final class PigeonApiIMAAdsLoaderDelegate: PigeonApiProtocolIMAAdsLoaderDelegate completion(.success(Void())) return } - print( - "Error: Attempting to create a new Dart instance of IMAAdsLoaderDelegate, but the class has a nonnull callback method." - ) + print("Error: Attempting to create a new Dart instance of IMAAdsLoaderDelegate, but the class has a nonnull callback method.") } /// Called when ads are successfully loaded from the ad servers by the loader. - func adLoaderLoadedWith( - pigeonInstance pigeonInstanceArg: IMAAdsLoaderDelegate, loader loaderArg: IMAAdsLoader, - adsLoadedData adsLoadedDataArg: IMAAdsLoadedData, - completion: @escaping (Result) -> Void - ) { + func adLoaderLoadedWith(pigeonInstance pigeonInstanceArg: IMAAdsLoaderDelegate, loader loaderArg: IMAAdsLoader, adsLoadedData adsLoadedDataArg: IMAAdsLoadedData, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1940,10 +1720,8 @@ final class PigeonApiIMAAdsLoaderDelegate: PigeonApiProtocolIMAAdsLoaderDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoaderDelegate.adLoaderLoadedWith" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoaderDelegate.adLoaderLoadedWith" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, loaderArg, adsLoadedDataArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1961,11 +1739,7 @@ final class PigeonApiIMAAdsLoaderDelegate: PigeonApiProtocolIMAAdsLoaderDelegate } /// Error reported by the ads loader when loading or requesting an ad fails. - func adsLoaderFailedWithErrorData( - pigeonInstance pigeonInstanceArg: IMAAdsLoaderDelegate, loader loaderArg: IMAAdsLoader, - adErrorData adErrorDataArg: IMAAdLoadingErrorData, - completion: @escaping (Result) -> Void - ) { + func adsLoaderFailedWithErrorData(pigeonInstance pigeonInstanceArg: IMAAdsLoaderDelegate, loader loaderArg: IMAAdsLoader, adErrorData adErrorDataArg: IMAAdLoadingErrorData, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1976,10 +1750,8 @@ final class PigeonApiIMAAdsLoaderDelegate: PigeonApiProtocolIMAAdsLoaderDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoaderDelegate.adsLoaderFailedWithErrorData" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoaderDelegate.adsLoaderFailedWithErrorData" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, loaderArg, adErrorDataArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2001,14 +1773,13 @@ protocol PigeonApiDelegateIMAAdsLoadedData { /// The ads manager instance created by the ads loader. /// /// Will be null when using dynamic ad insertion. - func adsManager(pigeonApi: PigeonApiIMAAdsLoadedData, pigeonInstance: IMAAdsLoadedData) throws - -> IMAAdsManager? + func adsManager(pigeonApi: PigeonApiIMAAdsLoadedData, pigeonInstance: IMAAdsLoadedData) throws -> IMAAdsManager? } protocol PigeonApiProtocolIMAAdsLoadedData { } -final class PigeonApiIMAAdsLoadedData: PigeonApiProtocolIMAAdsLoadedData { +final class PigeonApiIMAAdsLoadedData: PigeonApiProtocolIMAAdsLoadedData { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdsLoadedData ///An implementation of [NSObject] used to access callback methods @@ -2016,17 +1787,12 @@ final class PigeonApiIMAAdsLoadedData: PigeonApiProtocolIMAAdsLoadedData { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateIMAAdsLoadedData - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdsLoadedData) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of IMAAdsLoadedData and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: IMAAdsLoadedData, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: IMAAdsLoadedData, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2039,16 +1805,12 @@ final class PigeonApiIMAAdsLoadedData: PigeonApiProtocolIMAAdsLoadedData { completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let adsManagerArg = try! pigeonDelegate.adsManager( - pigeonApi: self, pigeonInstance: pigeonInstance) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + let adsManagerArg = try! pigeonDelegate.adsManager(pigeonApi: self, pigeonInstance: pigeonInstance) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoadedData.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoadedData.pigeon_newInstance" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg, adsManagerArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2067,14 +1829,13 @@ final class PigeonApiIMAAdsLoadedData: PigeonApiProtocolIMAAdsLoadedData { } protocol PigeonApiDelegateIMAAdLoadingErrorData { /// The ad error that occurred while loading the ad. - func adError(pigeonApi: PigeonApiIMAAdLoadingErrorData, pigeonInstance: IMAAdLoadingErrorData) - throws -> IMAAdError + func adError(pigeonApi: PigeonApiIMAAdLoadingErrorData, pigeonInstance: IMAAdLoadingErrorData) throws -> IMAAdError } protocol PigeonApiProtocolIMAAdLoadingErrorData { } -final class PigeonApiIMAAdLoadingErrorData: PigeonApiProtocolIMAAdLoadingErrorData { +final class PigeonApiIMAAdLoadingErrorData: PigeonApiProtocolIMAAdLoadingErrorData { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdLoadingErrorData ///An implementation of [NSObject] used to access callback methods @@ -2082,17 +1843,12 @@ final class PigeonApiIMAAdLoadingErrorData: PigeonApiProtocolIMAAdLoadingErrorDa return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateIMAAdLoadingErrorData - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdLoadingErrorData) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of IMAAdLoadingErrorData and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: IMAAdLoadingErrorData, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: IMAAdLoadingErrorData, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2105,15 +1861,12 @@ final class PigeonApiIMAAdLoadingErrorData: PigeonApiProtocolIMAAdLoadingErrorDa completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) let adErrorArg = try! pigeonDelegate.adError(pigeonApi: self, pigeonInstance: pigeonInstance) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMAAdLoadingErrorData.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdLoadingErrorData.pigeon_newInstance" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg, adErrorArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2142,7 +1895,7 @@ protocol PigeonApiDelegateIMAAdError { protocol PigeonApiProtocolIMAAdError { } -final class PigeonApiIMAAdError: PigeonApiProtocolIMAAdError { +final class PigeonApiIMAAdError: PigeonApiProtocolIMAAdError { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdError ///An implementation of [NSObject] used to access callback methods @@ -2150,17 +1903,12 @@ final class PigeonApiIMAAdError: PigeonApiProtocolIMAAdError { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateIMAAdError - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdError) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of IMAAdError and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: IMAAdError, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: IMAAdError, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2173,17 +1921,14 @@ final class PigeonApiIMAAdError: PigeonApiProtocolIMAAdError { completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) let typeArg = try! pigeonDelegate.type(pigeonApi: self, pigeonInstance: pigeonInstance) let codeArg = try! pigeonDelegate.code(pigeonApi: self, pigeonInstance: pigeonInstance) let messageArg = try! pigeonDelegate.message(pigeonApi: self, pigeonInstance: pigeonInstance) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMAAdError.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdError.pigeon_newInstance" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg, typeArg, codeArg, messageArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2202,13 +1947,9 @@ final class PigeonApiIMAAdError: PigeonApiProtocolIMAAdError { } protocol PigeonApiDelegateIMAAdsManager { /// The `IMAAdsManagerDelegate` to notify with events during ad playback. - func setDelegate( - pigeonApi: PigeonApiIMAAdsManager, pigeonInstance: IMAAdsManager, - delegate: IMAAdsManagerDelegate?) throws + func setDelegate(pigeonApi: PigeonApiIMAAdsManager, pigeonInstance: IMAAdsManager, delegate: IMAAdsManagerDelegate?) throws /// Initializes and loads the ad. - func initialize( - pigeonApi: PigeonApiIMAAdsManager, pigeonInstance: IMAAdsManager, - adsRenderingSettings: IMAAdsRenderingSettings?) throws + func initialize(pigeonApi: PigeonApiIMAAdsManager, pigeonInstance: IMAAdsManager, adsRenderingSettings: IMAAdsRenderingSettings?) throws /// Starts advertisement playback. func start(pigeonApi: PigeonApiIMAAdsManager, pigeonInstance: IMAAdsManager) throws /// Pauses advertisement. @@ -2227,7 +1968,7 @@ protocol PigeonApiDelegateIMAAdsManager { protocol PigeonApiProtocolIMAAdsManager { } -final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { +final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdsManager ///An implementation of [NSObject] used to access callback methods @@ -2235,33 +1976,24 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateIMAAdsManager - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdsManager) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsManager? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsManager?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let setDelegateChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.setDelegate", - binaryMessenger: binaryMessenger, codec: codec) + let setDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.setDelegate", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setDelegateChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsManager let delegateArg: IMAAdsManagerDelegate? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setDelegate( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + try api.pigeonDelegate.setDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2270,18 +2002,14 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { } else { setDelegateChannel.setMessageHandler(nil) } - let initializeChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.initialize", - binaryMessenger: binaryMessenger, codec: codec) + let initializeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.initialize", binaryMessenger: binaryMessenger, codec: codec) if let api = api { initializeChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsManager let adsRenderingSettingsArg: IMAAdsRenderingSettings? = nilOrValue(args[1]) do { - try api.pigeonDelegate.initialize( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, - adsRenderingSettings: adsRenderingSettingsArg) + try api.pigeonDelegate.initialize(pigeonApi: api, pigeonInstance: pigeonInstanceArg, adsRenderingSettings: adsRenderingSettingsArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2290,9 +2018,7 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { } else { initializeChannel.setMessageHandler(nil) } - let startChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.start", - binaryMessenger: binaryMessenger, codec: codec) + let startChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.start", binaryMessenger: binaryMessenger, codec: codec) if let api = api { startChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2307,9 +2033,7 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { } else { startChannel.setMessageHandler(nil) } - let pauseChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.pause", - binaryMessenger: binaryMessenger, codec: codec) + let pauseChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.pause", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pauseChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2324,9 +2048,7 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { } else { pauseChannel.setMessageHandler(nil) } - let resumeChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.resume", - binaryMessenger: binaryMessenger, codec: codec) + let resumeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.resume", binaryMessenger: binaryMessenger, codec: codec) if let api = api { resumeChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2341,9 +2063,7 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { } else { resumeChannel.setMessageHandler(nil) } - let skipChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.skip", - binaryMessenger: binaryMessenger, codec: codec) + let skipChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.skip", binaryMessenger: binaryMessenger, codec: codec) if let api = api { skipChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2358,9 +2078,7 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { } else { skipChannel.setMessageHandler(nil) } - let discardAdBreakChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.discardAdBreak", - binaryMessenger: binaryMessenger, codec: codec) + let discardAdBreakChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.discardAdBreak", binaryMessenger: binaryMessenger, codec: codec) if let api = api { discardAdBreakChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2375,9 +2093,7 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { } else { discardAdBreakChannel.setMessageHandler(nil) } - let destroyChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.destroy", - binaryMessenger: binaryMessenger, codec: codec) + let destroyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.destroy", binaryMessenger: binaryMessenger, codec: codec) if let api = api { destroyChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2395,9 +2111,7 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { } ///Creates a Dart instance of IMAAdsManager and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: IMAAdsManager, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: IMAAdsManager, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2410,14 +2124,11 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.pigeon_newInstance" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2435,34 +2146,21 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { } } protocol PigeonApiDelegateIMAAdsManagerDelegate { - func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsManagerDelegate) throws - -> IMAAdsManagerDelegate + func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsManagerDelegate) throws -> IMAAdsManagerDelegate } protocol PigeonApiProtocolIMAAdsManagerDelegate { /// Called when there is an IMAAdEvent. - func didReceiveAdEvent( - pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, - adsManager adsManagerArg: IMAAdsManager, event eventArg: IMAAdEvent, - completion: @escaping (Result) -> Void) + func didReceiveAdEvent(pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, adsManager adsManagerArg: IMAAdsManager, event eventArg: IMAAdEvent, completion: @escaping (Result) -> Void) /// Called when there was an error playing the ad. - func didReceiveAdError( - pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, - adsManager adsManagerArg: IMAAdsManager, error errorArg: IMAAdError, - completion: @escaping (Result) -> Void) + func didReceiveAdError(pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, adsManager adsManagerArg: IMAAdsManager, error errorArg: IMAAdError, completion: @escaping (Result) -> Void) /// Called when an ad is ready to play. - func didRequestContentPause( - pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, - adsManager adsManagerArg: IMAAdsManager, - completion: @escaping (Result) -> Void) + func didRequestContentPause(pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, adsManager adsManagerArg: IMAAdsManager, completion: @escaping (Result) -> Void) /// Called when an ad has finished or an error occurred during the playback. - func didRequestContentResume( - pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, - adsManager adsManagerArg: IMAAdsManager, - completion: @escaping (Result) -> Void) + func didRequestContentResume(pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, adsManager adsManagerArg: IMAAdsManager, completion: @escaping (Result) -> Void) } -final class PigeonApiIMAAdsManagerDelegate: PigeonApiProtocolIMAAdsManagerDelegate { +final class PigeonApiIMAAdsManagerDelegate: PigeonApiProtocolIMAAdsManagerDelegate { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdsManagerDelegate ///An implementation of [NSObject] used to access callback methods @@ -2470,34 +2168,25 @@ final class PigeonApiIMAAdsManagerDelegate: PigeonApiProtocolIMAAdsManagerDelega return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateIMAAdsManagerDelegate - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdsManagerDelegate) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsManagerDelegate? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsManagerDelegate?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2509,9 +2198,7 @@ final class PigeonApiIMAAdsManagerDelegate: PigeonApiProtocolIMAAdsManagerDelega } ///Creates a Dart instance of IMAAdsManagerDelegate and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: IMAAdsManagerDelegate, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: IMAAdsManagerDelegate, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2524,16 +2211,10 @@ final class PigeonApiIMAAdsManagerDelegate: PigeonApiProtocolIMAAdsManagerDelega completion(.success(Void())) return } - print( - "Error: Attempting to create a new Dart instance of IMAAdsManagerDelegate, but the class has a nonnull callback method." - ) + print("Error: Attempting to create a new Dart instance of IMAAdsManagerDelegate, but the class has a nonnull callback method.") } /// Called when there is an IMAAdEvent. - func didReceiveAdEvent( - pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, - adsManager adsManagerArg: IMAAdsManager, event eventArg: IMAAdEvent, - completion: @escaping (Result) -> Void - ) { + func didReceiveAdEvent(pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, adsManager adsManagerArg: IMAAdsManager, event eventArg: IMAAdEvent, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2544,10 +2225,8 @@ final class PigeonApiIMAAdsManagerDelegate: PigeonApiProtocolIMAAdsManagerDelega } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.didReceiveAdEvent" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.didReceiveAdEvent" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, adsManagerArg, eventArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2565,11 +2244,7 @@ final class PigeonApiIMAAdsManagerDelegate: PigeonApiProtocolIMAAdsManagerDelega } /// Called when there was an error playing the ad. - func didReceiveAdError( - pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, - adsManager adsManagerArg: IMAAdsManager, error errorArg: IMAAdError, - completion: @escaping (Result) -> Void - ) { + func didReceiveAdError(pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, adsManager adsManagerArg: IMAAdsManager, error errorArg: IMAAdError, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2580,10 +2255,8 @@ final class PigeonApiIMAAdsManagerDelegate: PigeonApiProtocolIMAAdsManagerDelega } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.didReceiveAdError" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.didReceiveAdError" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, adsManagerArg, errorArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2601,11 +2274,7 @@ final class PigeonApiIMAAdsManagerDelegate: PigeonApiProtocolIMAAdsManagerDelega } /// Called when an ad is ready to play. - func didRequestContentPause( - pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, - adsManager adsManagerArg: IMAAdsManager, - completion: @escaping (Result) -> Void - ) { + func didRequestContentPause(pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, adsManager adsManagerArg: IMAAdsManager, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2616,10 +2285,8 @@ final class PigeonApiIMAAdsManagerDelegate: PigeonApiProtocolIMAAdsManagerDelega } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.didRequestContentPause" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.didRequestContentPause" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, adsManagerArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2637,11 +2304,7 @@ final class PigeonApiIMAAdsManagerDelegate: PigeonApiProtocolIMAAdsManagerDelega } /// Called when an ad has finished or an error occurred during the playback. - func didRequestContentResume( - pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, - adsManager adsManagerArg: IMAAdsManager, - completion: @escaping (Result) -> Void - ) { + func didRequestContentResume(pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, adsManager adsManagerArg: IMAAdsManager, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2652,10 +2315,8 @@ final class PigeonApiIMAAdsManagerDelegate: PigeonApiProtocolIMAAdsManagerDelega } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.didRequestContentResume" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.didRequestContentResume" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, adsManagerArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2678,12 +2339,14 @@ protocol PigeonApiDelegateIMAAdEvent { func type(pigeonApi: PigeonApiIMAAdEvent, pigeonInstance: IMAAdEvent) throws -> AdEventType /// Stringified type of the event. func typeString(pigeonApi: PigeonApiIMAAdEvent, pigeonInstance: IMAAdEvent) throws -> String + /// Extra data about the ad. + func adData(pigeonApi: PigeonApiIMAAdEvent, pigeonInstance: IMAAdEvent) throws -> [String: Any]? } protocol PigeonApiProtocolIMAAdEvent { } -final class PigeonApiIMAAdEvent: PigeonApiProtocolIMAAdEvent { +final class PigeonApiIMAAdEvent: PigeonApiProtocolIMAAdEvent { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdEvent ///An implementation of [NSObject] used to access callback methods @@ -2691,17 +2354,12 @@ final class PigeonApiIMAAdEvent: PigeonApiProtocolIMAAdEvent { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateIMAAdEvent - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdEvent) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of IMAAdEvent and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: IMAAdEvent, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: IMAAdEvent, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2714,18 +2372,15 @@ final class PigeonApiIMAAdEvent: PigeonApiProtocolIMAAdEvent { completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) let typeArg = try! pigeonDelegate.type(pigeonApi: self, pigeonInstance: pigeonInstance) - let typeStringArg = try! pigeonDelegate.typeString( - pigeonApi: self, pigeonInstance: pigeonInstance) + let typeStringArg = try! pigeonDelegate.typeString(pigeonApi: self, pigeonInstance: pigeonInstance) + let adDataArg = try! pigeonDelegate.adData(pigeonApi: self, pigeonInstance: pigeonInstance) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMAAdEvent.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg, typeArg, typeStringArg] as [Any?]) { response in + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdEvent.pigeon_newInstance" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg, typeArg, typeStringArg, adDataArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -2742,14 +2397,13 @@ final class PigeonApiIMAAdEvent: PigeonApiProtocolIMAAdEvent { } } protocol PigeonApiDelegateIMAAdsRenderingSettings { - func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsRenderingSettings) throws - -> IMAAdsRenderingSettings + func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsRenderingSettings) throws -> IMAAdsRenderingSettings } protocol PigeonApiProtocolIMAAdsRenderingSettings { } -final class PigeonApiIMAAdsRenderingSettings: PigeonApiProtocolIMAAdsRenderingSettings { +final class PigeonApiIMAAdsRenderingSettings: PigeonApiProtocolIMAAdsRenderingSettings { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdsRenderingSettings ///An implementation of [NSObject] used to access callback methods @@ -2757,34 +2411,25 @@ final class PigeonApiIMAAdsRenderingSettings: PigeonApiProtocolIMAAdsRenderingSe return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateIMAAdsRenderingSettings - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdsRenderingSettings) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsRenderingSettings? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsRenderingSettings?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2796,10 +2441,7 @@ final class PigeonApiIMAAdsRenderingSettings: PigeonApiProtocolIMAAdsRenderingSe } ///Creates a Dart instance of IMAAdsRenderingSettings and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: IMAAdsRenderingSettings, - completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: IMAAdsRenderingSettings, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2812,14 +2454,11 @@ final class PigeonApiIMAAdsRenderingSettings: PigeonApiProtocolIMAAdsRenderingSe completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.pigeon_newInstance" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2842,20 +2481,15 @@ open class PigeonApiDelegateNSObject { protocol PigeonApiProtocolNSObject { } -final class PigeonApiNSObject: PigeonApiProtocolNSObject { +final class PigeonApiNSObject: PigeonApiProtocolNSObject { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateNSObject - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateNSObject - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateNSObject) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of NSObject and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: NSObject, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: NSObject, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2868,13 +2502,11 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec let channelName: String = "dev.flutter.pigeon.interactive_media_ads.NSObject.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) diff --git a/packages/interactive_media_ads/lib/src/ios/interactive_media_ads.g.dart b/packages/interactive_media_ads/lib/src/ios/interactive_media_ads.g.dart index 77e9f90cf4e9..4e1570217908 100644 --- a/packages/interactive_media_ads/lib/src/ios/interactive_media_ads.g.dart +++ b/packages/interactive_media_ads/lib/src/ios/interactive_media_ads.g.dart @@ -8,8 +8,7 @@ import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; -import 'package:flutter/foundation.dart' - show ReadBuffer, WriteBuffer, immutable, protected; +import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer, immutable, protected; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart' show WidgetsFlutterBinding; @@ -20,8 +19,7 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse( - {Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -30,7 +28,6 @@ List wrapResponse( } return [error.code, error.message, error.details]; } - /// An immutable object that serves as the base class for all ProxyApis and /// can provide functional copies of itself. /// @@ -116,8 +113,7 @@ class PigeonInstanceManager { final Expando _identifiers = Expando(); final Map> _weakInstances = >{}; - final Map _strongInstances = - {}; + final Map _strongInstances = {}; late final Finalizer _finalizer; int _nextIdentifier = 0; @@ -135,39 +131,23 @@ class PigeonInstanceManager { api.removeStrongReference(identifier); }, ); - _PigeonInstanceManagerApi.setUpMessageHandlers( - instanceManager: instanceManager); - IMAAdDisplayContainer.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); + _PigeonInstanceManagerApi.setUpMessageHandlers(instanceManager: instanceManager); + IMAAdDisplayContainer.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); UIView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - UIViewController.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - IMAContentPlayhead.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - IMAAdsLoader.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - IMASettings.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - IMAAdsRequest.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - IMAAdsLoaderDelegate.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - IMAAdsLoadedData.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - IMAAdLoadingErrorData.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - IMAAdError.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - IMAAdsManager.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - IMAAdsManagerDelegate.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - IMAAdEvent.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - IMAAdsRenderingSettings.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - NSObject.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); + UIViewController.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + IMAContentPlayhead.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + IMAAdsLoader.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + IMASettings.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + IMAAdsRequest.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + IMAAdsLoaderDelegate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + IMAAdsLoadedData.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + IMAAdLoadingErrorData.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + IMAAdError.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + IMAAdsManager.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + IMAAdsManagerDelegate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + IMAAdEvent.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + IMAAdsRenderingSettings.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + NSObject.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); return instanceManager; } @@ -231,19 +211,15 @@ class PigeonInstanceManager { /// /// This method also expects the host `InstanceManager` to have a strong /// reference to the instance the identifier is associated with. - T? getInstanceWithWeakReference( - int identifier) { - final PigeonProxyApiBaseClass? weakInstance = - _weakInstances[identifier]?.target; + T? getInstanceWithWeakReference(int identifier) { + final PigeonProxyApiBaseClass? weakInstance = _weakInstances[identifier]?.target; if (weakInstance == null) { - final PigeonProxyApiBaseClass? strongInstance = - _strongInstances[identifier]; + final PigeonProxyApiBaseClass? strongInstance = _strongInstances[identifier]; if (strongInstance != null) { final PigeonProxyApiBaseClass copy = strongInstance.pigeon_copy(); _identifiers[copy] = identifier; - _weakInstances[identifier] = - WeakReference(copy); + _weakInstances[identifier] = WeakReference(copy); _finalizer.attach(copy, identifier, detach: copy); return copy as T; } @@ -267,20 +243,17 @@ class PigeonInstanceManager { /// added. /// /// Returns unique identifier of the [instance] added. - void addHostCreatedInstance( - PigeonProxyApiBaseClass instance, int identifier) { + void addHostCreatedInstance(PigeonProxyApiBaseClass instance, int identifier) { _addInstanceWithIdentifier(instance, identifier); } - void _addInstanceWithIdentifier( - PigeonProxyApiBaseClass instance, int identifier) { + void _addInstanceWithIdentifier(PigeonProxyApiBaseClass instance, int identifier) { assert(!containsIdentifier(identifier)); assert(getIdentifier(instance) == null); assert(identifier >= 0); _identifiers[instance] = identifier; - _weakInstances[identifier] = - WeakReference(instance); + _weakInstances[identifier] = WeakReference(instance); _finalizer.attach(instance, identifier, detach: instance); final PigeonProxyApiBaseClass copy = instance.pigeon_copy(); @@ -404,40 +377,38 @@ class _PigeonInstanceManagerApi { } class _PigeonProxyApiBaseCodec extends _PigeonCodec { - const _PigeonProxyApiBaseCodec(this.instanceManager); - final PigeonInstanceManager instanceManager; - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is PigeonProxyApiBaseClass) { - buffer.putUint8(128); - writeValue(buffer, instanceManager.getIdentifier(value)); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return instanceManager - .getInstanceWithWeakReference(readValue(buffer)! as int); - default: - return super.readValueOfType(type, buffer); - } - } + const _PigeonProxyApiBaseCodec(this.instanceManager); + final PigeonInstanceManager instanceManager; + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is PigeonProxyApiBaseClass) { + buffer.putUint8(128); + writeValue(buffer, instanceManager.getIdentifier(value)); + } else { + super.writeValue(buffer, value); + } + } + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return instanceManager + .getInstanceWithWeakReference(readValue(buffer)! as int); + default: + return super.readValueOfType(type, buffer); + } + } } + /// Possible error types while loading or playing ads. /// /// See https://developers.google.com/interactive-media-ads/docs/sdks/ios/client-side/reference/Enums/IMAErrorType.html. enum AdErrorType { /// An error occurred while loading the ads. loadingFailed, - /// An error occurred while playing the ads. adPlayingFailed, - /// An unexpected error occurred while loading or playing the ads. /// /// This may mean that the SDK wasn’t loaded properly or the wrapper doesn't @@ -451,81 +422,58 @@ enum AdErrorType { enum AdErrorCode { /// The ad slot is not visible on the page. adslotNotVisible, - /// Generic invalid usage of the API. apiError, - /// A companion ad failed to load or render. companionAdLoadingFailed, - /// Content playhead was not passed in, but list of ads has been returned from /// the server. contentPlayheadMissing, - /// There was an error loading the ad. failedLoadingAd, - /// There was a problem requesting ads from the server. failedToRequestAds, - /// Invalid arguments were provided to SDK methods. invalidArguments, - /// The version of the runtime is too old. osRuntimeTooOld, - /// Ads list response was malformed. playlistMalformedResponse, - /// Listener for at least one of the required vast events was not added. requiredListenersNotAdded, - /// There was an error initializing the stream. streamInitializationFailed, - /// An unexpected error occurred and the cause is not known. unknownError, - /// No assets were found in the VAST ad response. vastAssetNotFound, - /// A VAST response containing a single `` tag with no child tags. vastEmptyResponse, - /// At least one VAST wrapper loaded and a subsequent wrapper or inline ad /// load has resulted in a 404 response code. vastInvalidUrl, - /// Assets were found in the VAST ad response for a linear ad, but none of /// them matched the video player's capabilities. vastLinearAssetMismatch, - /// The VAST URI provided, or a VAST URI provided in a subsequent Wrapper /// element, was either unavailable or reached a timeout, as defined by the /// video player. vastLoadTimeout, - /// The ad response was not recognized as a valid VAST ad. vastMalformedResponse, - /// Failed to load media assets from a VAST response. vastMediaLoadTimeout, - /// The maximum number of VAST wrapper redirects has been reached. vastTooManyRedirects, - /// Trafficking error. /// /// Video player received an ad type that it was not expecting and/or cannot /// display. vastTraffickingError, - /// Another VideoAdsManager is still using the video. videoElementUsed, - /// A video element was not specified where it was required. videoElementRequired, - /// There was an error playing the video ad. videoPlayError, } @@ -536,77 +484,53 @@ enum AdErrorCode { enum AdEventType { /// Fired the first time each ad break ends. adBreakEnded, - /// Fired when an ad break will not play back any ads. adBreakFetchError, - /// Fired when an ad break is ready. adBreakReady, - /// Fired first time each ad break begins playback. adBreakStarted, - /// Fired every time the stream switches from advertising or slate to content. adPeriodEnded, - /// Fired every time the stream switches from content to advertising or slate. adPeriodStarted, - /// All valid ads managed by the ads manager have completed or the ad response /// did not return any valid ads. allAdsCompleted, - /// Fired when an ad is clicked. clicked, - /// Single ad has finished. completed, - /// Cuepoints changed for VOD stream (only used for dynamic ad insertion). cuepointsChanged, - /// First quartile of a linear ad was reached. firstQuartile, - /// The user has closed the icon fallback image dialog. iconFallbackImageClosed, - /// The user has tapped an ad icon. iconTapped, - /// An ad was loaded. loaded, - /// A log event for the ads being played. log, - /// Midpoint of a linear ad was reached. midpoint, - /// Ad paused. pause, - /// Ad resumed. resume, - /// Fired when an ad was skipped. skipped, - /// Fired when an ad starts playing. started, - /// Stream request has loaded (only used for dynamic ad insertion). streamLoaded, - /// Stream has started playing (only used for dynamic ad insertion). streamStarted, - /// Ad tapped. tapped, - /// Third quartile of a linear ad was reached.. thirdQuartile, - /// The event type is not recognized by this wrapper. unknown, } @@ -618,15 +542,12 @@ enum KeyValueObservingOptions { /// Indicates that the change dictionary should provide the new attribute /// value, if applicable. newValue, - /// Indicates that the change dictionary should contain the old attribute /// value, if applicable. oldValue, - /// If specified, a notification should be sent to the observer immediately, /// before the observer registration method even returns. initialValue, - /// Whether separate notifications should be sent to the observer before and /// after each change, instead of a single notification after the change. priorNotification, @@ -638,15 +559,12 @@ enum KeyValueObservingOptions { enum KeyValueChange { /// Indicates that the value of the observed key path was set to a new value. setting, - /// Indicates that an object has been inserted into the to-many relationship /// that is being observed. insertion, - /// Indicates that an object has been removed from the to-many relationship /// that is being observed. removal, - /// Indicates that an object has been replaced in the to-many relationship /// that is being observed. replacement, @@ -661,29 +579,25 @@ enum KeyValueChangeKey { /// this key is an NSIndexSet object that contains the indexes of the /// inserted, removed, or replaced objects. indexes, - /// An NSNumber object that contains a value corresponding to one of the /// NSKeyValueChange enums, indicating what sort of change has occurred. kind, - /// If the value of the kindKey entry is NSKeyValueChange.setting, and new was /// specified when the observer was registered, the value of this key is the /// new value for the attribute. newValue, - /// If the prior option was specified when the observer was registered this /// notification is sent prior to a change. notificationIsPrior, - /// If the value of the kindKey entry is NSKeyValueChange.setting, and old was /// specified when the observer was registered, the value of this key is the /// value before the attribute was changed. oldValue, - /// The key is not recognized by this wrapper. unknown, } + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -691,19 +605,19 @@ class _PigeonCodec extends StandardMessageCodec { if (value is AdErrorType) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is AdErrorCode) { + } else if (value is AdErrorCode) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is AdEventType) { + } else if (value is AdEventType) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is KeyValueObservingOptions) { + } else if (value is KeyValueObservingOptions) { buffer.putUint8(132); writeValue(buffer, value.index); - } else if (value is KeyValueChange) { + } else if (value is KeyValueChange) { buffer.putUint8(133); writeValue(buffer, value.index); - } else if (value is KeyValueChangeKey) { + } else if (value is KeyValueChangeKey) { buffer.putUint8(134); writeValue(buffer, value.index); } else { @@ -714,22 +628,22 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: final int? value = readValue(buffer) as int?; return value == null ? null : AdErrorType.values[value]; - case 130: + case 130: final int? value = readValue(buffer) as int?; return value == null ? null : AdErrorCode.values[value]; - case 131: + case 131: final int? value = readValue(buffer) as int?; return value == null ? null : AdEventType.values[value]; - case 132: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : KeyValueObservingOptions.values[value]; - case 133: + case 133: final int? value = readValue(buffer) as int?; return value == null ? null : KeyValueChange.values[value]; - case 134: + case 134: final int? value = readValue(buffer) as int?; return value == null ? null : KeyValueChangeKey.values[value]; default: @@ -737,7 +651,6 @@ class _PigeonCodec extends StandardMessageCodec { } } } - /// The `IMAAdDisplayContainer` is responsible for managing the ad container /// view and companion ad slots used for ad playback. /// @@ -2791,6 +2704,7 @@ class IMAAdEvent extends NSObject { super.pigeon_instanceManager, required this.type, required this.typeString, + this.adData, }) : super.pigeon_detached(); /// Type of the event. @@ -2799,6 +2713,9 @@ class IMAAdEvent extends NSObject { /// Stringified type of the event. final String typeString; + /// Extra data about the ad. + final Map? adData; + static void pigeon_setUpMessageHandlers({ bool pigeon_clearHandlers = false, BinaryMessenger? pigeon_binaryMessenger, @@ -2806,6 +2723,7 @@ class IMAAdEvent extends NSObject { IMAAdEvent Function( AdEventType type, String typeString, + Map? adData, )? pigeon_newInstance, }) { final _PigeonProxyApiBaseCodec pigeonChannelCodec = @@ -2834,15 +2752,19 @@ class IMAAdEvent extends NSObject { final String? arg_typeString = (args[2] as String?); assert(arg_typeString != null, 'Argument for dev.flutter.pigeon.interactive_media_ads.IMAAdEvent.pigeon_newInstance was null, expected non-null String.'); + final Map? arg_adData = + (args[3] as Map?)?.cast(); try { (pigeon_instanceManager ?? PigeonInstanceManager.instance) .addHostCreatedInstance( - pigeon_newInstance?.call(arg_type!, arg_typeString!) ?? + pigeon_newInstance?.call( + arg_type!, arg_typeString!, arg_adData) ?? IMAAdEvent.pigeon_detached( pigeon_binaryMessenger: pigeon_binaryMessenger, pigeon_instanceManager: pigeon_instanceManager, type: arg_type!, typeString: arg_typeString!, + adData: arg_adData, ), arg_pigeon_instanceIdentifier!, ); @@ -2865,6 +2787,7 @@ class IMAAdEvent extends NSObject { pigeon_instanceManager: pigeon_instanceManager, type: type, typeString: typeString, + adData: adData, ); } } @@ -3049,3 +2972,4 @@ class NSObject extends PigeonProxyApiBaseClass { ); } } + diff --git a/packages/interactive_media_ads/lib/src/ios/ios_ads_manager_delegate.dart b/packages/interactive_media_ads/lib/src/ios/ios_ads_manager_delegate.dart index a45afe1dc81f..d055805064a3 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_ads_manager_delegate.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_ads_manager_delegate.dart @@ -67,6 +67,12 @@ final class IOSAdsManagerDelegate extends PlatformAdsManagerDelegate { interfaceDelegate.target?.params.onAdEvent?.call( AdEvent( type: toInterfaceEventType(event.type), + adData: event.adData?.map( + (String? key, Object? value) { + return MapEntry(key!, value.toString()); + }, + ) ?? + {}, ), ); }, diff --git a/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart b/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart index e7034fe1510f..8331c5418d02 100644 --- a/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart +++ b/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart @@ -7,719 +7,720 @@ // Kotlin ProxyApi feature from pigeon. // ignore_for_file: avoid_unused_constructor_parameters -import 'package:pigeon/pigeon.dart'; - -@ConfigurePigeon( - PigeonOptions( - copyrightHeader: 'pigeons/copyright.txt', - dartOut: 'lib/src/android/interactive_media_ads.g.dart', - kotlinOut: - 'android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt', - kotlinOptions: KotlinOptions( - package: 'dev.flutter.packages.interactive_media_ads', - ), - ), -) - -/// The types of error that can be encountered. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorCode.html. -enum AdErrorCode { - /// Ads player was not provided. - adsPlayerWasNotProvided, - - /// There was a problem requesting ads from the server. - adsRequestNetworkError, - - /// A companion ad failed to load or render. - companionAdLoadingFailed, - - /// There was a problem requesting ads from the server. - failedToRequestAds, - - /// An error internal to the SDK occurred. - internalError, - - /// Invalid arguments were provided to SDK methods. - invalidArguments, - - /// An overlay ad failed to load. - overlayAdLoadingFailed, - - /// An overlay ad failed to render. - overlayAdPlayingFailed, - - /// Ads list was returned but ContentProgressProvider was not configured. - playlistNoContentTracking, - - /// Ads loader sent ads loaded event when it was not expected. - unexpectedAdsLoadedEvent, - - /// The ad response was not understood and cannot be parsed. - unknownAdResponse, - - /// An unexpected error occurred and the cause is not known. - unknownError, - - /// No assets were found in the VAST ad response. - vastAssetNotFound, - - /// A VAST response containing a single `` tag with no child tags. - vastEmptyResponse, - - /// Assets were found in the VAST ad response for a linear ad, but none of - /// them matched the video player's capabilities. - vastLinearAssetMismatch, - - /// At least one VAST wrapper ad loaded successfully and a subsequent wrapper - /// or inline ad load has timed out. - vastLoadTimeout, - - /// The ad response was not recognized as a valid VAST ad. - vastMalformedResponse, - - /// Failed to load media assets from a VAST response. - vastMediaLoadTimeout, - - /// Assets were found in the VAST ad response for a nonlinear ad, but none of - /// them matched the video player's capabilities. - vastNonlinearAssetMismatch, - - /// No Ads VAST response after one or more wrappers. - vastNoAdsAfterWrapper, - - /// The maximum number of VAST wrapper redirects has been reached. - vastTooManyRedirects, - - /// Trafficking error. - /// - /// Video player received an ad type that it was not expecting and/or cannot - /// display. - vastTraffickingError, - - /// There was an error playing the video ad. - videoPlayError, - - /// The error code is not recognized by this wrapper. - unknown, -} - -/// Specifies when the error was encountered, during either ad loading or playback. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorType.html. -enum AdErrorType { - /// Indicates that the error was encountered when the ad was being loaded. - load, - - /// Indicates that the error was encountered after the ad loaded, during ad play. - play, - - /// The error is not recognized by this wrapper. - unknown, -} - -/// Types of events that can occur during ad playback. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventType.html. -enum AdEventType { - /// Fired when an ad break in a stream ends. - adBreakEnded, - - /// Fired when an ad break will not play back any ads. - adBreakFetchError, - - /// Fired when an ad break is ready from VMAP or ad rule ads. - adBreakReady, - - /// Fired when an ad break in a stream starts. - adBreakStarted, - - /// Fired when playback stalls while the ad buffers. - adBuffering, - - /// Fired when an ad period in a stream ends. - adPeriodEnded, - - /// Fired when an ad period in a stream starts. - adPeriodStarted, - - /// Fired to inform of ad progress and can be used by publisher to display a - /// countdown timer. - adProgress, - - /// Fired when the ads manager is done playing all the valid ads in the ads - /// response, or when the response doesn't return any valid ads. - allAdsCompleted, - - /// Fired when an ad is clicked. - clicked, - - /// Fired when an ad completes playing. - completed, - - /// Fired when content should be paused. - contentPauseRequested, - - /// Fired when content should be resumed. - contentResumeRequested, - - /// Fired when VOD stream cuepoints have changed. - cuepointsChanged, - - /// Fired when the ad playhead crosses first quartile. - firstQuartile, - - /// The user has closed the icon fallback image dialog. - iconFallbackImageClosed, - - /// The user has tapped an ad icon. - iconTapped, - - /// Fired when the VAST response has been received. - loaded, - - /// Fired to enable the SDK to communicate a message to be logged, which is - /// stored in adData. - log, - - /// Fired when the ad playhead crosses midpoint. - midpoint, - - /// Fired when an ad is paused. - paused, - - /// Fired when an ad is resumed. - resumed, - - /// Fired when an ad changes its skippable state. - skippableStateChanged, - - /// Fired when an ad was skipped. - skipped, - - /// Fired when an ad starts playing. - started, - - /// Fired when a non-clickthrough portion of a video ad is clicked. - tapped, - - /// Fired when the ad playhead crosses third quartile. - thirdQuartile, - - /// The event type is not recognized by this wrapper. - unknown, -} - -/// A base class for more specialized container interfaces. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseDisplayContainer.html. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: - 'com.google.ads.interactivemedia.v3.api.BaseDisplayContainer', - ), -) -abstract class BaseDisplayContainer {} - -/// A container in which to display the ads. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdDisplayContainer. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: 'com.google.ads.interactivemedia.v3.api.AdDisplayContainer', - ), -) -abstract class AdDisplayContainer implements BaseDisplayContainer {} - -/// An object which allows publishers to request ads from ad servers or a -/// dynamic ad insertion stream. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: 'com.google.ads.interactivemedia.v3.api.AdsLoader', - ), -) -abstract class AdsLoader { - /// Registers a listener for errors that occur during the ads request. - void addAdErrorListener(AdErrorListener listener); - - /// Registers a listener for the ads manager loaded event. - void addAdsLoadedListener(AdsLoadedListener listener); - - /// Requests ads from a server. - void requestAds(AdsRequest request); -} - -/// An event raised when ads are successfully loaded from the ad server through an AdsLoader. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManagerLoadedEvent.html. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: - 'com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent', - ), -) -abstract class AdsManagerLoadedEvent { - /// The ads manager that will control playback of the loaded ads, or null when - /// using dynamic ad insertion. - late final AdsManager manager; -} - -/// An event raised when there is an error loading or playing ads. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.html. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: 'com.google.ads.interactivemedia.v3.api.AdErrorEvent', - ), -) -abstract class AdErrorEvent { - /// The AdError that caused this event. - late final AdError error; -} - -/// An error that occurred in the SDK. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.html. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: 'com.google.ads.interactivemedia.v3.api.AdError', - ), -) -abstract class AdError { - /// The error's code. - late final AdErrorCode errorCode; - - /// The error code's number. - late final int errorCodeNumber; - - /// The error's type. - late final AdErrorType errorType; - - /// A human-readable summary of the error. - late final String message; -} - -/// An object containing the data used to request ads from the server. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsRequest. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: 'com.google.ads.interactivemedia.v3.api.AdsRequest', - ), -) -abstract class AdsRequest { - /// Sets the URL from which ads will be requested. - void setAdTagUrl(String adTagUrl); - - /// Attaches a ContentProgressProvider instance to allow scheduling ad breaks - /// based on content progress (cue points). - void setContentProgressProvider(ContentProgressProvider provider); -} - -/// Defines an interface to allow SDK to track progress of the content video. -/// -/// See https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/android/api/reference/com/google/ads/interactivemedia/v3/api/player/ContentProgressProvider.html. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: - 'com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider', - ), -) -abstract class ContentProgressProvider {} - -/// An object which handles playing ads after they've been received from the -/// server. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManager. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: 'com.google.ads.interactivemedia.v3.api.AdsManager', - ), -) -abstract class AdsManager extends BaseManager { - /// Discards current ad break and resumes content. - void discardAdBreak(); - - /// Pauses the current ad. - void pause(); - - /// Starts playing the ads. - void start(); -} - -/// Base interface for managing ads.. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseManager.html. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: 'com.google.ads.interactivemedia.v3.api.BaseManager', - ), -) -abstract class BaseManager { - /// Registers a listener for errors that occur during the ad or stream - /// initialization and playback. - void addAdErrorListener(AdErrorListener errorListener); - - /// Registers a listener for ad events that occur during ad or stream - /// initialization and playback. - void addAdEventListener(AdEventListener adEventListener); - - /// Stops the ad and all tracking, then releases all assets that were loaded - /// to play the ad. - void destroy(); - - /// Initializes the ad experience using default rendering settings - void init(); -} - -/// Event to notify publisher that an event occurred with an Ad. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.html. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: 'com.google.ads.interactivemedia.v3.api.AdEvent', - ), -) -abstract class AdEvent { - /// The type of event that occurred. - late final AdEventType type; - - late final Map adData; -} - -/// Factory class for creating SDK objects. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkFactory. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: 'com.google.ads.interactivemedia.v3.api.ImaSdkFactory', - ), -) -abstract class ImaSdkFactory { - @static - @attached - late final ImaSdkFactory instance; - - @static - AdDisplayContainer createAdDisplayContainer( - ViewGroup container, - VideoAdPlayer player, - ); - - /// Creates an `ImaSdkSettings` object for configuring the IMA SDK. - ImaSdkSettings createImaSdkSettings(); - - /// Creates an `AdsLoader` for requesting ads using the specified settings - /// object. - AdsLoader createAdsLoader( - ImaSdkSettings settings, - AdDisplayContainer container, - ); - - /// Creates an AdsRequest object to contain the data used to request ads. - AdsRequest createAdsRequest(); -} - -/// Defines general SDK settings that are used when creating an `AdsLoader`. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkSettings.html. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: 'com.google.ads.interactivemedia.v3.api.ImaSdkSettings', - ), -) -abstract class ImaSdkSettings {} - -/// Defines an update to the video's progress. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoProgressUpdate.html. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: - 'com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate', - ), -) -abstract class VideoProgressUpdate { - VideoProgressUpdate(int currentTimeMs, int durationMs); - - /// Value to use for cases when progress is not yet defined, such as video - /// initialization. - @static - @attached - late final VideoProgressUpdate videoTimeNotReady; -} - -/// The minimal information required to play an ad. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/AdMediaInfo.html. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: 'com.google.ads.interactivemedia.v3.api.player.AdMediaInfo', - ), -) -abstract class AdMediaInfo { - late final String url; -} - -/// An ad may be part of a pod of ads. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdPodInfo.html. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: 'com.google.ads.interactivemedia.v3.api.AdPodInfo', - ), -) -abstract class AdPodInfo { - /// The position of the ad within the pod. - /// - /// The value returned is one-based, for example, 1 of 2, 2 of 2, etc. If the - /// ad is not part of a pod, this will return 1. - late final int adPosition; - - /// The maximum duration of the pod in seconds. - /// - /// For unknown duration, -1 is returned. - late final double maxDuration; - - /// Client side and DAI VOD: Returns the index of the ad pod. - late final int podIndex; - - /// The content time offset at which the current ad pod was scheduled. - /// - /// For preroll pod, 0 is returned. For midrolls, the scheduled time is - /// returned in seconds. For postroll, -1 is returned. Defaults to 0 if this - /// ad is not part of a pod, or the pod is not part of an ad playlist. - late final double timeOffset; - - /// The total number of ads contained within this pod, including bumpers. - late final int totalAds; - - /// Returns true if the ad is a bumper ad. - late final bool isBumper; -} - -/// FrameLayout is designed to block out an area on the screen to display a -/// single item. -/// -/// See https://developer.android.com/reference/android/widget/FrameLayout. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: 'android.widget.FrameLayout', - ), -) -abstract class FrameLayout extends ViewGroup { - FrameLayout(); -} - -/// A special view that can contain other views (called children.) -/// -/// See https://developer.android.com/reference/android/view/ViewGroup. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: 'android.view.ViewGroup', - ), -) -abstract class ViewGroup extends View { - void addView(View view); -} - -/// Displays a video file. -/// -/// See https://developer.android.com/reference/android/widget/VideoView. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: 'android.widget.VideoView', - ), -) -abstract class VideoView extends View { - VideoView(); - - /// Callback to be invoked when the media source is ready for playback. - late final void Function(MediaPlayer player)? onPrepared; - - /// Callback to be invoked when playback of a media source has completed. - late final void Function(MediaPlayer player)? onCompletion; - - /// Callback to be invoked when there has been an error during an asynchronous - /// operation. - late final void Function(MediaPlayer player, int what, int extra) onError; - - /// Sets the URI of the video. - void setVideoUri(String uri); - - /// The current position of the playing video. - /// - /// In milliseconds. - int getCurrentPosition(); -} - -/// This class represents the basic building block for user interface components. -/// -/// See https://developer.android.com/reference/android/view/View. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions(fullClassName: 'android.view.View'), -) -abstract class View {} - -/// MediaPlayer class can be used to control playback of audio/video files and -/// streams. -/// -/// See https://developer.android.com/reference/android/media/MediaPlayer. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: 'android.media.MediaPlayer', - ), -) -abstract class MediaPlayer { - /// Gets the duration of the file. - int getDuration(); - - /// Seeks to specified time position. - void seekTo(int mSec); - - /// Starts or resumes playback. - void start(); - - /// Pauses playback. - void pause(); - - /// Stops playback after playback has been started or paused. - void stop(); -} - -/// Callbacks that the player must fire. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.VideoAdPlayerCallback.html -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: - 'com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback', - ), -) -abstract class VideoAdPlayerCallback { - /// Fire this callback periodically as ad playback occurs. - void onAdProgress( - AdMediaInfo adMediaInfo, - VideoProgressUpdate videoProgressUpdate, - ); - - /// Fire this callback when video playback stalls waiting for data. - void onBuffering(AdMediaInfo adMediaInfo); - - /// Fire this callback when all content has finished playing. - void onContentComplete(); - - /// Fire this callback when the video finishes playing. - void onEnded(AdMediaInfo adMediaInfo); - - /// Fire this callback when the video has encountered an error. - void onError(AdMediaInfo adMediaInfo); - - /// Fire this callback when the video is ready to begin playback. - void onLoaded(AdMediaInfo adMediaInfo); - - /// Fire this callback when the video is paused. - void onPause(AdMediaInfo adMediaInfo); - - /// Fire this callback when the player begins playing a video. - void onPlay(AdMediaInfo adMediaInfo); - - /// Fire this callback when the video is unpaused. - void onResume(AdMediaInfo adMediaInfo); - - /// Fire this callback when the playback volume changes. - void onVolumeChanged(AdMediaInfo adMediaInfo, int percentage); -} - -/// Defines the set of methods that a video player must implement to be used by -/// the IMA SDK, as well as a set of callbacks that it must fire. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.html. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: - 'com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer', - ), -) -abstract class VideoAdPlayer { - VideoAdPlayer(); - - /// Adds a callback. - late final void Function(VideoAdPlayerCallback callback) addCallback; - - /// Loads a video ad hosted at AdMediaInfo. - late final void Function(AdMediaInfo adMediaInfo, AdPodInfo adPodInfo) loadAd; - - /// Pauses playing the current ad. - late final void Function(AdMediaInfo adMediaInfo) pauseAd; - - /// Starts or resumes playing the video ad referenced by the AdMediaInfo, - /// provided loadAd has already been called for it. - late final void Function(AdMediaInfo adMediaInfo) playAd; - - /// Cleans up and releases all resources used by the `VideoAdPlayer`. - late final void Function() release; - - /// Removes a callback. - late final void Function(VideoAdPlayerCallback callback) removeCallback; - - /// Stops playing the current ad. - late final void Function(AdMediaInfo adMediaInfo) stopAd; - - /// The volume of the player as a percentage from 0 to 100. - void setVolume(int value); - - /// The `VideoProgressUpdate` describing playback progress of the current - /// video. - void setAdProgress(VideoProgressUpdate progress); -} - -/// Listener interface for notification of ad load or stream load completion. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader.AdsLoadedListener.html. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: - 'com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener', - ), -) -abstract class AdsLoadedListener { - AdsLoadedListener(); - - /// Called once the AdsManager or StreamManager has been loaded. - late final void Function(AdsManagerLoadedEvent event) onAdsManagerLoaded; -} - -/// Interface for classes that will listen to AdErrorEvents. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.AdErrorListener.html. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: - 'com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener', - ), -) -abstract class AdErrorListener { - AdErrorListener(); - - /// Called when an error occurs. - late final void Function(AdErrorEvent event) onAdError; -} - -/// Listener interface for ad events. -/// -/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventListener.html. -@ProxyApi( - kotlinOptions: KotlinProxyApiOptions( - fullClassName: - 'com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener', - ), -) -abstract class AdEventListener { - AdEventListener(); - - /// Respond to an occurrence of an AdEvent. - late final void Function(AdEvent event) onAdEvent; -} +// import 'package:pigeon/pigeon.dart'; +// +// @ConfigurePigeon( +// PigeonOptions( +// copyrightHeader: 'pigeons/copyright.txt', +// dartOut: 'lib/src/android/interactive_media_ads.g.dart', +// kotlinOut: +// 'android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt', +// kotlinOptions: KotlinOptions( +// package: 'dev.flutter.packages.interactive_media_ads', +// ), +// ), +// ) +// +// /// The types of error that can be encountered. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorCode.html. +// enum AdErrorCode { +// /// Ads player was not provided. +// adsPlayerWasNotProvided, +// +// /// There was a problem requesting ads from the server. +// adsRequestNetworkError, +// +// /// A companion ad failed to load or render. +// companionAdLoadingFailed, +// +// /// There was a problem requesting ads from the server. +// failedToRequestAds, +// +// /// An error internal to the SDK occurred. +// internalError, +// +// /// Invalid arguments were provided to SDK methods. +// invalidArguments, +// +// /// An overlay ad failed to load. +// overlayAdLoadingFailed, +// +// /// An overlay ad failed to render. +// overlayAdPlayingFailed, +// +// /// Ads list was returned but ContentProgressProvider was not configured. +// playlistNoContentTracking, +// +// /// Ads loader sent ads loaded event when it was not expected. +// unexpectedAdsLoadedEvent, +// +// /// The ad response was not understood and cannot be parsed. +// unknownAdResponse, +// +// /// An unexpected error occurred and the cause is not known. +// unknownError, +// +// /// No assets were found in the VAST ad response. +// vastAssetNotFound, +// +// /// A VAST response containing a single `` tag with no child tags. +// vastEmptyResponse, +// +// /// Assets were found in the VAST ad response for a linear ad, but none of +// /// them matched the video player's capabilities. +// vastLinearAssetMismatch, +// +// /// At least one VAST wrapper ad loaded successfully and a subsequent wrapper +// /// or inline ad load has timed out. +// vastLoadTimeout, +// +// /// The ad response was not recognized as a valid VAST ad. +// vastMalformedResponse, +// +// /// Failed to load media assets from a VAST response. +// vastMediaLoadTimeout, +// +// /// Assets were found in the VAST ad response for a nonlinear ad, but none of +// /// them matched the video player's capabilities. +// vastNonlinearAssetMismatch, +// +// /// No Ads VAST response after one or more wrappers. +// vastNoAdsAfterWrapper, +// +// /// The maximum number of VAST wrapper redirects has been reached. +// vastTooManyRedirects, +// +// /// Trafficking error. +// /// +// /// Video player received an ad type that it was not expecting and/or cannot +// /// display. +// vastTraffickingError, +// +// /// There was an error playing the video ad. +// videoPlayError, +// +// /// The error code is not recognized by this wrapper. +// unknown, +// } +// +// /// Specifies when the error was encountered, during either ad loading or playback. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorType.html. +// enum AdErrorType { +// /// Indicates that the error was encountered when the ad was being loaded. +// load, +// +// /// Indicates that the error was encountered after the ad loaded, during ad play. +// play, +// +// /// The error is not recognized by this wrapper. +// unknown, +// } +// +// /// Types of events that can occur during ad playback. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventType.html. +// enum AdEventType { +// /// Fired when an ad break in a stream ends. +// adBreakEnded, +// +// /// Fired when an ad break will not play back any ads. +// adBreakFetchError, +// +// /// Fired when an ad break is ready from VMAP or ad rule ads. +// adBreakReady, +// +// /// Fired when an ad break in a stream starts. +// adBreakStarted, +// +// /// Fired when playback stalls while the ad buffers. +// adBuffering, +// +// /// Fired when an ad period in a stream ends. +// adPeriodEnded, +// +// /// Fired when an ad period in a stream starts. +// adPeriodStarted, +// +// /// Fired to inform of ad progress and can be used by publisher to display a +// /// countdown timer. +// adProgress, +// +// /// Fired when the ads manager is done playing all the valid ads in the ads +// /// response, or when the response doesn't return any valid ads. +// allAdsCompleted, +// +// /// Fired when an ad is clicked. +// clicked, +// +// /// Fired when an ad completes playing. +// completed, +// +// /// Fired when content should be paused. +// contentPauseRequested, +// +// /// Fired when content should be resumed. +// contentResumeRequested, +// +// /// Fired when VOD stream cuepoints have changed. +// cuepointsChanged, +// +// /// Fired when the ad playhead crosses first quartile. +// firstQuartile, +// +// /// The user has closed the icon fallback image dialog. +// iconFallbackImageClosed, +// +// /// The user has tapped an ad icon. +// iconTapped, +// +// /// Fired when the VAST response has been received. +// loaded, +// +// /// Fired to enable the SDK to communicate a message to be logged, which is +// /// stored in adData. +// log, +// +// /// Fired when the ad playhead crosses midpoint. +// midpoint, +// +// /// Fired when an ad is paused. +// paused, +// +// /// Fired when an ad is resumed. +// resumed, +// +// /// Fired when an ad changes its skippable state. +// skippableStateChanged, +// +// /// Fired when an ad was skipped. +// skipped, +// +// /// Fired when an ad starts playing. +// started, +// +// /// Fired when a non-clickthrough portion of a video ad is clicked. +// tapped, +// +// /// Fired when the ad playhead crosses third quartile. +// thirdQuartile, +// +// /// The event type is not recognized by this wrapper. +// unknown, +// } +// +// /// A base class for more specialized container interfaces. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseDisplayContainer.html. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: +// 'com.google.ads.interactivemedia.v3.api.BaseDisplayContainer', +// ), +// ) +// abstract class BaseDisplayContainer {} +// +// /// A container in which to display the ads. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdDisplayContainer. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdDisplayContainer', +// ), +// ) +// abstract class AdDisplayContainer implements BaseDisplayContainer {} +// +// /// An object which allows publishers to request ads from ad servers or a +// /// dynamic ad insertion stream. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdsLoader', +// ), +// ) +// abstract class AdsLoader { +// /// Registers a listener for errors that occur during the ads request. +// void addAdErrorListener(AdErrorListener listener); +// +// /// Registers a listener for the ads manager loaded event. +// void addAdsLoadedListener(AdsLoadedListener listener); +// +// /// Requests ads from a server. +// void requestAds(AdsRequest request); +// } +// +// /// An event raised when ads are successfully loaded from the ad server through an AdsLoader. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManagerLoadedEvent.html. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: +// 'com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent', +// ), +// ) +// abstract class AdsManagerLoadedEvent { +// /// The ads manager that will control playback of the loaded ads, or null when +// /// using dynamic ad insertion. +// late final AdsManager manager; +// } +// +// /// An event raised when there is an error loading or playing ads. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.html. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdErrorEvent', +// ), +// ) +// abstract class AdErrorEvent { +// /// The AdError that caused this event. +// late final AdError error; +// } +// +// /// An error that occurred in the SDK. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.html. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdError', +// ), +// ) +// abstract class AdError { +// /// The error's code. +// late final AdErrorCode errorCode; +// +// /// The error code's number. +// late final int errorCodeNumber; +// +// /// The error's type. +// late final AdErrorType errorType; +// +// /// A human-readable summary of the error. +// late final String message; +// } +// +// /// An object containing the data used to request ads from the server. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsRequest. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdsRequest', +// ), +// ) +// abstract class AdsRequest { +// /// Sets the URL from which ads will be requested. +// void setAdTagUrl(String adTagUrl); +// +// /// Attaches a ContentProgressProvider instance to allow scheduling ad breaks +// /// based on content progress (cue points). +// void setContentProgressProvider(ContentProgressProvider provider); +// } +// +// /// Defines an interface to allow SDK to track progress of the content video. +// /// +// /// See https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/android/api/reference/com/google/ads/interactivemedia/v3/api/player/ContentProgressProvider.html. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: +// 'com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider', +// ), +// ) +// abstract class ContentProgressProvider {} +// +// /// An object which handles playing ads after they've been received from the +// /// server. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManager. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdsManager', +// ), +// ) +// abstract class AdsManager extends BaseManager { +// /// Discards current ad break and resumes content. +// void discardAdBreak(); +// +// /// Pauses the current ad. +// void pause(); +// +// /// Starts playing the ads. +// void start(); +// } +// +// /// Base interface for managing ads.. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseManager.html. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: 'com.google.ads.interactivemedia.v3.api.BaseManager', +// ), +// ) +// abstract class BaseManager { +// /// Registers a listener for errors that occur during the ad or stream +// /// initialization and playback. +// void addAdErrorListener(AdErrorListener errorListener); +// +// /// Registers a listener for ad events that occur during ad or stream +// /// initialization and playback. +// void addAdEventListener(AdEventListener adEventListener); +// +// /// Stops the ad and all tracking, then releases all assets that were loaded +// /// to play the ad. +// void destroy(); +// +// /// Initializes the ad experience using default rendering settings +// void init(); +// } +// +// /// Event to notify publisher that an event occurred with an Ad. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.html. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdEvent', +// ), +// ) +// abstract class AdEvent { +// /// The type of event that occurred. +// late final AdEventType type; +// +// /// A map containing any extra ad data for the event, if needed. +// late final Map adData; +// } +// +// /// Factory class for creating SDK objects. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkFactory. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: 'com.google.ads.interactivemedia.v3.api.ImaSdkFactory', +// ), +// ) +// abstract class ImaSdkFactory { +// @static +// @attached +// late final ImaSdkFactory instance; +// +// @static +// AdDisplayContainer createAdDisplayContainer( +// ViewGroup container, +// VideoAdPlayer player, +// ); +// +// /// Creates an `ImaSdkSettings` object for configuring the IMA SDK. +// ImaSdkSettings createImaSdkSettings(); +// +// /// Creates an `AdsLoader` for requesting ads using the specified settings +// /// object. +// AdsLoader createAdsLoader( +// ImaSdkSettings settings, +// AdDisplayContainer container, +// ); +// +// /// Creates an AdsRequest object to contain the data used to request ads. +// AdsRequest createAdsRequest(); +// } +// +// /// Defines general SDK settings that are used when creating an `AdsLoader`. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkSettings.html. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: 'com.google.ads.interactivemedia.v3.api.ImaSdkSettings', +// ), +// ) +// abstract class ImaSdkSettings {} +// +// /// Defines an update to the video's progress. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoProgressUpdate.html. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: +// 'com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate', +// ), +// ) +// abstract class VideoProgressUpdate { +// VideoProgressUpdate(int currentTimeMs, int durationMs); +// +// /// Value to use for cases when progress is not yet defined, such as video +// /// initialization. +// @static +// @attached +// late final VideoProgressUpdate videoTimeNotReady; +// } +// +// /// The minimal information required to play an ad. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/AdMediaInfo.html. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: 'com.google.ads.interactivemedia.v3.api.player.AdMediaInfo', +// ), +// ) +// abstract class AdMediaInfo { +// late final String url; +// } +// +// /// An ad may be part of a pod of ads. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdPodInfo.html. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdPodInfo', +// ), +// ) +// abstract class AdPodInfo { +// /// The position of the ad within the pod. +// /// +// /// The value returned is one-based, for example, 1 of 2, 2 of 2, etc. If the +// /// ad is not part of a pod, this will return 1. +// late final int adPosition; +// +// /// The maximum duration of the pod in seconds. +// /// +// /// For unknown duration, -1 is returned. +// late final double maxDuration; +// +// /// Client side and DAI VOD: Returns the index of the ad pod. +// late final int podIndex; +// +// /// The content time offset at which the current ad pod was scheduled. +// /// +// /// For preroll pod, 0 is returned. For midrolls, the scheduled time is +// /// returned in seconds. For postroll, -1 is returned. Defaults to 0 if this +// /// ad is not part of a pod, or the pod is not part of an ad playlist. +// late final double timeOffset; +// +// /// The total number of ads contained within this pod, including bumpers. +// late final int totalAds; +// +// /// Returns true if the ad is a bumper ad. +// late final bool isBumper; +// } +// +// /// FrameLayout is designed to block out an area on the screen to display a +// /// single item. +// /// +// /// See https://developer.android.com/reference/android/widget/FrameLayout. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: 'android.widget.FrameLayout', +// ), +// ) +// abstract class FrameLayout extends ViewGroup { +// FrameLayout(); +// } +// +// /// A special view that can contain other views (called children.) +// /// +// /// See https://developer.android.com/reference/android/view/ViewGroup. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: 'android.view.ViewGroup', +// ), +// ) +// abstract class ViewGroup extends View { +// void addView(View view); +// } +// +// /// Displays a video file. +// /// +// /// See https://developer.android.com/reference/android/widget/VideoView. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: 'android.widget.VideoView', +// ), +// ) +// abstract class VideoView extends View { +// VideoView(); +// +// /// Callback to be invoked when the media source is ready for playback. +// late final void Function(MediaPlayer player)? onPrepared; +// +// /// Callback to be invoked when playback of a media source has completed. +// late final void Function(MediaPlayer player)? onCompletion; +// +// /// Callback to be invoked when there has been an error during an asynchronous +// /// operation. +// late final void Function(MediaPlayer player, int what, int extra) onError; +// +// /// Sets the URI of the video. +// void setVideoUri(String uri); +// +// /// The current position of the playing video. +// /// +// /// In milliseconds. +// int getCurrentPosition(); +// } +// +// /// This class represents the basic building block for user interface components. +// /// +// /// See https://developer.android.com/reference/android/view/View. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions(fullClassName: 'android.view.View'), +// ) +// abstract class View {} +// +// /// MediaPlayer class can be used to control playback of audio/video files and +// /// streams. +// /// +// /// See https://developer.android.com/reference/android/media/MediaPlayer. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: 'android.media.MediaPlayer', +// ), +// ) +// abstract class MediaPlayer { +// /// Gets the duration of the file. +// int getDuration(); +// +// /// Seeks to specified time position. +// void seekTo(int mSec); +// +// /// Starts or resumes playback. +// void start(); +// +// /// Pauses playback. +// void pause(); +// +// /// Stops playback after playback has been started or paused. +// void stop(); +// } +// +// /// Callbacks that the player must fire. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.VideoAdPlayerCallback.html +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: +// 'com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback', +// ), +// ) +// abstract class VideoAdPlayerCallback { +// /// Fire this callback periodically as ad playback occurs. +// void onAdProgress( +// AdMediaInfo adMediaInfo, +// VideoProgressUpdate videoProgressUpdate, +// ); +// +// /// Fire this callback when video playback stalls waiting for data. +// void onBuffering(AdMediaInfo adMediaInfo); +// +// /// Fire this callback when all content has finished playing. +// void onContentComplete(); +// +// /// Fire this callback when the video finishes playing. +// void onEnded(AdMediaInfo adMediaInfo); +// +// /// Fire this callback when the video has encountered an error. +// void onError(AdMediaInfo adMediaInfo); +// +// /// Fire this callback when the video is ready to begin playback. +// void onLoaded(AdMediaInfo adMediaInfo); +// +// /// Fire this callback when the video is paused. +// void onPause(AdMediaInfo adMediaInfo); +// +// /// Fire this callback when the player begins playing a video. +// void onPlay(AdMediaInfo adMediaInfo); +// +// /// Fire this callback when the video is unpaused. +// void onResume(AdMediaInfo adMediaInfo); +// +// /// Fire this callback when the playback volume changes. +// void onVolumeChanged(AdMediaInfo adMediaInfo, int percentage); +// } +// +// /// Defines the set of methods that a video player must implement to be used by +// /// the IMA SDK, as well as a set of callbacks that it must fire. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.html. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: +// 'com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer', +// ), +// ) +// abstract class VideoAdPlayer { +// VideoAdPlayer(); +// +// /// Adds a callback. +// late final void Function(VideoAdPlayerCallback callback) addCallback; +// +// /// Loads a video ad hosted at AdMediaInfo. +// late final void Function(AdMediaInfo adMediaInfo, AdPodInfo adPodInfo) loadAd; +// +// /// Pauses playing the current ad. +// late final void Function(AdMediaInfo adMediaInfo) pauseAd; +// +// /// Starts or resumes playing the video ad referenced by the AdMediaInfo, +// /// provided loadAd has already been called for it. +// late final void Function(AdMediaInfo adMediaInfo) playAd; +// +// /// Cleans up and releases all resources used by the `VideoAdPlayer`. +// late final void Function() release; +// +// /// Removes a callback. +// late final void Function(VideoAdPlayerCallback callback) removeCallback; +// +// /// Stops playing the current ad. +// late final void Function(AdMediaInfo adMediaInfo) stopAd; +// +// /// The volume of the player as a percentage from 0 to 100. +// void setVolume(int value); +// +// /// The `VideoProgressUpdate` describing playback progress of the current +// /// video. +// void setAdProgress(VideoProgressUpdate progress); +// } +// +// /// Listener interface for notification of ad load or stream load completion. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader.AdsLoadedListener.html. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: +// 'com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener', +// ), +// ) +// abstract class AdsLoadedListener { +// AdsLoadedListener(); +// +// /// Called once the AdsManager or StreamManager has been loaded. +// late final void Function(AdsManagerLoadedEvent event) onAdsManagerLoaded; +// } +// +// /// Interface for classes that will listen to AdErrorEvents. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.AdErrorListener.html. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: +// 'com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener', +// ), +// ) +// abstract class AdErrorListener { +// AdErrorListener(); +// +// /// Called when an error occurs. +// late final void Function(AdErrorEvent event) onAdError; +// } +// +// /// Listener interface for ad events. +// /// +// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventListener.html. +// @ProxyApi( +// kotlinOptions: KotlinProxyApiOptions( +// fullClassName: +// 'com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener', +// ), +// ) +// abstract class AdEventListener { +// AdEventListener(); +// +// /// Respond to an occurrence of an AdEvent. +// late final void Function(AdEvent event) onAdEvent; +// } diff --git a/packages/interactive_media_ads/pigeons/interactive_media_ads_ios.dart b/packages/interactive_media_ads/pigeons/interactive_media_ads_ios.dart index 934518843645..5777bb838ace 100644 --- a/packages/interactive_media_ads/pigeons/interactive_media_ads_ios.dart +++ b/packages/interactive_media_ads/pigeons/interactive_media_ads_ios.dart @@ -7,7 +7,6 @@ // Swift ProxyApi feature from pigeon. // ignore_for_file: avoid_unused_constructor_parameters -/* import 'package:pigeon/pigeon.dart'; @ConfigurePigeon( @@ -488,6 +487,9 @@ abstract class IMAAdEvent extends NSObject { /// Stringified type of the event. late final String typeString; + + /// Extra data about the ad. + late final Map? adData; } /// Set of properties that influence how ads are rendered. @@ -505,4 +507,3 @@ abstract class IMAAdsRenderingSettings extends NSObject { /// See https://developer.apple.com/documentation/objectivec/nsobject. @ProxyApi() abstract class NSObject {} -*/ diff --git a/packages/interactive_media_ads/pubspec.yaml b/packages/interactive_media_ads/pubspec.yaml index a95135ea53d5..0c5d9f2d3f31 100644 --- a/packages/interactive_media_ads/pubspec.yaml +++ b/packages/interactive_media_ads/pubspec.yaml @@ -34,7 +34,7 @@ dev_dependencies: pigeon: git: url: https://github.com/bparrishMines/packages.git - ref: pigeon_kotlin_split + ref: pigeon_wrapper_swift path: packages/pigeon topics: diff --git a/packages/interactive_media_ads/test/ios/ads_manager_delegate_tests.dart b/packages/interactive_media_ads/test/ios/ads_manager_delegate_tests.dart index 398d8600e058..b1fdcb87598e 100644 --- a/packages/interactive_media_ads/test/ios/ads_manager_delegate_tests.dart +++ b/packages/interactive_media_ads/test/ios/ads_manager_delegate_tests.dart @@ -57,6 +57,7 @@ void main() { IOSAdsManagerDelegateCreationParams( onAdEvent: expectAsync1((AdEvent event) { expect(event.type, AdEventType.allAdsCompleted); + expect(event.adData, {'hawk': 'tuah'}); }), proxy: imaProxy, ), @@ -74,6 +75,7 @@ void main() { ima.IMAAdEvent.pigeon_detached( type: ima.AdEventType.allAdsCompleted, typeString: 'typeString', + adData: const {'hawk': 'tuah'}, pigeon_instanceManager: instanceManager, ), ); From 2f329b48bf8ae188689307335afba90ecc2e8b1f Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 1 Aug 2024 19:10:40 -0400 Subject: [PATCH 04/14] formatting --- .../InteractiveMediaAdsLibrary.g.kt | 2454 ++++++++++------- .../InteractiveMediaAdsPlugin.kt | 5 +- .../ProxyApiRegistrar.kt | 2 +- .../ios/RunnerTests/AdEventTests.swift | 8 +- .../AdEventProxyAPIDelegate.swift | 4 +- .../InteractiveMediaAdsLibrary.g.swift | 972 +++++-- .../src/android/interactive_media_ads.g.dart | 218 +- .../lib/src/ios/interactive_media_ads.g.dart | 208 +- 8 files changed, 2482 insertions(+), 1389 deletions(-) diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt index 7f4eb6f5b319..5a490b981ffd 100644 --- a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt +++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt @@ -21,52 +21,52 @@ private fun wrapResult(result: Any?): List { private fun wrapError(exception: Throwable): List { return if (exception is FlutterError) { - listOf( - exception.code, - exception.message, - exception.details - ) + listOf(exception.code, exception.message, exception.details) } else { listOf( - exception.javaClass.simpleName, - exception.toString(), - "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) - ) + exception.javaClass.simpleName, + exception.toString(), + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) } } private fun createConnectionError(channelName: String): FlutterError { - return FlutterError("channel-error", "Unable to establish connection on channel: '$channelName'.", "")} + return FlutterError( + "channel-error", "Unable to establish connection on channel: '$channelName'.", "") +} /** * Error class for passing custom error details to Flutter via a thrown PlatformException. + * * @property code The error code. * @property message The error message. * @property details The error details. Must be a datatype supported by the api codec. */ -class FlutterError ( - val code: String, - override val message: String? = null, - val details: Any? = null +class FlutterError( + val code: String, + override val message: String? = null, + val details: Any? = null ) : Throwable() /** * Maintains instances used to communicate with the corresponding objects in Dart. * - * Objects stored in this container are represented by an object in Dart that is also stored in - * an InstanceManager with the same identifier. + * Objects stored in this container are represented by an object in Dart that is also stored in an + * InstanceManager with the same identifier. * * When an instance is added with an identifier, either can be used to retrieve the other. * - * Added instances are added as a weak reference and a strong reference. When the strong - * reference is removed with [remove] and the weak reference is deallocated, the - * `finalizationListener.onFinalize` is called with the instance's identifier. However, if the strong - * reference is removed and then the identifier is retrieved with the intention to pass the identifier - * to Dart (e.g. calling [getIdentifierForStrongReference]), the strong reference to the instance - * is recreated. The strong reference will then need to be removed manually again. + * Added instances are added as a weak reference and a strong reference. When the strong reference + * is removed with [remove] and the weak reference is deallocated, the + * `finalizationListener.onFinalize` is called with the instance's identifier. However, if the + * strong reference is removed and then the identifier is retrieved with the intention to pass the + * identifier to Dart (e.g. calling [getIdentifierForStrongReference]), the strong reference to the + * instance is recreated. The strong reference will then need to be removed manually again. */ @Suppress("UNCHECKED_CAST", "MemberVisibilityCanBePrivate") -class InteractiveMediaAdsLibraryPigeonInstanceManager(private val finalizationListener: PigeonFinalizationListener) { - /** Interface for listening when a weak reference of an instance is removed from the manager. */ +class InteractiveMediaAdsLibraryPigeonInstanceManager( + private val finalizationListener: PigeonFinalizationListener +) { + /** Interface for listening when a weak reference of an instance is removed from the manager. */ interface PigeonFinalizationListener { fun onFinalize(identifier: Long) } @@ -92,10 +92,7 @@ class InteractiveMediaAdsLibraryPigeonInstanceManager(private val finalizationLi } init { - handler.postDelayed( - { releaseAllFinalizedInstances() }, - clearFinalizedWeakReferencesInterval - ) + handler.postDelayed({ releaseAllFinalizedInstances() }, clearFinalizedWeakReferencesInterval) } companion object { @@ -107,19 +104,20 @@ class InteractiveMediaAdsLibraryPigeonInstanceManager(private val finalizationLi private const val tag = "PigeonInstanceManager" /** - * Instantiate a new manager with a listener for garbage collected weak - * references. + * Instantiate a new manager with a listener for garbage collected weak references. * * When the manager is no longer needed, [stopFinalizationListener] must be called. */ - fun create(finalizationListener: PigeonFinalizationListener): InteractiveMediaAdsLibraryPigeonInstanceManager { + fun create( + finalizationListener: PigeonFinalizationListener + ): InteractiveMediaAdsLibraryPigeonInstanceManager { return InteractiveMediaAdsLibraryPigeonInstanceManager(finalizationListener) } } /** - * Removes `identifier` and return its associated strongly referenced instance, if present, - * from the manager. + * Removes `identifier` and return its associated strongly referenced instance, if present, from + * the manager. */ fun remove(identifier: Long): T? { logWarningIfFinalizationListenerHasStopped() @@ -129,15 +127,13 @@ class InteractiveMediaAdsLibraryPigeonInstanceManager(private val finalizationLi /** * Retrieves the identifier paired with an instance, if present, otherwise `null`. * - * * If the manager contains a strong reference to `instance`, it will return the identifier * associated with `instance`. If the manager contains only a weak reference to `instance`, a new * strong reference to `instance` will be added and will need to be removed again with [remove]. * - * * If this method returns a nonnull identifier, this method also expects the Dart - * `InteractiveMediaAdsLibraryPigeonInstanceManager` to have, or recreate, a weak reference to the Dart instance the - * identifier is associated with. + * `InteractiveMediaAdsLibraryPigeonInstanceManager` to have, or recreate, a weak reference to the + * Dart instance the identifier is associated with. */ fun getIdentifierForStrongReference(instance: Any?): Long? { logWarningIfFinalizationListenerHasStopped() @@ -151,9 +147,9 @@ class InteractiveMediaAdsLibraryPigeonInstanceManager(private val finalizationLi /** * Adds a new instance that was instantiated from Dart. * - * The same instance can be added multiple times, but each identifier must be unique. This - * allows two objects that are equivalent (e.g. the `equals` method returns true and their - * hashcodes are equal) to both be added. + * The same instance can be added multiple times, but each identifier must be unique. This allows + * two objects that are equivalent (e.g. the `equals` method returns true and their hashcodes are + * equal) to both be added. * * [identifier] must be >= 0 and unique. */ @@ -169,7 +165,9 @@ class InteractiveMediaAdsLibraryPigeonInstanceManager(private val finalizationLi */ fun addHostCreatedInstance(instance: Any): Long { logWarningIfFinalizationListenerHasStopped() - require(!containsInstance(instance)) { "Instance of ${instance.javaClass} has already been added." } + require(!containsInstance(instance)) { + "Instance of ${instance.javaClass} has already been added." + } val identifier = nextIdentifier++ addInstance(instance, identifier) return identifier @@ -227,7 +225,8 @@ class InteractiveMediaAdsLibraryPigeonInstanceManager(private val finalizationLi return } var reference: java.lang.ref.WeakReference? - while ((referenceQueue.poll() as java.lang.ref.WeakReference?).also { reference = it } != null) { + while ((referenceQueue.poll() as java.lang.ref.WeakReference?).also { reference = it } != + null) { val identifier = weakReferencesToIdentifiers.remove(reference) if (identifier != null) { weakInstances.remove(identifier) @@ -235,10 +234,7 @@ class InteractiveMediaAdsLibraryPigeonInstanceManager(private val finalizationLi finalizationListener.onFinalize(identifier) } } - handler.postDelayed( - { releaseAllFinalizedInstances() }, - clearFinalizedWeakReferencesInterval - ) + handler.postDelayed({ releaseAllFinalizedInstances() }, clearFinalizedWeakReferencesInterval) } private fun addInstance(instance: Any, identifier: Long) { @@ -256,39 +252,45 @@ class InteractiveMediaAdsLibraryPigeonInstanceManager(private val finalizationLi private fun logWarningIfFinalizationListenerHasStopped() { if (hasFinalizationListenerStopped()) { Log.w( - tag, - "The manager was used after calls to the PigeonFinalizationListener has been stopped." - ) + tag, + "The manager was used after calls to the PigeonFinalizationListener has been stopped.") } } } - -/**Generated API for managing the Dart and native `PigeonInstanceManager`s. */ -private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi(val binaryMessenger: BinaryMessenger) { +/** Generated API for managing the Dart and native `PigeonInstanceManager`s. */ +private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi( + val binaryMessenger: BinaryMessenger +) { companion object { - /**The codec used by InteractiveMediaAdsLibraryPigeonInstanceManagerApi. */ - val codec: MessageCodec by lazy { - StandardMessageCodec() - } + /** The codec used by InteractiveMediaAdsLibraryPigeonInstanceManagerApi. */ + val codec: MessageCodec by lazy { StandardMessageCodec() } /** - * Sets up an instance of `InteractiveMediaAdsLibraryPigeonInstanceManagerApi` to handle messages from the - * `binaryMessenger`. + * Sets up an instance of `InteractiveMediaAdsLibraryPigeonInstanceManagerApi` to handle + * messages from the `binaryMessenger`. */ - fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, instanceManager: InteractiveMediaAdsLibraryPigeonInstanceManager?) { + fun setUpMessageHandlers( + binaryMessenger: BinaryMessenger, + instanceManager: InteractiveMediaAdsLibraryPigeonInstanceManager? + ) { run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.removeStrongReference", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.removeStrongReference", + codec) if (instanceManager != null) { channel.setMessageHandler { message, reply -> val args = message as List val identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = try { - instanceManager.remove(identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + instanceManager.remove(identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -296,15 +298,20 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi(val binaryMesse } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.clear", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.clear", + codec) if (instanceManager != null) { channel.setMessageHandler { _, reply -> - val wrapped: List = try { - instanceManager.clear() - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + instanceManager.clear() + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -314,9 +321,9 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi(val binaryMesse } } - fun removeStrongReference(identifierArg: Long, callback: (Result) -> Unit) -{ - val channelName = "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.removeStrongReference" + fun removeStrongReference(identifierArg: Long, callback: (Result) -> Unit) { + val channelName = + "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.removeStrongReference" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(identifierArg)) { if (it is List<*>) { @@ -327,15 +334,17 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi(val binaryMesse } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } } /** - * Provides implementations for each ProxyApi implementation and provides access to resources - * needed by any implementation. + * Provides implementations for each ProxyApi implementation and provides access to resources needed + * by any implementation. */ -abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(val binaryMessenger: BinaryMessenger) { +abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar( + val binaryMessenger: BinaryMessenger +) { /** Whether APIs should ignore calling to Dart. */ public var ignoreCallsToDart = false val instanceManager: InteractiveMediaAdsLibraryPigeonInstanceManager @@ -350,27 +359,25 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(val binaryMesse init { val api = InteractiveMediaAdsLibraryPigeonInstanceManagerApi(binaryMessenger) - instanceManager = InteractiveMediaAdsLibraryPigeonInstanceManager.create( - object : InteractiveMediaAdsLibraryPigeonInstanceManager.PigeonFinalizationListener { - override fun onFinalize(identifier: Long) { - api.removeStrongReference(identifier) { - if (it.isFailure) { - Log.e( - "PigeonProxyApiRegistrar", - "Failed to remove Dart strong reference with identifier: $identifier" - ) - } - } - } - } - ) + instanceManager = + InteractiveMediaAdsLibraryPigeonInstanceManager.create( + object : InteractiveMediaAdsLibraryPigeonInstanceManager.PigeonFinalizationListener { + override fun onFinalize(identifier: Long) { + api.removeStrongReference(identifier) { + if (it.isFailure) { + Log.e( + "PigeonProxyApiRegistrar", + "Failed to remove Dart strong reference with identifier: $identifier") + } + } + } + }) } /** * An implementation of [PigeonApiBaseDisplayContainer] used to add a new Dart instance of * `BaseDisplayContainer` to the Dart `InstanceManager`. */ - open fun getPigeonApiBaseDisplayContainer(): PigeonApiBaseDisplayContainer - { + open fun getPigeonApiBaseDisplayContainer(): PigeonApiBaseDisplayContainer { return PigeonApiBaseDisplayContainer(this) } @@ -378,14 +385,13 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(val binaryMesse * An implementation of [PigeonApiAdDisplayContainer] used to add a new Dart instance of * `AdDisplayContainer` to the Dart `InstanceManager`. */ - open fun getPigeonApiAdDisplayContainer(): PigeonApiAdDisplayContainer - { + open fun getPigeonApiAdDisplayContainer(): PigeonApiAdDisplayContainer { return PigeonApiAdDisplayContainer(this) } /** - * An implementation of [PigeonApiAdsLoader] used to add a new Dart instance of - * `AdsLoader` to the Dart `InstanceManager`. + * An implementation of [PigeonApiAdsLoader] used to add a new Dart instance of `AdsLoader` to the + * Dart `InstanceManager`. */ abstract fun getPigeonApiAdsLoader(): PigeonApiAdsLoader @@ -396,20 +402,20 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(val binaryMesse abstract fun getPigeonApiAdsManagerLoadedEvent(): PigeonApiAdsManagerLoadedEvent /** - * An implementation of [PigeonApiAdErrorEvent] used to add a new Dart instance of - * `AdErrorEvent` to the Dart `InstanceManager`. + * An implementation of [PigeonApiAdErrorEvent] used to add a new Dart instance of `AdErrorEvent` + * to the Dart `InstanceManager`. */ abstract fun getPigeonApiAdErrorEvent(): PigeonApiAdErrorEvent /** - * An implementation of [PigeonApiAdError] used to add a new Dart instance of - * `AdError` to the Dart `InstanceManager`. + * An implementation of [PigeonApiAdError] used to add a new Dart instance of `AdError` to the + * Dart `InstanceManager`. */ abstract fun getPigeonApiAdError(): PigeonApiAdError /** - * An implementation of [PigeonApiAdsRequest] used to add a new Dart instance of - * `AdsRequest` to the Dart `InstanceManager`. + * An implementation of [PigeonApiAdsRequest] used to add a new Dart instance of `AdsRequest` to + * the Dart `InstanceManager`. */ abstract fun getPigeonApiAdsRequest(): PigeonApiAdsRequest @@ -417,26 +423,25 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(val binaryMesse * An implementation of [PigeonApiContentProgressProvider] used to add a new Dart instance of * `ContentProgressProvider` to the Dart `InstanceManager`. */ - open fun getPigeonApiContentProgressProvider(): PigeonApiContentProgressProvider - { + open fun getPigeonApiContentProgressProvider(): PigeonApiContentProgressProvider { return PigeonApiContentProgressProvider(this) } /** - * An implementation of [PigeonApiAdsManager] used to add a new Dart instance of - * `AdsManager` to the Dart `InstanceManager`. + * An implementation of [PigeonApiAdsManager] used to add a new Dart instance of `AdsManager` to + * the Dart `InstanceManager`. */ abstract fun getPigeonApiAdsManager(): PigeonApiAdsManager /** - * An implementation of [PigeonApiBaseManager] used to add a new Dart instance of - * `BaseManager` to the Dart `InstanceManager`. + * An implementation of [PigeonApiBaseManager] used to add a new Dart instance of `BaseManager` to + * the Dart `InstanceManager`. */ abstract fun getPigeonApiBaseManager(): PigeonApiBaseManager /** - * An implementation of [PigeonApiAdEvent] used to add a new Dart instance of - * `AdEvent` to the Dart `InstanceManager`. + * An implementation of [PigeonApiAdEvent] used to add a new Dart instance of `AdEvent` to the + * Dart `InstanceManager`. */ abstract fun getPigeonApiAdEvent(): PigeonApiAdEvent @@ -450,8 +455,7 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(val binaryMesse * An implementation of [PigeonApiImaSdkSettings] used to add a new Dart instance of * `ImaSdkSettings` to the Dart `InstanceManager`. */ - open fun getPigeonApiImaSdkSettings(): PigeonApiImaSdkSettings - { + open fun getPigeonApiImaSdkSettings(): PigeonApiImaSdkSettings { return PigeonApiImaSdkSettings(this) } @@ -462,47 +466,46 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(val binaryMesse abstract fun getPigeonApiVideoProgressUpdate(): PigeonApiVideoProgressUpdate /** - * An implementation of [PigeonApiAdMediaInfo] used to add a new Dart instance of - * `AdMediaInfo` to the Dart `InstanceManager`. + * An implementation of [PigeonApiAdMediaInfo] used to add a new Dart instance of `AdMediaInfo` to + * the Dart `InstanceManager`. */ abstract fun getPigeonApiAdMediaInfo(): PigeonApiAdMediaInfo /** - * An implementation of [PigeonApiAdPodInfo] used to add a new Dart instance of - * `AdPodInfo` to the Dart `InstanceManager`. + * An implementation of [PigeonApiAdPodInfo] used to add a new Dart instance of `AdPodInfo` to the + * Dart `InstanceManager`. */ abstract fun getPigeonApiAdPodInfo(): PigeonApiAdPodInfo /** - * An implementation of [PigeonApiFrameLayout] used to add a new Dart instance of - * `FrameLayout` to the Dart `InstanceManager`. + * An implementation of [PigeonApiFrameLayout] used to add a new Dart instance of `FrameLayout` to + * the Dart `InstanceManager`. */ abstract fun getPigeonApiFrameLayout(): PigeonApiFrameLayout /** - * An implementation of [PigeonApiViewGroup] used to add a new Dart instance of - * `ViewGroup` to the Dart `InstanceManager`. + * An implementation of [PigeonApiViewGroup] used to add a new Dart instance of `ViewGroup` to the + * Dart `InstanceManager`. */ abstract fun getPigeonApiViewGroup(): PigeonApiViewGroup /** - * An implementation of [PigeonApiVideoView] used to add a new Dart instance of - * `VideoView` to the Dart `InstanceManager`. + * An implementation of [PigeonApiVideoView] used to add a new Dart instance of `VideoView` to the + * Dart `InstanceManager`. */ abstract fun getPigeonApiVideoView(): PigeonApiVideoView /** - * An implementation of [PigeonApiView] used to add a new Dart instance of - * `View` to the Dart `InstanceManager`. + * An implementation of [PigeonApiView] used to add a new Dart instance of `View` to the Dart + * `InstanceManager`. */ - open fun getPigeonApiView(): PigeonApiView - { + open fun getPigeonApiView(): PigeonApiView { return PigeonApiView(this) } /** - * An implementation of [PigeonApiMediaPlayer] used to add a new Dart instance of - * `MediaPlayer` to the Dart `InstanceManager`. + * An implementation of [PigeonApiMediaPlayer] used to add a new Dart instance of `MediaPlayer` to + * the Dart `InstanceManager`. */ abstract fun getPigeonApiMediaPlayer(): PigeonApiMediaPlayer @@ -537,23 +540,28 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(val binaryMesse abstract fun getPigeonApiAdEventListener(): PigeonApiAdEventListener fun setUp() { - InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger, instanceManager) + InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers( + binaryMessenger, instanceManager) PigeonApiAdsLoader.setUpMessageHandlers(binaryMessenger, getPigeonApiAdsLoader()) PigeonApiAdsRequest.setUpMessageHandlers(binaryMessenger, getPigeonApiAdsRequest()) PigeonApiAdsManager.setUpMessageHandlers(binaryMessenger, getPigeonApiAdsManager()) PigeonApiBaseManager.setUpMessageHandlers(binaryMessenger, getPigeonApiBaseManager()) PigeonApiImaSdkFactory.setUpMessageHandlers(binaryMessenger, getPigeonApiImaSdkFactory()) - PigeonApiVideoProgressUpdate.setUpMessageHandlers(binaryMessenger, getPigeonApiVideoProgressUpdate()) + PigeonApiVideoProgressUpdate.setUpMessageHandlers( + binaryMessenger, getPigeonApiVideoProgressUpdate()) PigeonApiFrameLayout.setUpMessageHandlers(binaryMessenger, getPigeonApiFrameLayout()) PigeonApiViewGroup.setUpMessageHandlers(binaryMessenger, getPigeonApiViewGroup()) PigeonApiVideoView.setUpMessageHandlers(binaryMessenger, getPigeonApiVideoView()) PigeonApiMediaPlayer.setUpMessageHandlers(binaryMessenger, getPigeonApiMediaPlayer()) - PigeonApiVideoAdPlayerCallback.setUpMessageHandlers(binaryMessenger, getPigeonApiVideoAdPlayerCallback()) + PigeonApiVideoAdPlayerCallback.setUpMessageHandlers( + binaryMessenger, getPigeonApiVideoAdPlayerCallback()) PigeonApiVideoAdPlayer.setUpMessageHandlers(binaryMessenger, getPigeonApiVideoAdPlayer()) - PigeonApiAdsLoadedListener.setUpMessageHandlers(binaryMessenger, getPigeonApiAdsLoadedListener()) + PigeonApiAdsLoadedListener.setUpMessageHandlers( + binaryMessenger, getPigeonApiAdsLoadedListener()) PigeonApiAdErrorListener.setUpMessageHandlers(binaryMessenger, getPigeonApiAdErrorListener()) PigeonApiAdEventListener.setUpMessageHandlers(binaryMessenger, getPigeonApiAdEventListener()) } + fun tearDown() { InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger, null) PigeonApiAdsLoader.setUpMessageHandlers(binaryMessenger, null) @@ -573,7 +581,10 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(val binaryMesse PigeonApiAdEventListener.setUpMessageHandlers(binaryMessenger, null) } } -private class InteractiveMediaAdsLibraryPigeonProxyApiBaseCodec(val registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) : InteractiveMediaAdsLibraryPigeonCodec() { + +private class InteractiveMediaAdsLibraryPigeonProxyApiBaseCodec( + val registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) : InteractiveMediaAdsLibraryPigeonCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { 128.toByte() -> { @@ -585,88 +596,79 @@ private class InteractiveMediaAdsLibraryPigeonProxyApiBaseCodec(val registrar: I } override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { - if (value is Boolean || value is ByteArray || value is Double || value is DoubleArray || value is FloatArray || value is Int || value is IntArray || value is List<*> || value is Long || value is LongArray || value is Map<*, *> || value is String || value is AdErrorCode || value is AdErrorType || value is AdEventType || value == null) { + if (value is Boolean || + value is ByteArray || + value is Double || + value is DoubleArray || + value is FloatArray || + value is Int || + value is IntArray || + value is List<*> || + value is Long || + value is LongArray || + value is Map<*, *> || + value is String || + value is AdErrorCode || + value is AdErrorType || + value is AdEventType || + value == null) { super.writeValue(stream, value) return } if (value is com.google.ads.interactivemedia.v3.api.AdDisplayContainer) { - registrar.getPigeonApiAdDisplayContainer().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.BaseDisplayContainer) { - registrar.getPigeonApiBaseDisplayContainer().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.AdsLoader) { - registrar.getPigeonApiAdsLoader().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent) { - registrar.getPigeonApiAdsManagerLoadedEvent().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.AdErrorEvent) { - registrar.getPigeonApiAdErrorEvent().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.AdError) { - registrar.getPigeonApiAdError().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.AdsRequest) { - registrar.getPigeonApiAdsRequest().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider) { - registrar.getPigeonApiContentProgressProvider().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.AdsManager) { - registrar.getPigeonApiAdsManager().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.BaseManager) { - registrar.getPigeonApiBaseManager().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.AdEvent) { - registrar.getPigeonApiAdEvent().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.ImaSdkFactory) { - registrar.getPigeonApiImaSdkFactory().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.ImaSdkSettings) { - registrar.getPigeonApiImaSdkSettings().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate) { - registrar.getPigeonApiVideoProgressUpdate().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.player.AdMediaInfo) { - registrar.getPigeonApiAdMediaInfo().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.AdPodInfo) { - registrar.getPigeonApiAdPodInfo().pigeon_newInstance(value) { } - } - else if (value is android.widget.FrameLayout) { - registrar.getPigeonApiFrameLayout().pigeon_newInstance(value) { } - } - else if (value is android.view.ViewGroup) { - registrar.getPigeonApiViewGroup().pigeon_newInstance(value) { } - } - else if (value is android.widget.VideoView) { - registrar.getPigeonApiVideoView().pigeon_newInstance(value) { } - } - else if (value is android.view.View) { - registrar.getPigeonApiView().pigeon_newInstance(value) { } - } - else if (value is android.media.MediaPlayer) { - registrar.getPigeonApiMediaPlayer().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback) { - registrar.getPigeonApiVideoAdPlayerCallback().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer) { - registrar.getPigeonApiVideoAdPlayer().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener) { - registrar.getPigeonApiAdsLoadedListener().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener) { - registrar.getPigeonApiAdErrorListener().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener) { - registrar.getPigeonApiAdEventListener().pigeon_newInstance(value) { } + registrar.getPigeonApiAdDisplayContainer().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.BaseDisplayContainer) { + registrar.getPigeonApiBaseDisplayContainer().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.AdsLoader) { + registrar.getPigeonApiAdsLoader().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent) { + registrar.getPigeonApiAdsManagerLoadedEvent().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.AdErrorEvent) { + registrar.getPigeonApiAdErrorEvent().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.AdError) { + registrar.getPigeonApiAdError().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.AdsRequest) { + registrar.getPigeonApiAdsRequest().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider) { + registrar.getPigeonApiContentProgressProvider().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.AdsManager) { + registrar.getPigeonApiAdsManager().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.BaseManager) { + registrar.getPigeonApiBaseManager().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.AdEvent) { + registrar.getPigeonApiAdEvent().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.ImaSdkFactory) { + registrar.getPigeonApiImaSdkFactory().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.ImaSdkSettings) { + registrar.getPigeonApiImaSdkSettings().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate) { + registrar.getPigeonApiVideoProgressUpdate().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.player.AdMediaInfo) { + registrar.getPigeonApiAdMediaInfo().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.AdPodInfo) { + registrar.getPigeonApiAdPodInfo().pigeon_newInstance(value) {} + } else if (value is android.widget.FrameLayout) { + registrar.getPigeonApiFrameLayout().pigeon_newInstance(value) {} + } else if (value is android.view.ViewGroup) { + registrar.getPigeonApiViewGroup().pigeon_newInstance(value) {} + } else if (value is android.widget.VideoView) { + registrar.getPigeonApiVideoView().pigeon_newInstance(value) {} + } else if (value is android.view.View) { + registrar.getPigeonApiView().pigeon_newInstance(value) {} + } else if (value is android.media.MediaPlayer) { + registrar.getPigeonApiMediaPlayer().pigeon_newInstance(value) {} + } else if (value + is com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback) { + registrar.getPigeonApiVideoAdPlayerCallback().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer) { + registrar.getPigeonApiVideoAdPlayer().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener) { + registrar.getPigeonApiAdsLoadedListener().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener) { + registrar.getPigeonApiAdErrorListener().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener) { + registrar.getPigeonApiAdEventListener().pigeon_newInstance(value) {} } when { @@ -674,7 +676,9 @@ private class InteractiveMediaAdsLibraryPigeonProxyApiBaseCodec(val registrar: I stream.write(128) writeValue(stream, registrar.instanceManager.getIdentifierForStrongReference(value)) } - else -> throw IllegalArgumentException("Unsupported value: '$value' of type '${value.javaClass.name}'") + else -> + throw IllegalArgumentException( + "Unsupported value: '$value' of type '${value.javaClass.name}'") } } } @@ -682,7 +686,8 @@ private class InteractiveMediaAdsLibraryPigeonProxyApiBaseCodec(val registrar: I /** * The types of error that can be encountered. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorCode.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorCode.html. */ enum class AdErrorCode(val raw: Int) { /** Ads player was not provided. */ @@ -714,13 +719,13 @@ enum class AdErrorCode(val raw: Int) { /** A VAST response containing a single `` tag with no child tags. */ VAST_EMPTY_RESPONSE(13), /** - * Assets were found in the VAST ad response for a linear ad, but none of - * them matched the video player's capabilities. + * Assets were found in the VAST ad response for a linear ad, but none of them matched the video + * player's capabilities. */ VAST_LINEAR_ASSET_MISMATCH(14), /** - * At least one VAST wrapper ad loaded successfully and a subsequent wrapper - * or inline ad load has timed out. + * At least one VAST wrapper ad loaded successfully and a subsequent wrapper or inline ad load has + * timed out. */ VAST_LOAD_TIMEOUT(15), /** The ad response was not recognized as a valid VAST ad. */ @@ -728,8 +733,8 @@ enum class AdErrorCode(val raw: Int) { /** Failed to load media assets from a VAST response. */ VAST_MEDIA_LOAD_TIMEOUT(17), /** - * Assets were found in the VAST ad response for a nonlinear ad, but none of - * them matched the video player's capabilities. + * Assets were found in the VAST ad response for a nonlinear ad, but none of them matched the + * video player's capabilities. */ VAST_NONLINEAR_ASSET_MISMATCH(18), /** No Ads VAST response after one or more wrappers. */ @@ -739,8 +744,7 @@ enum class AdErrorCode(val raw: Int) { /** * Trafficking error. * - * Video player received an ad type that it was not expecting and/or cannot - * display. + * Video player received an ad type that it was not expecting and/or cannot display. */ VAST_TRAFFICKING_ERROR(21), /** There was an error playing the video ad. */ @@ -758,7 +762,8 @@ enum class AdErrorCode(val raw: Int) { /** * Specifies when the error was encountered, during either ad loading or playback. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorType.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorType.html. */ enum class AdErrorType(val raw: Int) { /** Indicates that the error was encountered when the ad was being loaded. */ @@ -778,7 +783,8 @@ enum class AdErrorType(val raw: Int) { /** * Types of events that can occur during ad playback. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventType.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventType.html. */ enum class AdEventType(val raw: Int) { /** Fired when an ad break in a stream ends. */ @@ -795,14 +801,11 @@ enum class AdEventType(val raw: Int) { AD_PERIOD_ENDED(5), /** Fired when an ad period in a stream starts. */ AD_PERIOD_STARTED(6), - /** - * Fired to inform of ad progress and can be used by publisher to display a - * countdown timer. - */ + /** Fired to inform of ad progress and can be used by publisher to display a countdown timer. */ AD_PROGRESS(7), /** - * Fired when the ads manager is done playing all the valid ads in the ads - * response, or when the response doesn't return any valid ads. + * Fired when the ads manager is done playing all the valid ads in the ads response, or when the + * response doesn't return any valid ads. */ ALL_ADS_COMPLETED(8), /** Fired when an ad is clicked. */ @@ -823,10 +826,7 @@ enum class AdEventType(val raw: Int) { ICON_TAPPED(16), /** Fired when the VAST response has been received. */ LOADED(17), - /** - * Fired to enable the SDK to communicate a message to be logged, which is - * stored in adData. - */ + /** Fired to enable the SDK to communicate a message to be logged, which is stored in adData. */ LOG(18), /** Fired when the ad playhead crosses midpoint. */ MIDPOINT(19), @@ -853,28 +853,24 @@ enum class AdEventType(val raw: Int) { } } } + private open class InteractiveMediaAdsLibraryPigeonCodec : StandardMessageCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { 129.toByte() -> { - return (readValue(buffer) as Int?)?.let { - AdErrorCode.ofRaw(it) - } + return (readValue(buffer) as Int?)?.let { AdErrorCode.ofRaw(it) } } 130.toByte() -> { - return (readValue(buffer) as Int?)?.let { - AdErrorType.ofRaw(it) - } + return (readValue(buffer) as Int?)?.let { AdErrorType.ofRaw(it) } } 131.toByte() -> { - return (readValue(buffer) as Int?)?.let { - AdEventType.ofRaw(it) - } + return (readValue(buffer) as Int?)?.let { AdEventType.ofRaw(it) } } else -> super.readValueOfType(type, buffer) } } - override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { + + override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { when (value) { is AdErrorCode -> { stream.write(129) @@ -896,14 +892,19 @@ private open class InteractiveMediaAdsLibraryPigeonCodec : StandardMessageCodec( /** * A base class for more specialized container interfaces. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseDisplayContainer.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseDisplayContainer.html. */ @Suppress("UNCHECKED_CAST") -open class PigeonApiBaseDisplayContainer(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +open class PigeonApiBaseDisplayContainer( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of BaseDisplayContainer and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.BaseDisplayContainer, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of BaseDisplayContainer and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.BaseDisplayContainer, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -914,10 +915,12 @@ open class PigeonApiBaseDisplayContainer(open val pigeonRegistrar: InteractiveMe Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.interactive_media_ads.BaseDisplayContainer.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.interactive_media_ads.BaseDisplayContainer.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { @@ -928,22 +931,26 @@ open class PigeonApiBaseDisplayContainer(open val pigeonRegistrar: InteractiveMe } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - } /** * A container in which to display the ads. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdDisplayContainer. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdDisplayContainer. */ @Suppress("UNCHECKED_CAST") -open class PigeonApiAdDisplayContainer(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +open class PigeonApiAdDisplayContainer( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of AdDisplayContainer and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdDisplayContainer, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of AdDisplayContainer and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdDisplayContainer, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -954,10 +961,12 @@ open class PigeonApiAdDisplayContainer(open val pigeonRegistrar: InteractiveMedi Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.interactive_media_ads.AdDisplayContainer.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.interactive_media_ads.AdDisplayContainer.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { @@ -968,52 +977,68 @@ open class PigeonApiAdDisplayContainer(open val pigeonRegistrar: InteractiveMedi } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } @Suppress("FunctionName") - /**An implementation of [PigeonApiBaseDisplayContainer] used to access callback methods */ - fun pigeon_getPigeonApiBaseDisplayContainer(): PigeonApiBaseDisplayContainer - { + /** An implementation of [PigeonApiBaseDisplayContainer] used to access callback methods */ + fun pigeon_getPigeonApiBaseDisplayContainer(): PigeonApiBaseDisplayContainer { return pigeonRegistrar.getPigeonApiBaseDisplayContainer() } - } /** - * An object which allows publishers to request ads from ad servers or a - * dynamic ad insertion stream. + * An object which allows publishers to request ads from ad servers or a dynamic ad insertion + * stream. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdsLoader(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiAdsLoader( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { /** Registers a listener for errors that occur during the ads request. */ - abstract fun addAdErrorListener(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsLoader, listener: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener) + abstract fun addAdErrorListener( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsLoader, + listener: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener + ) /** Registers a listener for the ads manager loaded event. */ - abstract fun addAdsLoadedListener(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsLoader, listener: com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener) + abstract fun addAdsLoadedListener( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsLoader, + listener: com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener + ) /** Requests ads from a server. */ - abstract fun requestAds(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsLoader, request: com.google.ads.interactivemedia.v3.api.AdsRequest) + abstract fun requestAds( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsLoader, + request: com.google.ads.interactivemedia.v3.api.AdsRequest + ) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAdsLoader?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsLoader.addAdErrorListener", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsLoader.addAdErrorListener", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsLoader - val listenerArg = args[1] as com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener - val wrapped: List = try { - api.addAdErrorListener(pigeon_instanceArg, listenerArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val listenerArg = + args[1] as com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener + val wrapped: List = + try { + api.addAdErrorListener(pigeon_instanceArg, listenerArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1021,18 +1046,24 @@ abstract class PigeonApiAdsLoader(open val pigeonRegistrar: InteractiveMediaAdsL } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsLoader.addAdsLoadedListener", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsLoader.addAdsLoadedListener", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsLoader - val listenerArg = args[1] as com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener - val wrapped: List = try { - api.addAdsLoadedListener(pigeon_instanceArg, listenerArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val listenerArg = + args[1] as com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener + val wrapped: List = + try { + api.addAdsLoadedListener(pigeon_instanceArg, listenerArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1040,18 +1071,23 @@ abstract class PigeonApiAdsLoader(open val pigeonRegistrar: InteractiveMediaAdsL } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsLoader.requestAds", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsLoader.requestAds", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsLoader val requestArg = args[1] as com.google.ads.interactivemedia.v3.api.AdsRequest - val wrapped: List = try { - api.requestAds(pigeon_instanceArg, requestArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + api.requestAds(pigeon_instanceArg, requestArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1062,9 +1098,11 @@ abstract class PigeonApiAdsLoader(open val pigeonRegistrar: InteractiveMediaAdsL } @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of AdsLoader and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsLoader, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of AdsLoader and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsLoader, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -1075,7 +1113,8 @@ abstract class PigeonApiAdsLoader(open val pigeonRegistrar: InteractiveMediaAdsL Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.AdsLoader.pigeon_newInstance" @@ -1089,28 +1128,34 @@ abstract class PigeonApiAdsLoader(open val pigeonRegistrar: InteractiveMediaAdsL } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - } /** * An event raised when ads are successfully loaded from the ad server through an AdsLoader. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManagerLoadedEvent.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManagerLoadedEvent.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdsManagerLoadedEvent(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiAdsManagerLoadedEvent( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { /** - * The ads manager that will control playback of the loaded ads, or null when - * using dynamic ad insertion. + * The ads manager that will control playback of the loaded ads, or null when using dynamic ad + * insertion. */ - abstract fun manager(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent): com.google.ads.interactivemedia.v3.api.AdsManager + abstract fun manager( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent + ): com.google.ads.interactivemedia.v3.api.AdsManager @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of AdsManagerLoadedEvent and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of AdsManagerLoadedEvent and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -1121,11 +1166,13 @@ abstract class PigeonApiAdsManagerLoadedEvent(open val pigeonRegistrar: Interact Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val managerArg = manager(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.interactive_media_ads.AdsManagerLoadedEvent.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.interactive_media_ads.AdsManagerLoadedEvent.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg, managerArg)) { if (it is List<*>) { @@ -1136,25 +1183,31 @@ abstract class PigeonApiAdsManagerLoadedEvent(open val pigeonRegistrar: Interact } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - } /** * An event raised when there is an error loading or playing ads. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdErrorEvent(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiAdErrorEvent( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { /** The AdError that caused this event. */ - abstract fun error(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdErrorEvent): com.google.ads.interactivemedia.v3.api.AdError + abstract fun error( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdErrorEvent + ): com.google.ads.interactivemedia.v3.api.AdError @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of AdErrorEvent and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdErrorEvent, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of AdErrorEvent and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdErrorEvent, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -1165,7 +1218,8 @@ abstract class PigeonApiAdErrorEvent(open val pigeonRegistrar: InteractiveMediaA Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val errorArg = error(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec @@ -1180,34 +1234,44 @@ abstract class PigeonApiAdErrorEvent(open val pigeonRegistrar: InteractiveMediaA } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - } /** * An error that occurred in the SDK. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdError(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiAdError( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { /** The error's code. */ - abstract fun errorCode(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdError): AdErrorCode + abstract fun errorCode( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdError + ): AdErrorCode /** The error code's number. */ - abstract fun errorCodeNumber(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdError): Long + abstract fun errorCodeNumber( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdError + ): Long /** The error's type. */ - abstract fun errorType(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdError): AdErrorType + abstract fun errorType( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdError + ): AdErrorType /** A human-readable summary of the error. */ abstract fun message(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdError): String @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of AdError and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdError, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of AdError and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdError, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -1218,7 +1282,8 @@ abstract class PigeonApiAdError(open val pigeonRegistrar: InteractiveMediaAdsLib Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val errorCodeArg = errorCode(pigeon_instanceArg) val errorCodeNumberArg = errorCodeNumber(pigeon_instanceArg) val errorTypeArg = errorType(pigeon_instanceArg) @@ -1227,53 +1292,68 @@ abstract class PigeonApiAdError(open val pigeonRegistrar: InteractiveMediaAdsLib val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.AdError.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(listOf(pigeon_identifierArg, errorCodeArg, errorCodeNumberArg, errorTypeArg, messageArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) + channel.send( + listOf(pigeon_identifierArg, errorCodeArg, errorCodeNumberArg, errorTypeArg, messageArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback( + Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } } - } else { - callback(Result.failure(createConnectionError(channelName))) - } - } } - } /** * An object containing the data used to request ads from the server. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsRequest. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsRequest. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdsRequest(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiAdsRequest( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { /** Sets the URL from which ads will be requested. */ - abstract fun setAdTagUrl(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRequest, adTagUrl: String) + abstract fun setAdTagUrl( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRequest, + adTagUrl: String + ) /** - * Attaches a ContentProgressProvider instance to allow scheduling ad breaks - * based on content progress (cue points). + * Attaches a ContentProgressProvider instance to allow scheduling ad breaks based on content + * progress (cue points). */ - abstract fun setContentProgressProvider(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRequest, provider: com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider) + abstract fun setContentProgressProvider( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRequest, + provider: com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider + ) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAdsRequest?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRequest.setAdTagUrl", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsRequest.setAdTagUrl", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsRequest val adTagUrlArg = args[1] as String - val wrapped: List = try { - api.setAdTagUrl(pigeon_instanceArg, adTagUrlArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + api.setAdTagUrl(pigeon_instanceArg, adTagUrlArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1281,18 +1361,24 @@ abstract class PigeonApiAdsRequest(open val pigeonRegistrar: InteractiveMediaAds } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRequest.setContentProgressProvider", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsRequest.setContentProgressProvider", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsRequest - val providerArg = args[1] as com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider - val wrapped: List = try { - api.setContentProgressProvider(pigeon_instanceArg, providerArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val providerArg = + args[1] as com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider + val wrapped: List = + try { + api.setContentProgressProvider(pigeon_instanceArg, providerArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1303,9 +1389,11 @@ abstract class PigeonApiAdsRequest(open val pigeonRegistrar: InteractiveMediaAds } @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of AdsRequest and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsRequest, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of AdsRequest and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsRequest, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -1316,7 +1404,8 @@ abstract class PigeonApiAdsRequest(open val pigeonRegistrar: InteractiveMediaAds Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.AdsRequest.pigeon_newInstance" @@ -1330,22 +1419,26 @@ abstract class PigeonApiAdsRequest(open val pigeonRegistrar: InteractiveMediaAds } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - } /** * Defines an interface to allow SDK to track progress of the content video. * - * See https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/android/api/reference/com/google/ads/interactivemedia/v3/api/player/ContentProgressProvider.html. + * See + * https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/android/api/reference/com/google/ads/interactivemedia/v3/api/player/ContentProgressProvider.html. */ @Suppress("UNCHECKED_CAST") -open class PigeonApiContentProgressProvider(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +open class PigeonApiContentProgressProvider( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of ContentProgressProvider and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of ContentProgressProvider and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -1356,10 +1449,12 @@ open class PigeonApiContentProgressProvider(open val pigeonRegistrar: Interactiv Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.interactive_media_ads.ContentProgressProvider.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.interactive_media_ads.ContentProgressProvider.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { @@ -1370,19 +1465,20 @@ open class PigeonApiContentProgressProvider(open val pigeonRegistrar: Interactiv } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - } /** - * An object which handles playing ads after they've been received from the - * server. + * An object which handles playing ads after they've been received from the server. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManager. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManager. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdsManager(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiAdsManager( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { /** Discards current ad break and resumes content. */ abstract fun discardAdBreak(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsManager) @@ -1397,17 +1493,22 @@ abstract class PigeonApiAdsManager(open val pigeonRegistrar: InteractiveMediaAds fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAdsManager?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.discardAdBreak", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsManager.discardAdBreak", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsManager - val wrapped: List = try { - api.discardAdBreak(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + api.discardAdBreak(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1415,17 +1516,20 @@ abstract class PigeonApiAdsManager(open val pigeonRegistrar: InteractiveMediaAds } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.pause", codec) + val channel = + BasicMessageChannel( + binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.pause", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsManager - val wrapped: List = try { - api.pause(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + api.pause(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1433,17 +1537,20 @@ abstract class PigeonApiAdsManager(open val pigeonRegistrar: InteractiveMediaAds } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.start", codec) + val channel = + BasicMessageChannel( + binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.start", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsManager - val wrapped: List = try { - api.start(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + api.start(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1454,9 +1561,11 @@ abstract class PigeonApiAdsManager(open val pigeonRegistrar: InteractiveMediaAds } @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of AdsManager and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsManager, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of AdsManager and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsManager, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -1467,7 +1576,8 @@ abstract class PigeonApiAdsManager(open val pigeonRegistrar: InteractiveMediaAds Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.AdsManager.pigeon_newInstance" @@ -1481,41 +1591,43 @@ abstract class PigeonApiAdsManager(open val pigeonRegistrar: InteractiveMediaAds } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } @Suppress("FunctionName") - /**An implementation of [PigeonApiBaseManager] used to access callback methods */ - fun pigeon_getPigeonApiBaseManager(): PigeonApiBaseManager - { + /** An implementation of [PigeonApiBaseManager] used to access callback methods */ + fun pigeon_getPigeonApiBaseManager(): PigeonApiBaseManager { return pigeonRegistrar.getPigeonApiBaseManager() } - } /** * Base interface for managing ads.. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseManager.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseManager.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiBaseManager(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiBaseManager( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { /** - * Registers a listener for errors that occur during the ad or stream - * initialization and playback. + * Registers a listener for errors that occur during the ad or stream initialization and playback. */ - abstract fun addAdErrorListener(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, errorListener: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener) + abstract fun addAdErrorListener( + pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, + errorListener: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener + ) /** - * Registers a listener for ad events that occur during ad or stream - * initialization and playback. + * Registers a listener for ad events that occur during ad or stream initialization and playback. */ - abstract fun addAdEventListener(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, adEventListener: com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener) + abstract fun addAdEventListener( + pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, + adEventListener: com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener + ) - /** - * Stops the ad and all tracking, then releases all assets that were loaded - * to play the ad. - */ + /** Stops the ad and all tracking, then releases all assets that were loaded to play the ad. */ abstract fun destroy(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager) /** Initializes the ad experience using default rendering settings */ @@ -1526,18 +1638,24 @@ abstract class PigeonApiBaseManager(open val pigeonRegistrar: InteractiveMediaAd fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiBaseManager?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.addAdErrorListener", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.BaseManager.addAdErrorListener", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.BaseManager - val errorListenerArg = args[1] as com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener - val wrapped: List = try { - api.addAdErrorListener(pigeon_instanceArg, errorListenerArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val errorListenerArg = + args[1] as com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener + val wrapped: List = + try { + api.addAdErrorListener(pigeon_instanceArg, errorListenerArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1545,18 +1663,24 @@ abstract class PigeonApiBaseManager(open val pigeonRegistrar: InteractiveMediaAd } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.addAdEventListener", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.BaseManager.addAdEventListener", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.BaseManager - val adEventListenerArg = args[1] as com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener - val wrapped: List = try { - api.addAdEventListener(pigeon_instanceArg, adEventListenerArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val adEventListenerArg = + args[1] as com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener + val wrapped: List = + try { + api.addAdEventListener(pigeon_instanceArg, adEventListenerArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1564,17 +1688,22 @@ abstract class PigeonApiBaseManager(open val pigeonRegistrar: InteractiveMediaAd } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.destroy", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.BaseManager.destroy", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.BaseManager - val wrapped: List = try { - api.destroy(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + api.destroy(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1582,17 +1711,20 @@ abstract class PigeonApiBaseManager(open val pigeonRegistrar: InteractiveMediaAd } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.init", codec) + val channel = + BasicMessageChannel( + binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.init", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.BaseManager - val wrapped: List = try { - api.init(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + api.init(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1603,9 +1735,11 @@ abstract class PigeonApiBaseManager(open val pigeonRegistrar: InteractiveMediaAd } @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of BaseManager and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.BaseManager, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of BaseManager and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.BaseManager, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -1616,7 +1750,8 @@ abstract class PigeonApiBaseManager(open val pigeonRegistrar: InteractiveMediaAd Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.BaseManager.pigeon_newInstance" @@ -1630,27 +1765,33 @@ abstract class PigeonApiBaseManager(open val pigeonRegistrar: InteractiveMediaAd } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - } /** * Event to notify publisher that an event occurred with an Ad. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdEvent(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiAdEvent( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { /** The type of event that occurred. */ abstract fun type(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdEvent): AdEventType - abstract fun adData(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdEvent): Map + abstract fun adData( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdEvent + ): Map @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of AdEvent and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdEvent, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of AdEvent and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdEvent, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -1661,7 +1802,8 @@ abstract class PigeonApiAdEvent(open val pigeonRegistrar: InteractiveMediaAdsLib Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val typeArg = type(pigeon_instanceArg) val adDataArg = adData(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger @@ -1677,50 +1819,67 @@ abstract class PigeonApiAdEvent(open val pigeonRegistrar: InteractiveMediaAdsLib } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - } /** * Factory class for creating SDK objects. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkFactory. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkFactory. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiImaSdkFactory( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { abstract fun instance(): com.google.ads.interactivemedia.v3.api.ImaSdkFactory - abstract fun createAdDisplayContainer(container: android.view.ViewGroup, player: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer): com.google.ads.interactivemedia.v3.api.AdDisplayContainer + abstract fun createAdDisplayContainer( + container: android.view.ViewGroup, + player: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer + ): com.google.ads.interactivemedia.v3.api.AdDisplayContainer /** Creates an `ImaSdkSettings` object for configuring the IMA SDK. */ - abstract fun createImaSdkSettings(pigeon_instance: com.google.ads.interactivemedia.v3.api.ImaSdkFactory): com.google.ads.interactivemedia.v3.api.ImaSdkSettings + abstract fun createImaSdkSettings( + pigeon_instance: com.google.ads.interactivemedia.v3.api.ImaSdkFactory + ): com.google.ads.interactivemedia.v3.api.ImaSdkSettings - /** - * Creates an `AdsLoader` for requesting ads using the specified settings - * object. - */ - abstract fun createAdsLoader(pigeon_instance: com.google.ads.interactivemedia.v3.api.ImaSdkFactory, settings: com.google.ads.interactivemedia.v3.api.ImaSdkSettings, container: com.google.ads.interactivemedia.v3.api.AdDisplayContainer): com.google.ads.interactivemedia.v3.api.AdsLoader + /** Creates an `AdsLoader` for requesting ads using the specified settings object. */ + abstract fun createAdsLoader( + pigeon_instance: com.google.ads.interactivemedia.v3.api.ImaSdkFactory, + settings: com.google.ads.interactivemedia.v3.api.ImaSdkSettings, + container: com.google.ads.interactivemedia.v3.api.AdDisplayContainer + ): com.google.ads.interactivemedia.v3.api.AdsLoader /** Creates an AdsRequest object to contain the data used to request ads. */ - abstract fun createAdsRequest(pigeon_instance: com.google.ads.interactivemedia.v3.api.ImaSdkFactory): com.google.ads.interactivemedia.v3.api.AdsRequest + abstract fun createAdsRequest( + pigeon_instance: com.google.ads.interactivemedia.v3.api.ImaSdkFactory + ): com.google.ads.interactivemedia.v3.api.AdsRequest companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiImaSdkFactory?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.instance", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.instance", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.instance(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_identifierArg = + args[0].let { num -> if (num is Int) num.toLong() else num as Long } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.instance(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1728,17 +1887,22 @@ abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: InteractiveMedia } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createAdDisplayContainer", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createAdDisplayContainer", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val containerArg = args[0] as android.view.ViewGroup val playerArg = args[1] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer - val wrapped: List = try { - listOf(api.createAdDisplayContainer(containerArg, playerArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + listOf(api.createAdDisplayContainer(containerArg, playerArg)) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1746,16 +1910,21 @@ abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: InteractiveMedia } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createImaSdkSettings", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createImaSdkSettings", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.ImaSdkFactory - val wrapped: List = try { - listOf(api.createImaSdkSettings(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + listOf(api.createImaSdkSettings(pigeon_instanceArg)) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1763,18 +1932,23 @@ abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: InteractiveMedia } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createAdsLoader", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createAdsLoader", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.ImaSdkFactory val settingsArg = args[1] as com.google.ads.interactivemedia.v3.api.ImaSdkSettings val containerArg = args[2] as com.google.ads.interactivemedia.v3.api.AdDisplayContainer - val wrapped: List = try { - listOf(api.createAdsLoader(pigeon_instanceArg, settingsArg, containerArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + listOf(api.createAdsLoader(pigeon_instanceArg, settingsArg, containerArg)) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1782,16 +1956,21 @@ abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: InteractiveMedia } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createAdsRequest", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createAdsRequest", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.ImaSdkFactory - val wrapped: List = try { - listOf(api.createAdsRequest(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + listOf(api.createAdsRequest(pigeon_instanceArg)) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1802,9 +1981,11 @@ abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: InteractiveMedia } @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of ImaSdkFactory and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.ImaSdkFactory, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of ImaSdkFactory and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.ImaSdkFactory, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -1815,7 +1996,8 @@ abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: InteractiveMedia Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.pigeon_newInstance" @@ -1829,22 +2011,26 @@ abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: InteractiveMedia } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - } /** * Defines general SDK settings that are used when creating an `AdsLoader`. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkSettings.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkSettings.html. */ @Suppress("UNCHECKED_CAST") -open class PigeonApiImaSdkSettings(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +open class PigeonApiImaSdkSettings( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of ImaSdkSettings and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.ImaSdkSettings, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of ImaSdkSettings and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.ImaSdkSettings, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -1855,7 +2041,8 @@ open class PigeonApiImaSdkSettings(open val pigeonRegistrar: InteractiveMediaAds Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.ImaSdkSettings.pigeon_newInstance" @@ -1869,44 +2056,56 @@ open class PigeonApiImaSdkSettings(open val pigeonRegistrar: InteractiveMediaAds } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - } /** * Defines an update to the video's progress. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoProgressUpdate.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoProgressUpdate.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiVideoProgressUpdate(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { - abstract fun pigeon_defaultConstructor(currentTimeMs: Long, durationMs: Long): com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate - - /** - * Value to use for cases when progress is not yet defined, such as video - * initialization. - */ - abstract fun videoTimeNotReady(): com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate +abstract class PigeonApiVideoProgressUpdate( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { + abstract fun pigeon_defaultConstructor( + currentTimeMs: Long, + durationMs: Long + ): com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate + + /** Value to use for cases when progress is not yet defined, such as video initialization. */ + abstract fun videoTimeNotReady(): + com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiVideoProgressUpdate?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoProgressUpdate.pigeon_defaultConstructor", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.VideoProgressUpdate.pigeon_defaultConstructor", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val currentTimeMsArg = args[1].let { num -> if (num is Int) num.toLong() else num as Long } + val pigeon_identifierArg = + args[0].let { num -> if (num is Int) num.toLong() else num as Long } + val currentTimeMsArg = + args[1].let { num -> if (num is Int) num.toLong() else num as Long } val durationMsArg = args[2].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(currentTimeMsArg,durationMsArg), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(currentTimeMsArg, durationMsArg), + pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1914,17 +2113,24 @@ abstract class PigeonApiVideoProgressUpdate(open val pigeonRegistrar: Interactiv } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoProgressUpdate.videoTimeNotReady", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.VideoProgressUpdate.videoTimeNotReady", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.videoTimeNotReady(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_identifierArg = + args[0].let { num -> if (num is Int) num.toLong() else num as Long } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.videoTimeNotReady(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1935,9 +2141,11 @@ abstract class PigeonApiVideoProgressUpdate(open val pigeonRegistrar: Interactiv } @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of VideoProgressUpdate and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of VideoProgressUpdate and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -1948,10 +2156,12 @@ abstract class PigeonApiVideoProgressUpdate(open val pigeonRegistrar: Interactiv Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoProgressUpdate.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.interactive_media_ads.VideoProgressUpdate.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { @@ -1962,24 +2172,30 @@ abstract class PigeonApiVideoProgressUpdate(open val pigeonRegistrar: Interactiv } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - } /** * The minimal information required to play an ad. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/AdMediaInfo.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/AdMediaInfo.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdMediaInfo(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { - abstract fun url(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo): String +abstract class PigeonApiAdMediaInfo( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { + abstract fun url( + pigeon_instance: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + ): String @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of AdMediaInfo and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of AdMediaInfo and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -1990,7 +2206,8 @@ abstract class PigeonApiAdMediaInfo(open val pigeonRegistrar: InteractiveMediaAd Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val urlArg = url(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec @@ -2005,23 +2222,25 @@ abstract class PigeonApiAdMediaInfo(open val pigeonRegistrar: InteractiveMediaAd } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - } /** * An ad may be part of a pod of ads. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdPodInfo.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdPodInfo.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdPodInfo(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiAdPodInfo( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { /** * The position of the ad within the pod. * - * The value returned is one-based, for example, 1 of 2, 2 of 2, etc. If the - * ad is not part of a pod, this will return 1. + * The value returned is one-based, for example, 1 of 2, 2 of 2, etc. If the ad is not part of a + * pod, this will return 1. */ abstract fun adPosition(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdPodInfo): Long @@ -2030,7 +2249,9 @@ abstract class PigeonApiAdPodInfo(open val pigeonRegistrar: InteractiveMediaAdsL * * For unknown duration, -1 is returned. */ - abstract fun maxDuration(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdPodInfo): Double + abstract fun maxDuration( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdPodInfo + ): Double /** Client side and DAI VOD: Returns the index of the ad pod. */ abstract fun podIndex(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdPodInfo): Long @@ -2038,9 +2259,9 @@ abstract class PigeonApiAdPodInfo(open val pigeonRegistrar: InteractiveMediaAdsL /** * The content time offset at which the current ad pod was scheduled. * - * For preroll pod, 0 is returned. For midrolls, the scheduled time is - * returned in seconds. For postroll, -1 is returned. Defaults to 0 if this - * ad is not part of a pod, or the pod is not part of an ad playlist. + * For preroll pod, 0 is returned. For midrolls, the scheduled time is returned in seconds. For + * postroll, -1 is returned. Defaults to 0 if this ad is not part of a pod, or the pod is not part + * of an ad playlist. */ abstract fun timeOffset(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdPodInfo): Double @@ -2051,9 +2272,11 @@ abstract class PigeonApiAdPodInfo(open val pigeonRegistrar: InteractiveMediaAdsL abstract fun isBumper(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdPodInfo): Boolean @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of AdPodInfo and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdPodInfo, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of AdPodInfo and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdPodInfo, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -2064,7 +2287,8 @@ abstract class PigeonApiAdPodInfo(open val pigeonRegistrar: InteractiveMediaAdsL Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val adPositionArg = adPosition(pigeon_instanceArg) val maxDurationArg = maxDuration(pigeon_instanceArg) val podIndexArg = podIndex(pigeon_instanceArg) @@ -2075,28 +2299,37 @@ abstract class PigeonApiAdPodInfo(open val pigeonRegistrar: InteractiveMediaAdsL val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.AdPodInfo.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(listOf(pigeon_identifierArg, adPositionArg, maxDurationArg, podIndexArg, timeOffsetArg, totalAdsArg, isBumperArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) + channel.send( + listOf( + pigeon_identifierArg, + adPositionArg, + maxDurationArg, + podIndexArg, + timeOffsetArg, + totalAdsArg, + isBumperArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback( + Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } } - } else { - callback(Result.failure(createConnectionError(channelName))) - } - } } - } /** - * FrameLayout is designed to block out an area on the screen to display a - * single item. + * FrameLayout is designed to block out an area on the screen to display a single item. * * See https://developer.android.com/reference/android/widget/FrameLayout. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiFrameLayout(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiFrameLayout( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { abstract fun pigeon_defaultConstructor(): android.widget.FrameLayout companion object { @@ -2104,17 +2337,24 @@ abstract class PigeonApiFrameLayout(open val pigeonRegistrar: InteractiveMediaAd fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiFrameLayout?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.FrameLayout.pigeon_defaultConstructor", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.FrameLayout.pigeon_defaultConstructor", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_identifierArg = + args[0].let { num -> if (num is Int) num.toLong() else num as Long } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2125,9 +2365,11 @@ abstract class PigeonApiFrameLayout(open val pigeonRegistrar: InteractiveMediaAd } @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of FrameLayout and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.widget.FrameLayout, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of FrameLayout and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: android.widget.FrameLayout, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -2138,7 +2380,8 @@ abstract class PigeonApiFrameLayout(open val pigeonRegistrar: InteractiveMediaAd Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.FrameLayout.pigeon_newInstance" @@ -2152,17 +2395,15 @@ abstract class PigeonApiFrameLayout(open val pigeonRegistrar: InteractiveMediaAd } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } @Suppress("FunctionName") - /**An implementation of [PigeonApiViewGroup] used to access callback methods */ - fun pigeon_getPigeonApiViewGroup(): PigeonApiViewGroup - { + /** An implementation of [PigeonApiViewGroup] used to access callback methods */ + fun pigeon_getPigeonApiViewGroup(): PigeonApiViewGroup { return pigeonRegistrar.getPigeonApiViewGroup() } - } /** * A special view that can contain other views (called children.) @@ -2170,7 +2411,9 @@ abstract class PigeonApiFrameLayout(open val pigeonRegistrar: InteractiveMediaAd * See https://developer.android.com/reference/android/view/ViewGroup. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiViewGroup(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiViewGroup( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { abstract fun addView(pigeon_instance: android.view.ViewGroup, view: android.view.View) companion object { @@ -2178,18 +2421,23 @@ abstract class PigeonApiViewGroup(open val pigeonRegistrar: InteractiveMediaAdsL fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiViewGroup?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ViewGroup.addView", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.ViewGroup.addView", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.view.ViewGroup val viewArg = args[1] as android.view.View - val wrapped: List = try { - api.addView(pigeon_instanceArg, viewArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + api.addView(pigeon_instanceArg, viewArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2200,9 +2448,11 @@ abstract class PigeonApiViewGroup(open val pigeonRegistrar: InteractiveMediaAdsL } @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of ViewGroup and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.view.ViewGroup, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of ViewGroup and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: android.view.ViewGroup, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -2213,7 +2463,8 @@ abstract class PigeonApiViewGroup(open val pigeonRegistrar: InteractiveMediaAdsL Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.ViewGroup.pigeon_newInstance" @@ -2227,17 +2478,15 @@ abstract class PigeonApiViewGroup(open val pigeonRegistrar: InteractiveMediaAdsL } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } @Suppress("FunctionName") - /**An implementation of [PigeonApiView] used to access callback methods */ - fun pigeon_getPigeonApiView(): PigeonApiView - { + /** An implementation of [PigeonApiView] used to access callback methods */ + fun pigeon_getPigeonApiView(): PigeonApiView { return pigeonRegistrar.getPigeonApiView() } - } /** * Displays a video file. @@ -2245,7 +2494,9 @@ abstract class PigeonApiViewGroup(open val pigeonRegistrar: InteractiveMediaAdsL * See https://developer.android.com/reference/android/widget/VideoView. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiVideoView(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiVideoView( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { abstract fun pigeon_defaultConstructor(): android.widget.VideoView /** Sets the URI of the video. */ @@ -2263,17 +2514,24 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: InteractiveMediaAdsL fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiVideoView?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoView.pigeon_defaultConstructor", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.VideoView.pigeon_defaultConstructor", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_identifierArg = + args[0].let { num -> if (num is Int) num.toLong() else num as Long } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2281,18 +2539,23 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: InteractiveMediaAdsL } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoView.setVideoUri", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.VideoView.setVideoUri", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.widget.VideoView val uriArg = args[1] as String - val wrapped: List = try { - api.setVideoUri(pigeon_instanceArg, uriArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + api.setVideoUri(pigeon_instanceArg, uriArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2300,16 +2563,21 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: InteractiveMediaAdsL } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoView.getCurrentPosition", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.VideoView.getCurrentPosition", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.widget.VideoView - val wrapped: List = try { - listOf(api.getCurrentPosition(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getCurrentPosition(pigeon_instanceArg)) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2320,9 +2588,11 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: InteractiveMediaAdsL } @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of VideoView and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.widget.VideoView, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of VideoView and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: android.widget.VideoView, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -2333,12 +2603,16 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: InteractiveMediaAdsL Result.success(Unit) return } - throw IllegalStateException("Attempting to create a new Dart instance of VideoView, but the class has a nonnull callback method.") + throw IllegalStateException( + "Attempting to create a new Dart instance of VideoView, but the class has a nonnull callback method.") } /** Callback to be invoked when the media source is ready for playback. */ - fun onPrepared(pigeon_instanceArg: android.widget.VideoView, playerArg: android.media.MediaPlayer, callback: (Result) -> Unit) -{ + fun onPrepared( + pigeon_instanceArg: android.widget.VideoView, + playerArg: android.media.MediaPlayer, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -2358,13 +2632,16 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: InteractiveMediaAdsL } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } /** Callback to be invoked when playback of a media source has completed. */ - fun onCompletion(pigeon_instanceArg: android.widget.VideoView, playerArg: android.media.MediaPlayer, callback: (Result) -> Unit) -{ + fun onCompletion( + pigeon_instanceArg: android.widget.VideoView, + playerArg: android.media.MediaPlayer, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -2384,16 +2661,18 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: InteractiveMediaAdsL } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - /** - * Callback to be invoked when there has been an error during an asynchronous - * operation. - */ - fun onError(pigeon_instanceArg: android.widget.VideoView, playerArg: android.media.MediaPlayer, whatArg: Long, extraArg: Long, callback: (Result) -> Unit) -{ + /** Callback to be invoked when there has been an error during an asynchronous operation. */ + fun onError( + pigeon_instanceArg: android.widget.VideoView, + playerArg: android.media.MediaPlayer, + whatArg: Long, + extraArg: Long, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -2413,17 +2692,15 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: InteractiveMediaAdsL } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } @Suppress("FunctionName") - /**An implementation of [PigeonApiView] used to access callback methods */ - fun pigeon_getPigeonApiView(): PigeonApiView - { + /** An implementation of [PigeonApiView] used to access callback methods */ + fun pigeon_getPigeonApiView(): PigeonApiView { return pigeonRegistrar.getPigeonApiView() } - } /** * This class represents the basic building block for user interface components. @@ -2431,11 +2708,12 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: InteractiveMediaAdsL * See https://developer.android.com/reference/android/view/View. */ @Suppress("UNCHECKED_CAST") -open class PigeonApiView(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +open class PigeonApiView( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of View and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.view.View, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of View and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: android.view.View, callback: (Result) -> Unit) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -2446,7 +2724,8 @@ open class PigeonApiView(open val pigeonRegistrar: InteractiveMediaAdsLibraryPig Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.View.pigeon_newInstance" @@ -2460,19 +2739,19 @@ open class PigeonApiView(open val pigeonRegistrar: InteractiveMediaAdsLibraryPig } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - } /** - * MediaPlayer class can be used to control playback of audio/video files and - * streams. + * MediaPlayer class can be used to control playback of audio/video files and streams. * * See https://developer.android.com/reference/android/media/MediaPlayer. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiMediaPlayer( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { /** Gets the duration of the file. */ abstract fun getDuration(pigeon_instance: android.media.MediaPlayer): Long @@ -2493,16 +2772,21 @@ abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: InteractiveMediaAd fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiMediaPlayer?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.getDuration", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.getDuration", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.media.MediaPlayer - val wrapped: List = try { - listOf(api.getDuration(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getDuration(pigeon_instanceArg)) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2510,18 +2794,23 @@ abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: InteractiveMediaAd } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.seekTo", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.seekTo", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.media.MediaPlayer val mSecArg = args[1].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = try { - api.seekTo(pigeon_instanceArg, mSecArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + api.seekTo(pigeon_instanceArg, mSecArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2529,17 +2818,22 @@ abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: InteractiveMediaAd } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.start", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.start", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.media.MediaPlayer - val wrapped: List = try { - api.start(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + api.start(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2547,17 +2841,22 @@ abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: InteractiveMediaAd } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.pause", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.pause", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.media.MediaPlayer - val wrapped: List = try { - api.pause(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + api.pause(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2565,17 +2864,20 @@ abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: InteractiveMediaAd } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.stop", codec) + val channel = + BasicMessageChannel( + binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.stop", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.media.MediaPlayer - val wrapped: List = try { - api.stop(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + api.stop(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2586,9 +2888,11 @@ abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: InteractiveMediaAd } @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of MediaPlayer and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.media.MediaPlayer, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of MediaPlayer and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: android.media.MediaPlayer, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -2599,7 +2903,8 @@ abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: InteractiveMediaAd Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.pigeon_newInstance" @@ -2613,66 +2918,122 @@ abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: InteractiveMediaAd } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - } /** * Callbacks that the player must fire. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.VideoAdPlayerCallback.html + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.VideoAdPlayerCallback.html */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiVideoAdPlayerCallback( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { /** Fire this callback periodically as ad playback occurs. */ - abstract fun onAdProgress(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, videoProgressUpdate: com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate) + abstract fun onAdProgress( + pigeon_instance: + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, + adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, + videoProgressUpdate: com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate + ) /** Fire this callback when video playback stalls waiting for data. */ - abstract fun onBuffering(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo) + abstract fun onBuffering( + pigeon_instance: + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, + adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + ) /** Fire this callback when all content has finished playing. */ - abstract fun onContentComplete(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback) + abstract fun onContentComplete( + pigeon_instance: + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + ) /** Fire this callback when the video finishes playing. */ - abstract fun onEnded(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo) + abstract fun onEnded( + pigeon_instance: + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, + adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + ) /** Fire this callback when the video has encountered an error. */ - abstract fun onError(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo) + abstract fun onError( + pigeon_instance: + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, + adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + ) /** Fire this callback when the video is ready to begin playback. */ - abstract fun onLoaded(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo) + abstract fun onLoaded( + pigeon_instance: + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, + adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + ) /** Fire this callback when the video is paused. */ - abstract fun onPause(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo) + abstract fun onPause( + pigeon_instance: + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, + adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + ) /** Fire this callback when the player begins playing a video. */ - abstract fun onPlay(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo) + abstract fun onPlay( + pigeon_instance: + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, + adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + ) /** Fire this callback when the video is unpaused. */ - abstract fun onResume(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo) + abstract fun onResume( + pigeon_instance: + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, + adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + ) /** Fire this callback when the playback volume changes. */ - abstract fun onVolumeChanged(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, percentage: Long) + abstract fun onVolumeChanged( + pigeon_instance: + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, + adMediaInfo: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, + percentage: Long + ) companion object { @Suppress("LocalVariableName") - fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiVideoAdPlayerCallback?) { + fun setUpMessageHandlers( + binaryMessenger: BinaryMessenger, + api: PigeonApiVideoAdPlayerCallback? + ) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onAdProgress", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onAdProgress", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val adMediaInfoArg = args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - val videoProgressUpdateArg = args[2] as com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate - val wrapped: List = try { - api.onAdProgress(pigeon_instanceArg, adMediaInfoArg, videoProgressUpdateArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = + args[0] + as + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val adMediaInfoArg = + args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + val videoProgressUpdateArg = + args[2] as com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate + val wrapped: List = + try { + api.onAdProgress(pigeon_instanceArg, adMediaInfoArg, videoProgressUpdateArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2680,18 +3041,27 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: Interact } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onBuffering", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onBuffering", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val adMediaInfoArg = args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - val wrapped: List = try { - api.onBuffering(pigeon_instanceArg, adMediaInfoArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = + args[0] + as + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val adMediaInfoArg = + args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + val wrapped: List = + try { + api.onBuffering(pigeon_instanceArg, adMediaInfoArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2699,17 +3069,25 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: Interact } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onContentComplete", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onContentComplete", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val wrapped: List = try { - api.onContentComplete(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = + args[0] + as + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val wrapped: List = + try { + api.onContentComplete(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2717,18 +3095,27 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: Interact } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onEnded", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onEnded", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val adMediaInfoArg = args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - val wrapped: List = try { - api.onEnded(pigeon_instanceArg, adMediaInfoArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = + args[0] + as + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val adMediaInfoArg = + args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + val wrapped: List = + try { + api.onEnded(pigeon_instanceArg, adMediaInfoArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2736,18 +3123,27 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: Interact } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onError", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onError", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val adMediaInfoArg = args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - val wrapped: List = try { - api.onError(pigeon_instanceArg, adMediaInfoArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = + args[0] + as + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val adMediaInfoArg = + args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + val wrapped: List = + try { + api.onError(pigeon_instanceArg, adMediaInfoArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2755,18 +3151,27 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: Interact } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onLoaded", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onLoaded", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val adMediaInfoArg = args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - val wrapped: List = try { - api.onLoaded(pigeon_instanceArg, adMediaInfoArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = + args[0] + as + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val adMediaInfoArg = + args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + val wrapped: List = + try { + api.onLoaded(pigeon_instanceArg, adMediaInfoArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2774,18 +3179,27 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: Interact } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onPause", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onPause", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val adMediaInfoArg = args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - val wrapped: List = try { - api.onPause(pigeon_instanceArg, adMediaInfoArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = + args[0] + as + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val adMediaInfoArg = + args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + val wrapped: List = + try { + api.onPause(pigeon_instanceArg, adMediaInfoArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2793,18 +3207,27 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: Interact } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onPlay", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onPlay", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val adMediaInfoArg = args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - val wrapped: List = try { - api.onPlay(pigeon_instanceArg, adMediaInfoArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = + args[0] + as + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val adMediaInfoArg = + args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + val wrapped: List = + try { + api.onPlay(pigeon_instanceArg, adMediaInfoArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2812,18 +3235,27 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: Interact } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onResume", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onResume", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val adMediaInfoArg = args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo - val wrapped: List = try { - api.onResume(pigeon_instanceArg, adMediaInfoArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = + args[0] + as + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val adMediaInfoArg = + args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + val wrapped: List = + try { + api.onResume(pigeon_instanceArg, adMediaInfoArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2831,19 +3263,28 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: Interact } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onVolumeChanged", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onVolumeChanged", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback - val adMediaInfoArg = args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo + val pigeon_instanceArg = + args[0] + as + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback + val adMediaInfoArg = + args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo val percentageArg = args[2].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = try { - api.onVolumeChanged(pigeon_instanceArg, adMediaInfoArg, percentageArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + api.onVolumeChanged(pigeon_instanceArg, adMediaInfoArg, percentageArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2854,9 +3295,12 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: Interact } @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of VideoAdPlayerCallback and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of VideoAdPlayerCallback and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -2867,10 +3311,12 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: Interact Result.success(Unit) return } - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { @@ -2881,46 +3327,59 @@ abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: Interact } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - } /** - * Defines the set of methods that a video player must implement to be used by - * the IMA SDK, as well as a set of callbacks that it must fire. + * Defines the set of methods that a video player must implement to be used by the IMA SDK, as well + * as a set of callbacks that it must fire. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { - abstract fun pigeon_defaultConstructor(): com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer +abstract class PigeonApiVideoAdPlayer( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { + abstract fun pigeon_defaultConstructor(): + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer /** The volume of the player as a percentage from 0 to 100. */ - abstract fun setVolume(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, value: Long) + abstract fun setVolume( + pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, + value: Long + ) - /** - * The `VideoProgressUpdate` describing playback progress of the current - * video. - */ - abstract fun setAdProgress(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, progress: com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate) + /** The `VideoProgressUpdate` describing playback progress of the current video. */ + abstract fun setAdProgress( + pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, + progress: com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate + ) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiVideoAdPlayer?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.pigeon_defaultConstructor", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.pigeon_defaultConstructor", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_identifierArg = + args[0].let { num -> if (num is Int) num.toLong() else num as Long } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2928,18 +3387,24 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMedia } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.setVolume", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.setVolume", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer val valueArg = args[1].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = try { - api.setVolume(pigeon_instanceArg, valueArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = + try { + api.setVolume(pigeon_instanceArg, valueArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2947,18 +3412,25 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMedia } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.setAdProgress", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.setAdProgress", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer - val progressArg = args[1] as com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate - val wrapped: List = try { - api.setAdProgress(pigeon_instanceArg, progressArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer + val progressArg = + args[1] as com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate + val wrapped: List = + try { + api.setAdProgress(pigeon_instanceArg, progressArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2969,9 +3441,11 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMedia } @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of VideoAdPlayer and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of VideoAdPlayer and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -2982,12 +3456,17 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMedia Result.success(Unit) return } - throw IllegalStateException("Attempting to create a new Dart instance of VideoAdPlayer, but the class has a nonnull callback method.") + throw IllegalStateException( + "Attempting to create a new Dart instance of VideoAdPlayer, but the class has a nonnull callback method.") } /** Adds a callback. */ - fun addCallback(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, callbackArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, callback: (Result) -> Unit) -{ + fun addCallback( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, + callbackArg: + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3007,13 +3486,17 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMedia } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } /** Loads a video ad hosted at AdMediaInfo. */ - fun loadAd(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, adMediaInfoArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, adPodInfoArg: com.google.ads.interactivemedia.v3.api.AdPodInfo, callback: (Result) -> Unit) -{ + fun loadAd( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, + adMediaInfoArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, + adPodInfoArg: com.google.ads.interactivemedia.v3.api.AdPodInfo, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3033,13 +3516,16 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMedia } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } /** Pauses playing the current ad. */ - fun pauseAd(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, adMediaInfoArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, callback: (Result) -> Unit) -{ + fun pauseAd( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, + adMediaInfoArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3059,16 +3545,19 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMedia } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } /** - * Starts or resumes playing the video ad referenced by the AdMediaInfo, - * provided loadAd has already been called for it. + * Starts or resumes playing the video ad referenced by the AdMediaInfo, provided loadAd has + * already been called for it. */ - fun playAd(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, adMediaInfoArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, callback: (Result) -> Unit) -{ + fun playAd( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, + adMediaInfoArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3088,13 +3577,15 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMedia } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } /** Cleans up and releases all resources used by the `VideoAdPlayer`. */ - fun release(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, callback: (Result) -> Unit) -{ + fun release( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3114,13 +3605,17 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMedia } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } /** Removes a callback. */ - fun removeCallback(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, callbackArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, callback: (Result) -> Unit) -{ + fun removeCallback( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, + callbackArg: + com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3140,13 +3635,16 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMedia } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } /** Stops playing the current ad. */ - fun stopAd(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, adMediaInfoArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, callback: (Result) -> Unit) -{ + fun stopAd( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer, + adMediaInfoArg: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3166,36 +3664,46 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMedia } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - } /** * Listener interface for notification of ad load or stream load completion. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader.AdsLoadedListener.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader.AdsLoadedListener.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdsLoadedListener(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { - abstract fun pigeon_defaultConstructor(): com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener +abstract class PigeonApiAdsLoadedListener( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { + abstract fun pigeon_defaultConstructor(): + com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAdsLoadedListener?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsLoadedListener.pigeon_defaultConstructor", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsLoadedListener.pigeon_defaultConstructor", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_identifierArg = + args[0].let { num -> if (num is Int) num.toLong() else num as Long } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3206,9 +3714,11 @@ abstract class PigeonApiAdsLoadedListener(open val pigeonRegistrar: InteractiveM } @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of AdsLoadedListener and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of AdsLoadedListener and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3219,12 +3729,16 @@ abstract class PigeonApiAdsLoadedListener(open val pigeonRegistrar: InteractiveM Result.success(Unit) return } - throw IllegalStateException("Attempting to create a new Dart instance of AdsLoadedListener, but the class has a nonnull callback method.") + throw IllegalStateException( + "Attempting to create a new Dart instance of AdsLoadedListener, but the class has a nonnull callback method.") } /** Called once the AdsManager or StreamManager has been loaded. */ - fun onAdsManagerLoaded(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener, eventArg: com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent, callback: (Result) -> Unit) -{ + fun onAdsManagerLoaded( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener, + eventArg: com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3233,7 +3747,8 @@ abstract class PigeonApiAdsLoadedListener(open val pigeonRegistrar: InteractiveM } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.interactive_media_ads.AdsLoadedListener.onAdsManagerLoaded" + val channelName = + "dev.flutter.pigeon.interactive_media_ads.AdsLoadedListener.onAdsManagerLoaded" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg, eventArg)) { if (it is List<*>) { @@ -3244,36 +3759,46 @@ abstract class PigeonApiAdsLoadedListener(open val pigeonRegistrar: InteractiveM } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - } /** * Interface for classes that will listen to AdErrorEvents. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.AdErrorListener.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.AdErrorListener.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdErrorListener(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { - abstract fun pigeon_defaultConstructor(): com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener +abstract class PigeonApiAdErrorListener( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { + abstract fun pigeon_defaultConstructor(): + com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAdErrorListener?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdErrorListener.pigeon_defaultConstructor", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdErrorListener.pigeon_defaultConstructor", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_identifierArg = + args[0].let { num -> if (num is Int) num.toLong() else num as Long } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3284,9 +3809,11 @@ abstract class PigeonApiAdErrorListener(open val pigeonRegistrar: InteractiveMed } @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of AdErrorListener and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of AdErrorListener and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3297,12 +3824,16 @@ abstract class PigeonApiAdErrorListener(open val pigeonRegistrar: InteractiveMed Result.success(Unit) return } - throw IllegalStateException("Attempting to create a new Dart instance of AdErrorListener, but the class has a nonnull callback method.") + throw IllegalStateException( + "Attempting to create a new Dart instance of AdErrorListener, but the class has a nonnull callback method.") } /** Called when an error occurs. */ - fun onAdError(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener, eventArg: com.google.ads.interactivemedia.v3.api.AdErrorEvent, callback: (Result) -> Unit) -{ + fun onAdError( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener, + eventArg: com.google.ads.interactivemedia.v3.api.AdErrorEvent, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3322,36 +3853,46 @@ abstract class PigeonApiAdErrorListener(open val pigeonRegistrar: InteractiveMed } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - } /** * Listener interface for ad events. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventListener.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventListener.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdEventListener(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { - abstract fun pigeon_defaultConstructor(): com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener +abstract class PigeonApiAdEventListener( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { + abstract fun pigeon_defaultConstructor(): + com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAdEventListener?) { val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdEventListener.pigeon_defaultConstructor", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdEventListener.pigeon_defaultConstructor", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val pigeon_identifierArg = + args[0].let { num -> if (num is Int) num.toLong() else num as Long } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3362,9 +3903,11 @@ abstract class PigeonApiAdEventListener(open val pigeonRegistrar: InteractiveMed } @Suppress("LocalVariableName", "FunctionName") - /**Creates a Dart instance of AdEventListener and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener, callback: (Result) -> Unit) -{ + /** Creates a Dart instance of AdEventListener and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3375,12 +3918,16 @@ abstract class PigeonApiAdEventListener(open val pigeonRegistrar: InteractiveMed Result.success(Unit) return } - throw IllegalStateException("Attempting to create a new Dart instance of AdEventListener, but the class has a nonnull callback method.") + throw IllegalStateException( + "Attempting to create a new Dart instance of AdEventListener, but the class has a nonnull callback method.") } /** Respond to an occurrence of an AdEvent. */ - fun onAdEvent(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener, eventArg: com.google.ads.interactivemedia.v3.api.AdEvent, callback: (Result) -> Unit) -{ + fun onAdEvent( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener, + eventArg: com.google.ads.interactivemedia.v3.api.AdEvent, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3400,8 +3947,7 @@ abstract class PigeonApiAdEventListener(open val pigeonRegistrar: InteractiveMed } } else { callback(Result.failure(createConnectionError(channelName))) - } + } } } - } diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsPlugin.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsPlugin.kt index 1e829f9a16d7..e56f58685dd3 100644 --- a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsPlugin.kt +++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsPlugin.kt @@ -52,8 +52,9 @@ class InteractiveMediaAdsPlugin : FlutterPlugin, ActivityAware { } } -internal class FlutterViewFactory(private val instanceManager: InteractiveMediaAdsLibraryPigeonInstanceManager) : - PlatformViewFactory(StandardMessageCodec.INSTANCE) { +internal class FlutterViewFactory( + private val instanceManager: InteractiveMediaAdsLibraryPigeonInstanceManager +) : PlatformViewFactory(StandardMessageCodec.INSTANCE) { override fun create(context: Context, viewId: Int, args: Any?): PlatformView { val identifier = diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ProxyApiRegistrar.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ProxyApiRegistrar.kt index fe80589b199e..ff1190eb9fc7 100644 --- a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ProxyApiRegistrar.kt +++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ProxyApiRegistrar.kt @@ -14,7 +14,7 @@ import io.flutter.plugin.common.BinaryMessenger * implementation and any additional resources needed by an implementation. */ open class ProxyApiRegistrar(binaryMessenger: BinaryMessenger, var context: Context) : - InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(binaryMessenger) { + InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(binaryMessenger) { // Added to be overriden for tests. The test implementation calls `callback` immediately, instead // of waiting for the main thread to run it. diff --git a/packages/interactive_media_ads/example/ios/RunnerTests/AdEventTests.swift b/packages/interactive_media_ads/example/ios/RunnerTests/AdEventTests.swift index 0c5082cc1598..9906e3157342 100644 --- a/packages/interactive_media_ads/example/ios/RunnerTests/AdEventTests.swift +++ b/packages/interactive_media_ads/example/ios/RunnerTests/AdEventTests.swift @@ -30,7 +30,7 @@ final class AdEventTests: XCTestCase { XCTAssertEqual(value, "message") } - + func testAdData() { let registrar = TestProxyApiRegistrar() let api = registrar.apiDelegate.pigeonApiIMAAdEvent(registrar) @@ -39,7 +39,7 @@ final class AdEventTests: XCTestCase { let value = try? api.pigeonDelegate.adData(pigeonApi: api, pigeonInstance: instance) - XCTAssertEqual(value as! [String : String], ["my": "string"]) + XCTAssertEqual(value as! [String: String], ["my": "string"]) } } @@ -58,8 +58,8 @@ class TestAdEvent: IMAAdEvent { override var typeString: String { return "message" } - - override var adData: [String : Any]? { + + override var adData: [String: Any]? { return ["my": "string"] } } diff --git a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdEventProxyAPIDelegate.swift b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdEventProxyAPIDelegate.swift index 195b625b12a0..f4d018700d06 100644 --- a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdEventProxyAPIDelegate.swift +++ b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdEventProxyAPIDelegate.swift @@ -10,10 +10,10 @@ import GoogleInteractiveMediaAds /// This class may handle instantiating native object instances that are attached to a Dart /// instance or handle method calls on the associated native class or an instance of that class. class AdEventProxyAPIDelegate: PigeonApiDelegateIMAAdEvent { - func adData(pigeonApi: PigeonApiIMAAdEvent, pigeonInstance: IMAAdEvent) throws -> [String : Any]? { + func adData(pigeonApi: PigeonApiIMAAdEvent, pigeonInstance: IMAAdEvent) throws -> [String: Any]? { return pigeonInstance.adData } - + func type(pigeonApi: PigeonApiIMAAdEvent, pigeonInstance: IMAAdEvent) throws -> AdEventType { switch pigeonInstance.type { case .AD_BREAK_READY: diff --git a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/InteractiveMediaAdsLibrary.g.swift b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/InteractiveMediaAdsLibrary.g.swift index 47b303232b1c..4ceb8ad33802 100644 --- a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/InteractiveMediaAdsLibrary.g.swift +++ b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/InteractiveMediaAdsLibrary.g.swift @@ -31,7 +31,7 @@ final class PigeonError: Error { var localizedDescription: String { return "PigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? "")" - } + } } private func wrapResult(_ result: Any?) -> [Any?] { @@ -61,7 +61,9 @@ private func wrapError(_ error: Any) -> [Any?] { } private func createConnectionError(withChannelName channelName: String) -> PigeonError { - return PigeonError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") + return PigeonError( + code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", + details: "") } private func isNullish(_ value: Any?) -> Bool { @@ -78,7 +80,6 @@ protocol InteractiveMediaAdsLibraryPigeonFinalizerDelegate: AnyObject { func onDeinit(identifier: Int64) } - // Attaches to an object to receive a callback when the object is deallocated. internal final class InteractiveMediaAdsLibraryPigeonFinalizer { private static let associatedObjectKey = malloc(1)! @@ -94,9 +95,11 @@ internal final class InteractiveMediaAdsLibraryPigeonFinalizer { } internal static func attach( - to instance: AnyObject, identifier: Int64, delegate: InteractiveMediaAdsLibraryPigeonFinalizerDelegate + to instance: AnyObject, identifier: Int64, + delegate: InteractiveMediaAdsLibraryPigeonFinalizerDelegate ) { - let finalizer = InteractiveMediaAdsLibraryPigeonFinalizer(identifier: identifier, delegate: delegate) + let finalizer = InteractiveMediaAdsLibraryPigeonFinalizer( + identifier: identifier, delegate: delegate) objc_setAssociatedObject(instance, associatedObjectKey, finalizer, .OBJC_ASSOCIATION_RETAIN) } @@ -109,7 +112,6 @@ internal final class InteractiveMediaAdsLibraryPigeonFinalizer { } } - /// Maintains instances used to communicate with the corresponding objects in Dart. /// /// Objects stored in this container are represented by an object in Dart that is also stored in @@ -213,7 +215,8 @@ final class InteractiveMediaAdsLibraryPigeonInstanceManager { identifiers.setObject(NSNumber(value: identifier), forKey: instance) weakInstances.setObject(instance, forKey: NSNumber(value: identifier)) strongInstances.setObject(instance, forKey: NSNumber(value: identifier)) - InteractiveMediaAdsLibraryPigeonFinalizer.attach(to: instance, identifier: identifier, delegate: finalizerDelegate) + InteractiveMediaAdsLibraryPigeonFinalizer.attach( + to: instance, identifier: identifier, delegate: finalizerDelegate) } /// Retrieves the identifier paired with an instance. @@ -290,7 +293,6 @@ final class InteractiveMediaAdsLibraryPigeonInstanceManager { } } - private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi { /// The codec used for serializing messages. let codec = FlutterStandardMessageCodec.sharedInstance() @@ -303,9 +305,15 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi { } /// Sets up an instance of `InteractiveMediaAdsLibraryPigeonInstanceManagerApi` to handle messages through the `binaryMessenger`. - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, instanceManager: InteractiveMediaAdsLibraryPigeonInstanceManager?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, + instanceManager: InteractiveMediaAdsLibraryPigeonInstanceManager? + ) { let codec = FlutterStandardMessageCodec.sharedInstance() - let removeStrongReferenceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.removeStrongReference", binaryMessenger: binaryMessenger, codec: codec) + let removeStrongReferenceChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.removeStrongReference", + binaryMessenger: binaryMessenger, codec: codec) if let instanceManager = instanceManager { removeStrongReferenceChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -320,7 +328,9 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi { } else { removeStrongReferenceChannel.setMessageHandler(nil) } - let clearChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.clear", binaryMessenger: binaryMessenger, codec: codec) + let clearChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.clear", + binaryMessenger: binaryMessenger, codec: codec) if let instanceManager = instanceManager { clearChannel.setMessageHandler { _, reply in do { @@ -336,9 +346,13 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi { } /// Sends a message to the Dart `InstanceManager` to remove the strong reference of the instance associated with `identifier`. - func removeStrongReference(identifier identifierArg: Int64, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.removeStrongReference" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func removeStrongReference( + identifier identifierArg: Int64, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.removeStrongReference" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([identifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -358,62 +372,89 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi { protocol InteractiveMediaAdsLibraryPigeonProxyApiDelegate { /// An implementation of [PigeonApiIMAAdDisplayContainer] used to add a new Dart instance of /// `IMAAdDisplayContainer` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdDisplayContainer(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdDisplayContainer + func pigeonApiIMAAdDisplayContainer( + _ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar + ) -> PigeonApiIMAAdDisplayContainer /// An implementation of [PigeonApiUIView] used to add a new Dart instance of /// `UIView` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiUIView(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiUIView + func pigeonApiUIView(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiUIView /// An implementation of [PigeonApiUIViewController] used to add a new Dart instance of /// `UIViewController` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiUIViewController(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiUIViewController + func pigeonApiUIViewController(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiUIViewController /// An implementation of [PigeonApiIMAContentPlayhead] used to add a new Dart instance of /// `IMAContentPlayhead` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAContentPlayhead(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAContentPlayhead + func pigeonApiIMAContentPlayhead(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiIMAContentPlayhead /// An implementation of [PigeonApiIMAAdsLoader] used to add a new Dart instance of /// `IMAAdsLoader` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdsLoader(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdsLoader + func pigeonApiIMAAdsLoader(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiIMAAdsLoader /// An implementation of [PigeonApiIMASettings] used to add a new Dart instance of /// `IMASettings` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMASettings(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMASettings + func pigeonApiIMASettings(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiIMASettings /// An implementation of [PigeonApiIMAAdsRequest] used to add a new Dart instance of /// `IMAAdsRequest` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdsRequest(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdsRequest + func pigeonApiIMAAdsRequest(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiIMAAdsRequest /// An implementation of [PigeonApiIMAAdsLoaderDelegate] used to add a new Dart instance of /// `IMAAdsLoaderDelegate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdsLoaderDelegate(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdsLoaderDelegate + func pigeonApiIMAAdsLoaderDelegate(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiIMAAdsLoaderDelegate /// An implementation of [PigeonApiIMAAdsLoadedData] used to add a new Dart instance of /// `IMAAdsLoadedData` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdsLoadedData(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdsLoadedData + func pigeonApiIMAAdsLoadedData(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiIMAAdsLoadedData /// An implementation of [PigeonApiIMAAdLoadingErrorData] used to add a new Dart instance of /// `IMAAdLoadingErrorData` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdLoadingErrorData(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdLoadingErrorData + func pigeonApiIMAAdLoadingErrorData( + _ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar + ) -> PigeonApiIMAAdLoadingErrorData /// An implementation of [PigeonApiIMAAdError] used to add a new Dart instance of /// `IMAAdError` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdError(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdError + func pigeonApiIMAAdError(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiIMAAdError /// An implementation of [PigeonApiIMAAdsManager] used to add a new Dart instance of /// `IMAAdsManager` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdsManager(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdsManager + func pigeonApiIMAAdsManager(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiIMAAdsManager /// An implementation of [PigeonApiIMAAdsManagerDelegate] used to add a new Dart instance of /// `IMAAdsManagerDelegate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdsManagerDelegate(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdsManagerDelegate + func pigeonApiIMAAdsManagerDelegate( + _ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar + ) -> PigeonApiIMAAdsManagerDelegate /// An implementation of [PigeonApiIMAAdEvent] used to add a new Dart instance of /// `IMAAdEvent` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdEvent(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdEvent + func pigeonApiIMAAdEvent(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiIMAAdEvent /// An implementation of [PigeonApiIMAAdsRenderingSettings] used to add a new Dart instance of /// `IMAAdsRenderingSettings` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdsRenderingSettings(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdsRenderingSettings + func pigeonApiIMAAdsRenderingSettings( + _ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar + ) -> PigeonApiIMAAdsRenderingSettings /// An implementation of [PigeonApiNSObject] used to add a new Dart instance of /// `NSObject` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiNSObject(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiNSObject + func pigeonApiNSObject(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiNSObject } extension InteractiveMediaAdsLibraryPigeonProxyApiDelegate { - func pigeonApiUIView(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiUIView { + func pigeonApiUIView(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiUIView + { return PigeonApiUIView(pigeonRegistrar: registrar, delegate: PigeonApiDelegateUIView()) } - func pigeonApiIMASettings(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMASettings { - return PigeonApiIMASettings(pigeonRegistrar: registrar, delegate: PigeonApiDelegateIMASettings()) + func pigeonApiIMASettings(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiIMASettings + { + return PigeonApiIMASettings( + pigeonRegistrar: registrar, delegate: PigeonApiDelegateIMASettings()) } - func pigeonApiNSObject(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiNSObject { + func pigeonApiNSObject(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiNSObject + { return PigeonApiNSObject(pigeonRegistrar: registrar, delegate: PigeonApiDelegateNSObject()) } } @@ -428,12 +469,15 @@ open class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar { var codec: FlutterStandardMessageCodec { if _codec == nil { _codec = FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: self)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( + pigeonRegistrar: self)) } return _codec! } - private class InstanceManagerApiFinalizerDelegate: InteractiveMediaAdsLibraryPigeonFinalizerDelegate { + private class InstanceManagerApiFinalizerDelegate: + InteractiveMediaAdsLibraryPigeonFinalizerDelegate + { let api: InteractiveMediaAdsLibraryPigeonInstanceManagerApi init(_ api: InteractiveMediaAdsLibraryPigeonInstanceManagerApi) { @@ -447,7 +491,10 @@ open class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar { } } - init(binaryMessenger: FlutterBinaryMessenger, apiDelegate: InteractiveMediaAdsLibraryPigeonProxyApiDelegate) { + init( + binaryMessenger: FlutterBinaryMessenger, + apiDelegate: InteractiveMediaAdsLibraryPigeonProxyApiDelegate + ) { self.binaryMessenger = binaryMessenger self.apiDelegate = apiDelegate self.instanceManager = InteractiveMediaAdsLibraryPigeonInstanceManager( @@ -456,19 +503,30 @@ open class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar { } func setUp() { - InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger: binaryMessenger, instanceManager: instanceManager) - PigeonApiIMAAdDisplayContainer.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdDisplayContainer(self)) - PigeonApiUIViewController.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIViewController(self)) - PigeonApiIMAContentPlayhead.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAContentPlayhead(self)) - PigeonApiIMAAdsLoader.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsLoader(self)) - PigeonApiIMAAdsRequest.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsRequest(self)) - PigeonApiIMAAdsLoaderDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsLoaderDelegate(self)) - PigeonApiIMAAdsManager.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsManager(self)) - PigeonApiIMAAdsManagerDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsManagerDelegate(self)) - PigeonApiIMAAdsRenderingSettings.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsRenderingSettings(self)) + InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers( + binaryMessenger: binaryMessenger, instanceManager: instanceManager) + PigeonApiIMAAdDisplayContainer.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdDisplayContainer(self)) + PigeonApiUIViewController.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIViewController(self)) + PigeonApiIMAContentPlayhead.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAContentPlayhead(self)) + PigeonApiIMAAdsLoader.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsLoader(self)) + PigeonApiIMAAdsRequest.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsRequest(self)) + PigeonApiIMAAdsLoaderDelegate.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsLoaderDelegate(self)) + PigeonApiIMAAdsManager.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsManager(self)) + PigeonApiIMAAdsManagerDelegate.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsManagerDelegate(self)) + PigeonApiIMAAdsRenderingSettings.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdsRenderingSettings(self)) } func tearDown() { - InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger: binaryMessenger, instanceManager: nil) + InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers( + binaryMessenger: binaryMessenger, instanceManager: nil) PigeonApiIMAAdDisplayContainer.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiUIViewController.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiIMAContentPlayhead.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) @@ -477,13 +535,17 @@ open class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar { PigeonApiIMAAdsLoaderDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiIMAAdsManager.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiIMAAdsManagerDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) - PigeonApiIMAAdsRenderingSettings.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) + PigeonApiIMAAdsRenderingSettings.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: nil) } } -private class InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter: FlutterStandardReaderWriter { +private class InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter: FlutterStandardReaderWriter +{ unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar - private class InteractiveMediaAdsLibraryPigeonProxyApiCodecReader: InteractiveMediaAdsLibraryPigeonCodecReader { + private class InteractiveMediaAdsLibraryPigeonProxyApiCodecReader: + InteractiveMediaAdsLibraryPigeonCodecReader + { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar init(data: Data, pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { @@ -504,7 +566,9 @@ private class InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter: Flutter } } - private class InteractiveMediaAdsLibraryPigeonProxyApiCodecWriter: InteractiveMediaAdsLibraryPigeonCodecWriter { + private class InteractiveMediaAdsLibraryPigeonProxyApiCodecWriter: + InteractiveMediaAdsLibraryPigeonCodecWriter + { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar init(data: NSMutableData, pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { @@ -513,189 +577,199 @@ private class InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter: Flutter } override func writeValue(_ value: Any) { - if value is [Any] || value is Bool || value is Data || value is [AnyHashable: Any] || value is Double || value is FlutterStandardTypedData || value is Int64 || value is String || value is AdErrorType || value is AdErrorCode || value is AdEventType || value is KeyValueObservingOptions || value is KeyValueChange || value is KeyValueChangeKey { + if value is [Any] || value is Bool || value is Data || value is [AnyHashable: Any] + || value is Double || value is FlutterStandardTypedData || value is Int64 || value is String + || value is AdErrorType || value is AdErrorCode || value is AdEventType + || value is KeyValueObservingOptions || value is KeyValueChange + || value is KeyValueChangeKey + { super.writeValue(value) return } - if let instance = value as? IMAAdDisplayContainer { - pigeonRegistrar.apiDelegate.pigeonApiIMAAdDisplayContainer(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiIMAAdDisplayContainer(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? UIView { pigeonRegistrar.apiDelegate.pigeonApiUIView(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? UIViewController { pigeonRegistrar.apiDelegate.pigeonApiUIViewController(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? IMAContentPlayhead { pigeonRegistrar.apiDelegate.pigeonApiIMAContentPlayhead(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? IMAAdsLoader { pigeonRegistrar.apiDelegate.pigeonApiIMAAdsLoader(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? IMASettings { pigeonRegistrar.apiDelegate.pigeonApiIMASettings(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? IMAAdsRequest { pigeonRegistrar.apiDelegate.pigeonApiIMAAdsRequest(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? IMAAdsLoaderDelegate { - pigeonRegistrar.apiDelegate.pigeonApiIMAAdsLoaderDelegate(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiIMAAdsLoaderDelegate(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? IMAAdsLoadedData { pigeonRegistrar.apiDelegate.pigeonApiIMAAdsLoadedData(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? IMAAdLoadingErrorData { - pigeonRegistrar.apiDelegate.pigeonApiIMAAdLoadingErrorData(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiIMAAdLoadingErrorData(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? IMAAdError { pigeonRegistrar.apiDelegate.pigeonApiIMAAdError(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? IMAAdsManager { pigeonRegistrar.apiDelegate.pigeonApiIMAAdsManager(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? IMAAdsManagerDelegate { - pigeonRegistrar.apiDelegate.pigeonApiIMAAdsManagerDelegate(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiIMAAdsManagerDelegate(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? IMAAdEvent { pigeonRegistrar.apiDelegate.pigeonApiIMAAdEvent(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? IMAAdsRenderingSettings { - pigeonRegistrar.apiDelegate.pigeonApiIMAAdsRenderingSettings(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiIMAAdsRenderingSettings(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? NSObject { pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - - if let instance = value as AnyObject?, pigeonRegistrar.instanceManager.containsInstance(instance) + if let instance = value as AnyObject?, + pigeonRegistrar.instanceManager.containsInstance(instance) { super.writeByte(128) super.writeValue( @@ -713,11 +787,13 @@ private class InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter: Flutter } override func reader(with data: Data) -> FlutterStandardReader { - return InteractiveMediaAdsLibraryPigeonProxyApiCodecReader(data: data, pigeonRegistrar: pigeonRegistrar) + return InteractiveMediaAdsLibraryPigeonProxyApiCodecReader( + data: data, pigeonRegistrar: pigeonRegistrar) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return InteractiveMediaAdsLibraryPigeonProxyApiCodecWriter(data: data, pigeonRegistrar: pigeonRegistrar) + return InteractiveMediaAdsLibraryPigeonProxyApiCodecWriter( + data: data, pigeonRegistrar: pigeonRegistrar) } } @@ -1004,17 +1080,21 @@ private class InteractiveMediaAdsLibraryPigeonCodecReaderWriter: FlutterStandard } class InteractiveMediaAdsLibraryPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { - static let shared = InteractiveMediaAdsLibraryPigeonCodec(readerWriter: InteractiveMediaAdsLibraryPigeonCodecReaderWriter()) + static let shared = InteractiveMediaAdsLibraryPigeonCodec( + readerWriter: InteractiveMediaAdsLibraryPigeonCodecReaderWriter()) } protocol PigeonApiDelegateIMAAdDisplayContainer { - func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdDisplayContainer, adContainer: UIView, adContainerViewController: UIViewController?) throws -> IMAAdDisplayContainer + func pigeonDefaultConstructor( + pigeonApi: PigeonApiIMAAdDisplayContainer, adContainer: UIView, + adContainerViewController: UIViewController? + ) throws -> IMAAdDisplayContainer } protocol PigeonApiProtocolIMAAdDisplayContainer { } -final class PigeonApiIMAAdDisplayContainer: PigeonApiProtocolIMAAdDisplayContainer { +final class PigeonApiIMAAdDisplayContainer: PigeonApiProtocolIMAAdDisplayContainer { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdDisplayContainer ///An implementation of [NSObject] used to access callback methods @@ -1022,17 +1102,26 @@ final class PigeonApiIMAAdDisplayContainer: PigeonApiProtocolIMAAdDisplayContain return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdDisplayContainer) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateIMAAdDisplayContainer + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdDisplayContainer?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdDisplayContainer? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1041,8 +1130,10 @@ final class PigeonApiIMAAdDisplayContainer: PigeonApiProtocolIMAAdDisplayContain let adContainerViewControllerArg: UIViewController? = nilOrValue(args[2]) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, adContainer: adContainerArg, adContainerViewController: adContainerViewControllerArg), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor( + pigeonApi: api, adContainer: adContainerArg, + adContainerViewController: adContainerViewControllerArg), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1054,7 +1145,9 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of IMAAdDisplayContainer and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: IMAAdDisplayContainer, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: IMAAdDisplayContainer, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1067,11 +1160,14 @@ withIdentifier: pigeonIdentifierArg) completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1094,7 +1190,7 @@ open class PigeonApiDelegateUIView { protocol PigeonApiProtocolUIView { } -final class PigeonApiUIView: PigeonApiProtocolUIView { +final class PigeonApiUIView: PigeonApiProtocolUIView { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIView ///An implementation of [NSObject] used to access callback methods @@ -1102,12 +1198,17 @@ final class PigeonApiUIView: PigeonApiProtocolUIView { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIView) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateUIView + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of UIView and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: UIView, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: UIView, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1120,11 +1221,13 @@ final class PigeonApiUIView: PigeonApiProtocolUIView { completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec let channelName: String = "dev.flutter.pigeon.interactive_media_ads.UIView.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1154,10 +1257,12 @@ protocol PigeonApiDelegateUIViewController { protocol PigeonApiProtocolUIViewController { /// Notifies the view controller that its view was added to a view hierarchy. - func viewDidAppear(pigeonInstance pigeonInstanceArg: UIViewController, animated animatedArg: Bool, completion: @escaping (Result) -> Void) + func viewDidAppear( + pigeonInstance pigeonInstanceArg: UIViewController, animated animatedArg: Bool, + completion: @escaping (Result) -> Void) } -final class PigeonApiUIViewController: PigeonApiProtocolUIViewController { +final class PigeonApiUIViewController: PigeonApiProtocolUIViewController { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIViewController ///An implementation of [NSObject] used to access callback methods @@ -1165,25 +1270,33 @@ final class PigeonApiUIViewController: PigeonApiProtocolUIViewController { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIViewController) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateUIViewController + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIViewController?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIViewController? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.UIViewController.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.UIViewController.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1192,14 +1305,18 @@ withIdentifier: pigeonIdentifierArg) } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let viewChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.UIViewController.view", binaryMessenger: binaryMessenger, codec: codec) + let viewChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.UIViewController.view", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { viewChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! UIViewController let pigeonIdentifierArg = args[1] is Int64 ? args[1] as! Int64 : Int64(args[1] as! Int32) do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.view(pigeonApi: api, pigeonInstance: pigeonInstanceArg), withIdentifier: pigeonIdentifierArg) + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + try api.pigeonDelegate.view(pigeonApi: api, pigeonInstance: pigeonInstanceArg), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1211,7 +1328,9 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of UIViewController and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: UIViewController, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: UIViewController, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1224,11 +1343,14 @@ withIdentifier: pigeonIdentifierArg) completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.UIViewController.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.UIViewController.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1245,7 +1367,10 @@ withIdentifier: pigeonIdentifierArg) } } /// Notifies the view controller that its view was added to a view hierarchy. - func viewDidAppear(pigeonInstance pigeonInstanceArg: UIViewController, animated animatedArg: Bool, completion: @escaping (Result) -> Void) { + func viewDidAppear( + pigeonInstance pigeonInstanceArg: UIViewController, animated animatedArg: Bool, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1256,8 +1381,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.UIViewController.viewDidAppear" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.UIViewController.viewDidAppear" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, animatedArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1278,13 +1405,15 @@ withIdentifier: pigeonIdentifierArg) protocol PigeonApiDelegateIMAContentPlayhead { func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAContentPlayhead) throws -> IMAContentPlayhead /// Reflects the current playback time in seconds for the content. - func setCurrentTime(pigeonApi: PigeonApiIMAContentPlayhead, pigeonInstance: IMAContentPlayhead, timeInterval: Double) throws + func setCurrentTime( + pigeonApi: PigeonApiIMAContentPlayhead, pigeonInstance: IMAContentPlayhead, timeInterval: Double + ) throws } protocol PigeonApiProtocolIMAContentPlayhead { } -final class PigeonApiIMAContentPlayhead: PigeonApiProtocolIMAContentPlayhead { +final class PigeonApiIMAContentPlayhead: PigeonApiProtocolIMAContentPlayhead { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAContentPlayhead ///An implementation of [NSObject] used to access callback methods @@ -1292,25 +1421,33 @@ final class PigeonApiIMAContentPlayhead: PigeonApiProtocolIMAContentPlayhead { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAContentPlayhead) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateIMAContentPlayhead + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAContentPlayhead?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAContentPlayhead? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAContentPlayhead.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAContentPlayhead.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1319,14 +1456,17 @@ withIdentifier: pigeonIdentifierArg) } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let setCurrentTimeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAContentPlayhead.setCurrentTime", binaryMessenger: binaryMessenger, codec: codec) + let setCurrentTimeChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAContentPlayhead.setCurrentTime", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setCurrentTimeChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAContentPlayhead let timeIntervalArg = args[1] as! Double do { - try api.pigeonDelegate.setCurrentTime(pigeonApi: api, pigeonInstance: pigeonInstanceArg, timeInterval: timeIntervalArg) + try api.pigeonDelegate.setCurrentTime( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, timeInterval: timeIntervalArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1338,7 +1478,9 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of IMAContentPlayhead and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: IMAContentPlayhead, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: IMAContentPlayhead, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1351,11 +1493,14 @@ withIdentifier: pigeonIdentifierArg) completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAContentPlayhead.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMAContentPlayhead.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1373,21 +1518,25 @@ withIdentifier: pigeonIdentifierArg) } } protocol PigeonApiDelegateIMAAdsLoader { - func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsLoader, settings: IMASettings?) throws -> IMAAdsLoader + func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsLoader, settings: IMASettings?) throws + -> IMAAdsLoader /// Signal to the SDK that the content has completed. func contentComplete(pigeonApi: PigeonApiIMAAdsLoader, pigeonInstance: IMAAdsLoader) throws /// Request ads from the ad server. - func requestAds(pigeonApi: PigeonApiIMAAdsLoader, pigeonInstance: IMAAdsLoader, request: IMAAdsRequest) throws + func requestAds( + pigeonApi: PigeonApiIMAAdsLoader, pigeonInstance: IMAAdsLoader, request: IMAAdsRequest) throws /// Delegate that receives `IMAAdsLoaderDelegate` callbacks. /// /// Note that this sets to a `weak` property in Swift. - func setDelegate(pigeonApi: PigeonApiIMAAdsLoader, pigeonInstance: IMAAdsLoader, delegate: IMAAdsLoaderDelegate?) throws + func setDelegate( + pigeonApi: PigeonApiIMAAdsLoader, pigeonInstance: IMAAdsLoader, delegate: IMAAdsLoaderDelegate?) + throws } protocol PigeonApiProtocolIMAAdsLoader { } -final class PigeonApiIMAAdsLoader: PigeonApiProtocolIMAAdsLoader { +final class PigeonApiIMAAdsLoader: PigeonApiProtocolIMAAdsLoader { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdsLoader ///An implementation of [NSObject] used to access callback methods @@ -1395,17 +1544,25 @@ final class PigeonApiIMAAdsLoader: PigeonApiProtocolIMAAdsLoader { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdsLoader) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateIMAAdsLoader + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsLoader?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsLoader? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1413,8 +1570,8 @@ final class PigeonApiIMAAdsLoader: PigeonApiProtocolIMAAdsLoader { let settingsArg: IMASettings? = nilOrValue(args[1]) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, settings: settingsArg), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, settings: settingsArg), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1423,7 +1580,9 @@ withIdentifier: pigeonIdentifierArg) } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let contentCompleteChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.contentComplete", binaryMessenger: binaryMessenger, codec: codec) + let contentCompleteChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.contentComplete", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { contentCompleteChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1438,14 +1597,17 @@ withIdentifier: pigeonIdentifierArg) } else { contentCompleteChannel.setMessageHandler(nil) } - let requestAdsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.requestAds", binaryMessenger: binaryMessenger, codec: codec) + let requestAdsChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.requestAds", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { requestAdsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsLoader let requestArg = args[1] as! IMAAdsRequest do { - try api.pigeonDelegate.requestAds(pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) + try api.pigeonDelegate.requestAds( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1454,14 +1616,17 @@ withIdentifier: pigeonIdentifierArg) } else { requestAdsChannel.setMessageHandler(nil) } - let setDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.setDelegate", binaryMessenger: binaryMessenger, codec: codec) + let setDelegateChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.setDelegate", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setDelegateChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsLoader let delegateArg: IMAAdsLoaderDelegate? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + try api.pigeonDelegate.setDelegate( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1473,7 +1638,9 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of IMAAdsLoader and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: IMAAdsLoader, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: IMAAdsLoader, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1486,11 +1653,14 @@ withIdentifier: pigeonIdentifierArg) completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1513,7 +1683,7 @@ open class PigeonApiDelegateIMASettings { protocol PigeonApiProtocolIMASettings { } -final class PigeonApiIMASettings: PigeonApiProtocolIMASettings { +final class PigeonApiIMASettings: PigeonApiProtocolIMASettings { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMASettings ///An implementation of [NSObject] used to access callback methods @@ -1521,12 +1691,17 @@ final class PigeonApiIMASettings: PigeonApiProtocolIMASettings { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMASettings) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateIMASettings + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of IMASettings and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: IMASettings, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: IMASettings, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1539,11 +1714,14 @@ final class PigeonApiIMASettings: PigeonApiProtocolIMASettings { completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMASettings.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMASettings.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1563,13 +1741,16 @@ final class PigeonApiIMASettings: PigeonApiProtocolIMASettings { protocol PigeonApiDelegateIMAAdsRequest { /// Initializes an ads request instance with the given ad tag URL and ad /// display container. - func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsRequest, adTagUrl: String, adDisplayContainer: IMAAdDisplayContainer, contentPlayhead: IMAContentPlayhead?) throws -> IMAAdsRequest + func pigeonDefaultConstructor( + pigeonApi: PigeonApiIMAAdsRequest, adTagUrl: String, adDisplayContainer: IMAAdDisplayContainer, + contentPlayhead: IMAContentPlayhead? + ) throws -> IMAAdsRequest } protocol PigeonApiProtocolIMAAdsRequest { } -final class PigeonApiIMAAdsRequest: PigeonApiProtocolIMAAdsRequest { +final class PigeonApiIMAAdsRequest: PigeonApiProtocolIMAAdsRequest { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdsRequest ///An implementation of [NSObject] used to access callback methods @@ -1577,17 +1758,25 @@ final class PigeonApiIMAAdsRequest: PigeonApiProtocolIMAAdsRequest { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdsRequest) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateIMAAdsRequest + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsRequest?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsRequest? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRequest.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRequest.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1597,8 +1786,10 @@ final class PigeonApiIMAAdsRequest: PigeonApiProtocolIMAAdsRequest { let contentPlayheadArg: IMAContentPlayhead? = nilOrValue(args[3]) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, adTagUrl: adTagUrlArg, adDisplayContainer: adDisplayContainerArg, contentPlayhead: contentPlayheadArg), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor( + pigeonApi: api, adTagUrl: adTagUrlArg, adDisplayContainer: adDisplayContainerArg, + contentPlayhead: contentPlayheadArg), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1610,7 +1801,9 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of IMAAdsRequest and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: IMAAdsRequest, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: IMAAdsRequest, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1623,11 +1816,14 @@ withIdentifier: pigeonIdentifierArg) completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsRequest.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMAAdsRequest.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1645,17 +1841,24 @@ withIdentifier: pigeonIdentifierArg) } } protocol PigeonApiDelegateIMAAdsLoaderDelegate { - func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsLoaderDelegate) throws -> IMAAdsLoaderDelegate + func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsLoaderDelegate) throws + -> IMAAdsLoaderDelegate } protocol PigeonApiProtocolIMAAdsLoaderDelegate { /// Called when ads are successfully loaded from the ad servers by the loader. - func adLoaderLoadedWith(pigeonInstance pigeonInstanceArg: IMAAdsLoaderDelegate, loader loaderArg: IMAAdsLoader, adsLoadedData adsLoadedDataArg: IMAAdsLoadedData, completion: @escaping (Result) -> Void) + func adLoaderLoadedWith( + pigeonInstance pigeonInstanceArg: IMAAdsLoaderDelegate, loader loaderArg: IMAAdsLoader, + adsLoadedData adsLoadedDataArg: IMAAdsLoadedData, + completion: @escaping (Result) -> Void) /// Error reported by the ads loader when loading or requesting an ad fails. - func adsLoaderFailedWithErrorData(pigeonInstance pigeonInstanceArg: IMAAdsLoaderDelegate, loader loaderArg: IMAAdsLoader, adErrorData adErrorDataArg: IMAAdLoadingErrorData, completion: @escaping (Result) -> Void) + func adsLoaderFailedWithErrorData( + pigeonInstance pigeonInstanceArg: IMAAdsLoaderDelegate, loader loaderArg: IMAAdsLoader, + adErrorData adErrorDataArg: IMAAdLoadingErrorData, + completion: @escaping (Result) -> Void) } -final class PigeonApiIMAAdsLoaderDelegate: PigeonApiProtocolIMAAdsLoaderDelegate { +final class PigeonApiIMAAdsLoaderDelegate: PigeonApiProtocolIMAAdsLoaderDelegate { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdsLoaderDelegate ///An implementation of [NSObject] used to access callback methods @@ -1663,25 +1866,34 @@ final class PigeonApiIMAAdsLoaderDelegate: PigeonApiProtocolIMAAdsLoaderDelegate return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdsLoaderDelegate) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateIMAAdsLoaderDelegate + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsLoaderDelegate?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsLoaderDelegate? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoaderDelegate.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoaderDelegate.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1693,7 +1905,9 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of IMAAdsLoaderDelegate and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: IMAAdsLoaderDelegate, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: IMAAdsLoaderDelegate, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1706,10 +1920,16 @@ withIdentifier: pigeonIdentifierArg) completion(.success(Void())) return } - print("Error: Attempting to create a new Dart instance of IMAAdsLoaderDelegate, but the class has a nonnull callback method.") + print( + "Error: Attempting to create a new Dart instance of IMAAdsLoaderDelegate, but the class has a nonnull callback method." + ) } /// Called when ads are successfully loaded from the ad servers by the loader. - func adLoaderLoadedWith(pigeonInstance pigeonInstanceArg: IMAAdsLoaderDelegate, loader loaderArg: IMAAdsLoader, adsLoadedData adsLoadedDataArg: IMAAdsLoadedData, completion: @escaping (Result) -> Void) { + func adLoaderLoadedWith( + pigeonInstance pigeonInstanceArg: IMAAdsLoaderDelegate, loader loaderArg: IMAAdsLoader, + adsLoadedData adsLoadedDataArg: IMAAdsLoadedData, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1720,8 +1940,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoaderDelegate.adLoaderLoadedWith" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoaderDelegate.adLoaderLoadedWith" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, loaderArg, adsLoadedDataArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1739,7 +1961,11 @@ withIdentifier: pigeonIdentifierArg) } /// Error reported by the ads loader when loading or requesting an ad fails. - func adsLoaderFailedWithErrorData(pigeonInstance pigeonInstanceArg: IMAAdsLoaderDelegate, loader loaderArg: IMAAdsLoader, adErrorData adErrorDataArg: IMAAdLoadingErrorData, completion: @escaping (Result) -> Void) { + func adsLoaderFailedWithErrorData( + pigeonInstance pigeonInstanceArg: IMAAdsLoaderDelegate, loader loaderArg: IMAAdsLoader, + adErrorData adErrorDataArg: IMAAdLoadingErrorData, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1750,8 +1976,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoaderDelegate.adsLoaderFailedWithErrorData" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoaderDelegate.adsLoaderFailedWithErrorData" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, loaderArg, adErrorDataArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1773,13 +2001,14 @@ protocol PigeonApiDelegateIMAAdsLoadedData { /// The ads manager instance created by the ads loader. /// /// Will be null when using dynamic ad insertion. - func adsManager(pigeonApi: PigeonApiIMAAdsLoadedData, pigeonInstance: IMAAdsLoadedData) throws -> IMAAdsManager? + func adsManager(pigeonApi: PigeonApiIMAAdsLoadedData, pigeonInstance: IMAAdsLoadedData) throws + -> IMAAdsManager? } protocol PigeonApiProtocolIMAAdsLoadedData { } -final class PigeonApiIMAAdsLoadedData: PigeonApiProtocolIMAAdsLoadedData { +final class PigeonApiIMAAdsLoadedData: PigeonApiProtocolIMAAdsLoadedData { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdsLoadedData ///An implementation of [NSObject] used to access callback methods @@ -1787,12 +2016,17 @@ final class PigeonApiIMAAdsLoadedData: PigeonApiProtocolIMAAdsLoadedData { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdsLoadedData) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateIMAAdsLoadedData + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of IMAAdsLoadedData and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: IMAAdsLoadedData, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: IMAAdsLoadedData, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1805,12 +2039,16 @@ final class PigeonApiIMAAdsLoadedData: PigeonApiProtocolIMAAdsLoadedData { completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) - let adsManagerArg = try! pigeonDelegate.adsManager(pigeonApi: self, pigeonInstance: pigeonInstance) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let adsManagerArg = try! pigeonDelegate.adsManager( + pigeonApi: self, pigeonInstance: pigeonInstance) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoadedData.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMAAdsLoadedData.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg, adsManagerArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1829,13 +2067,14 @@ final class PigeonApiIMAAdsLoadedData: PigeonApiProtocolIMAAdsLoadedData { } protocol PigeonApiDelegateIMAAdLoadingErrorData { /// The ad error that occurred while loading the ad. - func adError(pigeonApi: PigeonApiIMAAdLoadingErrorData, pigeonInstance: IMAAdLoadingErrorData) throws -> IMAAdError + func adError(pigeonApi: PigeonApiIMAAdLoadingErrorData, pigeonInstance: IMAAdLoadingErrorData) + throws -> IMAAdError } protocol PigeonApiProtocolIMAAdLoadingErrorData { } -final class PigeonApiIMAAdLoadingErrorData: PigeonApiProtocolIMAAdLoadingErrorData { +final class PigeonApiIMAAdLoadingErrorData: PigeonApiProtocolIMAAdLoadingErrorData { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdLoadingErrorData ///An implementation of [NSObject] used to access callback methods @@ -1843,12 +2082,17 @@ final class PigeonApiIMAAdLoadingErrorData: PigeonApiProtocolIMAAdLoadingErrorDa return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdLoadingErrorData) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateIMAAdLoadingErrorData + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of IMAAdLoadingErrorData and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: IMAAdLoadingErrorData, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: IMAAdLoadingErrorData, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1861,12 +2105,15 @@ final class PigeonApiIMAAdLoadingErrorData: PigeonApiProtocolIMAAdLoadingErrorDa completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) let adErrorArg = try! pigeonDelegate.adError(pigeonApi: self, pigeonInstance: pigeonInstance) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdLoadingErrorData.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMAAdLoadingErrorData.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg, adErrorArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1895,7 +2142,7 @@ protocol PigeonApiDelegateIMAAdError { protocol PigeonApiProtocolIMAAdError { } -final class PigeonApiIMAAdError: PigeonApiProtocolIMAAdError { +final class PigeonApiIMAAdError: PigeonApiProtocolIMAAdError { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdError ///An implementation of [NSObject] used to access callback methods @@ -1903,12 +2150,17 @@ final class PigeonApiIMAAdError: PigeonApiProtocolIMAAdError { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdError) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateIMAAdError + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of IMAAdError and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: IMAAdError, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: IMAAdError, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -1921,14 +2173,17 @@ final class PigeonApiIMAAdError: PigeonApiProtocolIMAAdError { completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) let typeArg = try! pigeonDelegate.type(pigeonApi: self, pigeonInstance: pigeonInstance) let codeArg = try! pigeonDelegate.code(pigeonApi: self, pigeonInstance: pigeonInstance) let messageArg = try! pigeonDelegate.message(pigeonApi: self, pigeonInstance: pigeonInstance) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdError.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMAAdError.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg, typeArg, codeArg, messageArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1947,9 +2202,13 @@ final class PigeonApiIMAAdError: PigeonApiProtocolIMAAdError { } protocol PigeonApiDelegateIMAAdsManager { /// The `IMAAdsManagerDelegate` to notify with events during ad playback. - func setDelegate(pigeonApi: PigeonApiIMAAdsManager, pigeonInstance: IMAAdsManager, delegate: IMAAdsManagerDelegate?) throws + func setDelegate( + pigeonApi: PigeonApiIMAAdsManager, pigeonInstance: IMAAdsManager, + delegate: IMAAdsManagerDelegate?) throws /// Initializes and loads the ad. - func initialize(pigeonApi: PigeonApiIMAAdsManager, pigeonInstance: IMAAdsManager, adsRenderingSettings: IMAAdsRenderingSettings?) throws + func initialize( + pigeonApi: PigeonApiIMAAdsManager, pigeonInstance: IMAAdsManager, + adsRenderingSettings: IMAAdsRenderingSettings?) throws /// Starts advertisement playback. func start(pigeonApi: PigeonApiIMAAdsManager, pigeonInstance: IMAAdsManager) throws /// Pauses advertisement. @@ -1968,7 +2227,7 @@ protocol PigeonApiDelegateIMAAdsManager { protocol PigeonApiProtocolIMAAdsManager { } -final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { +final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdsManager ///An implementation of [NSObject] used to access callback methods @@ -1976,24 +2235,33 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdsManager) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateIMAAdsManager + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsManager?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsManager? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let setDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.setDelegate", binaryMessenger: binaryMessenger, codec: codec) + let setDelegateChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.setDelegate", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setDelegateChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsManager let delegateArg: IMAAdsManagerDelegate? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + try api.pigeonDelegate.setDelegate( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2002,14 +2270,18 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { } else { setDelegateChannel.setMessageHandler(nil) } - let initializeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.initialize", binaryMessenger: binaryMessenger, codec: codec) + let initializeChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.initialize", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { initializeChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsManager let adsRenderingSettingsArg: IMAAdsRenderingSettings? = nilOrValue(args[1]) do { - try api.pigeonDelegate.initialize(pigeonApi: api, pigeonInstance: pigeonInstanceArg, adsRenderingSettings: adsRenderingSettingsArg) + try api.pigeonDelegate.initialize( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, + adsRenderingSettings: adsRenderingSettingsArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2018,7 +2290,9 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { } else { initializeChannel.setMessageHandler(nil) } - let startChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.start", binaryMessenger: binaryMessenger, codec: codec) + let startChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.start", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { startChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2033,7 +2307,9 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { } else { startChannel.setMessageHandler(nil) } - let pauseChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.pause", binaryMessenger: binaryMessenger, codec: codec) + let pauseChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.pause", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pauseChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2048,7 +2324,9 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { } else { pauseChannel.setMessageHandler(nil) } - let resumeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.resume", binaryMessenger: binaryMessenger, codec: codec) + let resumeChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.resume", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { resumeChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2063,7 +2341,9 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { } else { resumeChannel.setMessageHandler(nil) } - let skipChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.skip", binaryMessenger: binaryMessenger, codec: codec) + let skipChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.skip", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { skipChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2078,7 +2358,9 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { } else { skipChannel.setMessageHandler(nil) } - let discardAdBreakChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.discardAdBreak", binaryMessenger: binaryMessenger, codec: codec) + let discardAdBreakChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.discardAdBreak", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { discardAdBreakChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2093,7 +2375,9 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { } else { discardAdBreakChannel.setMessageHandler(nil) } - let destroyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.destroy", binaryMessenger: binaryMessenger, codec: codec) + let destroyChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.destroy", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { destroyChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2111,7 +2395,9 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { } ///Creates a Dart instance of IMAAdsManager and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: IMAAdsManager, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: IMAAdsManager, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2124,11 +2410,14 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMAAdsManager.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2146,21 +2435,34 @@ final class PigeonApiIMAAdsManager: PigeonApiProtocolIMAAdsManager { } } protocol PigeonApiDelegateIMAAdsManagerDelegate { - func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsManagerDelegate) throws -> IMAAdsManagerDelegate + func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsManagerDelegate) throws + -> IMAAdsManagerDelegate } protocol PigeonApiProtocolIMAAdsManagerDelegate { /// Called when there is an IMAAdEvent. - func didReceiveAdEvent(pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, adsManager adsManagerArg: IMAAdsManager, event eventArg: IMAAdEvent, completion: @escaping (Result) -> Void) + func didReceiveAdEvent( + pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, + adsManager adsManagerArg: IMAAdsManager, event eventArg: IMAAdEvent, + completion: @escaping (Result) -> Void) /// Called when there was an error playing the ad. - func didReceiveAdError(pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, adsManager adsManagerArg: IMAAdsManager, error errorArg: IMAAdError, completion: @escaping (Result) -> Void) + func didReceiveAdError( + pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, + adsManager adsManagerArg: IMAAdsManager, error errorArg: IMAAdError, + completion: @escaping (Result) -> Void) /// Called when an ad is ready to play. - func didRequestContentPause(pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, adsManager adsManagerArg: IMAAdsManager, completion: @escaping (Result) -> Void) + func didRequestContentPause( + pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, + adsManager adsManagerArg: IMAAdsManager, + completion: @escaping (Result) -> Void) /// Called when an ad has finished or an error occurred during the playback. - func didRequestContentResume(pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, adsManager adsManagerArg: IMAAdsManager, completion: @escaping (Result) -> Void) + func didRequestContentResume( + pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, + adsManager adsManagerArg: IMAAdsManager, + completion: @escaping (Result) -> Void) } -final class PigeonApiIMAAdsManagerDelegate: PigeonApiProtocolIMAAdsManagerDelegate { +final class PigeonApiIMAAdsManagerDelegate: PigeonApiProtocolIMAAdsManagerDelegate { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdsManagerDelegate ///An implementation of [NSObject] used to access callback methods @@ -2168,25 +2470,34 @@ final class PigeonApiIMAAdsManagerDelegate: PigeonApiProtocolIMAAdsManagerDelega return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdsManagerDelegate) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateIMAAdsManagerDelegate + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsManagerDelegate?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsManagerDelegate? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2198,7 +2509,9 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of IMAAdsManagerDelegate and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: IMAAdsManagerDelegate, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: IMAAdsManagerDelegate, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2211,10 +2524,16 @@ withIdentifier: pigeonIdentifierArg) completion(.success(Void())) return } - print("Error: Attempting to create a new Dart instance of IMAAdsManagerDelegate, but the class has a nonnull callback method.") + print( + "Error: Attempting to create a new Dart instance of IMAAdsManagerDelegate, but the class has a nonnull callback method." + ) } /// Called when there is an IMAAdEvent. - func didReceiveAdEvent(pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, adsManager adsManagerArg: IMAAdsManager, event eventArg: IMAAdEvent, completion: @escaping (Result) -> Void) { + func didReceiveAdEvent( + pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, + adsManager adsManagerArg: IMAAdsManager, event eventArg: IMAAdEvent, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2225,8 +2544,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.didReceiveAdEvent" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.didReceiveAdEvent" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, adsManagerArg, eventArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2244,7 +2565,11 @@ withIdentifier: pigeonIdentifierArg) } /// Called when there was an error playing the ad. - func didReceiveAdError(pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, adsManager adsManagerArg: IMAAdsManager, error errorArg: IMAAdError, completion: @escaping (Result) -> Void) { + func didReceiveAdError( + pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, + adsManager adsManagerArg: IMAAdsManager, error errorArg: IMAAdError, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2255,8 +2580,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.didReceiveAdError" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.didReceiveAdError" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, adsManagerArg, errorArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2274,7 +2601,11 @@ withIdentifier: pigeonIdentifierArg) } /// Called when an ad is ready to play. - func didRequestContentPause(pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, adsManager adsManagerArg: IMAAdsManager, completion: @escaping (Result) -> Void) { + func didRequestContentPause( + pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, + adsManager adsManagerArg: IMAAdsManager, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2285,8 +2616,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.didRequestContentPause" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.didRequestContentPause" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, adsManagerArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2304,7 +2637,11 @@ withIdentifier: pigeonIdentifierArg) } /// Called when an ad has finished or an error occurred during the playback. - func didRequestContentResume(pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, adsManager adsManagerArg: IMAAdsManager, completion: @escaping (Result) -> Void) { + func didRequestContentResume( + pigeonInstance pigeonInstanceArg: IMAAdsManagerDelegate, + adsManager adsManagerArg: IMAAdsManager, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2315,8 +2652,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.didRequestContentResume" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.didRequestContentResume" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, adsManagerArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2346,7 +2685,7 @@ protocol PigeonApiDelegateIMAAdEvent { protocol PigeonApiProtocolIMAAdEvent { } -final class PigeonApiIMAAdEvent: PigeonApiProtocolIMAAdEvent { +final class PigeonApiIMAAdEvent: PigeonApiProtocolIMAAdEvent { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdEvent ///An implementation of [NSObject] used to access callback methods @@ -2354,12 +2693,17 @@ final class PigeonApiIMAAdEvent: PigeonApiProtocolIMAAdEvent { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdEvent) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateIMAAdEvent + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of IMAAdEvent and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: IMAAdEvent, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: IMAAdEvent, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2372,15 +2716,20 @@ final class PigeonApiIMAAdEvent: PigeonApiProtocolIMAAdEvent { completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) let typeArg = try! pigeonDelegate.type(pigeonApi: self, pigeonInstance: pigeonInstance) - let typeStringArg = try! pigeonDelegate.typeString(pigeonApi: self, pigeonInstance: pigeonInstance) + let typeStringArg = try! pigeonDelegate.typeString( + pigeonApi: self, pigeonInstance: pigeonInstance) let adDataArg = try! pigeonDelegate.adData(pigeonApi: self, pigeonInstance: pigeonInstance) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdEvent.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg, typeArg, typeStringArg, adDataArg] as [Any?]) { response in + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMAAdEvent.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg, typeArg, typeStringArg, adDataArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -2397,13 +2746,14 @@ final class PigeonApiIMAAdEvent: PigeonApiProtocolIMAAdEvent { } } protocol PigeonApiDelegateIMAAdsRenderingSettings { - func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsRenderingSettings) throws -> IMAAdsRenderingSettings + func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsRenderingSettings) throws + -> IMAAdsRenderingSettings } protocol PigeonApiProtocolIMAAdsRenderingSettings { } -final class PigeonApiIMAAdsRenderingSettings: PigeonApiProtocolIMAAdsRenderingSettings { +final class PigeonApiIMAAdsRenderingSettings: PigeonApiProtocolIMAAdsRenderingSettings { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdsRenderingSettings ///An implementation of [NSObject] used to access callback methods @@ -2411,25 +2761,34 @@ final class PigeonApiIMAAdsRenderingSettings: PigeonApiProtocolIMAAdsRenderingSe return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdsRenderingSettings) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateIMAAdsRenderingSettings + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsRenderingSettings?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAAdsRenderingSettings? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2441,7 +2800,10 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of IMAAdsRenderingSettings and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: IMAAdsRenderingSettings, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: IMAAdsRenderingSettings, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2454,11 +2816,14 @@ withIdentifier: pigeonIdentifierArg) completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2481,15 +2846,20 @@ open class PigeonApiDelegateNSObject { protocol PigeonApiProtocolNSObject { } -final class PigeonApiNSObject: PigeonApiProtocolNSObject { +final class PigeonApiNSObject: PigeonApiProtocolNSObject { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateNSObject - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateNSObject) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateNSObject + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of NSObject and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: NSObject, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: NSObject, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -2502,11 +2872,13 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { completion(.success(Void())) return } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec let channelName: String = "dev.flutter.pigeon.interactive_media_ads.NSObject.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) diff --git a/packages/interactive_media_ads/lib/src/android/interactive_media_ads.g.dart b/packages/interactive_media_ads/lib/src/android/interactive_media_ads.g.dart index a228dd5f2d6c..8e823fc117aa 100644 --- a/packages/interactive_media_ads/lib/src/android/interactive_media_ads.g.dart +++ b/packages/interactive_media_ads/lib/src/android/interactive_media_ads.g.dart @@ -8,7 +8,8 @@ import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; -import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer, immutable, protected; +import 'package:flutter/foundation.dart' + show ReadBuffer, WriteBuffer, immutable, protected; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart' show WidgetsFlutterBinding; @@ -19,7 +20,8 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse( + {Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -28,6 +30,7 @@ List wrapResponse({Object? result, PlatformException? error, bool empty } return [error.code, error.message, error.details]; } + /// An immutable object that serves as the base class for all ProxyApis and /// can provide functional copies of itself. /// @@ -113,7 +116,8 @@ class PigeonInstanceManager { final Expando _identifiers = Expando(); final Map> _weakInstances = >{}; - final Map _strongInstances = {}; + final Map _strongInstances = + {}; late final Finalizer _finalizer; int _nextIdentifier = 0; @@ -131,33 +135,59 @@ class PigeonInstanceManager { api.removeStrongReference(identifier); }, ); - _PigeonInstanceManagerApi.setUpMessageHandlers(instanceManager: instanceManager); - BaseDisplayContainer.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - AdDisplayContainer.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - AdsLoader.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - AdsManagerLoadedEvent.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - AdErrorEvent.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - AdError.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - AdsRequest.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - ContentProgressProvider.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - AdsManager.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - BaseManager.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - AdEvent.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - ImaSdkFactory.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - ImaSdkSettings.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - VideoProgressUpdate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - AdMediaInfo.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - AdPodInfo.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - FrameLayout.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - ViewGroup.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - VideoView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + _PigeonInstanceManagerApi.setUpMessageHandlers( + instanceManager: instanceManager); + BaseDisplayContainer.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + AdDisplayContainer.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + AdsLoader.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + AdsManagerLoadedEvent.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + AdErrorEvent.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + AdError.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + AdsRequest.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + ContentProgressProvider.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + AdsManager.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + BaseManager.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + AdEvent.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + ImaSdkFactory.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + ImaSdkSettings.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + VideoProgressUpdate.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + AdMediaInfo.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + AdPodInfo.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + FrameLayout.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + ViewGroup.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + VideoView.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); View.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - MediaPlayer.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - VideoAdPlayerCallback.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - VideoAdPlayer.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - AdsLoadedListener.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - AdErrorListener.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - AdEventListener.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + MediaPlayer.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + VideoAdPlayerCallback.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + VideoAdPlayer.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + AdsLoadedListener.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + AdErrorListener.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + AdEventListener.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); return instanceManager; } @@ -221,15 +251,19 @@ class PigeonInstanceManager { /// /// This method also expects the host `InstanceManager` to have a strong /// reference to the instance the identifier is associated with. - T? getInstanceWithWeakReference(int identifier) { - final PigeonProxyApiBaseClass? weakInstance = _weakInstances[identifier]?.target; + T? getInstanceWithWeakReference( + int identifier) { + final PigeonProxyApiBaseClass? weakInstance = + _weakInstances[identifier]?.target; if (weakInstance == null) { - final PigeonProxyApiBaseClass? strongInstance = _strongInstances[identifier]; + final PigeonProxyApiBaseClass? strongInstance = + _strongInstances[identifier]; if (strongInstance != null) { final PigeonProxyApiBaseClass copy = strongInstance.pigeon_copy(); _identifiers[copy] = identifier; - _weakInstances[identifier] = WeakReference(copy); + _weakInstances[identifier] = + WeakReference(copy); _finalizer.attach(copy, identifier, detach: copy); return copy as T; } @@ -253,17 +287,20 @@ class PigeonInstanceManager { /// added. /// /// Returns unique identifier of the [instance] added. - void addHostCreatedInstance(PigeonProxyApiBaseClass instance, int identifier) { + void addHostCreatedInstance( + PigeonProxyApiBaseClass instance, int identifier) { _addInstanceWithIdentifier(instance, identifier); } - void _addInstanceWithIdentifier(PigeonProxyApiBaseClass instance, int identifier) { + void _addInstanceWithIdentifier( + PigeonProxyApiBaseClass instance, int identifier) { assert(!containsIdentifier(identifier)); assert(getIdentifier(instance) == null); assert(identifier >= 0); _identifiers[instance] = identifier; - _weakInstances[identifier] = WeakReference(instance); + _weakInstances[identifier] = + WeakReference(instance); _finalizer.attach(instance, identifier, detach: instance); final PigeonProxyApiBaseClass copy = instance.pigeon_copy(); @@ -387,29 +424,29 @@ class _PigeonInstanceManagerApi { } class _PigeonProxyApiBaseCodec extends _PigeonCodec { - const _PigeonProxyApiBaseCodec(this.instanceManager); - final PigeonInstanceManager instanceManager; - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is PigeonProxyApiBaseClass) { - buffer.putUint8(128); - writeValue(buffer, instanceManager.getIdentifier(value)); - } else { - super.writeValue(buffer, value); - } - } - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return instanceManager - .getInstanceWithWeakReference(readValue(buffer)! as int); - default: - return super.readValueOfType(type, buffer); - } - } -} + const _PigeonProxyApiBaseCodec(this.instanceManager); + final PigeonInstanceManager instanceManager; + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is PigeonProxyApiBaseClass) { + buffer.putUint8(128); + writeValue(buffer, instanceManager.getIdentifier(value)); + } else { + super.writeValue(buffer, value); + } + } + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return instanceManager + .getInstanceWithWeakReference(readValue(buffer)! as int); + default: + return super.readValueOfType(type, buffer); + } + } +} /// The types of error that can be encountered. /// @@ -417,56 +454,79 @@ class _PigeonProxyApiBaseCodec extends _PigeonCodec { enum AdErrorCode { /// Ads player was not provided. adsPlayerWasNotProvided, + /// There was a problem requesting ads from the server. adsRequestNetworkError, + /// A companion ad failed to load or render. companionAdLoadingFailed, + /// There was a problem requesting ads from the server. failedToRequestAds, + /// An error internal to the SDK occurred. internalError, + /// Invalid arguments were provided to SDK methods. invalidArguments, + /// An overlay ad failed to load. overlayAdLoadingFailed, + /// An overlay ad failed to render. overlayAdPlayingFailed, + /// Ads list was returned but ContentProgressProvider was not configured. playlistNoContentTracking, + /// Ads loader sent ads loaded event when it was not expected. unexpectedAdsLoadedEvent, + /// The ad response was not understood and cannot be parsed. unknownAdResponse, + /// An unexpected error occurred and the cause is not known. unknownError, + /// No assets were found in the VAST ad response. vastAssetNotFound, + /// A VAST response containing a single `` tag with no child tags. vastEmptyResponse, + /// Assets were found in the VAST ad response for a linear ad, but none of /// them matched the video player's capabilities. vastLinearAssetMismatch, + /// At least one VAST wrapper ad loaded successfully and a subsequent wrapper /// or inline ad load has timed out. vastLoadTimeout, + /// The ad response was not recognized as a valid VAST ad. vastMalformedResponse, + /// Failed to load media assets from a VAST response. vastMediaLoadTimeout, + /// Assets were found in the VAST ad response for a nonlinear ad, but none of /// them matched the video player's capabilities. vastNonlinearAssetMismatch, + /// No Ads VAST response after one or more wrappers. vastNoAdsAfterWrapper, + /// The maximum number of VAST wrapper redirects has been reached. vastTooManyRedirects, + /// Trafficking error. /// /// Video player received an ad type that it was not expecting and/or cannot /// display. vastTraffickingError, + /// There was an error playing the video ad. videoPlayError, + /// The error code is not recognized by this wrapper. unknown, } @@ -477,8 +537,10 @@ enum AdErrorCode { enum AdErrorType { /// Indicates that the error was encountered when the ad was being loaded. load, + /// Indicates that the error was encountered after the ad loaded, during ad play. play, + /// The error is not recognized by this wrapper. unknown, } @@ -489,66 +551,92 @@ enum AdErrorType { enum AdEventType { /// Fired when an ad break in a stream ends. adBreakEnded, + /// Fired when an ad break will not play back any ads. adBreakFetchError, + /// Fired when an ad break is ready from VMAP or ad rule ads. adBreakReady, + /// Fired when an ad break in a stream starts. adBreakStarted, + /// Fired when playback stalls while the ad buffers. adBuffering, + /// Fired when an ad period in a stream ends. adPeriodEnded, + /// Fired when an ad period in a stream starts. adPeriodStarted, + /// Fired to inform of ad progress and can be used by publisher to display a /// countdown timer. adProgress, + /// Fired when the ads manager is done playing all the valid ads in the ads /// response, or when the response doesn't return any valid ads. allAdsCompleted, + /// Fired when an ad is clicked. clicked, + /// Fired when an ad completes playing. completed, + /// Fired when content should be paused. contentPauseRequested, + /// Fired when content should be resumed. contentResumeRequested, + /// Fired when VOD stream cuepoints have changed. cuepointsChanged, + /// Fired when the ad playhead crosses first quartile. firstQuartile, + /// The user has closed the icon fallback image dialog. iconFallbackImageClosed, + /// The user has tapped an ad icon. iconTapped, + /// Fired when the VAST response has been received. loaded, + /// Fired to enable the SDK to communicate a message to be logged, which is /// stored in adData. log, + /// Fired when the ad playhead crosses midpoint. midpoint, + /// Fired when an ad is paused. paused, + /// Fired when an ad is resumed. resumed, + /// Fired when an ad changes its skippable state. skippableStateChanged, + /// Fired when an ad was skipped. skipped, + /// Fired when an ad starts playing. started, + /// Fired when a non-clickthrough portion of a video ad is clicked. tapped, + /// Fired when the ad playhead crosses third quartile. thirdQuartile, + /// The event type is not recognized by this wrapper. unknown, } - class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -556,10 +644,10 @@ class _PigeonCodec extends StandardMessageCodec { if (value is AdErrorCode) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is AdErrorType) { + } else if (value is AdErrorType) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is AdEventType) { + } else if (value is AdEventType) { buffer.putUint8(131); writeValue(buffer, value.index); } else { @@ -570,13 +658,13 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: final int? value = readValue(buffer) as int?; return value == null ? null : AdErrorCode.values[value]; - case 130: + case 130: final int? value = readValue(buffer) as int?; return value == null ? null : AdErrorType.values[value]; - case 131: + case 131: final int? value = readValue(buffer) as int?; return value == null ? null : AdEventType.values[value]; default: @@ -584,6 +672,7 @@ class _PigeonCodec extends StandardMessageCodec { } } } + /// A base class for more specialized container interfaces. /// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseDisplayContainer.html. @@ -4680,4 +4769,3 @@ class AdEventListener extends PigeonProxyApiBaseClass { ); } } - diff --git a/packages/interactive_media_ads/lib/src/ios/interactive_media_ads.g.dart b/packages/interactive_media_ads/lib/src/ios/interactive_media_ads.g.dart index 4e1570217908..32368a1ddf4f 100644 --- a/packages/interactive_media_ads/lib/src/ios/interactive_media_ads.g.dart +++ b/packages/interactive_media_ads/lib/src/ios/interactive_media_ads.g.dart @@ -8,7 +8,8 @@ import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; -import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer, immutable, protected; +import 'package:flutter/foundation.dart' + show ReadBuffer, WriteBuffer, immutable, protected; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart' show WidgetsFlutterBinding; @@ -19,7 +20,8 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse( + {Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -28,6 +30,7 @@ List wrapResponse({Object? result, PlatformException? error, bool empty } return [error.code, error.message, error.details]; } + /// An immutable object that serves as the base class for all ProxyApis and /// can provide functional copies of itself. /// @@ -113,7 +116,8 @@ class PigeonInstanceManager { final Expando _identifiers = Expando(); final Map> _weakInstances = >{}; - final Map _strongInstances = {}; + final Map _strongInstances = + {}; late final Finalizer _finalizer; int _nextIdentifier = 0; @@ -131,23 +135,39 @@ class PigeonInstanceManager { api.removeStrongReference(identifier); }, ); - _PigeonInstanceManagerApi.setUpMessageHandlers(instanceManager: instanceManager); - IMAAdDisplayContainer.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + _PigeonInstanceManagerApi.setUpMessageHandlers( + instanceManager: instanceManager); + IMAAdDisplayContainer.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); UIView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - UIViewController.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - IMAContentPlayhead.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - IMAAdsLoader.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - IMASettings.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - IMAAdsRequest.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - IMAAdsLoaderDelegate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - IMAAdsLoadedData.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - IMAAdLoadingErrorData.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - IMAAdError.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - IMAAdsManager.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - IMAAdsManagerDelegate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - IMAAdEvent.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - IMAAdsRenderingSettings.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - NSObject.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + UIViewController.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + IMAContentPlayhead.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + IMAAdsLoader.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + IMASettings.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + IMAAdsRequest.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + IMAAdsLoaderDelegate.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + IMAAdsLoadedData.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + IMAAdLoadingErrorData.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + IMAAdError.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + IMAAdsManager.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + IMAAdsManagerDelegate.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + IMAAdEvent.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + IMAAdsRenderingSettings.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + NSObject.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); return instanceManager; } @@ -211,15 +231,19 @@ class PigeonInstanceManager { /// /// This method also expects the host `InstanceManager` to have a strong /// reference to the instance the identifier is associated with. - T? getInstanceWithWeakReference(int identifier) { - final PigeonProxyApiBaseClass? weakInstance = _weakInstances[identifier]?.target; + T? getInstanceWithWeakReference( + int identifier) { + final PigeonProxyApiBaseClass? weakInstance = + _weakInstances[identifier]?.target; if (weakInstance == null) { - final PigeonProxyApiBaseClass? strongInstance = _strongInstances[identifier]; + final PigeonProxyApiBaseClass? strongInstance = + _strongInstances[identifier]; if (strongInstance != null) { final PigeonProxyApiBaseClass copy = strongInstance.pigeon_copy(); _identifiers[copy] = identifier; - _weakInstances[identifier] = WeakReference(copy); + _weakInstances[identifier] = + WeakReference(copy); _finalizer.attach(copy, identifier, detach: copy); return copy as T; } @@ -243,17 +267,20 @@ class PigeonInstanceManager { /// added. /// /// Returns unique identifier of the [instance] added. - void addHostCreatedInstance(PigeonProxyApiBaseClass instance, int identifier) { + void addHostCreatedInstance( + PigeonProxyApiBaseClass instance, int identifier) { _addInstanceWithIdentifier(instance, identifier); } - void _addInstanceWithIdentifier(PigeonProxyApiBaseClass instance, int identifier) { + void _addInstanceWithIdentifier( + PigeonProxyApiBaseClass instance, int identifier) { assert(!containsIdentifier(identifier)); assert(getIdentifier(instance) == null); assert(identifier >= 0); _identifiers[instance] = identifier; - _weakInstances[identifier] = WeakReference(instance); + _weakInstances[identifier] = + WeakReference(instance); _finalizer.attach(instance, identifier, detach: instance); final PigeonProxyApiBaseClass copy = instance.pigeon_copy(); @@ -377,29 +404,29 @@ class _PigeonInstanceManagerApi { } class _PigeonProxyApiBaseCodec extends _PigeonCodec { - const _PigeonProxyApiBaseCodec(this.instanceManager); - final PigeonInstanceManager instanceManager; - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is PigeonProxyApiBaseClass) { - buffer.putUint8(128); - writeValue(buffer, instanceManager.getIdentifier(value)); - } else { - super.writeValue(buffer, value); - } - } - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return instanceManager - .getInstanceWithWeakReference(readValue(buffer)! as int); - default: - return super.readValueOfType(type, buffer); - } - } -} + const _PigeonProxyApiBaseCodec(this.instanceManager); + final PigeonInstanceManager instanceManager; + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is PigeonProxyApiBaseClass) { + buffer.putUint8(128); + writeValue(buffer, instanceManager.getIdentifier(value)); + } else { + super.writeValue(buffer, value); + } + } + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return instanceManager + .getInstanceWithWeakReference(readValue(buffer)! as int); + default: + return super.readValueOfType(type, buffer); + } + } +} /// Possible error types while loading or playing ads. /// @@ -407,8 +434,10 @@ class _PigeonProxyApiBaseCodec extends _PigeonCodec { enum AdErrorType { /// An error occurred while loading the ads. loadingFailed, + /// An error occurred while playing the ads. adPlayingFailed, + /// An unexpected error occurred while loading or playing the ads. /// /// This may mean that the SDK wasn’t loaded properly or the wrapper doesn't @@ -422,58 +451,81 @@ enum AdErrorType { enum AdErrorCode { /// The ad slot is not visible on the page. adslotNotVisible, + /// Generic invalid usage of the API. apiError, + /// A companion ad failed to load or render. companionAdLoadingFailed, + /// Content playhead was not passed in, but list of ads has been returned from /// the server. contentPlayheadMissing, + /// There was an error loading the ad. failedLoadingAd, + /// There was a problem requesting ads from the server. failedToRequestAds, + /// Invalid arguments were provided to SDK methods. invalidArguments, + /// The version of the runtime is too old. osRuntimeTooOld, + /// Ads list response was malformed. playlistMalformedResponse, + /// Listener for at least one of the required vast events was not added. requiredListenersNotAdded, + /// There was an error initializing the stream. streamInitializationFailed, + /// An unexpected error occurred and the cause is not known. unknownError, + /// No assets were found in the VAST ad response. vastAssetNotFound, + /// A VAST response containing a single `` tag with no child tags. vastEmptyResponse, + /// At least one VAST wrapper loaded and a subsequent wrapper or inline ad /// load has resulted in a 404 response code. vastInvalidUrl, + /// Assets were found in the VAST ad response for a linear ad, but none of /// them matched the video player's capabilities. vastLinearAssetMismatch, + /// The VAST URI provided, or a VAST URI provided in a subsequent Wrapper /// element, was either unavailable or reached a timeout, as defined by the /// video player. vastLoadTimeout, + /// The ad response was not recognized as a valid VAST ad. vastMalformedResponse, + /// Failed to load media assets from a VAST response. vastMediaLoadTimeout, + /// The maximum number of VAST wrapper redirects has been reached. vastTooManyRedirects, + /// Trafficking error. /// /// Video player received an ad type that it was not expecting and/or cannot /// display. vastTraffickingError, + /// Another VideoAdsManager is still using the video. videoElementUsed, + /// A video element was not specified where it was required. videoElementRequired, + /// There was an error playing the video ad. videoPlayError, } @@ -484,53 +536,77 @@ enum AdErrorCode { enum AdEventType { /// Fired the first time each ad break ends. adBreakEnded, + /// Fired when an ad break will not play back any ads. adBreakFetchError, + /// Fired when an ad break is ready. adBreakReady, + /// Fired first time each ad break begins playback. adBreakStarted, + /// Fired every time the stream switches from advertising or slate to content. adPeriodEnded, + /// Fired every time the stream switches from content to advertising or slate. adPeriodStarted, + /// All valid ads managed by the ads manager have completed or the ad response /// did not return any valid ads. allAdsCompleted, + /// Fired when an ad is clicked. clicked, + /// Single ad has finished. completed, + /// Cuepoints changed for VOD stream (only used for dynamic ad insertion). cuepointsChanged, + /// First quartile of a linear ad was reached. firstQuartile, + /// The user has closed the icon fallback image dialog. iconFallbackImageClosed, + /// The user has tapped an ad icon. iconTapped, + /// An ad was loaded. loaded, + /// A log event for the ads being played. log, + /// Midpoint of a linear ad was reached. midpoint, + /// Ad paused. pause, + /// Ad resumed. resume, + /// Fired when an ad was skipped. skipped, + /// Fired when an ad starts playing. started, + /// Stream request has loaded (only used for dynamic ad insertion). streamLoaded, + /// Stream has started playing (only used for dynamic ad insertion). streamStarted, + /// Ad tapped. tapped, + /// Third quartile of a linear ad was reached.. thirdQuartile, + /// The event type is not recognized by this wrapper. unknown, } @@ -542,12 +618,15 @@ enum KeyValueObservingOptions { /// Indicates that the change dictionary should provide the new attribute /// value, if applicable. newValue, + /// Indicates that the change dictionary should contain the old attribute /// value, if applicable. oldValue, + /// If specified, a notification should be sent to the observer immediately, /// before the observer registration method even returns. initialValue, + /// Whether separate notifications should be sent to the observer before and /// after each change, instead of a single notification after the change. priorNotification, @@ -559,12 +638,15 @@ enum KeyValueObservingOptions { enum KeyValueChange { /// Indicates that the value of the observed key path was set to a new value. setting, + /// Indicates that an object has been inserted into the to-many relationship /// that is being observed. insertion, + /// Indicates that an object has been removed from the to-many relationship /// that is being observed. removal, + /// Indicates that an object has been replaced in the to-many relationship /// that is being observed. replacement, @@ -579,25 +661,29 @@ enum KeyValueChangeKey { /// this key is an NSIndexSet object that contains the indexes of the /// inserted, removed, or replaced objects. indexes, + /// An NSNumber object that contains a value corresponding to one of the /// NSKeyValueChange enums, indicating what sort of change has occurred. kind, + /// If the value of the kindKey entry is NSKeyValueChange.setting, and new was /// specified when the observer was registered, the value of this key is the /// new value for the attribute. newValue, + /// If the prior option was specified when the observer was registered this /// notification is sent prior to a change. notificationIsPrior, + /// If the value of the kindKey entry is NSKeyValueChange.setting, and old was /// specified when the observer was registered, the value of this key is the /// value before the attribute was changed. oldValue, + /// The key is not recognized by this wrapper. unknown, } - class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -605,19 +691,19 @@ class _PigeonCodec extends StandardMessageCodec { if (value is AdErrorType) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is AdErrorCode) { + } else if (value is AdErrorCode) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is AdEventType) { + } else if (value is AdEventType) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is KeyValueObservingOptions) { + } else if (value is KeyValueObservingOptions) { buffer.putUint8(132); writeValue(buffer, value.index); - } else if (value is KeyValueChange) { + } else if (value is KeyValueChange) { buffer.putUint8(133); writeValue(buffer, value.index); - } else if (value is KeyValueChangeKey) { + } else if (value is KeyValueChangeKey) { buffer.putUint8(134); writeValue(buffer, value.index); } else { @@ -628,22 +714,22 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: final int? value = readValue(buffer) as int?; return value == null ? null : AdErrorType.values[value]; - case 130: + case 130: final int? value = readValue(buffer) as int?; return value == null ? null : AdErrorCode.values[value]; - case 131: + case 131: final int? value = readValue(buffer) as int?; return value == null ? null : AdEventType.values[value]; - case 132: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : KeyValueObservingOptions.values[value]; - case 133: + case 133: final int? value = readValue(buffer) as int?; return value == null ? null : KeyValueChange.values[value]; - case 134: + case 134: final int? value = readValue(buffer) as int?; return value == null ? null : KeyValueChangeKey.values[value]; default: @@ -651,6 +737,7 @@ class _PigeonCodec extends StandardMessageCodec { } } } + /// The `IMAAdDisplayContainer` is responsible for managing the ad container /// view and companion ad slots used for ad playback. /// @@ -2972,4 +3059,3 @@ class NSObject extends PigeonProxyApiBaseClass { ); } } - From 7131e653988b2876ce81be32fddba4b481a973cd Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 1 Aug 2024 19:24:42 -0400 Subject: [PATCH 05/14] version bump --- packages/interactive_media_ads/CHANGELOG.md | 4 ++++ .../packages/interactive_media_ads/AdsRequestProxyApi.kt | 2 +- .../interactive_media_ads/AdsRequestProxyAPIDelegate.swift | 2 +- .../pigeons/interactive_media_ads_ios.dart | 2 ++ packages/interactive_media_ads/pubspec.yaml | 7 +------ 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/interactive_media_ads/CHANGELOG.md b/packages/interactive_media_ads/CHANGELOG.md index ff077c7acc49..ea83bcc2ef76 100644 --- a/packages/interactive_media_ads/CHANGELOG.md +++ b/packages/interactive_media_ads/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.2 + +* Adds support for all `AdEventType`s and ad data. + ## 0.1.1+1 * Fixes a typo in the formatting of the CHANGELOG. diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt index 3f828b5d587f..295adef3dcbc 100644 --- a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt +++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt @@ -21,7 +21,7 @@ class AdsRequestProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) : * * This must match the version in pubspec.yaml. */ - const val pluginVersion = "0.1.1+1" + const val pluginVersion = "0.1.2" } override fun setAdTagUrl(pigeon_instance: AdsRequest, adTagUrl: String) { diff --git a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdsRequestProxyAPIDelegate.swift b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdsRequestProxyAPIDelegate.swift index c02ebf0a668a..429393dda5c5 100644 --- a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdsRequestProxyAPIDelegate.swift +++ b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdsRequestProxyAPIDelegate.swift @@ -13,7 +13,7 @@ class AdsRequestProxyAPIDelegate: PigeonApiDelegateIMAAdsRequest { /// The current version of the `interactive_media_ads` plugin. /// /// This must match the version in pubspec.yaml. - static let pluginVersion = "0.1.1+1" + static let pluginVersion = "0.1.2" func pigeonDefaultConstructor( pigeonApi: PigeonApiIMAAdsRequest, adTagUrl: String, adDisplayContainer: IMAAdDisplayContainer, diff --git a/packages/interactive_media_ads/pigeons/interactive_media_ads_ios.dart b/packages/interactive_media_ads/pigeons/interactive_media_ads_ios.dart index 5777bb838ace..17046ad0b3a2 100644 --- a/packages/interactive_media_ads/pigeons/interactive_media_ads_ios.dart +++ b/packages/interactive_media_ads/pigeons/interactive_media_ads_ios.dart @@ -7,6 +7,7 @@ // Swift ProxyApi feature from pigeon. // ignore_for_file: avoid_unused_constructor_parameters +/* import 'package:pigeon/pigeon.dart'; @ConfigurePigeon( @@ -507,3 +508,4 @@ abstract class IMAAdsRenderingSettings extends NSObject { /// See https://developer.apple.com/documentation/objectivec/nsobject. @ProxyApi() abstract class NSObject {} +*/ diff --git a/packages/interactive_media_ads/pubspec.yaml b/packages/interactive_media_ads/pubspec.yaml index 0c5d9f2d3f31..f4b919fbaee3 100644 --- a/packages/interactive_media_ads/pubspec.yaml +++ b/packages/interactive_media_ads/pubspec.yaml @@ -2,7 +2,7 @@ name: interactive_media_ads description: A Flutter plugin for using the Interactive Media Ads SDKs on Android and iOS. repository: https://github.com/flutter/packages/tree/main/packages/interactive_media_ads issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+interactive_media_ads%22 -version: 0.1.1+1 # This must match the version in +version: 0.1.2 # This must match the version in # `android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt` and # `ios/interactive_media_ads/Sources/interactive_media_ads/AdsRequestProxyAPIDelegate.swift` @@ -31,11 +31,6 @@ dev_dependencies: flutter_test: sdk: flutter mockito: 5.4.4 - pigeon: - git: - url: https://github.com/bparrishMines/packages.git - ref: pigeon_wrapper_swift - path: packages/pigeon topics: - ads From 5457c5a6296aabe6ed99fb3efbb3872cf2323dc7 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 1 Aug 2024 19:26:43 -0400 Subject: [PATCH 06/14] remove return --- packages/interactive_media_ads/example/lib/main.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/interactive_media_ads/example/lib/main.dart b/packages/interactive_media_ads/example/lib/main.dart index 83cfc4676c0f..94bc09eff060 100644 --- a/packages/interactive_media_ads/example/lib/main.dart +++ b/packages/interactive_media_ads/example/lib/main.dart @@ -107,8 +107,6 @@ class _AdExampleWidgetState extends State { case AdEventType.complete: case _: } - - return; }, onAdErrorEvent: (AdErrorEvent event) { debugPrint('AdErrorEvent: ${event.error.message}'); From 10e2b2ce9efc98d9f4f5e48d9f38275677f92081 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 1 Aug 2024 19:28:26 -0400 Subject: [PATCH 07/14] comments --- .../pigeons/interactive_media_ads_android.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart b/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart index 8331c5418d02..716fa6cebe33 100644 --- a/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart +++ b/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart @@ -1,12 +1,12 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// + // TODO(bparrishMines): Uncomment this file once // https://github.com/flutter/packages/pull/6371 lands. This file uses the // Kotlin ProxyApi feature from pigeon. // ignore_for_file: avoid_unused_constructor_parameters - +// // import 'package:pigeon/pigeon.dart'; // // @ConfigurePigeon( From 791b1ec945acd82ee8d3092af16e045e61db3dea Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 1 Aug 2024 19:34:04 -0400 Subject: [PATCH 08/14] update excertps --- packages/interactive_media_ads/CHANGELOG.md | 2 +- packages/interactive_media_ads/README.md | 3 ++- packages/interactive_media_ads/example/lib/main.dart | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/interactive_media_ads/CHANGELOG.md b/packages/interactive_media_ads/CHANGELOG.md index ea83bcc2ef76..8ebb8fb7ebea 100644 --- a/packages/interactive_media_ads/CHANGELOG.md +++ b/packages/interactive_media_ads/CHANGELOG.md @@ -1,6 +1,6 @@ ## 0.1.2 -* Adds support for all `AdEventType`s and ad data. +* Adds support for all `AdEventType`s and ad data. See `AdEventType.adData`. ## 0.1.1+1 diff --git a/packages/interactive_media_ads/README.md b/packages/interactive_media_ads/README.md index 5153177159dc..4b585e746a8e 100644 --- a/packages/interactive_media_ads/README.md +++ b/packages/interactive_media_ads/README.md @@ -203,7 +203,7 @@ Future _requestAds(AdDisplayContainer container) { manager.setAdsManagerDelegate(AdsManagerDelegate( onAdEvent: (AdEvent event) { - debugPrint('OnAdEvent: ${event.type}'); + debugPrint('OnAdEvent: ${event.type} => ${event.adData}'); switch (event.type) { case AdEventType.loaded: manager.start(); @@ -216,6 +216,7 @@ Future _requestAds(AdDisplayContainer container) { _adsManager = null; case AdEventType.clicked: case AdEventType.complete: + case _: } }, onAdErrorEvent: (AdErrorEvent event) { diff --git a/packages/interactive_media_ads/example/lib/main.dart b/packages/interactive_media_ads/example/lib/main.dart index 94bc09eff060..13d6efff9c34 100644 --- a/packages/interactive_media_ads/example/lib/main.dart +++ b/packages/interactive_media_ads/example/lib/main.dart @@ -92,7 +92,7 @@ class _AdExampleWidgetState extends State { manager.setAdsManagerDelegate(AdsManagerDelegate( onAdEvent: (AdEvent event) { - debugPrint('OnAdEvent: ${event.type}'); + debugPrint('OnAdEvent: ${event.type} => ${event.adData}'); switch (event.type) { case AdEventType.loaded: manager.start(); From d60cfdf60bcd71b1e23e123ae678d26e69e1d8e3 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 1 Aug 2024 19:35:55 -0400 Subject: [PATCH 09/14] fix changelog --- packages/interactive_media_ads/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/interactive_media_ads/CHANGELOG.md b/packages/interactive_media_ads/CHANGELOG.md index 8ebb8fb7ebea..db6a62eb0a21 100644 --- a/packages/interactive_media_ads/CHANGELOG.md +++ b/packages/interactive_media_ads/CHANGELOG.md @@ -1,6 +1,6 @@ ## 0.1.2 -* Adds support for all `AdEventType`s and ad data. See `AdEventType.adData`. +* Adds support for all `AdEventType`s and ad data. See `AdEvent.adData`. ## 0.1.1+1 From d61c0a92f6ee0d40b005a8c3becb437a521dd37c Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 1 Aug 2024 20:02:58 -0400 Subject: [PATCH 10/14] fix android impl --- .../interactive_media_ads/AdEventProxyApi.kt | 2 +- .../InteractiveMediaAdsLibrary.g.kt | 3 ++- .../lib/src/android/android_ads_manager.dart | 3 ++- .../lib/src/android/interactive_media_ads.g.dart | 13 ++++++------- .../pigeons/interactive_media_ads_android.dart | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdEventProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdEventProxyApi.kt index f4c6eed04f6a..8cbf527a3751 100644 --- a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdEventProxyApi.kt +++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdEventProxyApi.kt @@ -47,7 +47,7 @@ class AdEventProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) : } } - override fun adData(pigeon_instance: AdEvent): Map { + override fun adData(pigeon_instance: AdEvent): Map? { return pigeon_instance.adData } } diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt index 5a490b981ffd..df43de21fc9e 100644 --- a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt +++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt @@ -1782,9 +1782,10 @@ abstract class PigeonApiAdEvent( /** The type of event that occurred. */ abstract fun type(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdEvent): AdEventType + /** A map containing any extra ad data for the event, if needed. */ abstract fun adData( pigeon_instance: com.google.ads.interactivemedia.v3.api.AdEvent - ): Map + ): Map? @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of AdEvent and attaches it to [pigeon_instanceArg]. */ diff --git a/packages/interactive_media_ads/lib/src/android/android_ads_manager.dart b/packages/interactive_media_ads/lib/src/android/android_ads_manager.dart index 69e7fcd067eb..0c0943c46f7f 100644 --- a/packages/interactive_media_ads/lib/src/android/android_ads_manager.dart +++ b/packages/interactive_media_ads/lib/src/android/android_ads_manager.dart @@ -60,7 +60,8 @@ class AndroidAdsManager extends PlatformAdsManager { weakThis.target?._managerDelegate?.params.onAdEvent?.call( AdEvent( type: toInterfaceEventType(event.type), - adData: event.adData.cast(), + adData: + event.adData?.cast() ?? {}, ), ); }, diff --git a/packages/interactive_media_ads/lib/src/android/interactive_media_ads.g.dart b/packages/interactive_media_ads/lib/src/android/interactive_media_ads.g.dart index 8e823fc117aa..1fca04f82608 100644 --- a/packages/interactive_media_ads/lib/src/android/interactive_media_ads.g.dart +++ b/packages/interactive_media_ads/lib/src/android/interactive_media_ads.g.dart @@ -1810,13 +1810,14 @@ class AdEvent extends PigeonProxyApiBaseClass { super.pigeon_binaryMessenger, super.pigeon_instanceManager, required this.type, - required this.adData, + this.adData, }); /// The type of event that occurred. final AdEventType type; - final Map adData; + /// A map containing any extra ad data for the event, if needed. + final Map? adData; static void pigeon_setUpMessageHandlers({ bool pigeon_clearHandlers = false, @@ -1824,7 +1825,7 @@ class AdEvent extends PigeonProxyApiBaseClass { PigeonInstanceManager? pigeon_instanceManager, AdEvent Function( AdEventType type, - Map adData, + Map? adData, )? pigeon_newInstance, }) { final _PigeonProxyApiBaseCodec pigeonChannelCodec = @@ -1852,17 +1853,15 @@ class AdEvent extends PigeonProxyApiBaseClass { 'Argument for dev.flutter.pigeon.interactive_media_ads.AdEvent.pigeon_newInstance was null, expected non-null AdEventType.'); final Map? arg_adData = (args[2] as Map?)?.cast(); - assert(arg_adData != null, - 'Argument for dev.flutter.pigeon.interactive_media_ads.AdEvent.pigeon_newInstance was null, expected non-null Map.'); try { (pigeon_instanceManager ?? PigeonInstanceManager.instance) .addHostCreatedInstance( - pigeon_newInstance?.call(arg_type!, arg_adData!) ?? + pigeon_newInstance?.call(arg_type!, arg_adData) ?? AdEvent.pigeon_detached( pigeon_binaryMessenger: pigeon_binaryMessenger, pigeon_instanceManager: pigeon_instanceManager, type: arg_type!, - adData: arg_adData!, + adData: arg_adData, ), arg_pigeon_instanceIdentifier!, ); diff --git a/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart b/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart index 716fa6cebe33..736e0ab82873 100644 --- a/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart +++ b/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart @@ -387,7 +387,7 @@ // late final AdEventType type; // // /// A map containing any extra ad data for the event, if needed. -// late final Map adData; +// late final Map? adData; // } // // /// Factory class for creating SDK objects. From bd74d5172ec11913e75b322c530a61457246ec42 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 2 Aug 2024 16:22:53 -0400 Subject: [PATCH 11/14] lint --- .../interactive_media_ads/InteractiveMediaAdsLibrary.g.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt index df43de21fc9e..b88f1ba596cf 100644 --- a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt +++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt @@ -3,7 +3,7 @@ // found in the LICENSE file. // Autogenerated from Pigeon (v21.2.0), do not edit directly. // See also: https://pub.dev/packages/pigeon -@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") +@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass", "SyntheticAccessor") package dev.flutter.packages.interactive_media_ads From dca8c94b49b5cf8be32a4a5ed067026e4b1b70c2 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 5 Aug 2024 19:27:29 -0400 Subject: [PATCH 12/14] change to hello world --- .../interactive_media_ads/test/android/ads_manager_tests.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/interactive_media_ads/test/android/ads_manager_tests.dart b/packages/interactive_media_ads/test/android/ads_manager_tests.dart index 029b6daacaf4..c2fd71c41612 100644 --- a/packages/interactive_media_ads/test/android/ads_manager_tests.dart +++ b/packages/interactive_media_ads/test/android/ads_manager_tests.dart @@ -80,7 +80,7 @@ void main() { PlatformAdsManagerDelegateCreationParams( onAdEvent: expectAsync1((AdEvent event) { expect(event.type, AdEventType.allAdsCompleted); - expect(event.adData, {'shrek': 'donkey'}); + expect(event.adData, {'hello': 'world'}); }), ), ), @@ -88,7 +88,7 @@ void main() { final MockAdEvent mockAdEvent = MockAdEvent(); when(mockAdEvent.type).thenReturn(ima.AdEventType.allAdsCompleted); - when(mockAdEvent.adData).thenReturn({'shrek': 'donkey'}); + when(mockAdEvent.adData).thenReturn({'hello': 'world'}); onAdEventCallback(MockAdEventListener(), mockAdEvent); }); From f643353cad1a956d43a8f68d4ae9fe46104efc27 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 8 Aug 2024 20:08:22 -0400 Subject: [PATCH 13/14] hello world and ignoreCallsToDart onDetached --- .../InteractiveMediaAdsPlugin.kt | 1 + .../interactive_media_ads_android.dart | 1437 +++++++++-------- .../test/ios/ads_manager_delegate_tests.dart | 2 +- 3 files changed, 721 insertions(+), 719 deletions(-) diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsPlugin.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsPlugin.kt index e56f58685dd3..ce7d1fba5741 100644 --- a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsPlugin.kt +++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsPlugin.kt @@ -31,6 +31,7 @@ class InteractiveMediaAdsPlugin : FlutterPlugin, ActivityAware { } override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) { + registrar.ignoreCallsToDart = true registrar.tearDown() registrar.instanceManager.clear() } diff --git a/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart b/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart index 736e0ab82873..0dc2201399f2 100644 --- a/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart +++ b/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart @@ -6,721 +6,722 @@ // https://github.com/flutter/packages/pull/6371 lands. This file uses the // Kotlin ProxyApi feature from pigeon. // ignore_for_file: avoid_unused_constructor_parameters -// -// import 'package:pigeon/pigeon.dart'; -// -// @ConfigurePigeon( -// PigeonOptions( -// copyrightHeader: 'pigeons/copyright.txt', -// dartOut: 'lib/src/android/interactive_media_ads.g.dart', -// kotlinOut: -// 'android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt', -// kotlinOptions: KotlinOptions( -// package: 'dev.flutter.packages.interactive_media_ads', -// ), -// ), -// ) -// -// /// The types of error that can be encountered. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorCode.html. -// enum AdErrorCode { -// /// Ads player was not provided. -// adsPlayerWasNotProvided, -// -// /// There was a problem requesting ads from the server. -// adsRequestNetworkError, -// -// /// A companion ad failed to load or render. -// companionAdLoadingFailed, -// -// /// There was a problem requesting ads from the server. -// failedToRequestAds, -// -// /// An error internal to the SDK occurred. -// internalError, -// -// /// Invalid arguments were provided to SDK methods. -// invalidArguments, -// -// /// An overlay ad failed to load. -// overlayAdLoadingFailed, -// -// /// An overlay ad failed to render. -// overlayAdPlayingFailed, -// -// /// Ads list was returned but ContentProgressProvider was not configured. -// playlistNoContentTracking, -// -// /// Ads loader sent ads loaded event when it was not expected. -// unexpectedAdsLoadedEvent, -// -// /// The ad response was not understood and cannot be parsed. -// unknownAdResponse, -// -// /// An unexpected error occurred and the cause is not known. -// unknownError, -// -// /// No assets were found in the VAST ad response. -// vastAssetNotFound, -// -// /// A VAST response containing a single `` tag with no child tags. -// vastEmptyResponse, -// -// /// Assets were found in the VAST ad response for a linear ad, but none of -// /// them matched the video player's capabilities. -// vastLinearAssetMismatch, -// -// /// At least one VAST wrapper ad loaded successfully and a subsequent wrapper -// /// or inline ad load has timed out. -// vastLoadTimeout, -// -// /// The ad response was not recognized as a valid VAST ad. -// vastMalformedResponse, -// -// /// Failed to load media assets from a VAST response. -// vastMediaLoadTimeout, -// -// /// Assets were found in the VAST ad response for a nonlinear ad, but none of -// /// them matched the video player's capabilities. -// vastNonlinearAssetMismatch, -// -// /// No Ads VAST response after one or more wrappers. -// vastNoAdsAfterWrapper, -// -// /// The maximum number of VAST wrapper redirects has been reached. -// vastTooManyRedirects, -// -// /// Trafficking error. -// /// -// /// Video player received an ad type that it was not expecting and/or cannot -// /// display. -// vastTraffickingError, -// -// /// There was an error playing the video ad. -// videoPlayError, -// -// /// The error code is not recognized by this wrapper. -// unknown, -// } -// -// /// Specifies when the error was encountered, during either ad loading or playback. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorType.html. -// enum AdErrorType { -// /// Indicates that the error was encountered when the ad was being loaded. -// load, -// -// /// Indicates that the error was encountered after the ad loaded, during ad play. -// play, -// -// /// The error is not recognized by this wrapper. -// unknown, -// } -// -// /// Types of events that can occur during ad playback. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventType.html. -// enum AdEventType { -// /// Fired when an ad break in a stream ends. -// adBreakEnded, -// -// /// Fired when an ad break will not play back any ads. -// adBreakFetchError, -// -// /// Fired when an ad break is ready from VMAP or ad rule ads. -// adBreakReady, -// -// /// Fired when an ad break in a stream starts. -// adBreakStarted, -// -// /// Fired when playback stalls while the ad buffers. -// adBuffering, -// -// /// Fired when an ad period in a stream ends. -// adPeriodEnded, -// -// /// Fired when an ad period in a stream starts. -// adPeriodStarted, -// -// /// Fired to inform of ad progress and can be used by publisher to display a -// /// countdown timer. -// adProgress, -// -// /// Fired when the ads manager is done playing all the valid ads in the ads -// /// response, or when the response doesn't return any valid ads. -// allAdsCompleted, -// -// /// Fired when an ad is clicked. -// clicked, -// -// /// Fired when an ad completes playing. -// completed, -// -// /// Fired when content should be paused. -// contentPauseRequested, -// -// /// Fired when content should be resumed. -// contentResumeRequested, -// -// /// Fired when VOD stream cuepoints have changed. -// cuepointsChanged, -// -// /// Fired when the ad playhead crosses first quartile. -// firstQuartile, -// -// /// The user has closed the icon fallback image dialog. -// iconFallbackImageClosed, -// -// /// The user has tapped an ad icon. -// iconTapped, -// -// /// Fired when the VAST response has been received. -// loaded, -// -// /// Fired to enable the SDK to communicate a message to be logged, which is -// /// stored in adData. -// log, -// -// /// Fired when the ad playhead crosses midpoint. -// midpoint, -// -// /// Fired when an ad is paused. -// paused, -// -// /// Fired when an ad is resumed. -// resumed, -// -// /// Fired when an ad changes its skippable state. -// skippableStateChanged, -// -// /// Fired when an ad was skipped. -// skipped, -// -// /// Fired when an ad starts playing. -// started, -// -// /// Fired when a non-clickthrough portion of a video ad is clicked. -// tapped, -// -// /// Fired when the ad playhead crosses third quartile. -// thirdQuartile, -// -// /// The event type is not recognized by this wrapper. -// unknown, -// } -// -// /// A base class for more specialized container interfaces. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseDisplayContainer.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: -// 'com.google.ads.interactivemedia.v3.api.BaseDisplayContainer', -// ), -// ) -// abstract class BaseDisplayContainer {} -// -// /// A container in which to display the ads. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdDisplayContainer. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdDisplayContainer', -// ), -// ) -// abstract class AdDisplayContainer implements BaseDisplayContainer {} -// -// /// An object which allows publishers to request ads from ad servers or a -// /// dynamic ad insertion stream. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdsLoader', -// ), -// ) -// abstract class AdsLoader { -// /// Registers a listener for errors that occur during the ads request. -// void addAdErrorListener(AdErrorListener listener); -// -// /// Registers a listener for the ads manager loaded event. -// void addAdsLoadedListener(AdsLoadedListener listener); -// -// /// Requests ads from a server. -// void requestAds(AdsRequest request); -// } -// -// /// An event raised when ads are successfully loaded from the ad server through an AdsLoader. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManagerLoadedEvent.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: -// 'com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent', -// ), -// ) -// abstract class AdsManagerLoadedEvent { -// /// The ads manager that will control playback of the loaded ads, or null when -// /// using dynamic ad insertion. -// late final AdsManager manager; -// } -// -// /// An event raised when there is an error loading or playing ads. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdErrorEvent', -// ), -// ) -// abstract class AdErrorEvent { -// /// The AdError that caused this event. -// late final AdError error; -// } -// -// /// An error that occurred in the SDK. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdError', -// ), -// ) -// abstract class AdError { -// /// The error's code. -// late final AdErrorCode errorCode; -// -// /// The error code's number. -// late final int errorCodeNumber; -// -// /// The error's type. -// late final AdErrorType errorType; -// -// /// A human-readable summary of the error. -// late final String message; -// } -// -// /// An object containing the data used to request ads from the server. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsRequest. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdsRequest', -// ), -// ) -// abstract class AdsRequest { -// /// Sets the URL from which ads will be requested. -// void setAdTagUrl(String adTagUrl); -// -// /// Attaches a ContentProgressProvider instance to allow scheduling ad breaks -// /// based on content progress (cue points). -// void setContentProgressProvider(ContentProgressProvider provider); -// } -// -// /// Defines an interface to allow SDK to track progress of the content video. -// /// -// /// See https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/android/api/reference/com/google/ads/interactivemedia/v3/api/player/ContentProgressProvider.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: -// 'com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider', -// ), -// ) -// abstract class ContentProgressProvider {} -// -// /// An object which handles playing ads after they've been received from the -// /// server. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManager. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdsManager', -// ), -// ) -// abstract class AdsManager extends BaseManager { -// /// Discards current ad break and resumes content. -// void discardAdBreak(); -// -// /// Pauses the current ad. -// void pause(); -// -// /// Starts playing the ads. -// void start(); -// } -// -// /// Base interface for managing ads.. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseManager.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.BaseManager', -// ), -// ) -// abstract class BaseManager { -// /// Registers a listener for errors that occur during the ad or stream -// /// initialization and playback. -// void addAdErrorListener(AdErrorListener errorListener); -// -// /// Registers a listener for ad events that occur during ad or stream -// /// initialization and playback. -// void addAdEventListener(AdEventListener adEventListener); -// -// /// Stops the ad and all tracking, then releases all assets that were loaded -// /// to play the ad. -// void destroy(); -// -// /// Initializes the ad experience using default rendering settings -// void init(); -// } -// -// /// Event to notify publisher that an event occurred with an Ad. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdEvent', -// ), -// ) -// abstract class AdEvent { -// /// The type of event that occurred. -// late final AdEventType type; -// -// /// A map containing any extra ad data for the event, if needed. -// late final Map? adData; -// } -// -// /// Factory class for creating SDK objects. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkFactory. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.ImaSdkFactory', -// ), -// ) -// abstract class ImaSdkFactory { -// @static -// @attached -// late final ImaSdkFactory instance; -// -// @static -// AdDisplayContainer createAdDisplayContainer( -// ViewGroup container, -// VideoAdPlayer player, -// ); -// -// /// Creates an `ImaSdkSettings` object for configuring the IMA SDK. -// ImaSdkSettings createImaSdkSettings(); -// -// /// Creates an `AdsLoader` for requesting ads using the specified settings -// /// object. -// AdsLoader createAdsLoader( -// ImaSdkSettings settings, -// AdDisplayContainer container, -// ); -// -// /// Creates an AdsRequest object to contain the data used to request ads. -// AdsRequest createAdsRequest(); -// } -// -// /// Defines general SDK settings that are used when creating an `AdsLoader`. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkSettings.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.ImaSdkSettings', -// ), -// ) -// abstract class ImaSdkSettings {} -// -// /// Defines an update to the video's progress. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoProgressUpdate.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: -// 'com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate', -// ), -// ) -// abstract class VideoProgressUpdate { -// VideoProgressUpdate(int currentTimeMs, int durationMs); -// -// /// Value to use for cases when progress is not yet defined, such as video -// /// initialization. -// @static -// @attached -// late final VideoProgressUpdate videoTimeNotReady; -// } -// -// /// The minimal information required to play an ad. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/AdMediaInfo.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.player.AdMediaInfo', -// ), -// ) -// abstract class AdMediaInfo { -// late final String url; -// } -// -// /// An ad may be part of a pod of ads. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdPodInfo.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'com.google.ads.interactivemedia.v3.api.AdPodInfo', -// ), -// ) -// abstract class AdPodInfo { -// /// The position of the ad within the pod. -// /// -// /// The value returned is one-based, for example, 1 of 2, 2 of 2, etc. If the -// /// ad is not part of a pod, this will return 1. -// late final int adPosition; -// -// /// The maximum duration of the pod in seconds. -// /// -// /// For unknown duration, -1 is returned. -// late final double maxDuration; -// -// /// Client side and DAI VOD: Returns the index of the ad pod. -// late final int podIndex; -// -// /// The content time offset at which the current ad pod was scheduled. -// /// -// /// For preroll pod, 0 is returned. For midrolls, the scheduled time is -// /// returned in seconds. For postroll, -1 is returned. Defaults to 0 if this -// /// ad is not part of a pod, or the pod is not part of an ad playlist. -// late final double timeOffset; -// -// /// The total number of ads contained within this pod, including bumpers. -// late final int totalAds; -// -// /// Returns true if the ad is a bumper ad. -// late final bool isBumper; -// } -// -// /// FrameLayout is designed to block out an area on the screen to display a -// /// single item. -// /// -// /// See https://developer.android.com/reference/android/widget/FrameLayout. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'android.widget.FrameLayout', -// ), -// ) -// abstract class FrameLayout extends ViewGroup { -// FrameLayout(); -// } -// -// /// A special view that can contain other views (called children.) -// /// -// /// See https://developer.android.com/reference/android/view/ViewGroup. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'android.view.ViewGroup', -// ), -// ) -// abstract class ViewGroup extends View { -// void addView(View view); -// } -// -// /// Displays a video file. -// /// -// /// See https://developer.android.com/reference/android/widget/VideoView. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'android.widget.VideoView', -// ), -// ) -// abstract class VideoView extends View { -// VideoView(); -// -// /// Callback to be invoked when the media source is ready for playback. -// late final void Function(MediaPlayer player)? onPrepared; -// -// /// Callback to be invoked when playback of a media source has completed. -// late final void Function(MediaPlayer player)? onCompletion; -// -// /// Callback to be invoked when there has been an error during an asynchronous -// /// operation. -// late final void Function(MediaPlayer player, int what, int extra) onError; -// -// /// Sets the URI of the video. -// void setVideoUri(String uri); -// -// /// The current position of the playing video. -// /// -// /// In milliseconds. -// int getCurrentPosition(); -// } -// -// /// This class represents the basic building block for user interface components. -// /// -// /// See https://developer.android.com/reference/android/view/View. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions(fullClassName: 'android.view.View'), -// ) -// abstract class View {} -// -// /// MediaPlayer class can be used to control playback of audio/video files and -// /// streams. -// /// -// /// See https://developer.android.com/reference/android/media/MediaPlayer. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: 'android.media.MediaPlayer', -// ), -// ) -// abstract class MediaPlayer { -// /// Gets the duration of the file. -// int getDuration(); -// -// /// Seeks to specified time position. -// void seekTo(int mSec); -// -// /// Starts or resumes playback. -// void start(); -// -// /// Pauses playback. -// void pause(); -// -// /// Stops playback after playback has been started or paused. -// void stop(); -// } -// -// /// Callbacks that the player must fire. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.VideoAdPlayerCallback.html -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: -// 'com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback', -// ), -// ) -// abstract class VideoAdPlayerCallback { -// /// Fire this callback periodically as ad playback occurs. -// void onAdProgress( -// AdMediaInfo adMediaInfo, -// VideoProgressUpdate videoProgressUpdate, -// ); -// -// /// Fire this callback when video playback stalls waiting for data. -// void onBuffering(AdMediaInfo adMediaInfo); -// -// /// Fire this callback when all content has finished playing. -// void onContentComplete(); -// -// /// Fire this callback when the video finishes playing. -// void onEnded(AdMediaInfo adMediaInfo); -// -// /// Fire this callback when the video has encountered an error. -// void onError(AdMediaInfo adMediaInfo); -// -// /// Fire this callback when the video is ready to begin playback. -// void onLoaded(AdMediaInfo adMediaInfo); -// -// /// Fire this callback when the video is paused. -// void onPause(AdMediaInfo adMediaInfo); -// -// /// Fire this callback when the player begins playing a video. -// void onPlay(AdMediaInfo adMediaInfo); -// -// /// Fire this callback when the video is unpaused. -// void onResume(AdMediaInfo adMediaInfo); -// -// /// Fire this callback when the playback volume changes. -// void onVolumeChanged(AdMediaInfo adMediaInfo, int percentage); -// } -// -// /// Defines the set of methods that a video player must implement to be used by -// /// the IMA SDK, as well as a set of callbacks that it must fire. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: -// 'com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer', -// ), -// ) -// abstract class VideoAdPlayer { -// VideoAdPlayer(); -// -// /// Adds a callback. -// late final void Function(VideoAdPlayerCallback callback) addCallback; -// -// /// Loads a video ad hosted at AdMediaInfo. -// late final void Function(AdMediaInfo adMediaInfo, AdPodInfo adPodInfo) loadAd; -// -// /// Pauses playing the current ad. -// late final void Function(AdMediaInfo adMediaInfo) pauseAd; -// -// /// Starts or resumes playing the video ad referenced by the AdMediaInfo, -// /// provided loadAd has already been called for it. -// late final void Function(AdMediaInfo adMediaInfo) playAd; -// -// /// Cleans up and releases all resources used by the `VideoAdPlayer`. -// late final void Function() release; -// -// /// Removes a callback. -// late final void Function(VideoAdPlayerCallback callback) removeCallback; -// -// /// Stops playing the current ad. -// late final void Function(AdMediaInfo adMediaInfo) stopAd; -// -// /// The volume of the player as a percentage from 0 to 100. -// void setVolume(int value); -// -// /// The `VideoProgressUpdate` describing playback progress of the current -// /// video. -// void setAdProgress(VideoProgressUpdate progress); -// } -// -// /// Listener interface for notification of ad load or stream load completion. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader.AdsLoadedListener.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: -// 'com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener', -// ), -// ) -// abstract class AdsLoadedListener { -// AdsLoadedListener(); -// -// /// Called once the AdsManager or StreamManager has been loaded. -// late final void Function(AdsManagerLoadedEvent event) onAdsManagerLoaded; -// } -// -// /// Interface for classes that will listen to AdErrorEvents. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.AdErrorListener.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: -// 'com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener', -// ), -// ) -// abstract class AdErrorListener { -// AdErrorListener(); -// -// /// Called when an error occurs. -// late final void Function(AdErrorEvent event) onAdError; -// } -// -// /// Listener interface for ad events. -// /// -// /// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventListener.html. -// @ProxyApi( -// kotlinOptions: KotlinProxyApiOptions( -// fullClassName: -// 'com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener', -// ), -// ) -// abstract class AdEventListener { -// AdEventListener(); -// -// /// Respond to an occurrence of an AdEvent. -// late final void Function(AdEvent event) onAdEvent; -// } +/* +import 'package:pigeon/pigeon.dart'; + +@ConfigurePigeon( + PigeonOptions( + copyrightHeader: 'pigeons/copyright.txt', + dartOut: 'lib/src/android/interactive_media_ads.g.dart', + kotlinOut: + 'android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt', + kotlinOptions: KotlinOptions( + package: 'dev.flutter.packages.interactive_media_ads', + ), + ), +) + +/// The types of error that can be encountered. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorCode.html. +enum AdErrorCode { + /// Ads player was not provided. + adsPlayerWasNotProvided, + + /// There was a problem requesting ads from the server. + adsRequestNetworkError, + + /// A companion ad failed to load or render. + companionAdLoadingFailed, + + /// There was a problem requesting ads from the server. + failedToRequestAds, + + /// An error internal to the SDK occurred. + internalError, + + /// Invalid arguments were provided to SDK methods. + invalidArguments, + + /// An overlay ad failed to load. + overlayAdLoadingFailed, + + /// An overlay ad failed to render. + overlayAdPlayingFailed, + + /// Ads list was returned but ContentProgressProvider was not configured. + playlistNoContentTracking, + + /// Ads loader sent ads loaded event when it was not expected. + unexpectedAdsLoadedEvent, + + /// The ad response was not understood and cannot be parsed. + unknownAdResponse, + + /// An unexpected error occurred and the cause is not known. + unknownError, + + /// No assets were found in the VAST ad response. + vastAssetNotFound, + + /// A VAST response containing a single `` tag with no child tags. + vastEmptyResponse, + + /// Assets were found in the VAST ad response for a linear ad, but none of + /// them matched the video player's capabilities. + vastLinearAssetMismatch, + + /// At least one VAST wrapper ad loaded successfully and a subsequent wrapper + /// or inline ad load has timed out. + vastLoadTimeout, + + /// The ad response was not recognized as a valid VAST ad. + vastMalformedResponse, + + /// Failed to load media assets from a VAST response. + vastMediaLoadTimeout, + + /// Assets were found in the VAST ad response for a nonlinear ad, but none of + /// them matched the video player's capabilities. + vastNonlinearAssetMismatch, + + /// No Ads VAST response after one or more wrappers. + vastNoAdsAfterWrapper, + + /// The maximum number of VAST wrapper redirects has been reached. + vastTooManyRedirects, + + /// Trafficking error. + /// + /// Video player received an ad type that it was not expecting and/or cannot + /// display. + vastTraffickingError, + + /// There was an error playing the video ad. + videoPlayError, + + /// The error code is not recognized by this wrapper. + unknown, +} + +/// Specifies when the error was encountered, during either ad loading or playback. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorType.html. +enum AdErrorType { + /// Indicates that the error was encountered when the ad was being loaded. + load, + + /// Indicates that the error was encountered after the ad loaded, during ad play. + play, + + /// The error is not recognized by this wrapper. + unknown, +} + +/// Types of events that can occur during ad playback. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventType.html. +enum AdEventType { + /// Fired when an ad break in a stream ends. + adBreakEnded, + + /// Fired when an ad break will not play back any ads. + adBreakFetchError, + + /// Fired when an ad break is ready from VMAP or ad rule ads. + adBreakReady, + + /// Fired when an ad break in a stream starts. + adBreakStarted, + + /// Fired when playback stalls while the ad buffers. + adBuffering, + + /// Fired when an ad period in a stream ends. + adPeriodEnded, + + /// Fired when an ad period in a stream starts. + adPeriodStarted, + + /// Fired to inform of ad progress and can be used by publisher to display a + /// countdown timer. + adProgress, + + /// Fired when the ads manager is done playing all the valid ads in the ads + /// response, or when the response doesn't return any valid ads. + allAdsCompleted, + + /// Fired when an ad is clicked. + clicked, + + /// Fired when an ad completes playing. + completed, + + /// Fired when content should be paused. + contentPauseRequested, + + /// Fired when content should be resumed. + contentResumeRequested, + + /// Fired when VOD stream cuepoints have changed. + cuepointsChanged, + + /// Fired when the ad playhead crosses first quartile. + firstQuartile, + + /// The user has closed the icon fallback image dialog. + iconFallbackImageClosed, + + /// The user has tapped an ad icon. + iconTapped, + + /// Fired when the VAST response has been received. + loaded, + + /// Fired to enable the SDK to communicate a message to be logged, which is + /// stored in adData. + log, + + /// Fired when the ad playhead crosses midpoint. + midpoint, + + /// Fired when an ad is paused. + paused, + + /// Fired when an ad is resumed. + resumed, + + /// Fired when an ad changes its skippable state. + skippableStateChanged, + + /// Fired when an ad was skipped. + skipped, + + /// Fired when an ad starts playing. + started, + + /// Fired when a non-clickthrough portion of a video ad is clicked. + tapped, + + /// Fired when the ad playhead crosses third quartile. + thirdQuartile, + + /// The event type is not recognized by this wrapper. + unknown, +} + +/// A base class for more specialized container interfaces. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseDisplayContainer.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: + 'com.google.ads.interactivemedia.v3.api.BaseDisplayContainer', + ), +) +abstract class BaseDisplayContainer {} + +/// A container in which to display the ads. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdDisplayContainer. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.AdDisplayContainer', + ), +) +abstract class AdDisplayContainer implements BaseDisplayContainer {} + +/// An object which allows publishers to request ads from ad servers or a +/// dynamic ad insertion stream. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.AdsLoader', + ), +) +abstract class AdsLoader { + /// Registers a listener for errors that occur during the ads request. + void addAdErrorListener(AdErrorListener listener); + + /// Registers a listener for the ads manager loaded event. + void addAdsLoadedListener(AdsLoadedListener listener); + + /// Requests ads from a server. + void requestAds(AdsRequest request); +} + +/// An event raised when ads are successfully loaded from the ad server through an AdsLoader. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManagerLoadedEvent.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: + 'com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent', + ), +) +abstract class AdsManagerLoadedEvent { + /// The ads manager that will control playback of the loaded ads, or null when + /// using dynamic ad insertion. + late final AdsManager manager; +} + +/// An event raised when there is an error loading or playing ads. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.AdErrorEvent', + ), +) +abstract class AdErrorEvent { + /// The AdError that caused this event. + late final AdError error; +} + +/// An error that occurred in the SDK. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.AdError', + ), +) +abstract class AdError { + /// The error's code. + late final AdErrorCode errorCode; + + /// The error code's number. + late final int errorCodeNumber; + + /// The error's type. + late final AdErrorType errorType; + + /// A human-readable summary of the error. + late final String message; +} + +/// An object containing the data used to request ads from the server. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsRequest. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.AdsRequest', + ), +) +abstract class AdsRequest { + /// Sets the URL from which ads will be requested. + void setAdTagUrl(String adTagUrl); + + /// Attaches a ContentProgressProvider instance to allow scheduling ad breaks + /// based on content progress (cue points). + void setContentProgressProvider(ContentProgressProvider provider); +} + +/// Defines an interface to allow SDK to track progress of the content video. +/// +/// See https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/android/api/reference/com/google/ads/interactivemedia/v3/api/player/ContentProgressProvider.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: + 'com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider', + ), +) +abstract class ContentProgressProvider {} + +/// An object which handles playing ads after they've been received from the +/// server. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManager. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.AdsManager', + ), +) +abstract class AdsManager extends BaseManager { + /// Discards current ad break and resumes content. + void discardAdBreak(); + + /// Pauses the current ad. + void pause(); + + /// Starts playing the ads. + void start(); +} + +/// Base interface for managing ads.. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseManager.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.BaseManager', + ), +) +abstract class BaseManager { + /// Registers a listener for errors that occur during the ad or stream + /// initialization and playback. + void addAdErrorListener(AdErrorListener errorListener); + + /// Registers a listener for ad events that occur during ad or stream + /// initialization and playback. + void addAdEventListener(AdEventListener adEventListener); + + /// Stops the ad and all tracking, then releases all assets that were loaded + /// to play the ad. + void destroy(); + + /// Initializes the ad experience using default rendering settings + void init(); +} + +/// Event to notify publisher that an event occurred with an Ad. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.AdEvent', + ), +) +abstract class AdEvent { + /// The type of event that occurred. + late final AdEventType type; + + /// A map containing any extra ad data for the event, if needed. + late final Map? adData; +} + +/// Factory class for creating SDK objects. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkFactory. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.ImaSdkFactory', + ), +) +abstract class ImaSdkFactory { + @static + @attached + late final ImaSdkFactory instance; + + @static + AdDisplayContainer createAdDisplayContainer( + ViewGroup container, + VideoAdPlayer player, + ); + + /// Creates an `ImaSdkSettings` object for configuring the IMA SDK. + ImaSdkSettings createImaSdkSettings(); + + /// Creates an `AdsLoader` for requesting ads using the specified settings + /// object. + AdsLoader createAdsLoader( + ImaSdkSettings settings, + AdDisplayContainer container, + ); + + /// Creates an AdsRequest object to contain the data used to request ads. + AdsRequest createAdsRequest(); +} + +/// Defines general SDK settings that are used when creating an `AdsLoader`. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkSettings.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.ImaSdkSettings', + ), +) +abstract class ImaSdkSettings {} + +/// Defines an update to the video's progress. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoProgressUpdate.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: + 'com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate', + ), +) +abstract class VideoProgressUpdate { + VideoProgressUpdate(int currentTimeMs, int durationMs); + + /// Value to use for cases when progress is not yet defined, such as video + /// initialization. + @static + @attached + late final VideoProgressUpdate videoTimeNotReady; +} + +/// The minimal information required to play an ad. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/AdMediaInfo.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.player.AdMediaInfo', + ), +) +abstract class AdMediaInfo { + late final String url; +} + +/// An ad may be part of a pod of ads. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdPodInfo.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'com.google.ads.interactivemedia.v3.api.AdPodInfo', + ), +) +abstract class AdPodInfo { + /// The position of the ad within the pod. + /// + /// The value returned is one-based, for example, 1 of 2, 2 of 2, etc. If the + /// ad is not part of a pod, this will return 1. + late final int adPosition; + + /// The maximum duration of the pod in seconds. + /// + /// For unknown duration, -1 is returned. + late final double maxDuration; + + /// Client side and DAI VOD: Returns the index of the ad pod. + late final int podIndex; + + /// The content time offset at which the current ad pod was scheduled. + /// + /// For preroll pod, 0 is returned. For midrolls, the scheduled time is + /// returned in seconds. For postroll, -1 is returned. Defaults to 0 if this + /// ad is not part of a pod, or the pod is not part of an ad playlist. + late final double timeOffset; + + /// The total number of ads contained within this pod, including bumpers. + late final int totalAds; + + /// Returns true if the ad is a bumper ad. + late final bool isBumper; +} + +/// FrameLayout is designed to block out an area on the screen to display a +/// single item. +/// +/// See https://developer.android.com/reference/android/widget/FrameLayout. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'android.widget.FrameLayout', + ), +) +abstract class FrameLayout extends ViewGroup { + FrameLayout(); +} + +/// A special view that can contain other views (called children.) +/// +/// See https://developer.android.com/reference/android/view/ViewGroup. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'android.view.ViewGroup', + ), +) +abstract class ViewGroup extends View { + void addView(View view); +} + +/// Displays a video file. +/// +/// See https://developer.android.com/reference/android/widget/VideoView. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'android.widget.VideoView', + ), +) +abstract class VideoView extends View { + VideoView(); + + /// Callback to be invoked when the media source is ready for playback. + late final void Function(MediaPlayer player)? onPrepared; + + /// Callback to be invoked when playback of a media source has completed. + late final void Function(MediaPlayer player)? onCompletion; + + /// Callback to be invoked when there has been an error during an asynchronous + /// operation. + late final void Function(MediaPlayer player, int what, int extra) onError; + + /// Sets the URI of the video. + void setVideoUri(String uri); + + /// The current position of the playing video. + /// + /// In milliseconds. + int getCurrentPosition(); +} + +/// This class represents the basic building block for user interface components. +/// +/// See https://developer.android.com/reference/android/view/View. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions(fullClassName: 'android.view.View'), +) +abstract class View {} + +/// MediaPlayer class can be used to control playback of audio/video files and +/// streams. +/// +/// See https://developer.android.com/reference/android/media/MediaPlayer. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'android.media.MediaPlayer', + ), +) +abstract class MediaPlayer { + /// Gets the duration of the file. + int getDuration(); + + /// Seeks to specified time position. + void seekTo(int mSec); + + /// Starts or resumes playback. + void start(); + + /// Pauses playback. + void pause(); + + /// Stops playback after playback has been started or paused. + void stop(); +} + +/// Callbacks that the player must fire. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.VideoAdPlayerCallback.html +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: + 'com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback', + ), +) +abstract class VideoAdPlayerCallback { + /// Fire this callback periodically as ad playback occurs. + void onAdProgress( + AdMediaInfo adMediaInfo, + VideoProgressUpdate videoProgressUpdate, + ); + + /// Fire this callback when video playback stalls waiting for data. + void onBuffering(AdMediaInfo adMediaInfo); + + /// Fire this callback when all content has finished playing. + void onContentComplete(); + + /// Fire this callback when the video finishes playing. + void onEnded(AdMediaInfo adMediaInfo); + + /// Fire this callback when the video has encountered an error. + void onError(AdMediaInfo adMediaInfo); + + /// Fire this callback when the video is ready to begin playback. + void onLoaded(AdMediaInfo adMediaInfo); + + /// Fire this callback when the video is paused. + void onPause(AdMediaInfo adMediaInfo); + + /// Fire this callback when the player begins playing a video. + void onPlay(AdMediaInfo adMediaInfo); + + /// Fire this callback when the video is unpaused. + void onResume(AdMediaInfo adMediaInfo); + + /// Fire this callback when the playback volume changes. + void onVolumeChanged(AdMediaInfo adMediaInfo, int percentage); +} + +/// Defines the set of methods that a video player must implement to be used by +/// the IMA SDK, as well as a set of callbacks that it must fire. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: + 'com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer', + ), +) +abstract class VideoAdPlayer { + VideoAdPlayer(); + + /// Adds a callback. + late final void Function(VideoAdPlayerCallback callback) addCallback; + + /// Loads a video ad hosted at AdMediaInfo. + late final void Function(AdMediaInfo adMediaInfo, AdPodInfo adPodInfo) loadAd; + + /// Pauses playing the current ad. + late final void Function(AdMediaInfo adMediaInfo) pauseAd; + + /// Starts or resumes playing the video ad referenced by the AdMediaInfo, + /// provided loadAd has already been called for it. + late final void Function(AdMediaInfo adMediaInfo) playAd; + + /// Cleans up and releases all resources used by the `VideoAdPlayer`. + late final void Function() release; + + /// Removes a callback. + late final void Function(VideoAdPlayerCallback callback) removeCallback; + + /// Stops playing the current ad. + late final void Function(AdMediaInfo adMediaInfo) stopAd; + + /// The volume of the player as a percentage from 0 to 100. + void setVolume(int value); + + /// The `VideoProgressUpdate` describing playback progress of the current + /// video. + void setAdProgress(VideoProgressUpdate progress); +} + +/// Listener interface for notification of ad load or stream load completion. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader.AdsLoadedListener.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: + 'com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener', + ), +) +abstract class AdsLoadedListener { + AdsLoadedListener(); + + /// Called once the AdsManager or StreamManager has been loaded. + late final void Function(AdsManagerLoadedEvent event) onAdsManagerLoaded; +} + +/// Interface for classes that will listen to AdErrorEvents. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.AdErrorListener.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: + 'com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener', + ), +) +abstract class AdErrorListener { + AdErrorListener(); + + /// Called when an error occurs. + late final void Function(AdErrorEvent event) onAdError; +} + +/// Listener interface for ad events. +/// +/// See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventListener.html. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: + 'com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener', + ), +) +abstract class AdEventListener { + AdEventListener(); + + /// Respond to an occurrence of an AdEvent. + late final void Function(AdEvent event) onAdEvent; +} +*/ diff --git a/packages/interactive_media_ads/test/ios/ads_manager_delegate_tests.dart b/packages/interactive_media_ads/test/ios/ads_manager_delegate_tests.dart index 2c27be926f25..33f5b3817b1e 100644 --- a/packages/interactive_media_ads/test/ios/ads_manager_delegate_tests.dart +++ b/packages/interactive_media_ads/test/ios/ads_manager_delegate_tests.dart @@ -55,7 +55,7 @@ void main() { IOSAdsManagerDelegateCreationParams( onAdEvent: expectAsync1((AdEvent event) { expect(event.type, AdEventType.allAdsCompleted); - expect(event.adData, {'hawk': 'tuah'}); + expect(event.adData, {'hello': 'world'}); }), proxy: imaProxy, ), From 4b7b8e15e6dea33c7dace8811eacefc40bf98e27 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 8 Aug 2024 20:12:35 -0400 Subject: [PATCH 14/14] fix test and doc --- .../lib/src/platform_interface/ad_event.dart | 2 +- .../test/ios/ads_manager_delegate_tests.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/interactive_media_ads/lib/src/platform_interface/ad_event.dart b/packages/interactive_media_ads/lib/src/platform_interface/ad_event.dart index e8798ac5595c..5246f8226bd2 100644 --- a/packages/interactive_media_ads/lib/src/platform_interface/ad_event.dart +++ b/packages/interactive_media_ads/lib/src/platform_interface/ad_event.dart @@ -102,7 +102,7 @@ enum AdEventType { /// Fired when the ad playhead crosses third quartile. thirdQuartile, - /// An unexpected event occurred and the type is not know. + /// An unexpected event occurred and the type is not known. /// /// Refer to the inner error for more information. unknown, diff --git a/packages/interactive_media_ads/test/ios/ads_manager_delegate_tests.dart b/packages/interactive_media_ads/test/ios/ads_manager_delegate_tests.dart index 33f5b3817b1e..62174b25d87a 100644 --- a/packages/interactive_media_ads/test/ios/ads_manager_delegate_tests.dart +++ b/packages/interactive_media_ads/test/ios/ads_manager_delegate_tests.dart @@ -73,7 +73,7 @@ void main() { ima.IMAAdEvent.pigeon_detached( type: ima.AdEventType.allAdsCompleted, typeString: 'typeString', - adData: const {'hawk': 'tuah'}, + adData: const {'hello': 'world'}, pigeon_instanceManager: instanceManager, ), );