From c77279bfe9e362ef3802f6db28f21af7ccc45150 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 29 Apr 2025 16:45:11 -0400 Subject: [PATCH 01/37] add last few companion ad methods --- .../CompanionAdSlotProxyApi.kt | 4 + .../ImaSdkFactoryProxyApi.kt | 5 + .../InteractiveMediaAdsLibrary.g.kt | 4092 +++++++---------- .../CompanionAdSlotProxyApiTest.kt | 10 + .../ImaSdkFactoryProxyApiTest.kt | 12 + .../src/android/interactive_media_ads.g.dart | 322 +- .../interactive_media_ads_android.dart | 9 + 7 files changed, 1735 insertions(+), 2719 deletions(-) diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/CompanionAdSlotProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/CompanionAdSlotProxyApi.kt index ec0bdafdbd2..b8687135a3a 100644 --- a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/CompanionAdSlotProxyApi.kt +++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/CompanionAdSlotProxyApi.kt @@ -47,4 +47,8 @@ class CompanionAdSlotProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) : override fun setSize(pigeon_instance: CompanionAdSlot, width: Long, height: Long) { pigeon_instance.setSize(width.toInt(), height.toInt()) } + + override fun setFluidSize(pigeon_instance: CompanionAdSlot) { + pigeon_instance.setSize(CompanionAdSlot.FLUID_SIZE, CompanionAdSlot.FLUID_SIZE) + } } diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ImaSdkFactoryProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ImaSdkFactoryProxyApi.kt index 00ee7a23e71..dfb3bb5f857 100644 --- a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ImaSdkFactoryProxyApi.kt +++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ImaSdkFactoryProxyApi.kt @@ -9,6 +9,7 @@ import com.google.ads.interactivemedia.v3.api.AdDisplayContainer import com.google.ads.interactivemedia.v3.api.AdsLoader import com.google.ads.interactivemedia.v3.api.AdsRenderingSettings import com.google.ads.interactivemedia.v3.api.AdsRequest +import com.google.ads.interactivemedia.v3.api.CompanionAdSlot import com.google.ads.interactivemedia.v3.api.ImaSdkFactory import com.google.ads.interactivemedia.v3.api.ImaSdkSettings import com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer @@ -32,6 +33,10 @@ class ImaSdkFactoryProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) : return ImaSdkFactory.createAdDisplayContainer(container, player) } + override fun createCompanionAdSlot(pigeon_instance: ImaSdkFactory): CompanionAdSlot { + return pigeon_instance.createCompanionAdSlot() + } + override fun createImaSdkSettings(pigeon_instance: ImaSdkFactory): ImaSdkSettings { return pigeon_instance.createImaSdkSettings() } 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 ecf6ebbe025..6f2c24fafcb 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 @@ -10,17 +10,16 @@ package dev.flutter.packages.interactive_media_ads import android.util.Log import io.flutter.plugin.common.BasicMessageChannel import io.flutter.plugin.common.BinaryMessenger +import io.flutter.plugin.common.EventChannel import io.flutter.plugin.common.MessageCodec +import io.flutter.plugin.common.StandardMethodCodec import io.flutter.plugin.common.StandardMessageCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer - private object InteractiveMediaAdsLibraryPigeonUtils { 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'.", "") } fun wrapResult(result: Any?): List { return listOf(result) @@ -28,48 +27,50 @@ private object InteractiveMediaAdsLibraryPigeonUtils { 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) + ) } } } /** * 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) } @@ -110,20 +111,19 @@ class InteractiveMediaAdsLibraryPigeonInstanceManager( 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() @@ -133,13 +133,15 @@ class InteractiveMediaAdsLibraryPigeonInstanceManager( /** * 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() @@ -153,9 +155,9 @@ class InteractiveMediaAdsLibraryPigeonInstanceManager( /** * 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. */ @@ -167,15 +169,13 @@ class InteractiveMediaAdsLibraryPigeonInstanceManager( /** * Adds a new unique instance that was instantiated from the host platform. * - * If the manager contains [instance], this returns the corresponding identifier. If the manager - * does not contain [instance], this adds the instance and returns a unique identifier for that - * [instance]. + * If the manager contains [instance], this returns the corresponding identifier. If the + * manager does not contain [instance], this adds the instance and returns a unique + * identifier for that [instance]. */ 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 @@ -233,8 +233,7 @@ class InteractiveMediaAdsLibraryPigeonInstanceManager( 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) @@ -260,45 +259,39 @@ class InteractiveMediaAdsLibraryPigeonInstanceManager( 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 `InstanceManager`s. */ -private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi( - val binaryMessenger: BinaryMessenger -) { +private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi(val binaryMessenger: BinaryMessenger) { companion object { /** The codec used by InteractiveMediaAdsLibraryPigeonInstanceManagerApi. */ - val codec: MessageCodec by lazy { InteractiveMediaAdsLibraryPigeonCodec() } + val codec: MessageCodec by lazy { + InteractiveMediaAdsLibraryPigeonCodec() + } /** - * 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.PigeonInternalInstanceManager.removeStrongReference", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.PigeonInternalInstanceManager.removeStrongReference", codec) if (instanceManager != null) { channel.setMessageHandler { message, reply -> val args = message as List val identifierArg = args[0] as Long - val wrapped: List = - try { - instanceManager.remove(identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + instanceManager.remove(identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -306,20 +299,15 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.PigeonInternalInstanceManager.clear", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.PigeonInternalInstanceManager.clear", codec) if (instanceManager != null) { channel.setMessageHandler { _, reply -> - val wrapped: List = - try { - instanceManager.clear() - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + instanceManager.clear() + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -329,9 +317,9 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi( } } - fun removeStrongReference(identifierArg: Long, callback: (Result) -> Unit) { - val channelName = - "dev.flutter.pigeon.interactive_media_ads.PigeonInternalInstanceManager.removeStrongReference" + fun removeStrongReference(identifierArg: Long, callback: (Result) -> Unit) +{ + val channelName = "dev.flutter.pigeon.interactive_media_ads.PigeonInternalInstanceManager.removeStrongReference" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(identifierArg)) { if (it is List<*>) { @@ -341,20 +329,16 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi( callback(Result.success(Unit)) } } else { - callback( - Result.failure( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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 @@ -369,25 +353,27 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar( 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) } @@ -395,13 +381,14 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar( * 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 @@ -412,20 +399,20 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar( 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 @@ -436,20 +423,20 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar( abstract fun getPigeonApiContentProgressProvider(): PigeonApiContentProgressProvider /** - * 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 @@ -463,7 +450,8 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar( * 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) } @@ -474,46 +462,47 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar( 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 @@ -560,8 +549,8 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar( abstract fun getPigeonApiAdProgressInfo(): PigeonApiAdProgressInfo /** - * An implementation of [PigeonApiCompanionAd] used to add a new Dart instance of `CompanionAd` to - * the Dart `InstanceManager`. + * An implementation of [PigeonApiCompanionAd] used to add a new Dart instance of + * `CompanionAd` to the Dart `InstanceManager`. */ abstract fun getPigeonApiCompanionAd(): PigeonApiCompanionAd @@ -572,8 +561,8 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar( abstract fun getPigeonApiUniversalAdId(): PigeonApiUniversalAdId /** - * An implementation of [PigeonApiAd] used to add a new Dart instance of `Ad` to the Dart - * `InstanceManager`. + * An implementation of [PigeonApiAd] used to add a new Dart instance of + * `Ad` to the Dart `InstanceManager`. */ abstract fun getPigeonApiAd(): PigeonApiAd @@ -590,35 +579,27 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar( abstract fun getPigeonApiCompanionAdSlot(): PigeonApiCompanionAdSlot fun setUp() { - InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers( - binaryMessenger, instanceManager) + InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger, instanceManager) PigeonApiAdsLoader.setUpMessageHandlers(binaryMessenger, getPigeonApiAdsLoader()) PigeonApiAdsRequest.setUpMessageHandlers(binaryMessenger, getPigeonApiAdsRequest()) - PigeonApiContentProgressProvider.setUpMessageHandlers( - binaryMessenger, getPigeonApiContentProgressProvider()) + PigeonApiContentProgressProvider.setUpMessageHandlers(binaryMessenger, getPigeonApiContentProgressProvider()) 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()) - PigeonApiAdsRenderingSettings.setUpMessageHandlers( - binaryMessenger, getPigeonApiAdsRenderingSettings()) - PigeonApiCompanionAdSlotClickListener.setUpMessageHandlers( - binaryMessenger, getPigeonApiCompanionAdSlotClickListener()) + PigeonApiAdsRenderingSettings.setUpMessageHandlers(binaryMessenger, getPigeonApiAdsRenderingSettings()) + PigeonApiCompanionAdSlotClickListener.setUpMessageHandlers(binaryMessenger, getPigeonApiCompanionAdSlotClickListener()) PigeonApiCompanionAdSlot.setUpMessageHandlers(binaryMessenger, getPigeonApiCompanionAdSlot()) } - fun tearDown() { InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger, null) PigeonApiAdsLoader.setUpMessageHandlers(binaryMessenger, null) @@ -642,17 +623,17 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar( PigeonApiCompanionAdSlot.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() -> { val identifier: Long = readValue(buffer) as Long val instance: Any? = registrar.instanceManager.getInstance(identifier) if (instance == null) { - Log.e("PigeonProxyApiBaseCodec", "Failed to find instance with identifier: $identifier") + Log.e( + "PigeonProxyApiBaseCodec", + "Failed to find instance with identifier: $identifier" + ) } return instance } @@ -661,94 +642,109 @@ private class InteractiveMediaAdsLibraryPigeonProxyApiBaseCodec( } 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 is UiElement || - 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 is UiElement || 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) {} - } else if (value is com.google.ads.interactivemedia.v3.api.AdsRenderingSettings) { - registrar.getPigeonApiAdsRenderingSettings().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.AdProgressInfo) { - registrar.getPigeonApiAdProgressInfo().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.CompanionAd) { - registrar.getPigeonApiCompanionAd().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.UniversalAdId) { - registrar.getPigeonApiUniversalAdId().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.Ad) { - registrar.getPigeonApiAd().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener) { - registrar.getPigeonApiCompanionAdSlotClickListener().pigeon_newInstance(value) {} - } else if (value is com.google.ads.interactivemedia.v3.api.CompanionAdSlot) { - registrar.getPigeonApiCompanionAdSlot().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) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.AdsRenderingSettings) { + registrar.getPigeonApiAdsRenderingSettings().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.AdProgressInfo) { + registrar.getPigeonApiAdProgressInfo().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.CompanionAd) { + registrar.getPigeonApiCompanionAd().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.UniversalAdId) { + registrar.getPigeonApiUniversalAdId().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.Ad) { + registrar.getPigeonApiAd().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener) { + registrar.getPigeonApiCompanionAdSlotClickListener().pigeon_newInstance(value) { } + } + else if (value is com.google.ads.interactivemedia.v3.api.CompanionAdSlot) { + registrar.getPigeonApiCompanionAdSlot().pigeon_newInstance(value) { } } when { @@ -756,9 +752,7 @@ private class InteractiveMediaAdsLibraryPigeonProxyApiBaseCodec( 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}'") } } } @@ -766,8 +760,7 @@ private class InteractiveMediaAdsLibraryPigeonProxyApiBaseCodec( /** * 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. */ @@ -799,13 +792,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. */ @@ -813,8 +806,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. */ @@ -824,7 +817,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. */ @@ -842,8 +836,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. */ @@ -863,8 +856,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. */ @@ -881,11 +873,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. */ @@ -906,7 +901,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), @@ -937,8 +935,7 @@ enum class AdEventType(val raw: Int) { /** * Describes an element of the ad UI, to be requested or rendered by the SDK. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/UiElement.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/UiElement.html. */ enum class UiElement(val raw: Int) { /** The ad attribution UI element, for example, "Ad". */ @@ -954,27 +951,33 @@ enum class UiElement(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 Long?)?.let { AdErrorCode.ofRaw(it.toInt()) } + return (readValue(buffer) as Long?)?.let { + AdErrorCode.ofRaw(it.toInt()) + } } 130.toByte() -> { - return (readValue(buffer) as Long?)?.let { AdErrorType.ofRaw(it.toInt()) } + return (readValue(buffer) as Long?)?.let { + AdErrorType.ofRaw(it.toInt()) + } } 131.toByte() -> { - return (readValue(buffer) as Long?)?.let { AdEventType.ofRaw(it.toInt()) } + return (readValue(buffer) as Long?)?.let { + AdEventType.ofRaw(it.toInt()) + } } 132.toByte() -> { - return (readValue(buffer) as Long?)?.let { UiElement.ofRaw(it.toInt()) } + return (readValue(buffer) as Long?)?.let { + UiElement.ofRaw(it.toInt()) + } } 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) @@ -1000,155 +1003,120 @@ 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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } } @Suppress("FunctionName") /** An implementation of [PigeonApiBaseDisplayContainer] used to access callback methods */ - fun pigeon_getPigeonApiBaseDisplayContainer(): PigeonApiBaseDisplayContainer { + 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 ?: InteractiveMediaAdsLibraryPigeonCodec() 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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1156,24 +1124,18 @@ abstract class PigeonApiAdsLoader( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1181,23 +1143,18 @@ abstract class PigeonApiAdsLoader( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.requestAds(pigeon_instanceArg, requestArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1209,19 +1166,16 @@ abstract class PigeonApiAdsLoader( @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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -1229,106 +1183,85 @@ abstract class PigeonApiAdsLoader( channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val errorArg = error(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec @@ -1337,63 +1270,49 @@ abstract class PigeonApiAdErrorEvent( channel.send(listOf(pigeon_identifierArg, errorArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val errorCodeArg = errorCode(pigeon_instanceArg) val errorCodeNumberArg = errorCodeNumber(pigeon_instanceArg) val errorTypeArg = errorType(pigeon_instanceArg) @@ -1402,73 +1321,54 @@ abstract class PigeonApiAdError( 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)) - } - } else { - callback( - Result.failure( - InteractiveMediaAdsLibraryPigeonUtils.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(InteractiveMediaAdsLibraryPigeonUtils.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 ?: InteractiveMediaAdsLibraryPigeonCodec() 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.setAdTagUrl(pigeon_instanceArg, adTagUrlArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1476,24 +1376,18 @@ abstract class PigeonApiAdsRequest( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1505,19 +1399,16 @@ abstract class PigeonApiAdsRequest( @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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -1525,69 +1416,51 @@ abstract class PigeonApiAdsRequest( channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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") -abstract class PigeonApiContentProgressProvider( - open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar -) { - abstract fun pigeon_defaultConstructor(): - com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider +abstract class PigeonApiContentProgressProvider(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { + abstract fun pigeon_defaultConstructor(): com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider /** * Sets an update on the progress of the video. * - * This is a custom method added to the native class because the native method - * `getContentProgress` requires a synchronous return value. + * This is a custom method added to the native class because the native + * method `getContentProgress` requires a synchronous return value. */ - abstract fun setContentProgress( - pigeon_instance: com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider, - update: com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate - ) + abstract fun setContentProgress(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider, update: com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate) companion object { @Suppress("LocalVariableName") - fun setUpMessageHandlers( - binaryMessenger: BinaryMessenger, - api: PigeonApiContentProgressProvider? - ) { + fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiContentProgressProvider?) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.ContentProgressProvider.pigeon_defaultConstructor", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ContentProgressProvider.pigeon_defaultConstructor", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1595,25 +1468,18 @@ abstract class PigeonApiContentProgressProvider( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.ContentProgressProvider.setContentProgress", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ContentProgressProvider.setContentProgress", 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.ContentProgressProvider - val updateArg = - args[1] as com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate - val wrapped: List = - try { - api.setContentProgress(pigeon_instanceArg, updateArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider + val updateArg = args[1] as com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate + val wrapped: List = try { + api.setContentProgress(pigeon_instanceArg, updateArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1625,51 +1491,43 @@ abstract class PigeonApiContentProgressProvider( @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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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) @@ -1684,9 +1542,7 @@ abstract class PigeonApiAdsManager( * * The list will be empty if no ad breaks are scheduled. */ - abstract fun getAdCuePoints( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsManager - ): List + abstract fun getAdCuePoints(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsManager): List /** Resumes the current ad. */ abstract fun resume(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsManager) @@ -1694,7 +1550,8 @@ abstract class PigeonApiAdsManager( /** * Skips the current ad. * - * `AdsManager.skip()` only skips ads if IMA does not render the 'Skip ad' button. + * `AdsManager.skip()` only skips ads if IMA does not render the 'Skip ad' + * button. */ abstract fun skip(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsManager) @@ -1703,22 +1560,17 @@ abstract class PigeonApiAdsManager( fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAdsManager?) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.discardAdBreak(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1726,20 +1578,17 @@ abstract class PigeonApiAdsManager( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.pause(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1747,20 +1596,17 @@ abstract class PigeonApiAdsManager( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.start(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1768,21 +1614,16 @@ abstract class PigeonApiAdsManager( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsManager.getAdCuePoints", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.getAdCuePoints", 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 { - listOf(api.getAdCuePoints(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + listOf(api.getAdCuePoints(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1790,22 +1631,17 @@ abstract class PigeonApiAdsManager( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsManager.resume", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.resume", 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.resume(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.resume(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1813,20 +1649,17 @@ abstract class PigeonApiAdsManager( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.skip", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.skip", 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.skip(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.skip(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1838,19 +1671,16 @@ abstract class PigeonApiAdsManager( @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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -1858,109 +1688,85 @@ abstract class PigeonApiAdsManager( channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } } @Suppress("FunctionName") /** An implementation of [PigeonApiBaseManager] used to access callback methods */ - fun pigeon_getPigeonApiBaseManager(): PigeonApiBaseManager { + 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 on the manager. */ - abstract fun init( - pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, - settings: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings? - ) + abstract fun init(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, settings: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings?) /** Generic focus endpoint that puts focus on the skip button if present. */ abstract fun focus(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager) /** Returns the latest AdProgressInfo for the current playing ad. */ - abstract fun getAdProgressInfo( - pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager - ): com.google.ads.interactivemedia.v3.api.AdProgressInfo? + abstract fun getAdProgressInfo(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager): com.google.ads.interactivemedia.v3.api.AdProgressInfo? /** Get currently playing ad. */ - abstract fun getCurrentAd( - pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager - ): com.google.ads.interactivemedia.v3.api.Ad? + abstract fun getCurrentAd(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager): com.google.ads.interactivemedia.v3.api.Ad? /** Removes a listener for error events. */ - abstract fun removeAdErrorListener( - pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, - errorListener: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener - ) + abstract fun removeAdErrorListener(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, errorListener: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener) /** Removes a listener for ad events. */ - abstract fun removeAdEventListener( - pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, - adEventListener: com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener - ) + abstract fun removeAdEventListener(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, adEventListener: com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiBaseManager?) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() 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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1968,24 +1774,18 @@ abstract class PigeonApiBaseManager( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1993,22 +1793,17 @@ abstract class PigeonApiBaseManager( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.destroy(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2016,22 +1811,18 @@ abstract class PigeonApiBaseManager( } } 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 settingsArg = - args[1] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings? - val wrapped: List = - try { - api.init(pigeon_instanceArg, settingsArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val settingsArg = args[1] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings? + val wrapped: List = try { + api.init(pigeon_instanceArg, settingsArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2039,22 +1830,17 @@ abstract class PigeonApiBaseManager( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.BaseManager.focus", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.focus", 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.focus(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.focus(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2062,21 +1848,16 @@ abstract class PigeonApiBaseManager( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.BaseManager.getAdProgressInfo", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.getAdProgressInfo", 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 { - listOf(api.getAdProgressInfo(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + listOf(api.getAdProgressInfo(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2084,21 +1865,16 @@ abstract class PigeonApiBaseManager( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.BaseManager.getCurrentAd", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.getCurrentAd", 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 { - listOf(api.getCurrentAd(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + listOf(api.getCurrentAd(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2106,24 +1882,18 @@ abstract class PigeonApiBaseManager( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.BaseManager.removeAdErrorListener", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.removeAdErrorListener", 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.removeAdErrorListener(pigeon_instanceArg, errorListenerArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val errorListenerArg = args[1] as com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener + val wrapped: List = try { + api.removeAdErrorListener(pigeon_instanceArg, errorListenerArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2131,24 +1901,18 @@ abstract class PigeonApiBaseManager( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.BaseManager.removeAdEventListener", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.removeAdEventListener", 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.removeAdEventListener(pigeon_instanceArg, adEventListenerArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val adEventListenerArg = args[1] as com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener + val wrapped: List = try { + api.removeAdEventListener(pigeon_instanceArg, adEventListenerArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2160,19 +1924,16 @@ abstract class PigeonApiBaseManager( @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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -2180,53 +1941,43 @@ abstract class PigeonApiBaseManager( channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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 /** 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? + 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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val typeArg = type(pigeon_instanceArg) val adDataArg = adData(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger @@ -2236,84 +1987,66 @@ abstract class PigeonApiAdEvent( 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?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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 a CompanionAdSlot for the SDK to fill with companion ads. */ + abstract fun createCompanionAdSlot(pigeon_instance: com.google.ads.interactivemedia.v3.api.ImaSdkFactory): com.google.ads.interactivemedia.v3.api.CompanionAdSlot /** 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 /** - * Creates an `AdsRenderingSettings` object to give the AdsManager parameters that control the - * rendering of ads. + * Creates an `AdsRenderingSettings` object to give the AdsManager parameters + * that control the rendering of ads. */ - abstract fun createAdsRenderingSettings( - pigeon_instance: com.google.ads.interactivemedia.v3.api.ImaSdkFactory - ): com.google.ads.interactivemedia.v3.api.AdsRenderingSettings + abstract fun createAdsRenderingSettings(pigeon_instance: com.google.ads.interactivemedia.v3.api.ImaSdkFactory): com.google.ads.interactivemedia.v3.api.AdsRenderingSettings companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiImaSdkFactory?) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() 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] as Long - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.instance(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.instance(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2321,22 +2054,17 @@ abstract class PigeonApiImaSdkFactory( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + listOf(api.createAdDisplayContainer(containerArg, playerArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2344,21 +2072,16 @@ abstract class PigeonApiImaSdkFactory( } } 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.createCompanionAdSlot", 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + listOf(api.createCompanionAdSlot(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2366,23 +2089,35 @@ abstract class PigeonApiImaSdkFactory( } } 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.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + listOf(api.createAdsLoader(pigeon_instanceArg, settingsArg, containerArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2390,21 +2125,16 @@ abstract class PigeonApiImaSdkFactory( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + listOf(api.createAdsRequest(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2412,21 +2142,16 @@ abstract class PigeonApiImaSdkFactory( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createAdsRenderingSettings", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createAdsRenderingSettings", 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.createAdsRenderingSettings(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + listOf(api.createAdsRenderingSettings(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2438,19 +2163,16 @@ abstract class PigeonApiImaSdkFactory( @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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -2458,45 +2180,37 @@ abstract class PigeonApiImaSdkFactory( channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -2504,64 +2218,51 @@ open class PigeonApiImaSdkSettings( channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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 ?: InteractiveMediaAdsLibraryPigeonCodec() 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] as Long val currentTimeMsArg = args[1] as Long val durationMsArg = args[2] as Long - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(currentTimeMsArg, durationMsArg), - pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(currentTimeMsArg,durationMsArg), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2569,23 +2270,17 @@ abstract class PigeonApiVideoProgressUpdate( } } 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] as Long - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.videoTimeNotReady(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.videoTimeNotReady(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2597,70 +2292,56 @@ abstract class PigeonApiVideoProgressUpdate( @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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val urlArg = url(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec @@ -2669,35 +2350,30 @@ abstract class PigeonApiAdMediaInfo( channel.send(listOf(pigeon_identifierArg, urlArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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 @@ -2706,9 +2382,7 @@ abstract class PigeonApiAdPodInfo( * * 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 @@ -2716,9 +2390,9 @@ abstract class PigeonApiAdPodInfo( /** * 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 @@ -2730,19 +2404,16 @@ abstract class PigeonApiAdPodInfo( @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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val adPositionArg = adPosition(pigeon_instanceArg) val maxDurationArg = maxDuration(pigeon_instanceArg) val podIndexArg = podIndex(pigeon_instanceArg) @@ -2753,41 +2424,29 @@ abstract class PigeonApiAdPodInfo( 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( - InteractiveMediaAdsLibraryPigeonUtils.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(InteractiveMediaAdsLibraryPigeonUtils.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 { @@ -2795,23 +2454,17 @@ abstract class PigeonApiFrameLayout( fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiFrameLayout?) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() 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] as Long - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2823,19 +2476,16 @@ abstract class PigeonApiFrameLayout( @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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -2843,25 +2493,24 @@ abstract class PigeonApiFrameLayout( channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } } @Suppress("FunctionName") /** An implementation of [PigeonApiViewGroup] used to access callback methods */ - fun pigeon_getPigeonApiViewGroup(): PigeonApiViewGroup { + fun pigeon_getPigeonApiViewGroup(): PigeonApiViewGroup + { return pigeonRegistrar.getPigeonApiViewGroup() } + } /** * A special view that can contain other views (called children.) @@ -2869,15 +2518,14 @@ abstract class PigeonApiFrameLayout( * 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) { /** Adds a child view. */ abstract fun addView(pigeon_instance: android.view.ViewGroup, view: android.view.View) /** - * Called by a ViewGroup subclass to remove child views from itself, when it must first know its - * size on screen before it can calculate how many child views it will render. + * Called by a ViewGroup subclass to remove child views from itself, when it + * must first know its size on screen before it can calculate how many child + * views it will render. */ abstract fun removeView(pigeon_instance: android.view.ViewGroup, view: android.view.View) @@ -2886,23 +2534,18 @@ abstract class PigeonApiViewGroup( fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiViewGroup?) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.addView(pigeon_instanceArg, viewArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2910,23 +2553,18 @@ abstract class PigeonApiViewGroup( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.ViewGroup.removeView", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ViewGroup.removeView", 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.removeView(pigeon_instanceArg, viewArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.removeView(pigeon_instanceArg, viewArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2938,19 +2576,16 @@ abstract class PigeonApiViewGroup( @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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -2958,25 +2593,24 @@ abstract class PigeonApiViewGroup( channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } } @Suppress("FunctionName") /** An implementation of [PigeonApiView] used to access callback methods */ - fun pigeon_getPigeonApiView(): PigeonApiView { + fun pigeon_getPigeonApiView(): PigeonApiView + { return pigeonRegistrar.getPigeonApiView() } + } /** * Displays a video file. @@ -2984,9 +2618,7 @@ abstract class PigeonApiViewGroup( * 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. */ @@ -3004,23 +2636,17 @@ abstract class PigeonApiVideoView( fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiVideoView?) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() 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] as Long - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3028,23 +2654,18 @@ abstract class PigeonApiVideoView( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.setVideoUri(pigeon_instanceArg, uriArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3052,21 +2673,16 @@ abstract class PigeonApiVideoView( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + listOf(api.getCurrentPosition(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3078,32 +2694,24 @@ abstract class PigeonApiVideoView( @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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { + } else { callback( Result.failure( - FlutterError( - "new-instance-error", - "Attempting to create a new Dart instance of VideoView, but the class has a nonnull callback method.", - ""))) + FlutterError("new-instance-error", "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( @@ -3122,19 +2730,14 @@ abstract class PigeonApiVideoView( callback(Result.success(Unit)) } } else { - callback( - Result.failure( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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( @@ -3153,21 +2756,17 @@ abstract class PigeonApiVideoView( callback(Result.success(Unit)) } } else { - callback( - Result.failure( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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( @@ -3186,18 +2785,18 @@ abstract class PigeonApiVideoView( callback(Result.success(Unit)) } } else { - callback( - Result.failure( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } @Suppress("FunctionName") /** An implementation of [PigeonApiView] used to access callback methods */ - fun pigeon_getPigeonApiView(): PigeonApiView { + fun pigeon_getPigeonApiView(): PigeonApiView + { return pigeonRegistrar.getPigeonApiView() } + } /** * This class represents the basic building block for user interface components. @@ -3205,21 +2804,19 @@ abstract class PigeonApiVideoView( * 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) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -3227,29 +2824,26 @@ open class PigeonApiView( channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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 @@ -3270,21 +2864,16 @@ abstract class PigeonApiMediaPlayer( fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiMediaPlayer?) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + listOf(api.getDuration(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3292,23 +2881,18 @@ abstract class PigeonApiMediaPlayer( } } 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] as Long - val wrapped: List = - try { - api.seekTo(pigeon_instanceArg, mSecArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.seekTo(pigeon_instanceArg, mSecArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3316,22 +2900,17 @@ abstract class PigeonApiMediaPlayer( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.start(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3339,22 +2918,17 @@ abstract class PigeonApiMediaPlayer( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.pause(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3362,20 +2936,17 @@ abstract class PigeonApiMediaPlayer( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.stop(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3387,19 +2958,16 @@ abstract class PigeonApiMediaPlayer( @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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -3407,132 +2975,73 @@ abstract class PigeonApiMediaPlayer( channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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 ?: InteractiveMediaAdsLibraryPigeonCodec() 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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3540,27 +3049,18 @@ abstract class PigeonApiVideoAdPlayerCallback( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3568,25 +3068,17 @@ abstract class PigeonApiVideoAdPlayerCallback( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3594,27 +3086,18 @@ abstract class PigeonApiVideoAdPlayerCallback( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3622,27 +3105,18 @@ abstract class PigeonApiVideoAdPlayerCallback( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3650,27 +3124,18 @@ abstract class PigeonApiVideoAdPlayerCallback( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3678,27 +3143,18 @@ abstract class PigeonApiVideoAdPlayerCallback( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3706,27 +3162,18 @@ abstract class PigeonApiVideoAdPlayerCallback( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3734,27 +3181,18 @@ abstract class PigeonApiVideoAdPlayerCallback( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3762,28 +3200,19 @@ abstract class PigeonApiVideoAdPlayerCallback( } } 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] as Long - val wrapped: List = - try { - api.onVolumeChanged(pigeon_instanceArg, adMediaInfoArg, percentageArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.onVolumeChanged(pigeon_instanceArg, adMediaInfoArg, percentageArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3795,90 +3224,70 @@ abstract class PigeonApiVideoAdPlayerCallback( @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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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 ?: InteractiveMediaAdsLibraryPigeonCodec() 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] as Long - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3886,24 +3295,18 @@ abstract class PigeonApiVideoAdPlayer( } } 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] as Long - val wrapped: List = - try { - api.setVolume(pigeon_instanceArg, valueArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.setVolume(pigeon_instanceArg, valueArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3911,25 +3314,18 @@ abstract class PigeonApiVideoAdPlayer( } } 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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3941,33 +3337,24 @@ abstract class PigeonApiVideoAdPlayer( @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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { + } else { callback( Result.failure( - FlutterError( - "new-instance-error", - "Attempting to create a new Dart instance of VideoAdPlayer, but the class has a nonnull callback method.", - ""))) + FlutterError("new-instance-error", "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( @@ -3986,20 +3373,14 @@ abstract class PigeonApiVideoAdPlayer( callback(Result.success(Unit)) } } else { - callback( - Result.failure( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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( @@ -4018,19 +3399,14 @@ abstract class PigeonApiVideoAdPlayer( callback(Result.success(Unit)) } } else { - callback( - Result.failure( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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( @@ -4049,22 +3425,17 @@ abstract class PigeonApiVideoAdPlayer( callback(Result.success(Unit)) } } else { - callback( - Result.failure( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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( @@ -4083,18 +3454,14 @@ abstract class PigeonApiVideoAdPlayer( callback(Result.success(Unit)) } } else { - callback( - Result.failure( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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( @@ -4113,20 +3480,14 @@ abstract class PigeonApiVideoAdPlayer( callback(Result.success(Unit)) } } else { - callback( - Result.failure( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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( @@ -4145,19 +3506,14 @@ abstract class PigeonApiVideoAdPlayer( callback(Result.success(Unit)) } } else { - callback( - Result.failure( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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( @@ -4176,48 +3532,37 @@ abstract class PigeonApiVideoAdPlayer( callback(Result.success(Unit)) } } else { - callback( - Result.failure( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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 ?: InteractiveMediaAdsLibraryPigeonCodec() 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] as Long - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4229,32 +3574,24 @@ abstract class PigeonApiAdsLoadedListener( @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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { + } else { callback( Result.failure( - FlutterError( - "new-instance-error", - "Attempting to create a new Dart instance of AdsLoadedListener, but the class has a nonnull callback method.", - ""))) + FlutterError("new-instance-error", "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( @@ -4263,8 +3600,7 @@ abstract class PigeonApiAdsLoadedListener( } 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<*>) { @@ -4274,48 +3610,37 @@ abstract class PigeonApiAdsLoadedListener( callback(Result.success(Unit)) } } else { - callback( - Result.failure( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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 ?: InteractiveMediaAdsLibraryPigeonCodec() 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] as Long - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4327,32 +3652,24 @@ abstract class PigeonApiAdErrorListener( @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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { + } else { callback( Result.failure( - FlutterError( - "new-instance-error", - "Attempting to create a new Dart instance of AdErrorListener, but the class has a nonnull callback method.", - ""))) + FlutterError("new-instance-error", "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( @@ -4371,48 +3688,37 @@ abstract class PigeonApiAdErrorListener( callback(Result.success(Unit)) } } else { - callback( - Result.failure( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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 ?: InteractiveMediaAdsLibraryPigeonCodec() 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] as Long - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4424,32 +3730,24 @@ abstract class PigeonApiAdEventListener( @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 - ) { + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { + } else { callback( Result.failure( - FlutterError( - "new-instance-error", - "Attempting to create a new Dart instance of AdEventListener, but the class has a nonnull callback method.", - ""))) + FlutterError("new-instance-error", "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( @@ -4468,155 +3766,120 @@ abstract class PigeonApiAdEventListener( callback(Result.success(Unit)) } } else { - callback( - Result.failure( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } + } /** * Defines parameters that control the rendering of ads. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsRenderingSettings.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsRenderingSettings.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdsRenderingSettings( - open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiAdsRenderingSettings(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { /** Maximum recommended bitrate. */ - abstract fun getBitrateKbps( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings - ): Long + abstract fun getBitrateKbps(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings): Long - /** Returns whether the click-through URL will be opened using Custom Tabs feature. */ - abstract fun getEnableCustomTabs( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings - ): Boolean + /** + * Returns whether the click-through URL will be opened using Custom Tabs + * feature. + */ + abstract fun getEnableCustomTabs(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings): Boolean /** - * Whether the SDK will instruct the player to load the creative in response to - * `BaseManager.init()`. + * Whether the SDK will instruct the player to load the creative in response + * to `BaseManager.init()`. */ - abstract fun getEnablePreloading( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings - ): Boolean + abstract fun getEnablePreloading(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings): Boolean /** - * Whether to focus on the skip button when the skippable ad can be skipped on Android TV. + * Whether to focus on the skip button when the skippable ad can be skipped + * on Android TV. * * This is a no-op on non-Android TV devices. */ - abstract fun getFocusSkipButtonWhenAvailable( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings - ): Boolean + abstract fun getFocusSkipButtonWhenAvailable(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings): Boolean /** The SDK will prioritize the media with MIME type on the list. */ - abstract fun getMimeTypes( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings - ): List + abstract fun getMimeTypes(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings): List /** * Maximum recommended bitrate. * - * The value is in kbit/s. Default value, -1, means the bitrate will be selected by the SDK. + * The value is in kbit/s. Default value, -1, means the bitrate will be + * selected by the SDK. */ - abstract fun setBitrateKbps( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, - bitrate: Long - ) + abstract fun setBitrateKbps(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, bitrate: Long) /** - * Notifies the SDK whether to launch the click-through URL using Custom Tabs feature. + * Notifies the SDK whether to launch the click-through URL using Custom Tabs + * feature. * * Default is false. */ - abstract fun setEnableCustomTabs( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, - enableCustomTabs: Boolean - ) + abstract fun setEnableCustomTabs(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, enableCustomTabs: Boolean) /** - * If set, the SDK will instruct the player to load the creative in response to - * `BaseManager.init()`. + * If set, the SDK will instruct the player to load the creative in response + * to `BaseManager.init()`. * - * This allows the player to preload the ad at any point before calling `AdsManager.start()`. + * This allows the player to preload the ad at any point before calling + * `AdsManager.start()`. */ - abstract fun setEnablePreloading( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, - enablePreloading: Boolean - ) + abstract fun setEnablePreloading(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, enablePreloading: Boolean) /** - * Set whether to focus on the skip button when the skippable ad can be skipped on Android TV. + * Set whether to focus on the skip button when the skippable ad can be + * skipped on Android TV. * * This is a no-op on non-Android TV devices. * * Default is true. */ - abstract fun setFocusSkipButtonWhenAvailable( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, - enableFocusSkipButton: Boolean - ) + abstract fun setFocusSkipButtonWhenAvailable(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, enableFocusSkipButton: Boolean) /** - * Specifies a non-default amount of time to wait for media to load before timing out, in - * milliseconds. + * Specifies a non-default amount of time to wait for media to load before + * timing out, in milliseconds. * * This only applies to the IMA client-side SDK. * * Default time is 8000 ms. */ - abstract fun setLoadVideoTimeout( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, - loadVideoTimeout: Long - ) + abstract fun setLoadVideoTimeout(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, loadVideoTimeout: Long) - /** If specified, the SDK will prioritize the media with MIME type on the list. */ - abstract fun setMimeTypes( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, - mimeTypes: List - ) + /** + * If specified, the SDK will prioritize the media with MIME type on the + * list. + */ + abstract fun setMimeTypes(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, mimeTypes: List) /** - * For VMAP and ad rules playlists, only play ad breaks scheduled after this time (in seconds). + * For VMAP and ad rules playlists, only play ad breaks scheduled after this + * time (in seconds). */ - abstract fun setPlayAdsAfterTime( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, - time: Double - ) + abstract fun setPlayAdsAfterTime(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, time: Double) /** Sets the ad UI elements to be rendered by the IMA SDK. */ - abstract fun setUiElements( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, - uiElements: List - ) + abstract fun setUiElements(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, uiElements: List) companion object { @Suppress("LocalVariableName") - fun setUpMessageHandlers( - binaryMessenger: BinaryMessenger, - api: PigeonApiAdsRenderingSettings? - ) { + fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAdsRenderingSettings?) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getBitrateKbps", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getBitrateKbps", 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.AdsRenderingSettings - val wrapped: List = - try { - listOf(api.getBitrateKbps(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings + val wrapped: List = try { + listOf(api.getBitrateKbps(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4624,22 +3887,16 @@ abstract class PigeonApiAdsRenderingSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getEnableCustomTabs", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getEnableCustomTabs", 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.AdsRenderingSettings - val wrapped: List = - try { - listOf(api.getEnableCustomTabs(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings + val wrapped: List = try { + listOf(api.getEnableCustomTabs(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4647,22 +3904,16 @@ abstract class PigeonApiAdsRenderingSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getEnablePreloading", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getEnablePreloading", 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.AdsRenderingSettings - val wrapped: List = - try { - listOf(api.getEnablePreloading(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings + val wrapped: List = try { + listOf(api.getEnablePreloading(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4670,22 +3921,16 @@ abstract class PigeonApiAdsRenderingSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getFocusSkipButtonWhenAvailable", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getFocusSkipButtonWhenAvailable", 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.AdsRenderingSettings - val wrapped: List = - try { - listOf(api.getFocusSkipButtonWhenAvailable(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings + val wrapped: List = try { + listOf(api.getFocusSkipButtonWhenAvailable(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4693,22 +3938,16 @@ abstract class PigeonApiAdsRenderingSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getMimeTypes", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getMimeTypes", 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.AdsRenderingSettings - val wrapped: List = - try { - listOf(api.getMimeTypes(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings + val wrapped: List = try { + listOf(api.getMimeTypes(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4716,24 +3955,18 @@ abstract class PigeonApiAdsRenderingSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setBitrateKbps", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setBitrateKbps", 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.AdsRenderingSettings + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings val bitrateArg = args[1] as Long - val wrapped: List = - try { - api.setBitrateKbps(pigeon_instanceArg, bitrateArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.setBitrateKbps(pigeon_instanceArg, bitrateArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4741,24 +3974,18 @@ abstract class PigeonApiAdsRenderingSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setEnableCustomTabs", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setEnableCustomTabs", 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.AdsRenderingSettings + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings val enableCustomTabsArg = args[1] as Boolean - val wrapped: List = - try { - api.setEnableCustomTabs(pigeon_instanceArg, enableCustomTabsArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.setEnableCustomTabs(pigeon_instanceArg, enableCustomTabsArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4766,24 +3993,18 @@ abstract class PigeonApiAdsRenderingSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setEnablePreloading", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setEnablePreloading", 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.AdsRenderingSettings + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings val enablePreloadingArg = args[1] as Boolean - val wrapped: List = - try { - api.setEnablePreloading(pigeon_instanceArg, enablePreloadingArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.setEnablePreloading(pigeon_instanceArg, enablePreloadingArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4791,24 +4012,18 @@ abstract class PigeonApiAdsRenderingSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setFocusSkipButtonWhenAvailable", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setFocusSkipButtonWhenAvailable", 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.AdsRenderingSettings + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings val enableFocusSkipButtonArg = args[1] as Boolean - val wrapped: List = - try { - api.setFocusSkipButtonWhenAvailable(pigeon_instanceArg, enableFocusSkipButtonArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.setFocusSkipButtonWhenAvailable(pigeon_instanceArg, enableFocusSkipButtonArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4816,24 +4031,18 @@ abstract class PigeonApiAdsRenderingSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setLoadVideoTimeout", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setLoadVideoTimeout", 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.AdsRenderingSettings + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings val loadVideoTimeoutArg = args[1] as Long - val wrapped: List = - try { - api.setLoadVideoTimeout(pigeon_instanceArg, loadVideoTimeoutArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.setLoadVideoTimeout(pigeon_instanceArg, loadVideoTimeoutArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4841,24 +4050,18 @@ abstract class PigeonApiAdsRenderingSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setMimeTypes", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setMimeTypes", 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.AdsRenderingSettings + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings val mimeTypesArg = args[1] as List - val wrapped: List = - try { - api.setMimeTypes(pigeon_instanceArg, mimeTypesArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.setMimeTypes(pigeon_instanceArg, mimeTypesArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4866,24 +4069,18 @@ abstract class PigeonApiAdsRenderingSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setPlayAdsAfterTime", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setPlayAdsAfterTime", 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.AdsRenderingSettings + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings val timeArg = args[1] as Double - val wrapped: List = - try { - api.setPlayAdsAfterTime(pigeon_instanceArg, timeArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.setPlayAdsAfterTime(pigeon_instanceArg, timeArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4891,24 +4088,18 @@ abstract class PigeonApiAdsRenderingSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setUiElements", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setUiElements", 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.AdsRenderingSettings + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings val uiElementsArg = args[1] as List - val wrapped: List = - try { - api.setUiElements(pigeon_instanceArg, uiElementsArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.setUiElements(pigeon_instanceArg, uiElementsArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4920,96 +4111,72 @@ abstract class PigeonApiAdsRenderingSettings( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of AdsRenderingSettings and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** * Represents the progress within this ad break. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdProgressInfo.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdProgressInfo.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdProgressInfo( - open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiAdProgressInfo(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { /** Total ad break duration (in seconds). */ - abstract fun adBreakDuration( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo - ): Double + abstract fun adBreakDuration(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo): Double /** Total ad period duration (in seconds). */ - abstract fun adPeriodDuration( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo - ): Double + abstract fun adPeriodDuration(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo): Double /** The position of current ad within the ad break, starting with 1. */ - abstract fun adPosition( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo - ): Long + abstract fun adPosition(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo): Long /** Current time within the ad (in seconds). */ - abstract fun currentTime( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo - ): Double + abstract fun currentTime(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo): Double /** Duration of current ad (in seconds). */ - abstract fun duration( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo - ): Double + abstract fun duration(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo): Double /** The total number of ads in this ad break. */ - abstract fun totalAds( - pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo - ): Long + abstract fun totalAds(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo): Long @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of AdProgressInfo and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdProgressInfo, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdProgressInfo, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val adBreakDurationArg = adBreakDuration(pigeon_instanceArg) val adPeriodDurationArg = adPeriodDuration(pigeon_instanceArg) val adPositionArg = adPosition(pigeon_instanceArg) @@ -5020,46 +4187,30 @@ abstract class PigeonApiAdProgressInfo( val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.AdProgressInfo.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send( - listOf( - pigeon_identifierArg, - adBreakDurationArg, - adPeriodDurationArg, - adPositionArg, - currentTimeArg, - durationArg, - totalAdsArg)) { - 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + channel.send(listOf(pigeon_identifierArg, adBreakDurationArg, adPeriodDurationArg, adPositionArg, currentTimeArg, durationArg, totalAdsArg)) { + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } + } } } + } /** * An object that holds data corresponding to the companion Ad. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/CompanionAd.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/CompanionAd.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiCompanionAd( - open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiCompanionAd(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { /** The API needed to execute this ad, or null if unavailable. */ - abstract fun apiFramework( - pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAd - ): String? + abstract fun apiFramework(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAd): String? /** * The height of the companion in pixels. @@ -5069,9 +4220,7 @@ abstract class PigeonApiCompanionAd( abstract fun height(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAd): Long /** The URL for the static resource of this companion. */ - abstract fun resourceValue( - pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAd - ): String + abstract fun resourceValue(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAd): String /** * The width of the companion in pixels. @@ -5082,19 +4231,16 @@ abstract class PigeonApiCompanionAd( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of CompanionAd and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.CompanionAd, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.CompanionAd, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val apiFrameworkArg = apiFramework(pigeon_instanceArg) val heightArg = height(pigeon_instanceArg) val resourceValueArg = resourceValue(pigeon_instanceArg) @@ -5103,68 +4249,54 @@ abstract class PigeonApiCompanionAd( val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.CompanionAd.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send( - listOf(pigeon_identifierArg, apiFrameworkArg, heightArg, resourceValueArg, widthArg)) { - 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + channel.send(listOf(pigeon_identifierArg, apiFrameworkArg, heightArg, resourceValueArg, widthArg)) { + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } + } } } + } /** * This object exposes information about the universal ad ID. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/UniversalAdId.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/UniversalAdId.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiUniversalAdId( - open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiUniversalAdId(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { /** * Returns the ad ID registry associated with the ad ID value. * * Returns "unknown" if the registry is not known. */ - abstract fun adIdRegistry( - pigeon_instance: com.google.ads.interactivemedia.v3.api.UniversalAdId - ): String + abstract fun adIdRegistry(pigeon_instance: com.google.ads.interactivemedia.v3.api.UniversalAdId): String /** * Returns the universal ad ID value. * * Returns "unknown" if the value is not known. */ - abstract fun adIdValue( - pigeon_instance: com.google.ads.interactivemedia.v3.api.UniversalAdId - ): String + abstract fun adIdValue(pigeon_instance: com.google.ads.interactivemedia.v3.api.UniversalAdId): String @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of UniversalAdId and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.UniversalAdId, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.UniversalAdId, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val adIdRegistryArg = adIdRegistry(pigeon_instanceArg) val adIdValueArg = adIdValue(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger @@ -5174,55 +4306,42 @@ abstract class PigeonApiUniversalAdId( channel.send(listOf(pigeon_identifierArg, adIdRegistryArg, adIdValueArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** * An object that holds data corresponding to the main Ad. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/Ad.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/Ad.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAd( - open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiAd(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { /** The ad ID as specified in the VAST response. */ abstract fun adId(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): String /** The pod metadata object. */ - abstract fun adPodInfo( - pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad - ): com.google.ads.interactivemedia.v3.api.AdPodInfo + abstract fun adPodInfo(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): com.google.ads.interactivemedia.v3.api.AdPodInfo /** The ad system as specified in the VAST response. */ abstract fun adSystem(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): String /** The IDs of the ads' creatives, starting with the first wrapper ad. */ - abstract fun adWrapperCreativeIds( - pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad - ): List + abstract fun adWrapperCreativeIds(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): List /** The wrapper ad IDs as specified in the VAST response. */ - abstract fun adWrapperIds( - pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad - ): List + abstract fun adWrapperIds(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): List /** The wrapper ad systems as specified in the VAST response. */ - abstract fun adWrapperSystems( - pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad - ): List + abstract fun adWrapperSystems(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): List /** The advertiser name as defined by the serving party. */ abstract fun advertiserName(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): String @@ -5232,13 +4351,11 @@ abstract class PigeonApiAd( * * Returns an empty list in any other scenario. */ - abstract fun companionAds( - pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad - ): List + abstract fun companionAds(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): List /** - * The content type of the currently selected creative, or null if no creative is selected or the - * content type is unavailable. + * The content type of the currently selected creative, or null if no + * creative is selected or the content type is unavailable. */ abstract fun contentType(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): String? @@ -5248,7 +4365,10 @@ abstract class PigeonApiAd( /** The ID of the selected creative for the ad, */ abstract fun creativeId(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): String - /** The first deal ID present in the wrapper chain for the current ad, starting from the top. */ + /** + * The first deal ID present in the wrapper chain for the current ad, + * starting from the top. + */ abstract fun dealId(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): String /** The description of this ad from the VAST response. */ @@ -5269,20 +4389,17 @@ abstract class PigeonApiAd( /** The title of this ad from the VAST response. */ abstract fun title(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): String? - /** The custom parameters associated with the ad at the time of ad trafficking. */ - abstract fun traffickingParameters( - pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad - ): String + /** + * The custom parameters associated with the ad at the time of ad + * trafficking. + */ + abstract fun traffickingParameters(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): String /** Te set of ad UI elements rendered by the IMA SDK for this ad. */ - abstract fun uiElements( - pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad - ): List + abstract fun uiElements(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): List /** The list of all universal ad IDs for this ad. */ - abstract fun universalAdIds( - pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad - ): List + abstract fun universalAdIds(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): List /** The VAST bitrate in Kbps of the selected creative. */ abstract fun vastMediaBitrate(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): Long @@ -5296,7 +4413,10 @@ abstract class PigeonApiAd( /** The width of the selected creative if non-linear, else returns 0. */ abstract fun width(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): Long - /** Indicates whether the ad’s current mode of operation is linear or non-linear. */ + /** + * Indicates whether the ad’s current mode of operation is linear or + * non-linear. + */ abstract fun isLinear(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): Boolean /** Indicates whether the ad can be skipped by the user. */ @@ -5304,19 +4424,16 @@ abstract class PigeonApiAd( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of Ad and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.Ad, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.Ad, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val adIdArg = adId(pigeon_instanceArg) val adPodInfoArg = adPodInfo(pigeon_instanceArg) val adSystemArg = adSystem(pigeon_instanceArg) @@ -5348,91 +4465,46 @@ abstract class PigeonApiAd( val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.Ad.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send( - listOf( - pigeon_identifierArg, - adIdArg, - adPodInfoArg, - adSystemArg, - adWrapperCreativeIdsArg, - adWrapperIdsArg, - adWrapperSystemsArg, - advertiserNameArg, - companionAdsArg, - contentTypeArg, - creativeAdIdArg, - creativeIdArg, - dealIdArg, - descriptionArg, - durationArg, - heightArg, - skipTimeOffsetArg, - surveyUrlArg, - titleArg, - traffickingParametersArg, - uiElementsArg, - universalAdIdsArg, - vastMediaBitrateArg, - vastMediaHeightArg, - vastMediaWidthArg, - widthArg, - isLinearArg, - isSkippableArg)) { - 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + channel.send(listOf(pigeon_identifierArg, adIdArg, adPodInfoArg, adSystemArg, adWrapperCreativeIdsArg, adWrapperIdsArg, adWrapperSystemsArg, advertiserNameArg, companionAdsArg, contentTypeArg, creativeAdIdArg, creativeIdArg, dealIdArg, descriptionArg, durationArg, heightArg, skipTimeOffsetArg, surveyUrlArg, titleArg, traffickingParametersArg, uiElementsArg, universalAdIdsArg, vastMediaBitrateArg, vastMediaHeightArg, vastMediaWidthArg, widthArg, isLinearArg, isSkippableArg)) { + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } + } } } + } /** * Listener interface for click events. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/CompanionAdSlot.ClickListener.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/CompanionAdSlot.ClickListener.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiCompanionAdSlotClickListener( - open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar -) { - abstract fun pigeon_defaultConstructor(): - com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener +abstract class PigeonApiCompanionAdSlotClickListener(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { + abstract fun pigeon_defaultConstructor(): com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener companion object { @Suppress("LocalVariableName") - fun setUpMessageHandlers( - binaryMessenger: BinaryMessenger, - api: PigeonApiCompanionAdSlotClickListener? - ) { + fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiCompanionAdSlotClickListener?) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlotClickListener.pigeon_defaultConstructor", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlotClickListener.pigeon_defaultConstructor", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5443,35 +4515,25 @@ abstract class PigeonApiCompanionAdSlotClickListener( } @Suppress("LocalVariableName", "FunctionName") - /** - * Creates a Dart instance of CompanionAdSlotClickListener and attaches it to - * [pigeon_instanceArg]. - */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener, - callback: (Result) -> Unit - ) { + /** Creates a Dart instance of CompanionAdSlotClickListener and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { + } else { callback( Result.failure( - FlutterError( - "new-instance-error", - "Attempting to create a new Dart instance of CompanionAdSlotClickListener, but the class has a nonnull callback method.", - ""))) + FlutterError("new-instance-error", "Attempting to create a new Dart instance of CompanionAdSlotClickListener, but the class has a nonnull callback method.", ""))) } } /** Respond to a click on this companion ad slot. */ - fun onCompanionAdClick( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener, - callback: (Result) -> Unit - ) { + fun onCompanionAdClick(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -5480,8 +4542,7 @@ abstract class PigeonApiCompanionAdSlotClickListener( } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlotClickListener.onCompanionAdClick" + val channelName = "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlotClickListener.onCompanionAdClick" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg)) { if (it is List<*>) { @@ -5491,100 +4552,76 @@ abstract class PigeonApiCompanionAdSlotClickListener( callback(Result.success(Unit)) } } else { - callback( - Result.failure( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } + } /** * A companion ad slot for which the SDK should retrieve ads. * - * See - * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/CompanionAdSlot.html. + * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/CompanionAdSlot.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiCompanionAdSlot( - open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiCompanionAdSlot(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { /** Registers a listener for companion clicks. */ - abstract fun addClickListener( - pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, - clickListener: com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener - ) + abstract fun addClickListener(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, clickListener: com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener) /** Returns the ViewGroup into which the companion will be rendered. */ - abstract fun getContainer( - pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot - ): android.view.ViewGroup + abstract fun getContainer(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot): android.view.ViewGroup /** Returns the height of the companion slot. */ - abstract fun getHeight( - pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot - ): Long + abstract fun getHeight(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot): Long /** Returns the width of the companion slot. */ - abstract fun getWidth( - pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot - ): Long + abstract fun getWidth(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot): Long /** Returns true if the companion slot is filled, false otherwise. */ - abstract fun isFilled( - pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot - ): Boolean + abstract fun isFilled(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot): Boolean /** Removes a listener for companion clicks. */ - abstract fun removeClickListener( - pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, - clickListener: com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener - ) + abstract fun removeClickListener(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, clickListener: com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener) /** * Sets the ViewGroup into which the companion will be rendered. * * Required. */ - abstract fun setContainer( - pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, - container: android.view.ViewGroup - ) + abstract fun setContainer(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, container: android.view.ViewGroup) /** * Sets the size of the slot. * * Only companions matching the slot size will be displayed in the slot. */ - abstract fun setSize( - pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, - width: Long, - height: Long - ) + abstract fun setSize(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, width: Long, height: Long) + + /** + * Sets the size of the slot as fluid. + * + * This is a convenience method that sets both parameters of [setSize] to + * [CompanionAdSlot.FLUID_SIZE](https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/CompanionAdSlot#FLUID_SIZE()). + */ + abstract fun setFluidSize(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiCompanionAdSlot?) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.addClickListener", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.addClickListener", 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.CompanionAdSlot - val clickListenerArg = - args[1] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener - val wrapped: List = - try { - api.addClickListener(pigeon_instanceArg, clickListenerArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot + val clickListenerArg = args[1] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener + val wrapped: List = try { + api.addClickListener(pigeon_instanceArg, clickListenerArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5592,22 +4629,16 @@ abstract class PigeonApiCompanionAdSlot( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.getContainer", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.getContainer", 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.CompanionAdSlot - val wrapped: List = - try { - listOf(api.getContainer(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot + val wrapped: List = try { + listOf(api.getContainer(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5615,22 +4646,16 @@ abstract class PigeonApiCompanionAdSlot( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.getHeight", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.getHeight", 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.CompanionAdSlot - val wrapped: List = - try { - listOf(api.getHeight(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot + val wrapped: List = try { + listOf(api.getHeight(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5638,22 +4663,16 @@ abstract class PigeonApiCompanionAdSlot( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.getWidth", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.getWidth", 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.CompanionAdSlot - val wrapped: List = - try { - listOf(api.getWidth(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot + val wrapped: List = try { + listOf(api.getWidth(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5661,22 +4680,16 @@ abstract class PigeonApiCompanionAdSlot( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.isFilled", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.isFilled", 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.CompanionAdSlot - val wrapped: List = - try { - listOf(api.isFilled(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot + val wrapped: List = try { + listOf(api.isFilled(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5684,25 +4697,18 @@ abstract class PigeonApiCompanionAdSlot( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.removeClickListener", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.removeClickListener", 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.CompanionAdSlot - val clickListenerArg = - args[1] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener - val wrapped: List = - try { - api.removeClickListener(pigeon_instanceArg, clickListenerArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot + val clickListenerArg = args[1] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener + val wrapped: List = try { + api.removeClickListener(pigeon_instanceArg, clickListenerArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5710,24 +4716,18 @@ abstract class PigeonApiCompanionAdSlot( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.setContainer", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.setContainer", 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.CompanionAdSlot + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot val containerArg = args[1] as android.view.ViewGroup - val wrapped: List = - try { - api.setContainer(pigeon_instanceArg, containerArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.setContainer(pigeon_instanceArg, containerArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5735,25 +4735,37 @@ abstract class PigeonApiCompanionAdSlot( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.setSize", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.setSize", 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.CompanionAdSlot + val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot val widthArg = args[1] as Long val heightArg = args[2] as Long - val wrapped: List = - try { - api.setSize(pigeon_instanceArg, widthArg, heightArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = try { + api.setSize(pigeon_instanceArg, widthArg, heightArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.setFluidSize", 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.CompanionAdSlot + val wrapped: List = try { + api.setFluidSize(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5765,38 +4777,32 @@ abstract class PigeonApiCompanionAdSlot( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of CompanionAdSlot and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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( - InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } diff --git a/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/CompanionAdSlotProxyApiTest.kt b/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/CompanionAdSlotProxyApiTest.kt index 9e85e402c14..720d03b8978 100644 --- a/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/CompanionAdSlotProxyApiTest.kt +++ b/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/CompanionAdSlotProxyApiTest.kt @@ -101,4 +101,14 @@ class CompanionAdSlotProxyApiTest { verify(instance).setSize(width.toInt(), height.toInt()) } + + @Test + fun setFluidSize() { + val api = TestProxyApiRegistrar().getPigeonApiCompanionAdSlot() + + val instance = mock() + api.setFluidSize(instance) + + verify(instance).setSize(CompanionAdSlot.FLUID_SIZE, CompanionAdSlot.FLUID_SIZE) + } } diff --git a/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/ImaSdkFactoryProxyApiTest.kt b/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/ImaSdkFactoryProxyApiTest.kt index 092340d5b47..da0100b0dfe 100644 --- a/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/ImaSdkFactoryProxyApiTest.kt +++ b/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/ImaSdkFactoryProxyApiTest.kt @@ -8,6 +8,7 @@ import com.google.ads.interactivemedia.v3.api.AdDisplayContainer import com.google.ads.interactivemedia.v3.api.AdsLoader import com.google.ads.interactivemedia.v3.api.AdsRenderingSettings import com.google.ads.interactivemedia.v3.api.AdsRequest +import com.google.ads.interactivemedia.v3.api.CompanionAdSlot import com.google.ads.interactivemedia.v3.api.ImaSdkFactory import com.google.ads.interactivemedia.v3.api.ImaSdkSettings import kotlin.test.Test @@ -42,6 +43,17 @@ class ImaSdkFactoryProxyApiTest { assertEquals(mockAdsLoader, api.createAdsLoader(instance, mockSettings, mockContainer)) } + @Test + fun createCompanionAdSlot() { + val api = TestProxyApiRegistrar().getPigeonApiImaSdkFactory() + + val instance = mock() + val mockAdSlot = mock() + whenever(instance.createCompanionAdSlot()).thenReturn(mockAdSlot) + + assertEquals(mockAdSlot, api.createCompanionAdSlot(instance)) + } + @Test fun createAdsRequest() { val api = TestProxyApiRegistrar().getPigeonApiImaSdkFactory() 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 5c96a97db60..665ccc2444e 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,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. /// @@ -113,10 +110,9 @@ class PigeonInstanceManager { // by calling instanceManager.getIdentifier() inside of `==` while this was a // HashMap). final Expando _identifiers = Expando(); - final Map> - _weakInstances = >{}; - final Map _strongInstances = - {}; + final Map> _weakInstances = + >{}; + final Map _strongInstances = {}; late final Finalizer _finalizer; int _nextIdentifier = 0; @@ -126,8 +122,7 @@ class PigeonInstanceManager { static PigeonInstanceManager _initInstance() { WidgetsFlutterBinding.ensureInitialized(); - final _PigeonInternalInstanceManagerApi api = - _PigeonInternalInstanceManagerApi(); + final _PigeonInternalInstanceManagerApi api = _PigeonInternalInstanceManagerApi(); // Clears the native `PigeonInstanceManager` on the initial use of the Dart one. api.clear(); final PigeonInstanceManager instanceManager = PigeonInstanceManager( @@ -135,72 +130,40 @@ class PigeonInstanceManager { api.removeStrongReference(identifier); }, ); - _PigeonInternalInstanceManagerApi.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); + _PigeonInternalInstanceManagerApi.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); - AdsRenderingSettings.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - AdProgressInfo.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - CompanionAd.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - UniversalAdId.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); + AdsRenderingSettings.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + AdProgressInfo.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + CompanionAd.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + UniversalAdId.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); Ad.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - CompanionAdSlotClickListener.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - CompanionAdSlot.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); + CompanionAdSlotClickListener.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + CompanionAdSlot.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); return instanceManager; } @@ -264,20 +227,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 PigeonInternalProxyApiBaseClass? weakInstance = - _weakInstances[identifier]?.target; + T? getInstanceWithWeakReference(int identifier) { + final PigeonInternalProxyApiBaseClass? weakInstance = _weakInstances[identifier]?.target; if (weakInstance == null) { - final PigeonInternalProxyApiBaseClass? strongInstance = - _strongInstances[identifier]; + final PigeonInternalProxyApiBaseClass? strongInstance = _strongInstances[identifier]; if (strongInstance != null) { - final PigeonInternalProxyApiBaseClass copy = - strongInstance.pigeon_copy(); + final PigeonInternalProxyApiBaseClass 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; } @@ -301,20 +259,17 @@ class PigeonInstanceManager { /// added. /// /// Returns unique identifier of the [instance] added. - void addHostCreatedInstance( - PigeonInternalProxyApiBaseClass instance, int identifier) { + void addHostCreatedInstance(PigeonInternalProxyApiBaseClass instance, int identifier) { _addInstanceWithIdentifier(instance, identifier); } - void _addInstanceWithIdentifier( - PigeonInternalProxyApiBaseClass instance, int identifier) { + void _addInstanceWithIdentifier(PigeonInternalProxyApiBaseClass 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 PigeonInternalProxyApiBaseClass copy = instance.pigeon_copy(); @@ -441,109 +396,86 @@ class _PigeonInternalInstanceManagerApi { } class _PigeonInternalProxyApiBaseCodec extends _PigeonCodec { - const _PigeonInternalProxyApiBaseCodec(this.instanceManager); - final PigeonInstanceManager instanceManager; - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is PigeonInternalProxyApiBaseClass) { - 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 _PigeonInternalProxyApiBaseCodec(this.instanceManager); + final PigeonInstanceManager instanceManager; + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is PigeonInternalProxyApiBaseClass) { + 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, } @@ -554,10 +486,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, } @@ -568,88 +498,61 @@ 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, } @@ -660,14 +563,13 @@ enum AdEventType { enum UiElement { /// The ad attribution UI element, for example, "Ad". adAttribution, - /// Ad attribution is required for a countdown timer to be displayed. countdown, - /// The element is not recognized by this wrapper. unknown, } + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -675,16 +577,16 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is AdErrorCode) { + } else 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 if (value is UiElement) { + } else if (value is UiElement) { buffer.putUint8(132); writeValue(buffer, value.index); } else { @@ -695,16 +597,16 @@ 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]; - case 132: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : UiElement.values[value]; default: @@ -712,7 +614,6 @@ 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. @@ -2433,6 +2334,41 @@ class ImaSdkFactory extends PigeonInternalProxyApiBaseClass { } } + /// Creates a CompanionAdSlot for the SDK to fill with companion ads. + Future createCompanionAdSlot() async { + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecImaSdkFactory; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createCompanionAdSlot'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else if (pigeonVar_replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (pigeonVar_replyList[0] as CompanionAdSlot?)!; + } + } + /// Creates an `ImaSdkSettings` object for configuring the IMA SDK. Future createImaSdkSettings() async { final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = @@ -7036,6 +6972,39 @@ class CompanionAdSlot extends PigeonInternalProxyApiBaseClass { } } + /// Sets the size of the slot as fluid. + /// + /// This is a convenience method that sets both parameters of [setSize] to + /// [CompanionAdSlot.FLUID_SIZE](https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/CompanionAdSlot#FLUID_SIZE()). + Future setFluidSize() async { + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecCompanionAdSlot; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.setFluidSize'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + @override CompanionAdSlot pigeon_copy() { return CompanionAdSlot.pigeon_detached( @@ -7044,3 +7013,4 @@ class CompanionAdSlot extends PigeonInternalProxyApiBaseClass { ); } } + 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 46db8d3e2d2..e032005c9b5 100644 --- a/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart +++ b/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart @@ -457,6 +457,9 @@ abstract class ImaSdkFactory { VideoAdPlayer player, ); + /// Creates a CompanionAdSlot for the SDK to fill with companion ads. + CompanionAdSlot createCompanionAdSlot(); + /// Creates an `ImaSdkSettings` object for configuring the IMA SDK. ImaSdkSettings createImaSdkSettings(); @@ -1083,4 +1086,10 @@ abstract class CompanionAdSlot { /// /// Only companions matching the slot size will be displayed in the slot. void setSize(int width, int height); + + /// Sets the size of the slot as fluid. + /// + /// This is a convenience method that sets both parameters of [setSize] to + /// [CompanionAdSlot.FLUID_SIZE](https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/CompanionAdSlot#FLUID_SIZE()). + void setFluidSize(); } From 520789c57b84b551a153a5c2f2c13e35dcad7ace Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 29 Apr 2025 17:38:33 -0400 Subject: [PATCH 02/37] platform interface and app facing impl --- .../lib/interactive_media_ads.dart | 1 + .../android_interactive_media_ads.dart | 7 + .../lib/src/companion_ad_slot.dart | 112 +++++++++++++ .../src/ios/ios_interactive_media_ads.dart | 7 + .../interactive_media_ads_platform.dart | 6 + .../platform_companion_ad_slot.dart | 121 ++++++++++++++ .../platform_interface.dart | 1 + .../ad_display_container_test.mocks.dart | 21 +-- .../test/android/ads_loader_test.mocks.dart | 141 ++++++++++------ .../test/android/ads_manager_test.mocks.dart | 71 ++++++-- .../content_progress_provider_test.mocks.dart | 3 +- .../test/companion_ad_slot_test.dart | 63 +++++++ .../ios/ad_display_container_test.mocks.dart | 107 +++++++++--- .../test/ios/ads_loader_test.mocks.dart | 155 ++++++++++++------ .../test/ios/ads_manager_test.mocks.dart | 3 +- .../content_progress_provider_test.mocks.dart | 3 +- .../test/test_stubs.dart | 32 +++- 17 files changed, 700 insertions(+), 154 deletions(-) create mode 100644 packages/interactive_media_ads/lib/src/companion_ad_slot.dart create mode 100644 packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart create mode 100644 packages/interactive_media_ads/test/companion_ad_slot_test.dart diff --git a/packages/interactive_media_ads/lib/interactive_media_ads.dart b/packages/interactive_media_ads/lib/interactive_media_ads.dart index f8355bba41c..86985d67a24 100644 --- a/packages/interactive_media_ads/lib/interactive_media_ads.dart +++ b/packages/interactive_media_ads/lib/interactive_media_ads.dart @@ -9,6 +9,7 @@ export 'src/ads_rendering_settings.dart'; export 'src/ads_request.dart'; export 'src/android/android_interactive_media_ads.dart' show AndroidInteractiveMediaAds; +export 'src/companion_ad_slot.dart'; export 'src/content_progress_provider.dart'; export 'src/ios/ios_interactive_media_ads.dart' show IOSInteractiveMediaAds; export 'src/platform_interface/platform_interface.dart' diff --git a/packages/interactive_media_ads/lib/src/android/android_interactive_media_ads.dart b/packages/interactive_media_ads/lib/src/android/android_interactive_media_ads.dart index 8e77520a07f..c262b331d37 100644 --- a/packages/interactive_media_ads/lib/src/android/android_interactive_media_ads.dart +++ b/packages/interactive_media_ads/lib/src/android/android_interactive_media_ads.dart @@ -7,6 +7,7 @@ import '../platform_interface/platform_ad_display_container.dart'; import '../platform_interface/platform_ads_loader.dart'; import '../platform_interface/platform_ads_manager_delegate.dart'; import '../platform_interface/platform_ads_rendering_settings.dart'; +import '../platform_interface/platform_companion_ad_slot.dart'; import '../platform_interface/platform_content_progress_provider.dart'; import 'android_ad_display_container.dart'; import 'android_ads_loader.dart'; @@ -55,4 +56,10 @@ final class AndroidInteractiveMediaAds extends InteractiveMediaAdsPlatform { ) { return AndroidAdsRenderingSettings(params); } + + @override + PlatformCompanionAdSlot createPlatformCompanionAdSlot(PlatformCompanionAdSlotCreationParams params) { + // TODO: implement createPlatformCompanionAdSlot + throw UnimplementedError(); + } } diff --git a/packages/interactive_media_ads/lib/src/companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/companion_ad_slot.dart new file mode 100644 index 00000000000..e82ac7b2171 --- /dev/null +++ b/packages/interactive_media_ads/lib/src/companion_ad_slot.dart @@ -0,0 +1,112 @@ +// 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. + +import 'package:flutter/material.dart'; + +import 'platform_interface/platform_interface.dart'; + +/// A [Widget] for displaying loaded ads. +/// +/// ## Platform-Specific Features +/// This class contains an underlying implementation provided by the current +/// platform. Once a platform implementation is imported, the examples below +/// can be followed to use features provided by a platform's implementation. +/// +/// {@macro interactive_media_ads.CompanionAdSlot.fromPlatformCreationParams} +/// +/// Below is an example of accessing the platform-specific implementation for +/// iOS and Android: +/// +/// ```dart +/// final CompanionAdSlot slot = CompanionAdSlot(); +/// +/// if (InteractiveMediaAdsPlatform.instance is IOSInteractiveMediaAdsPlatform) { +/// final IOSCompanionAdSlot iosSlot = slot.platform as IOSCompanionAdSlot; +/// } else if (InteractiveMediaAdsPlatform.instance is AndroidInteractiveMediaAdsPlatform) { +/// final AndroidCompanionAdSlot androidSlot = +/// slot.platform as AndroidCompanionAdSlot; +/// } +/// ``` +class CompanionAdSlot extends StatelessWidget { + /// Constructs an [CompanionAdSlot]. + /// + /// See [CompanionAdSlot.fromPlatformCreationParams] for setting parameters + /// for a specific platform. + CompanionAdSlot.size({ + Key? key, + required int width, + required int height, + TextDirection layoutDirection = TextDirection.ltr, + }) : this.fromPlatformCreationParams( + key: key, + params: PlatformCompanionAdSlotCreationParams.size( + width: width, + height: height, + layoutDirection: layoutDirection, + ), + ); + + /// Constructs an [CompanionAdSlot]. + /// + /// See [CompanionAdSlot.fromPlatformCreationParams] for setting parameters + /// for a specific platform. + CompanionAdSlot.fluid({ + Key? key, + TextDirection layoutDirection = TextDirection.ltr, + }) : this.fromPlatformCreationParams( + key: key, + params: PlatformCompanionAdSlotCreationParams.fluid( + layoutDirection: layoutDirection, + ), + ); + + /// Constructs an [CompanionAdSlot] from creation params for a specific platform. + /// + /// {@template interactive_media_ads.CompanionAdSlot.fromPlatformCreationParams} + /// Below is an example of setting platform-specific creation parameters for + /// iOS and Android: + /// + /// ```dart + /// PlatformCompanionAdSlotCreationParams params = + /// const PlatformCompanionAdSlotCreationParams(); + /// + /// if (InteractiveMediaAdsPlatform.instance is IOSInteractiveMediaAdsPlatform) { + /// params = IOSCompanionAdSlotCreationParams + /// .fromPlatformCompanionAdSlotCreationParams( + /// params, + /// ); + /// } else if (InteractiveMediaAdsPlatform.instance is AndroidInteractiveMediaAdsPlatform) { + /// params = AndroidCompanionAdSlotCreationParams + /// .fromPlatformCompanionAdSlotCreationParams( + /// params, + /// ); + /// } + /// + /// final CompanionAdSlot slot = CompanionAdSlot.fromPlatformCreationParams( + /// params, + /// ); + /// ``` + /// {@endtemplate} + CompanionAdSlot.fromPlatformCreationParams({ + Key? key, + required PlatformCompanionAdSlotCreationParams params, + }) : this.fromPlatform( + key: key, + platform: PlatformCompanionAdSlot(params), + ); + + /// Constructs an [CompanionAdSlot] from a specific platform implementation. + const CompanionAdSlot.fromPlatform({super.key, required this.platform}); + + /// Implementation of [PlatformCompanionAdSlot] for the current platform. + final PlatformCompanionAdSlot platform; + + /// The layout direction to use for the embedded CompanionAdSlot. + TextDirection get layoutDirection => platform.params.layoutDirection; + + @override + Widget build(BuildContext context) { + return platform.build(context); + } +} diff --git a/packages/interactive_media_ads/lib/src/ios/ios_interactive_media_ads.dart b/packages/interactive_media_ads/lib/src/ios/ios_interactive_media_ads.dart index b79928c57a0..8d64b1219fa 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_interactive_media_ads.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_interactive_media_ads.dart @@ -7,6 +7,7 @@ import '../platform_interface/platform_ad_display_container.dart'; import '../platform_interface/platform_ads_loader.dart'; import '../platform_interface/platform_ads_manager_delegate.dart'; import '../platform_interface/platform_ads_rendering_settings.dart'; +import '../platform_interface/platform_companion_ad_slot.dart'; import '../platform_interface/platform_content_progress_provider.dart'; import 'ios_ad_display_container.dart'; import 'ios_ads_loader.dart'; @@ -53,4 +54,10 @@ final class IOSInteractiveMediaAds extends InteractiveMediaAdsPlatform { ) { return IOSAdsRenderingSettings(params); } + + @override + PlatformCompanionAdSlot createPlatformCompanionAdSlot(PlatformCompanionAdSlotCreationParams params) { + // TODO: implement createPlatformCompanionAdSlot + throw UnimplementedError(); + } } diff --git a/packages/interactive_media_ads/lib/src/platform_interface/interactive_media_ads_platform.dart b/packages/interactive_media_ads/lib/src/platform_interface/interactive_media_ads_platform.dart index 15b898e462c..2eb3710fd8b 100644 --- a/packages/interactive_media_ads/lib/src/platform_interface/interactive_media_ads_platform.dart +++ b/packages/interactive_media_ads/lib/src/platform_interface/interactive_media_ads_platform.dart @@ -6,6 +6,7 @@ import 'platform_ad_display_container.dart'; import 'platform_ads_loader.dart'; import 'platform_ads_manager_delegate.dart'; import 'platform_ads_rendering_settings.dart'; +import 'platform_companion_ad_slot.dart'; import 'platform_content_progress_provider.dart'; /// Interface for a platform implementation of the Interactive Media Ads SDKs. @@ -41,4 +42,9 @@ abstract base class InteractiveMediaAdsPlatform { PlatformAdsRenderingSettings createPlatformAdsRenderingSettings( PlatformAdsRenderingSettingsCreationParams params, ); + + /// Creates a new [PlatformCompanionAdSlot]. + PlatformCompanionAdSlot createPlatformCompanionAdSlot( + PlatformCompanionAdSlotCreationParams params, + ); } diff --git a/packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart new file mode 100644 index 00000000000..26f25755d24 --- /dev/null +++ b/packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart @@ -0,0 +1,121 @@ +// 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. + +import 'package:flutter/widgets.dart'; + +import 'interactive_media_ads_platform.dart'; + +/// Object specifying creation parameters for creating a +/// [PlatformCompanionAdSlot]. +/// +/// Platform specific implementations can add additional fields by extending +/// this class. +/// +/// This example demonstrates how to extend the +/// [PlatformCompanionAdSlotCreationParams] to provide additional platform +/// specific parameters. +/// +/// When extending [PlatformCompanionAdSlotCreationParams], additional +/// parameters should always accept `null` or have a default value to prevent +/// breaking changes. +/// +/// ```dart +/// final class AndroidPlatformCompanionAdSlotCreationParams +/// extends PlatformCompanionAdSlotCreationParams { +/// const AndroidPlatformCompanionAdSlotCreationParams.fluid({ +/// super.key, +/// this.onFilled, +/// }) : super(); +/// +/// factory AndroidPlatformCompanionAdSlotCreationParams.fromPlatformCompanionAdSlotCreationParamsFluid( +/// PlatformCompanionAdSlotCreationParams params, { +/// void Function()? onFilled, +/// }) { +/// return AndroidPlatformCompanionAdSlotCreationParams.fluid( +/// key: params.key, +/// onFilled: onFilled, +/// ); +/// } +/// +/// final void Function()? onFilled; +/// } +/// ``` +@immutable +base class PlatformCompanionAdSlotCreationParams { + /// Used by the platform implementation to create a new + /// [PlatformCompanionAdSlot]. + const PlatformCompanionAdSlotCreationParams.size({ + this.key, + required int this.width, + required int this.height, + this.layoutDirection = TextDirection.ltr, + }) : isFluid = false; + + /// Used by the platform implementation to create a new + /// [PlatformCompanionAdSlot]. + const PlatformCompanionAdSlotCreationParams.fluid({ + this.key, + this.layoutDirection = TextDirection.ltr, + }) : width = null, + height = null, + isFluid = true; + + /// Controls how one widget replaces another widget in the tree. + /// + /// See also: + /// * The discussions at [Key] and [GlobalKey]. + final Key? key; + + /// The width of the companion slot. + /// + /// Returns `null` when [isFluid] returns true; + final int? width; + + /// The height of the companion slot. + /// + /// Returns `null` when [isFluid] returns true; + final int? height; + + /// Whether the companion ad has no fixed size, but rather adapts to fit the + /// creative content they display. + final bool isFluid; + + /// The layout direction to use for the embedded companion ad. + final TextDirection layoutDirection; +} + +/// Ad slot for companion ads. +abstract base class PlatformCompanionAdSlot { + /// Creates a new [PlatformCompanionAdSlot] + factory PlatformCompanionAdSlot( + PlatformCompanionAdSlotCreationParams params, + ) { + assert( + InteractiveMediaAdsPlatform.instance != null, + 'A platform implementation for `interactive_media_ads` has not been set. ' + 'Please ensure that an implementation of `InteractiveMediaAdsPlatform` ' + 'has been set to `InteractiveMediaAdsPlatform.instance` before use. For ' + 'unit testing, `InteractiveMediaAdsPlatform.instance` can be set with ' + 'your own test implementation.', + ); + final PlatformCompanionAdSlot implementation = InteractiveMediaAdsPlatform + .instance! + .createPlatformCompanionAdSlot(params); + return implementation; + } + + /// Used by the platform implementation to create a new + /// [PlatformCompanionAdSlot]. + /// + /// Should only be used by platform implementations because they can't extend + /// a class that only contains a factory constructor. + @protected + PlatformCompanionAdSlot.implementation(this.params); + + /// The parameters used to initialize the [PlatformCompanionAdSlot]. + final PlatformCompanionAdSlotCreationParams params; + + /// Builds the Widget that contains the native View. + Widget build(BuildContext context); +} diff --git a/packages/interactive_media_ads/lib/src/platform_interface/platform_interface.dart b/packages/interactive_media_ads/lib/src/platform_interface/platform_interface.dart index f2b60b7618f..8a808be70d8 100644 --- a/packages/interactive_media_ads/lib/src/platform_interface/platform_interface.dart +++ b/packages/interactive_media_ads/lib/src/platform_interface/platform_interface.dart @@ -12,4 +12,5 @@ export 'platform_ads_manager.dart'; export 'platform_ads_manager_delegate.dart'; export 'platform_ads_rendering_settings.dart'; export 'platform_ads_request.dart'; +export 'platform_companion_ad_slot.dart'; export 'platform_content_progress_provider.dart'; diff --git a/packages/interactive_media_ads/test/android/ad_display_container_test.mocks.dart b/packages/interactive_media_ads/test/android/ad_display_container_test.mocks.dart index adedc00cd18..c352bcd9f5f 100644 --- a/packages/interactive_media_ads/test/android/ad_display_container_test.mocks.dart +++ b/packages/interactive_media_ads/test/android/ad_display_container_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in interactive_media_ads/test/android/ad_display_container_test.dart. // Do not manually edit this file. @@ -22,6 +22,7 @@ import 'package:mockito/src/dummies.dart' as _i5; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types @@ -1010,15 +1011,6 @@ class MockSurfaceAndroidViewController extends _i1.Mock ), ) as _i4.PointTransformer); - @override - set pointTransformer(_i4.PointTransformer? transformer) => super.noSuchMethod( - Invocation.setter( - #pointTransformer, - transformer, - ), - returnValueForMissingStub: null, - ); - @override bool get isCreated => (super.noSuchMethod( Invocation.getter(#isCreated), @@ -1034,6 +1026,15 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValueForMissingStub: <_i4.PlatformViewCreatedCallback>[], ) as List<_i4.PlatformViewCreatedCallback>); + @override + set pointTransformer(_i4.PointTransformer? transformer) => super.noSuchMethod( + Invocation.setter( + #pointTransformer, + transformer, + ), + returnValueForMissingStub: null, + ); + @override _i6.Future setOffset(_i3.Offset? off) => (super.noSuchMethod( Invocation.method( diff --git a/packages/interactive_media_ads/test/android/ads_loader_test.mocks.dart b/packages/interactive_media_ads/test/android/ads_loader_test.mocks.dart index d1d3d9f26a8..3f0c287b080 100644 --- a/packages/interactive_media_ads/test/android/ads_loader_test.mocks.dart +++ b/packages/interactive_media_ads/test/android/ads_loader_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in interactive_media_ads/test/android/ads_loader_test.dart. // Do not manually edit this file. @@ -22,6 +22,7 @@ import 'package:mockito/src/dummies.dart' as _i5; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types @@ -142,9 +143,20 @@ class _FakeFrameLayout_10 extends _i1.SmartFake implements _i2.FrameLayout { ); } -class _FakeImaSdkSettings_11 extends _i1.SmartFake +class _FakeCompanionAdSlot_11 extends _i1.SmartFake + implements _i2.CompanionAdSlot { + _FakeCompanionAdSlot_11( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeImaSdkSettings_12 extends _i1.SmartFake implements _i2.ImaSdkSettings { - _FakeImaSdkSettings_11( + _FakeImaSdkSettings_12( Object parent, Invocation parentInvocation, ) : super( @@ -153,9 +165,9 @@ class _FakeImaSdkSettings_11 extends _i1.SmartFake ); } -class _FakeAdsRenderingSettings_12 extends _i1.SmartFake +class _FakeAdsRenderingSettings_13 extends _i1.SmartFake implements _i2.AdsRenderingSettings { - _FakeAdsRenderingSettings_12( + _FakeAdsRenderingSettings_13( Object parent, Invocation parentInvocation, ) : super( @@ -164,8 +176,8 @@ class _FakeAdsRenderingSettings_12 extends _i1.SmartFake ); } -class _FakeImaSdkFactory_13 extends _i1.SmartFake implements _i2.ImaSdkFactory { - _FakeImaSdkFactory_13( +class _FakeImaSdkFactory_14 extends _i1.SmartFake implements _i2.ImaSdkFactory { + _FakeImaSdkFactory_14( Object parent, Invocation parentInvocation, ) : super( @@ -174,8 +186,8 @@ class _FakeImaSdkFactory_13 extends _i1.SmartFake implements _i2.ImaSdkFactory { ); } -class _FakeVideoAdPlayer_14 extends _i1.SmartFake implements _i2.VideoAdPlayer { - _FakeVideoAdPlayer_14( +class _FakeVideoAdPlayer_15 extends _i1.SmartFake implements _i2.VideoAdPlayer { + _FakeVideoAdPlayer_15( Object parent, Invocation parentInvocation, ) : super( @@ -184,9 +196,9 @@ class _FakeVideoAdPlayer_14 extends _i1.SmartFake implements _i2.VideoAdPlayer { ); } -class _FakeVideoAdPlayerCallback_15 extends _i1.SmartFake +class _FakeVideoAdPlayerCallback_16 extends _i1.SmartFake implements _i2.VideoAdPlayerCallback { - _FakeVideoAdPlayerCallback_15( + _FakeVideoAdPlayerCallback_16( Object parent, Invocation parentInvocation, ) : super( @@ -195,8 +207,8 @@ class _FakeVideoAdPlayerCallback_15 extends _i1.SmartFake ); } -class _FakeVideoView_16 extends _i1.SmartFake implements _i2.VideoView { - _FakeVideoView_16( +class _FakeVideoView_17 extends _i1.SmartFake implements _i2.VideoView { + _FakeVideoView_17( Object parent, Invocation parentInvocation, ) : super( @@ -205,8 +217,8 @@ class _FakeVideoView_16 extends _i1.SmartFake implements _i2.VideoView { ); } -class _FakeOffset_17 extends _i1.SmartFake implements _i3.Offset { - _FakeOffset_17( +class _FakeOffset_18 extends _i1.SmartFake implements _i3.Offset { + _FakeOffset_18( Object parent, Invocation parentInvocation, ) : super( @@ -215,8 +227,8 @@ class _FakeOffset_17 extends _i1.SmartFake implements _i3.Offset { ); } -class _FakeSize_18 extends _i1.SmartFake implements _i3.Size { - _FakeSize_18( +class _FakeSize_19 extends _i1.SmartFake implements _i3.Size { + _FakeSize_19( Object parent, Invocation parentInvocation, ) : super( @@ -225,9 +237,9 @@ class _FakeSize_18 extends _i1.SmartFake implements _i3.Size { ); } -class _FakeExpensiveAndroidViewController_19 extends _i1.SmartFake +class _FakeExpensiveAndroidViewController_20 extends _i1.SmartFake implements _i4.ExpensiveAndroidViewController { - _FakeExpensiveAndroidViewController_19( + _FakeExpensiveAndroidViewController_20( Object parent, Invocation parentInvocation, ) : super( @@ -236,9 +248,9 @@ class _FakeExpensiveAndroidViewController_19 extends _i1.SmartFake ); } -class _FakeSurfaceAndroidViewController_20 extends _i1.SmartFake +class _FakeSurfaceAndroidViewController_21 extends _i1.SmartFake implements _i4.SurfaceAndroidViewController { - _FakeSurfaceAndroidViewController_20( + _FakeSurfaceAndroidViewController_21( Object parent, Invocation parentInvocation, ) : super( @@ -994,6 +1006,31 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { ), ) as _i2.PigeonInstanceManager); + @override + _i6.Future<_i2.CompanionAdSlot> createCompanionAdSlot() => + (super.noSuchMethod( + Invocation.method( + #createCompanionAdSlot, + [], + ), + returnValue: + _i6.Future<_i2.CompanionAdSlot>.value(_FakeCompanionAdSlot_11( + this, + Invocation.method( + #createCompanionAdSlot, + [], + ), + )), + returnValueForMissingStub: + _i6.Future<_i2.CompanionAdSlot>.value(_FakeCompanionAdSlot_11( + this, + Invocation.method( + #createCompanionAdSlot, + [], + ), + )), + ) as _i6.Future<_i2.CompanionAdSlot>); + @override _i6.Future<_i2.ImaSdkSettings> createImaSdkSettings() => (super.noSuchMethod( Invocation.method( @@ -1001,7 +1038,7 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { [], ), returnValue: - _i6.Future<_i2.ImaSdkSettings>.value(_FakeImaSdkSettings_11( + _i6.Future<_i2.ImaSdkSettings>.value(_FakeImaSdkSettings_12( this, Invocation.method( #createImaSdkSettings, @@ -1009,7 +1046,7 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { ), )), returnValueForMissingStub: - _i6.Future<_i2.ImaSdkSettings>.value(_FakeImaSdkSettings_11( + _i6.Future<_i2.ImaSdkSettings>.value(_FakeImaSdkSettings_12( this, Invocation.method( #createImaSdkSettings, @@ -1085,7 +1122,7 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { [], ), returnValue: _i6.Future<_i2.AdsRenderingSettings>.value( - _FakeAdsRenderingSettings_12( + _FakeAdsRenderingSettings_13( this, Invocation.method( #createAdsRenderingSettings, @@ -1093,7 +1130,7 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { ), )), returnValueForMissingStub: _i6.Future<_i2.AdsRenderingSettings>.value( - _FakeAdsRenderingSettings_12( + _FakeAdsRenderingSettings_13( this, Invocation.method( #createAdsRenderingSettings, @@ -1108,14 +1145,14 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { #pigeon_copy, [], ), - returnValue: _FakeImaSdkFactory_13( + returnValue: _FakeImaSdkFactory_14( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeImaSdkFactory_13( + returnValueForMissingStub: _FakeImaSdkFactory_14( this, Invocation.method( #pigeon_copy, @@ -1148,14 +1185,14 @@ class MockImaSdkSettings extends _i1.Mock implements _i2.ImaSdkSettings { #pigeon_copy, [], ), - returnValue: _FakeImaSdkSettings_11( + returnValue: _FakeImaSdkSettings_12( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeImaSdkSettings_11( + returnValueForMissingStub: _FakeImaSdkSettings_12( this, Invocation.method( #pigeon_copy, @@ -1334,14 +1371,14 @@ class MockVideoAdPlayer extends _i1.Mock implements _i2.VideoAdPlayer { #pigeon_copy, [], ), - returnValue: _FakeVideoAdPlayer_14( + returnValue: _FakeVideoAdPlayer_15( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeVideoAdPlayer_14( + returnValueForMissingStub: _FakeVideoAdPlayer_15( this, Invocation.method( #pigeon_copy, @@ -1492,14 +1529,14 @@ class MockVideoAdPlayerCallback extends _i1.Mock #pigeon_copy, [], ), - returnValue: _FakeVideoAdPlayerCallback_15( + returnValue: _FakeVideoAdPlayerCallback_16( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeVideoAdPlayerCallback_15( + returnValueForMissingStub: _FakeVideoAdPlayerCallback_16( this, Invocation.method( #pigeon_copy, @@ -1579,14 +1616,14 @@ class MockVideoView extends _i1.Mock implements _i2.VideoView { #pigeon_copy, [], ), - returnValue: _FakeVideoView_16( + returnValue: _FakeVideoView_17( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeVideoView_16( + returnValueForMissingStub: _FakeVideoView_17( this, Invocation.method( #pigeon_copy, @@ -1625,25 +1662,16 @@ class MockSurfaceAndroidViewController extends _i1.Mock @override _i4.PointTransformer get pointTransformer => (super.noSuchMethod( Invocation.getter(#pointTransformer), - returnValue: (_i3.Offset position) => _FakeOffset_17( + returnValue: (_i3.Offset position) => _FakeOffset_18( this, Invocation.getter(#pointTransformer), ), - returnValueForMissingStub: (_i3.Offset position) => _FakeOffset_17( + returnValueForMissingStub: (_i3.Offset position) => _FakeOffset_18( this, Invocation.getter(#pointTransformer), ), ) as _i4.PointTransformer); - @override - set pointTransformer(_i4.PointTransformer? transformer) => super.noSuchMethod( - Invocation.setter( - #pointTransformer, - transformer, - ), - returnValueForMissingStub: null, - ); - @override bool get isCreated => (super.noSuchMethod( Invocation.getter(#isCreated), @@ -1659,6 +1687,15 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValueForMissingStub: <_i4.PlatformViewCreatedCallback>[], ) as List<_i4.PlatformViewCreatedCallback>); + @override + set pointTransformer(_i4.PointTransformer? transformer) => super.noSuchMethod( + Invocation.setter( + #pointTransformer, + transformer, + ), + returnValueForMissingStub: null, + ); + @override _i6.Future setOffset(_i3.Offset? off) => (super.noSuchMethod( Invocation.method( @@ -1693,14 +1730,14 @@ class MockSurfaceAndroidViewController extends _i1.Mock #setSize, [size], ), - returnValue: _i6.Future<_i3.Size>.value(_FakeSize_18( + returnValue: _i6.Future<_i3.Size>.value(_FakeSize_19( this, Invocation.method( #setSize, [size], ), )), - returnValueForMissingStub: _i6.Future<_i3.Size>.value(_FakeSize_18( + returnValueForMissingStub: _i6.Future<_i3.Size>.value(_FakeSize_19( this, Invocation.method( #setSize, @@ -1813,7 +1850,7 @@ class MockPlatformViewsServiceProxy extends _i1.Mock #onFocus: onFocus, }, ), - returnValue: _FakeExpensiveAndroidViewController_19( + returnValue: _FakeExpensiveAndroidViewController_20( this, Invocation.method( #initExpensiveAndroidView, @@ -1828,7 +1865,7 @@ class MockPlatformViewsServiceProxy extends _i1.Mock }, ), ), - returnValueForMissingStub: _FakeExpensiveAndroidViewController_19( + returnValueForMissingStub: _FakeExpensiveAndroidViewController_20( this, Invocation.method( #initExpensiveAndroidView, @@ -1867,7 +1904,7 @@ class MockPlatformViewsServiceProxy extends _i1.Mock #onFocus: onFocus, }, ), - returnValue: _FakeSurfaceAndroidViewController_20( + returnValue: _FakeSurfaceAndroidViewController_21( this, Invocation.method( #initSurfaceAndroidView, @@ -1882,7 +1919,7 @@ class MockPlatformViewsServiceProxy extends _i1.Mock }, ), ), - returnValueForMissingStub: _FakeSurfaceAndroidViewController_20( + returnValueForMissingStub: _FakeSurfaceAndroidViewController_21( this, Invocation.method( #initSurfaceAndroidView, diff --git a/packages/interactive_media_ads/test/android/ads_manager_test.mocks.dart b/packages/interactive_media_ads/test/android/ads_manager_test.mocks.dart index 4181bca8d7f..8610a224046 100644 --- a/packages/interactive_media_ads/test/android/ads_manager_test.mocks.dart +++ b/packages/interactive_media_ads/test/android/ads_manager_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in interactive_media_ads/test/android/ads_manager_test.dart. // Do not manually edit this file. @@ -18,6 +18,7 @@ import 'package:mockito/src/dummies.dart' as _i3; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types @@ -107,9 +108,20 @@ class _FakeAdsRenderingSettings_7 extends _i1.SmartFake ); } -class _FakeImaSdkSettings_8 extends _i1.SmartFake +class _FakeCompanionAdSlot_8 extends _i1.SmartFake + implements _i2.CompanionAdSlot { + _FakeCompanionAdSlot_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeImaSdkSettings_9 extends _i1.SmartFake implements _i2.ImaSdkSettings { - _FakeImaSdkSettings_8( + _FakeImaSdkSettings_9( Object parent, Invocation parentInvocation, ) : super( @@ -118,8 +130,8 @@ class _FakeImaSdkSettings_8 extends _i1.SmartFake ); } -class _FakeAdsLoader_9 extends _i1.SmartFake implements _i2.AdsLoader { - _FakeAdsLoader_9( +class _FakeAdsLoader_10 extends _i1.SmartFake implements _i2.AdsLoader { + _FakeAdsLoader_10( Object parent, Invocation parentInvocation, ) : super( @@ -128,8 +140,8 @@ class _FakeAdsLoader_9 extends _i1.SmartFake implements _i2.AdsLoader { ); } -class _FakeAdsRequest_10 extends _i1.SmartFake implements _i2.AdsRequest { - _FakeAdsRequest_10( +class _FakeAdsRequest_11 extends _i1.SmartFake implements _i2.AdsRequest { + _FakeAdsRequest_11( Object parent, Invocation parentInvocation, ) : super( @@ -138,8 +150,8 @@ class _FakeAdsRequest_10 extends _i1.SmartFake implements _i2.AdsRequest { ); } -class _FakeImaSdkFactory_11 extends _i1.SmartFake implements _i2.ImaSdkFactory { - _FakeImaSdkFactory_11( +class _FakeImaSdkFactory_12 extends _i1.SmartFake implements _i2.ImaSdkFactory { + _FakeImaSdkFactory_12( Object parent, Invocation parentInvocation, ) : super( @@ -830,13 +842,38 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { ), ) as _i2.PigeonInstanceManager); + @override + _i4.Future<_i2.CompanionAdSlot> createCompanionAdSlot() => + (super.noSuchMethod( + Invocation.method( + #createCompanionAdSlot, + [], + ), + returnValue: + _i4.Future<_i2.CompanionAdSlot>.value(_FakeCompanionAdSlot_8( + this, + Invocation.method( + #createCompanionAdSlot, + [], + ), + )), + returnValueForMissingStub: + _i4.Future<_i2.CompanionAdSlot>.value(_FakeCompanionAdSlot_8( + this, + Invocation.method( + #createCompanionAdSlot, + [], + ), + )), + ) as _i4.Future<_i2.CompanionAdSlot>); + @override _i4.Future<_i2.ImaSdkSettings> createImaSdkSettings() => (super.noSuchMethod( Invocation.method( #createImaSdkSettings, [], ), - returnValue: _i4.Future<_i2.ImaSdkSettings>.value(_FakeImaSdkSettings_8( + returnValue: _i4.Future<_i2.ImaSdkSettings>.value(_FakeImaSdkSettings_9( this, Invocation.method( #createImaSdkSettings, @@ -844,7 +881,7 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { ), )), returnValueForMissingStub: - _i4.Future<_i2.ImaSdkSettings>.value(_FakeImaSdkSettings_8( + _i4.Future<_i2.ImaSdkSettings>.value(_FakeImaSdkSettings_9( this, Invocation.method( #createImaSdkSettings, @@ -866,7 +903,7 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { container, ], ), - returnValue: _i4.Future<_i2.AdsLoader>.value(_FakeAdsLoader_9( + returnValue: _i4.Future<_i2.AdsLoader>.value(_FakeAdsLoader_10( this, Invocation.method( #createAdsLoader, @@ -877,7 +914,7 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { ), )), returnValueForMissingStub: - _i4.Future<_i2.AdsLoader>.value(_FakeAdsLoader_9( + _i4.Future<_i2.AdsLoader>.value(_FakeAdsLoader_10( this, Invocation.method( #createAdsLoader, @@ -895,7 +932,7 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { #createAdsRequest, [], ), - returnValue: _i4.Future<_i2.AdsRequest>.value(_FakeAdsRequest_10( + returnValue: _i4.Future<_i2.AdsRequest>.value(_FakeAdsRequest_11( this, Invocation.method( #createAdsRequest, @@ -903,7 +940,7 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { ), )), returnValueForMissingStub: - _i4.Future<_i2.AdsRequest>.value(_FakeAdsRequest_10( + _i4.Future<_i2.AdsRequest>.value(_FakeAdsRequest_11( this, Invocation.method( #createAdsRequest, @@ -943,14 +980,14 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { #pigeon_copy, [], ), - returnValue: _FakeImaSdkFactory_11( + returnValue: _FakeImaSdkFactory_12( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeImaSdkFactory_11( + returnValueForMissingStub: _FakeImaSdkFactory_12( this, Invocation.method( #pigeon_copy, diff --git a/packages/interactive_media_ads/test/android/content_progress_provider_test.mocks.dart b/packages/interactive_media_ads/test/android/content_progress_provider_test.mocks.dart index 6d65d647503..c37290e27f3 100644 --- a/packages/interactive_media_ads/test/android/content_progress_provider_test.mocks.dart +++ b/packages/interactive_media_ads/test/android/content_progress_provider_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in interactive_media_ads/test/android/content_progress_provider_test.dart. // Do not manually edit this file. @@ -17,6 +17,7 @@ import 'package:mockito/mockito.dart' as _i1; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types diff --git a/packages/interactive_media_ads/test/companion_ad_slot_test.dart b/packages/interactive_media_ads/test/companion_ad_slot_test.dart new file mode 100644 index 00000000000..b56b852af8d --- /dev/null +++ b/packages/interactive_media_ads/test/companion_ad_slot_test.dart @@ -0,0 +1,63 @@ +// 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. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:interactive_media_ads/interactive_media_ads.dart'; +import 'package:interactive_media_ads/src/platform_interface/platform_interface.dart'; + +import 'test_stubs.dart'; + +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + + testWidgets('build', (WidgetTester tester) async { + final TestCompanionAdSlot slot = TestCompanionAdSlot( + const PlatformCompanionAdSlotCreationParams.fluid(), + onBuild: (_) => Container(), + ); + + await tester.pumpWidget(CompanionAdSlot.fromPlatform( + platform: slot, + )); + + expect(find.byType(Container), findsOneWidget); + }); + + testWidgets('constructor parameters are correctly passed to creation params', + (WidgetTester tester) async { + InteractiveMediaAdsPlatform.instance = TestInteractiveMediaAdsPlatform( + onCreatePlatformCompanionAdSlot: ( + PlatformCompanionAdSlotCreationParams params, + ) { + return TestCompanionAdSlot(params, onBuild: (_) => Container()); + }, + onCreatePlatformAdDisplayContainer: ( + PlatformAdDisplayContainerCreationParams params, + ) { + return TestPlatformAdDisplayContainer( + params, + onBuild: (_) => Container(), + ); + }, + onCreatePlatformAdsLoader: (PlatformAdsLoaderCreationParams params) { + throw UnimplementedError(); + }, + onCreatePlatformAdsManagerDelegate: ( + PlatformAdsManagerDelegateCreationParams params, + ) { + throw UnimplementedError(); + }, + onCreatePlatformContentProgressProvider: (_) { + throw UnimplementedError(); + }, + ); + + final CompanionAdSlot slot = CompanionAdSlot.fluid(key: GlobalKey()); + + // The key passed to the default constructor is used by the super class + // and not passed to the platform implementation. + expect(slot.platform.params.key, isNull); + }); +} diff --git a/packages/interactive_media_ads/test/ios/ad_display_container_test.mocks.dart b/packages/interactive_media_ads/test/ios/ad_display_container_test.mocks.dart index cb8c37e05dc..d0a0473b165 100644 --- a/packages/interactive_media_ads/test/ios/ad_display_container_test.mocks.dart +++ b/packages/interactive_media_ads/test/ios/ad_display_container_test.mocks.dart @@ -1,8 +1,10 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in interactive_media_ads/test/ios/ad_display_container_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i3; + import 'package:interactive_media_ads/src/ios/interactive_media_ads.g.dart' as _i2; import 'package:mockito/mockito.dart' as _i1; @@ -15,14 +17,14 @@ import 'package:mockito/mockito.dart' as _i1; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakePigeonInstanceManager_0 extends _i1.SmartFake - implements _i2.PigeonInstanceManager { - _FakePigeonInstanceManager_0( +class _FakeUIView_0 extends _i1.SmartFake implements _i2.UIView { + _FakeUIView_0( Object parent, Invocation parentInvocation, ) : super( @@ -31,9 +33,9 @@ class _FakePigeonInstanceManager_0 extends _i1.SmartFake ); } -class _FakeIMAAdDisplayContainer_1 extends _i1.SmartFake - implements _i2.IMAAdDisplayContainer { - _FakeIMAAdDisplayContainer_1( +class _FakePigeonInstanceManager_1 extends _i1.SmartFake + implements _i2.PigeonInstanceManager { + _FakePigeonInstanceManager_1( Object parent, Invocation parentInvocation, ) : super( @@ -42,8 +44,9 @@ class _FakeIMAAdDisplayContainer_1 extends _i1.SmartFake ); } -class _FakeUIView_2 extends _i1.SmartFake implements _i2.UIView { - _FakeUIView_2( +class _FakeIMAAdDisplayContainer_2 extends _i1.SmartFake + implements _i2.IMAAdDisplayContainer { + _FakeIMAAdDisplayContainer_2( Object parent, Invocation parentInvocation, ) : super( @@ -69,32 +72,90 @@ class _FakeUIViewController_3 extends _i1.SmartFake class MockIMAAdDisplayContainer extends _i1.Mock implements _i2.IMAAdDisplayContainer { @override + _i2.UIView get adContainer => (super.noSuchMethod( + Invocation.getter(#adContainer), + returnValue: _FakeUIView_0( + this, + Invocation.getter(#adContainer), + ), + returnValueForMissingStub: _FakeUIView_0( + this, + Invocation.getter(#adContainer), + ), + ) as _i2.UIView); + + @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( + returnValue: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_0( + returnValueForMissingStub: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), ) as _i2.PigeonInstanceManager); + @override + _i3.Future setAdContainerViewController( + _i2.UIViewController? controller) => + (super.noSuchMethod( + Invocation.method( + #setAdContainerViewController, + [controller], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future<_i2.UIViewController?> getAdContainerViewController() => + (super.noSuchMethod( + Invocation.method( + #getAdContainerViewController, + [], + ), + returnValue: _i3.Future<_i2.UIViewController?>.value(), + returnValueForMissingStub: _i3.Future<_i2.UIViewController?>.value(), + ) as _i3.Future<_i2.UIViewController?>); + + @override + _i3.Future registerFriendlyObstruction( + _i2.IMAFriendlyObstruction? friendlyObstruction) => + (super.noSuchMethod( + Invocation.method( + #registerFriendlyObstruction, + [friendlyObstruction], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future unregisterAllFriendlyObstructions() => (super.noSuchMethod( + Invocation.method( + #unregisterAllFriendlyObstructions, + [], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + @override _i2.IMAAdDisplayContainer pigeon_copy() => (super.noSuchMethod( Invocation.method( #pigeon_copy, [], ), - returnValue: _FakeIMAAdDisplayContainer_1( + returnValue: _FakeIMAAdDisplayContainer_2( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeIMAAdDisplayContainer_1( + returnValueForMissingStub: _FakeIMAAdDisplayContainer_2( this, Invocation.method( #pigeon_copy, @@ -111,11 +172,11 @@ class MockUIView extends _i1.Mock implements _i2.UIView { @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( + returnValue: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_0( + returnValueForMissingStub: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), @@ -127,14 +188,14 @@ class MockUIView extends _i1.Mock implements _i2.UIView { #pigeon_copy, [], ), - returnValue: _FakeUIView_2( + returnValue: _FakeUIView_0( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeUIView_2( + returnValueForMissingStub: _FakeUIView_0( this, Invocation.method( #pigeon_copy, @@ -151,11 +212,11 @@ class MockUIViewController extends _i1.Mock implements _i2.UIViewController { @override _i2.UIView get view => (super.noSuchMethod( Invocation.getter(#view), - returnValue: _FakeUIView_2( + returnValue: _FakeUIView_0( this, Invocation.getter(#view), ), - returnValueForMissingStub: _FakeUIView_2( + returnValueForMissingStub: _FakeUIView_0( this, Invocation.getter(#view), ), @@ -164,11 +225,11 @@ class MockUIViewController extends _i1.Mock implements _i2.UIViewController { @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( + returnValue: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_0( + returnValueForMissingStub: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), @@ -180,14 +241,14 @@ class MockUIViewController extends _i1.Mock implements _i2.UIViewController { #pigeonVar_view, [], ), - returnValue: _FakeUIView_2( + returnValue: _FakeUIView_0( this, Invocation.method( #pigeonVar_view, [], ), ), - returnValueForMissingStub: _FakeUIView_2( + returnValueForMissingStub: _FakeUIView_0( this, Invocation.method( #pigeonVar_view, diff --git a/packages/interactive_media_ads/test/ios/ads_loader_test.mocks.dart b/packages/interactive_media_ads/test/ios/ads_loader_test.mocks.dart index a19db9487f1..786ae126a73 100644 --- a/packages/interactive_media_ads/test/ios/ads_loader_test.mocks.dart +++ b/packages/interactive_media_ads/test/ios/ads_loader_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in interactive_media_ads/test/ios/ads_loader_test.dart. // Do not manually edit this file. @@ -17,14 +17,14 @@ import 'package:mockito/mockito.dart' as _i1; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakePigeonInstanceManager_0 extends _i1.SmartFake - implements _i2.PigeonInstanceManager { - _FakePigeonInstanceManager_0( +class _FakeUIView_0 extends _i1.SmartFake implements _i2.UIView { + _FakeUIView_0( Object parent, Invocation parentInvocation, ) : super( @@ -33,9 +33,9 @@ class _FakePigeonInstanceManager_0 extends _i1.SmartFake ); } -class _FakeIMAAdDisplayContainer_1 extends _i1.SmartFake - implements _i2.IMAAdDisplayContainer { - _FakeIMAAdDisplayContainer_1( +class _FakePigeonInstanceManager_1 extends _i1.SmartFake + implements _i2.PigeonInstanceManager { + _FakePigeonInstanceManager_1( Object parent, Invocation parentInvocation, ) : super( @@ -44,8 +44,9 @@ class _FakeIMAAdDisplayContainer_1 extends _i1.SmartFake ); } -class _FakeIMAAdsLoader_2 extends _i1.SmartFake implements _i2.IMAAdsLoader { - _FakeIMAAdsLoader_2( +class _FakeIMAAdDisplayContainer_2 extends _i1.SmartFake + implements _i2.IMAAdDisplayContainer { + _FakeIMAAdDisplayContainer_2( Object parent, Invocation parentInvocation, ) : super( @@ -54,9 +55,8 @@ class _FakeIMAAdsLoader_2 extends _i1.SmartFake implements _i2.IMAAdsLoader { ); } -class _FakeIMAAdsLoaderDelegate_3 extends _i1.SmartFake - implements _i2.IMAAdsLoaderDelegate { - _FakeIMAAdsLoaderDelegate_3( +class _FakeIMAAdsLoader_3 extends _i1.SmartFake implements _i2.IMAAdsLoader { + _FakeIMAAdsLoader_3( Object parent, Invocation parentInvocation, ) : super( @@ -65,8 +65,9 @@ class _FakeIMAAdsLoaderDelegate_3 extends _i1.SmartFake ); } -class _FakeIMAAdsManager_4 extends _i1.SmartFake implements _i2.IMAAdsManager { - _FakeIMAAdsManager_4( +class _FakeIMAAdsLoaderDelegate_4 extends _i1.SmartFake + implements _i2.IMAAdsLoaderDelegate { + _FakeIMAAdsLoaderDelegate_4( Object parent, Invocation parentInvocation, ) : super( @@ -75,8 +76,8 @@ class _FakeIMAAdsManager_4 extends _i1.SmartFake implements _i2.IMAAdsManager { ); } -class _FakeIMAAdsRequest_5 extends _i1.SmartFake implements _i2.IMAAdsRequest { - _FakeIMAAdsRequest_5( +class _FakeIMAAdsManager_5 extends _i1.SmartFake implements _i2.IMAAdsManager { + _FakeIMAAdsManager_5( Object parent, Invocation parentInvocation, ) : super( @@ -85,8 +86,8 @@ class _FakeIMAAdsRequest_5 extends _i1.SmartFake implements _i2.IMAAdsRequest { ); } -class _FakeUIView_6 extends _i1.SmartFake implements _i2.UIView { - _FakeUIView_6( +class _FakeIMAAdsRequest_6 extends _i1.SmartFake implements _i2.IMAAdsRequest { + _FakeIMAAdsRequest_6( Object parent, Invocation parentInvocation, ) : super( @@ -112,32 +113,90 @@ class _FakeUIViewController_7 extends _i1.SmartFake class MockIMAAdDisplayContainer extends _i1.Mock implements _i2.IMAAdDisplayContainer { @override + _i2.UIView get adContainer => (super.noSuchMethod( + Invocation.getter(#adContainer), + returnValue: _FakeUIView_0( + this, + Invocation.getter(#adContainer), + ), + returnValueForMissingStub: _FakeUIView_0( + this, + Invocation.getter(#adContainer), + ), + ) as _i2.UIView); + + @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( + returnValue: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_0( + returnValueForMissingStub: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), ) as _i2.PigeonInstanceManager); + @override + _i3.Future setAdContainerViewController( + _i2.UIViewController? controller) => + (super.noSuchMethod( + Invocation.method( + #setAdContainerViewController, + [controller], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future<_i2.UIViewController?> getAdContainerViewController() => + (super.noSuchMethod( + Invocation.method( + #getAdContainerViewController, + [], + ), + returnValue: _i3.Future<_i2.UIViewController?>.value(), + returnValueForMissingStub: _i3.Future<_i2.UIViewController?>.value(), + ) as _i3.Future<_i2.UIViewController?>); + + @override + _i3.Future registerFriendlyObstruction( + _i2.IMAFriendlyObstruction? friendlyObstruction) => + (super.noSuchMethod( + Invocation.method( + #registerFriendlyObstruction, + [friendlyObstruction], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future unregisterAllFriendlyObstructions() => (super.noSuchMethod( + Invocation.method( + #unregisterAllFriendlyObstructions, + [], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + @override _i2.IMAAdDisplayContainer pigeon_copy() => (super.noSuchMethod( Invocation.method( #pigeon_copy, [], ), - returnValue: _FakeIMAAdDisplayContainer_1( + returnValue: _FakeIMAAdDisplayContainer_2( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeIMAAdDisplayContainer_1( + returnValueForMissingStub: _FakeIMAAdDisplayContainer_2( this, Invocation.method( #pigeon_copy, @@ -154,11 +213,11 @@ class MockIMAAdsLoader extends _i1.Mock implements _i2.IMAAdsLoader { @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( + returnValue: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_0( + returnValueForMissingStub: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), @@ -202,14 +261,14 @@ class MockIMAAdsLoader extends _i1.Mock implements _i2.IMAAdsLoader { #pigeon_copy, [], ), - returnValue: _FakeIMAAdsLoader_2( + returnValue: _FakeIMAAdsLoader_3( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeIMAAdsLoader_2( + returnValueForMissingStub: _FakeIMAAdsLoader_3( this, Invocation.method( #pigeon_copy, @@ -273,11 +332,11 @@ class MockIMAAdsLoaderDelegate extends _i1.Mock @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( + returnValue: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_0( + returnValueForMissingStub: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), @@ -289,14 +348,14 @@ class MockIMAAdsLoaderDelegate extends _i1.Mock #pigeon_copy, [], ), - returnValue: _FakeIMAAdsLoaderDelegate_3( + returnValue: _FakeIMAAdsLoaderDelegate_4( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeIMAAdsLoaderDelegate_3( + returnValueForMissingStub: _FakeIMAAdsLoaderDelegate_4( this, Invocation.method( #pigeon_copy, @@ -313,11 +372,11 @@ class MockIMAAdsManager extends _i1.Mock implements _i2.IMAAdsManager { @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( + returnValue: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_0( + returnValueForMissingStub: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), @@ -412,14 +471,14 @@ class MockIMAAdsManager extends _i1.Mock implements _i2.IMAAdsManager { #pigeon_copy, [], ), - returnValue: _FakeIMAAdsManager_4( + returnValue: _FakeIMAAdsManager_5( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeIMAAdsManager_4( + returnValueForMissingStub: _FakeIMAAdsManager_5( this, Invocation.method( #pigeon_copy, @@ -436,11 +495,11 @@ class MockIMAAdsRequest extends _i1.Mock implements _i2.IMAAdsRequest { @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( + returnValue: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_0( + returnValueForMissingStub: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), @@ -452,14 +511,14 @@ class MockIMAAdsRequest extends _i1.Mock implements _i2.IMAAdsRequest { #pigeon_copy, [], ), - returnValue: _FakeIMAAdsRequest_5( + returnValue: _FakeIMAAdsRequest_6( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeIMAAdsRequest_5( + returnValueForMissingStub: _FakeIMAAdsRequest_6( this, Invocation.method( #pigeon_copy, @@ -476,11 +535,11 @@ class MockUIView extends _i1.Mock implements _i2.UIView { @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( + returnValue: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_0( + returnValueForMissingStub: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), @@ -492,14 +551,14 @@ class MockUIView extends _i1.Mock implements _i2.UIView { #pigeon_copy, [], ), - returnValue: _FakeUIView_6( + returnValue: _FakeUIView_0( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeUIView_6( + returnValueForMissingStub: _FakeUIView_0( this, Invocation.method( #pigeon_copy, @@ -516,11 +575,11 @@ class MockUIViewController extends _i1.Mock implements _i2.UIViewController { @override _i2.UIView get view => (super.noSuchMethod( Invocation.getter(#view), - returnValue: _FakeUIView_6( + returnValue: _FakeUIView_0( this, Invocation.getter(#view), ), - returnValueForMissingStub: _FakeUIView_6( + returnValueForMissingStub: _FakeUIView_0( this, Invocation.getter(#view), ), @@ -529,11 +588,11 @@ class MockUIViewController extends _i1.Mock implements _i2.UIViewController { @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( + returnValue: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_0( + returnValueForMissingStub: _FakePigeonInstanceManager_1( this, Invocation.getter(#pigeon_instanceManager), ), @@ -545,14 +604,14 @@ class MockUIViewController extends _i1.Mock implements _i2.UIViewController { #pigeonVar_view, [], ), - returnValue: _FakeUIView_6( + returnValue: _FakeUIView_0( this, Invocation.method( #pigeonVar_view, [], ), ), - returnValueForMissingStub: _FakeUIView_6( + returnValueForMissingStub: _FakeUIView_0( this, Invocation.method( #pigeonVar_view, diff --git a/packages/interactive_media_ads/test/ios/ads_manager_test.mocks.dart b/packages/interactive_media_ads/test/ios/ads_manager_test.mocks.dart index 7214de1d0a5..6b6b945c09c 100644 --- a/packages/interactive_media_ads/test/ios/ads_manager_test.mocks.dart +++ b/packages/interactive_media_ads/test/ios/ads_manager_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in interactive_media_ads/test/ios/ads_manager_test.dart. // Do not manually edit this file. @@ -17,6 +17,7 @@ import 'package:mockito/mockito.dart' as _i1; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types diff --git a/packages/interactive_media_ads/test/ios/content_progress_provider_test.mocks.dart b/packages/interactive_media_ads/test/ios/content_progress_provider_test.mocks.dart index a82fb3fbade..cdb10245a4f 100644 --- a/packages/interactive_media_ads/test/ios/content_progress_provider_test.mocks.dart +++ b/packages/interactive_media_ads/test/ios/content_progress_provider_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in interactive_media_ads/test/ios/content_progress_provider_test.dart. // Do not manually edit this file. @@ -17,6 +17,7 @@ import 'package:mockito/mockito.dart' as _i1; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types diff --git a/packages/interactive_media_ads/test/test_stubs.dart b/packages/interactive_media_ads/test/test_stubs.dart index ff3ae451215..193ab3dd116 100644 --- a/packages/interactive_media_ads/test/test_stubs.dart +++ b/packages/interactive_media_ads/test/test_stubs.dart @@ -13,6 +13,7 @@ final class TestInteractiveMediaAdsPlatform required this.onCreatePlatformAdDisplayContainer, required this.onCreatePlatformContentProgressProvider, this.onCreatePlatformAdsRenderingSettings, + this.onCreatePlatformCompanionAdSlot, }); PlatformAdsLoader Function(PlatformAdsLoaderCreationParams params) @@ -34,6 +35,10 @@ final class TestInteractiveMediaAdsPlatform PlatformAdsRenderingSettingsCreationParams params, )? onCreatePlatformAdsRenderingSettings; + PlatformCompanionAdSlot Function( + PlatformCompanionAdSlotCreationParams params, + )? onCreatePlatformCompanionAdSlot; + @override PlatformAdsLoader createPlatformAdsLoader( PlatformAdsLoaderCreationParams params, @@ -69,6 +74,17 @@ final class TestInteractiveMediaAdsPlatform return onCreatePlatformAdsRenderingSettings?.call(params) ?? TestAdsRenderingSettings(params); } + + @override + PlatformCompanionAdSlot createPlatformCompanionAdSlot( + PlatformCompanionAdSlotCreationParams params, + ) { + return onCreatePlatformCompanionAdSlot?.call(params) ?? + TestCompanionAdSlot( + params, + onBuild: (_) => Container(), + ); + } } final class TestPlatformAdDisplayContainer extends PlatformAdDisplayContainer { @@ -81,7 +97,7 @@ final class TestPlatformAdDisplayContainer extends PlatformAdDisplayContainer { @override Widget build(BuildContext context) { - return onBuild.call(context); + return onBuild(context); } } @@ -206,3 +222,17 @@ class TestContentProgressProvider extends PlatformContentProgressProvider { final class TestAdsRenderingSettings extends PlatformAdsRenderingSettings { TestAdsRenderingSettings(super.params) : super.implementation(); } + +final class TestCompanionAdSlot extends PlatformCompanionAdSlot { + TestCompanionAdSlot( + super.params, { + required this.onBuild, + }) : super.implementation(); + + Widget Function(BuildContext context) onBuild; + + @override + Widget build(BuildContext context) { + return onBuild(context); + } +} From e0e71c78873ff081441050b7b4337c699e2447ab Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 29 Apr 2025 18:41:08 -0400 Subject: [PATCH 03/37] android impl --- .../BaseDisplayContainerProxyApi.kt | 12 +- .../InteractiveMediaAdsLibrary.g.kt | 42 +- .../BaseDisplayContainerProxyApiTest.kt | 23 + .../lib/src/ad_display_container.dart | 12 + .../android/android_ad_display_container.dart | 15 + .../android/android_companion_ad_slot.dart | 128 ++++++ .../src/android/interactive_media_ads.g.dart | 41 +- .../platform_ad_display_container.dart | 4 + .../interactive_media_ads_android.dart | 9 +- .../ad_display_container_test.mocks.dart | 252 ++++++----- .../test/android/ads_loader_test.mocks.dart | 412 +++++++++--------- 11 files changed, 619 insertions(+), 331 deletions(-) create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApiTest.kt create mode 100644 packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApi.kt index 6499138ad9c..a1766072c89 100644 --- a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApi.kt +++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApi.kt @@ -4,6 +4,9 @@ package dev.flutter.packages.interactive_media_ads +import com.google.ads.interactivemedia.v3.api.BaseDisplayContainer +import com.google.ads.interactivemedia.v3.api.CompanionAdSlot + /** * ProxyApi implementation for [com.google.ads.interactivemedia.v3.api.BaseDisplayContainer]. * @@ -11,4 +14,11 @@ package dev.flutter.packages.interactive_media_ads * instance or handle method calls on the associated native class or an instance of that class. */ class BaseDisplayContainerProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) : - PigeonApiBaseDisplayContainer(pigeonRegistrar) + PigeonApiBaseDisplayContainer(pigeonRegistrar) { + override fun setCompanionSlots( + pigeon_instance: BaseDisplayContainer, + companionSlots: List? + ) { + return pigeon_instance.setCompanionSlots(companionSlots) + } +} 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 6f2c24fafcb..5586d67608b 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 @@ -372,10 +372,7 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(val binaryMesse * An implementation of [PigeonApiBaseDisplayContainer] used to add a new Dart instance of * `BaseDisplayContainer` to the Dart `InstanceManager`. */ - open fun getPigeonApiBaseDisplayContainer(): PigeonApiBaseDisplayContainer - { - return PigeonApiBaseDisplayContainer(this) - } + abstract fun getPigeonApiBaseDisplayContainer(): PigeonApiBaseDisplayContainer /** * An implementation of [PigeonApiAdDisplayContainer] used to add a new Dart instance of @@ -580,6 +577,7 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(val binaryMesse fun setUp() { InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger, instanceManager) + PigeonApiBaseDisplayContainer.setUpMessageHandlers(binaryMessenger, getPigeonApiBaseDisplayContainer()) PigeonApiAdsLoader.setUpMessageHandlers(binaryMessenger, getPigeonApiAdsLoader()) PigeonApiAdsRequest.setUpMessageHandlers(binaryMessenger, getPigeonApiAdsRequest()) PigeonApiContentProgressProvider.setUpMessageHandlers(binaryMessenger, getPigeonApiContentProgressProvider()) @@ -602,6 +600,7 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(val binaryMesse } fun tearDown() { InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger, null) + PigeonApiBaseDisplayContainer.setUpMessageHandlers(binaryMessenger, null) PigeonApiAdsLoader.setUpMessageHandlers(binaryMessenger, null) PigeonApiAdsRequest.setUpMessageHandlers(binaryMessenger, null) PigeonApiContentProgressProvider.setUpMessageHandlers(binaryMessenger, null) @@ -1006,7 +1005,40 @@ private open class InteractiveMediaAdsLibraryPigeonCodec : StandardMessageCodec( * 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) { +abstract class PigeonApiBaseDisplayContainer(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { + /** + * Sets slots for displaying companions. + * + * Passing null will reset the container to having no companion slots. + */ + abstract fun setCompanionSlots(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseDisplayContainer, companionSlots: List?) + + companion object { + @Suppress("LocalVariableName") + fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiBaseDisplayContainer?) { + val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseDisplayContainer.setCompanionSlots", 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.BaseDisplayContainer + val companionSlotsArg = args[1] as List? + val wrapped: List = try { + api.setCompanionSlots(pigeon_instanceArg, companionSlotsArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + } + } + @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) diff --git a/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApiTest.kt b/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApiTest.kt new file mode 100644 index 00000000000..15c33b2a3fe --- /dev/null +++ b/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApiTest.kt @@ -0,0 +1,23 @@ +package dev.flutter.packages.interactive_media_ads + +import com.google.ads.interactivemedia.v3.api.AdsRenderingSettings +import com.google.ads.interactivemedia.v3.api.BaseDisplayContainer +import com.google.ads.interactivemedia.v3.api.CompanionAdSlot +import org.mockito.kotlin.mock +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever +import kotlin.test.Test +import kotlin.test.assertEquals + +class BaseDisplayContainerProxyApiTest { + @Test + fun setCompanionSlots() { + val api = TestProxyApiRegistrar().getPigeonApiBaseDisplayContainer() + + val instance = mock() + val companionSlots = listOf(mock()) + api.setCompanionSlots(instance, companionSlots) + + verify(instance).setCompanionSlots(companionSlots) + } +} \ No newline at end of file diff --git a/packages/interactive_media_ads/lib/src/ad_display_container.dart b/packages/interactive_media_ads/lib/src/ad_display_container.dart index 9c4aeed9387..94af5764521 100644 --- a/packages/interactive_media_ads/lib/src/ad_display_container.dart +++ b/packages/interactive_media_ads/lib/src/ad_display_container.dart @@ -4,6 +4,7 @@ import 'package:flutter/cupertino.dart'; +import '../interactive_media_ads.dart'; import 'platform_interface/platform_ad_display_container.dart'; import 'platform_interface/platform_interface.dart'; @@ -37,6 +38,7 @@ class AdDisplayContainer extends StatelessWidget { AdDisplayContainer({ Key? key, required void Function(AdDisplayContainer container) onContainerAdded, + Iterable companionAds = const [], TextDirection layoutDirection = TextDirection.ltr, }) : this.fromPlatformCreationParams( key: key, @@ -46,6 +48,9 @@ class AdDisplayContainer extends StatelessWidget { platform: container, )); }, + companionSlots: companionAds.map( + (CompanionAdSlot slot) => slot.platform, + ), layoutDirection: layoutDirection, ), ); @@ -97,6 +102,13 @@ class AdDisplayContainer extends StatelessWidget { void Function(PlatformAdDisplayContainer container) get onContainerAdded => platform.params.onContainerAdded; + Iterable get companionAds => + platform.params.companionSlots.map( + (PlatformCompanionAdSlot slot) { + return CompanionAdSlot.fromPlatform(platform: slot); + }, + ); + /// The layout direction to use for the embedded AdDisplayContainer. TextDirection get layoutDirection => platform.params.layoutDirection; diff --git a/packages/interactive_media_ads/lib/src/android/android_ad_display_container.dart b/packages/interactive_media_ads/lib/src/android/android_ad_display_container.dart index 1c3a63dd965..57751746173 100644 --- a/packages/interactive_media_ads/lib/src/android/android_ad_display_container.dart +++ b/packages/interactive_media_ads/lib/src/android/android_ad_display_container.dart @@ -8,6 +8,7 @@ import 'package:flutter/widgets.dart'; import 'package:meta/meta.dart'; import '../platform_interface/platform_interface.dart'; +import 'android_companion_ad_slot.dart'; import 'android_view_widget.dart'; import 'interactive_media_ads.g.dart' as ima; import 'interactive_media_ads_proxy.dart'; @@ -20,6 +21,7 @@ final class AndroidAdDisplayContainerCreationParams const AndroidAdDisplayContainerCreationParams({ super.key, required super.onContainerAdded, + super.companionSlots, @visibleForTesting InteractiveMediaAdsProxy? imaProxy, @visibleForTesting PlatformViewsServiceProxy? platformViewsProxy, }) : _imaProxy = imaProxy ?? const InteractiveMediaAdsProxy(), @@ -37,6 +39,7 @@ final class AndroidAdDisplayContainerCreationParams return AndroidAdDisplayContainerCreationParams( key: params.key, onContainerAdded: params.onContainerAdded, + companionSlots: params.companionSlots, imaProxy: imaProxy, platformViewsProxy: platformViewsProxy, ); @@ -144,6 +147,18 @@ base class AndroidAdDisplayContainer extends PlatformAdDisplayContainer { _frameLayout, _videoAdPlayer, ); + final Iterable nativeCompanionSlots = + await Future.wait( + _androidParams.companionSlots.map( + (PlatformCompanionAdSlot slot) { + return (slot as AndroidCompanionAdSlot) + .getNativeCompanionAdSlot(); + }, + ), + ); + await adDisplayContainer!.setCompanionSlots( + nativeCompanionSlots.toList(), + ); params.onContainerAdded(this); }, ); diff --git a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart new file mode 100644 index 00000000000..411c6bdba14 --- /dev/null +++ b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart @@ -0,0 +1,128 @@ +import 'package:flutter/cupertino.dart'; + +import '../platform_interface/platform_companion_ad_slot.dart'; +import 'android_view_widget.dart'; +import 'interactive_media_ads.g.dart' as ima; +import 'interactive_media_ads_proxy.dart'; +import 'platform_views_service_proxy.dart'; + +/// Android implementation of [PlatformCompanionAdSlotCreationParams]. +final class AndroidCompanionAdSlotCreationParams + extends PlatformCompanionAdSlotCreationParams { + /// Constructs a [AndroidCompanionAdSlotCreationParams]. + const AndroidCompanionAdSlotCreationParams.size({ + super.key, + required super.width, + required super.height, + super.layoutDirection, + @visibleForTesting InteractiveMediaAdsProxy? proxy, + @visibleForTesting PlatformViewsServiceProxy? platformViewsProxy, + }) : _proxy = proxy ?? const InteractiveMediaAdsProxy(), + _platformViewsProxy = + platformViewsProxy ?? const PlatformViewsServiceProxy(), + super.size(); + + /// Constructs a [AndroidCompanionAdSlotCreationParams]. + const AndroidCompanionAdSlotCreationParams.fluid({ + super.key, + super.layoutDirection, + @visibleForTesting InteractiveMediaAdsProxy? proxy, + @visibleForTesting PlatformViewsServiceProxy? platformViewsProxy, + }) : _proxy = proxy ?? const InteractiveMediaAdsProxy(), + _platformViewsProxy = + platformViewsProxy ?? const PlatformViewsServiceProxy(), + super.fluid(); + + /// Creates a [AndroidCompanionAdSlotCreationParams] from an instance of + /// [PlatformCompanionAdSlotCreationParams]. + factory AndroidCompanionAdSlotCreationParams.fromPlatformCompanionAdSlotCreationParamsSize( + // Placeholder to prevent requiring a breaking change if params are added to + // PlatformCompanionAdSlotCreationParams. + // ignore: avoid_unused_constructor_parameters + PlatformCompanionAdSlotCreationParams params, { + @visibleForTesting InteractiveMediaAdsProxy? proxy, + @visibleForTesting PlatformViewsServiceProxy? platformViewsProxy, + }) { + return AndroidCompanionAdSlotCreationParams.size( + width: params.width!, + height: params.height!, + proxy: proxy, + platformViewsProxy: platformViewsProxy, + ); + } + + /// Creates a [AndroidCompanionAdSlotCreationParams] from an instance of + /// [PlatformCompanionAdSlotCreationParams]. + factory AndroidCompanionAdSlotCreationParams.fromPlatformCompanionAdSlotCreationParamsFluid( + // Placeholder to prevent requiring a breaking change if params are added to + // PlatformCompanionAdSlotCreationParams. + // ignore: avoid_unused_constructor_parameters + PlatformCompanionAdSlotCreationParams params, { + @visibleForTesting InteractiveMediaAdsProxy? proxy, + @visibleForTesting PlatformViewsServiceProxy? platformViewsProxy, + }) { + return AndroidCompanionAdSlotCreationParams.fluid( + proxy: proxy, + platformViewsProxy: platformViewsProxy, + ); + } + + final InteractiveMediaAdsProxy _proxy; + final PlatformViewsServiceProxy _platformViewsProxy; +} + +base class AndroidCompanionAdSlot extends PlatformCompanionAdSlot { + /// Constructs an [AndroidCompanionAdSlot]. + AndroidCompanionAdSlot(super.params) : super.implementation() { + _initCompanionAdSlot(); + } + + late final AndroidCompanionAdSlotCreationParams _androidParams = + _initAndroidParams(params); + + late final ima.ViewGroup _frameLayout = + _androidParams._proxy.newFrameLayout(); + + late final Future _adSlotFuture; + + Future getNativeCompanionAdSlot() => _adSlotFuture; + + Future _initCompanionAdSlot() async { + _adSlotFuture = + _androidParams._proxy.instanceImaSdkFactory().createCompanionAdSlot(); + final ima.CompanionAdSlot adSlot = await _adSlotFuture; + + await adSlot.setContainer(_frameLayout); + if (_androidParams.isFluid) { + await adSlot.setFluidSize(); + } else { + await adSlot.setSize(params.width!, params.height!); + } + } + + @override + Widget build(BuildContext context) { + return AndroidViewWidget( + key: params.key, + view: _frameLayout, + platformViewsServiceProxy: _androidParams._platformViewsProxy, + layoutDirection: params.layoutDirection, + ); + } + + AndroidCompanionAdSlotCreationParams _initAndroidParams( + PlatformCompanionAdSlotCreationParams params, + ) { + if (params is AndroidCompanionAdSlotCreationParams) { + return params; + } + + if (params.isFluid) { + return AndroidCompanionAdSlotCreationParams + .fromPlatformCompanionAdSlotCreationParamsFluid(params); + } else { + return AndroidCompanionAdSlotCreationParams + .fromPlatformCompanionAdSlotCreationParamsSize(params); + } + } +} 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 665ccc2444e..46df757f668 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 @@ -628,6 +628,10 @@ class BaseDisplayContainer extends PigeonInternalProxyApiBaseClass { super.pigeon_instanceManager, }); + late final _PigeonInternalProxyApiBaseCodec + _pigeonVar_codecBaseDisplayContainer = + _PigeonInternalProxyApiBaseCodec(pigeon_instanceManager); + static void pigeon_setUpMessageHandlers({ bool pigeon_clearHandlers = false, BinaryMessenger? pigeon_binaryMessenger, @@ -677,6 +681,38 @@ class BaseDisplayContainer extends PigeonInternalProxyApiBaseClass { } } + /// Sets slots for displaying companions. + /// + /// Passing null will reset the container to having no companion slots. + Future setCompanionSlots(List? companionSlots) async { + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecBaseDisplayContainer; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.interactive_media_ads.BaseDisplayContainer.setCompanionSlots'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, companionSlots]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + @override BaseDisplayContainer pigeon_copy() { return BaseDisplayContainer.pigeon_detached( @@ -689,8 +725,7 @@ class BaseDisplayContainer extends PigeonInternalProxyApiBaseClass { /// 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. -class AdDisplayContainer extends PigeonInternalProxyApiBaseClass - implements BaseDisplayContainer { +class AdDisplayContainer extends BaseDisplayContainer { /// Constructs [AdDisplayContainer] without creating the associated native object. /// /// This should only be used by subclasses created by this library or to @@ -699,7 +734,7 @@ class AdDisplayContainer extends PigeonInternalProxyApiBaseClass AdDisplayContainer.pigeon_detached({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, - }); + }) : super.pigeon_detached(); static void pigeon_setUpMessageHandlers({ bool pigeon_clearHandlers = false, diff --git a/packages/interactive_media_ads/lib/src/platform_interface/platform_ad_display_container.dart b/packages/interactive_media_ads/lib/src/platform_interface/platform_ad_display_container.dart index 2f961f9a7cc..cb3bf632dfa 100644 --- a/packages/interactive_media_ads/lib/src/platform_interface/platform_ad_display_container.dart +++ b/packages/interactive_media_ads/lib/src/platform_interface/platform_ad_display_container.dart @@ -5,6 +5,7 @@ import 'package:flutter/cupertino.dart'; import 'interactive_media_ads_platform.dart'; +import 'platform_companion_ad_slot.dart'; /// Object specifying creation parameters for creating a /// [PlatformAdDisplayContainer]. @@ -46,6 +47,7 @@ base class PlatformAdDisplayContainerCreationParams { this.key, required this.onContainerAdded, this.layoutDirection = TextDirection.ltr, + this.companionSlots = const [], }); /// Controls how one widget replaces another widget in the tree. @@ -60,6 +62,8 @@ base class PlatformAdDisplayContainerCreationParams { /// The layout direction to use for the embedded AdDisplayContainer. final TextDirection layoutDirection; + + final Iterable companionSlots; } /// The interface for a platform implementation for a container in which to 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 e032005c9b5..85c520bfc34 100644 --- a/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart +++ b/packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart @@ -230,7 +230,12 @@ enum UiElement { 'com.google.ads.interactivemedia.v3.api.BaseDisplayContainer', ), ) -abstract class BaseDisplayContainer {} +abstract class BaseDisplayContainer { + /// Sets slots for displaying companions. + /// + /// Passing null will reset the container to having no companion slots. + void setCompanionSlots(List? companionSlots); +} /// A container in which to display the ads. /// @@ -240,7 +245,7 @@ abstract class BaseDisplayContainer {} fullClassName: 'com.google.ads.interactivemedia.v3.api.AdDisplayContainer', ), ) -abstract class AdDisplayContainer implements BaseDisplayContainer {} +abstract class AdDisplayContainer extends BaseDisplayContainer {} /// An object which allows publishers to request ads from ad servers or a /// dynamic ad insertion stream. diff --git a/packages/interactive_media_ads/test/android/ad_display_container_test.mocks.dart b/packages/interactive_media_ads/test/android/ad_display_container_test.mocks.dart index c352bcd9f5f..84f4744da47 100644 --- a/packages/interactive_media_ads/test/android/ad_display_container_test.mocks.dart +++ b/packages/interactive_media_ads/test/android/ad_display_container_test.mocks.dart @@ -3,7 +3,7 @@ // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i6; +import 'dart:async' as _i5; import 'dart:ui' as _i3; import 'package:flutter/services.dart' as _i4; @@ -12,7 +12,7 @@ import 'package:interactive_media_ads/src/android/interactive_media_ads.g.dart' import 'package:interactive_media_ads/src/android/platform_views_service_proxy.dart' as _i7; import 'package:mockito/mockito.dart' as _i1; -import 'package:mockito/src/dummies.dart' as _i5; +import 'package:mockito/src/dummies.dart' as _i6; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -213,6 +213,18 @@ class MockAdDisplayContainer extends _i1.Mock ), ), ) as _i2.AdDisplayContainer); + + @override + _i5.Future setCompanionSlots( + List<_i2.CompanionAdSlot>? companionSlots) => + (super.noSuchMethod( + Invocation.method( + #setCompanionSlots, + [companionSlots], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); } /// A class which mocks [AdMediaInfo]. @@ -222,11 +234,11 @@ class MockAdMediaInfo extends _i1.Mock implements _i2.AdMediaInfo { @override String get url => (super.noSuchMethod( Invocation.getter(#url), - returnValue: _i5.dummyValue( + returnValue: _i6.dummyValue( this, Invocation.getter(#url), ), - returnValueForMissingStub: _i5.dummyValue( + returnValueForMissingStub: _i6.dummyValue( this, Invocation.getter(#url), ), @@ -390,24 +402,24 @@ class MockFrameLayout extends _i1.Mock implements _i2.FrameLayout { ) as _i2.FrameLayout); @override - _i6.Future addView(_i2.View? view) => (super.noSuchMethod( + _i5.Future addView(_i2.View? view) => (super.noSuchMethod( Invocation.method( #addView, [view], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future removeView(_i2.View? view) => (super.noSuchMethod( + _i5.Future removeView(_i2.View? view) => (super.noSuchMethod( Invocation.method( #removeView, [view], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); } /// A class which mocks [MediaPlayer]. @@ -428,54 +440,54 @@ class MockMediaPlayer extends _i1.Mock implements _i2.MediaPlayer { ) as _i2.PigeonInstanceManager); @override - _i6.Future getDuration() => (super.noSuchMethod( + _i5.Future getDuration() => (super.noSuchMethod( Invocation.method( #getDuration, [], ), - returnValue: _i6.Future.value(0), - returnValueForMissingStub: _i6.Future.value(0), - ) as _i6.Future); + returnValue: _i5.Future.value(0), + returnValueForMissingStub: _i5.Future.value(0), + ) as _i5.Future); @override - _i6.Future seekTo(int? mSec) => (super.noSuchMethod( + _i5.Future seekTo(int? mSec) => (super.noSuchMethod( Invocation.method( #seekTo, [mSec], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future start() => (super.noSuchMethod( + _i5.Future start() => (super.noSuchMethod( Invocation.method( #start, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future pause() => (super.noSuchMethod( + _i5.Future pause() => (super.noSuchMethod( Invocation.method( #pause, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future stop() => (super.noSuchMethod( + _i5.Future stop() => (super.noSuchMethod( Invocation.method( #stop, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override _i2.MediaPlayer pigeon_copy() => (super.noSuchMethod( @@ -643,25 +655,25 @@ class MockVideoAdPlayer extends _i1.Mock implements _i2.VideoAdPlayer { ) as _i2.PigeonInstanceManager); @override - _i6.Future setVolume(int? value) => (super.noSuchMethod( + _i5.Future setVolume(int? value) => (super.noSuchMethod( Invocation.method( #setVolume, [value], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future setAdProgress(_i2.VideoProgressUpdate? progress) => + _i5.Future setAdProgress(_i2.VideoProgressUpdate? progress) => (super.noSuchMethod( Invocation.method( #setAdProgress, [progress], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override _i2.VideoAdPlayer pigeon_copy() => (super.noSuchMethod( @@ -705,7 +717,7 @@ class MockVideoAdPlayerCallback extends _i1.Mock ) as _i2.PigeonInstanceManager); @override - _i6.Future onAdProgress( + _i5.Future onAdProgress( _i2.AdMediaInfo? adMediaInfo, _i2.VideoProgressUpdate? videoProgressUpdate, ) => @@ -717,95 +729,95 @@ class MockVideoAdPlayerCallback extends _i1.Mock videoProgressUpdate, ], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future onBuffering(_i2.AdMediaInfo? adMediaInfo) => + _i5.Future onBuffering(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( Invocation.method( #onBuffering, [adMediaInfo], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future onContentComplete() => (super.noSuchMethod( + _i5.Future onContentComplete() => (super.noSuchMethod( Invocation.method( #onContentComplete, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future onEnded(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( + _i5.Future onEnded(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( Invocation.method( #onEnded, [adMediaInfo], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future onError(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( + _i5.Future onError(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( Invocation.method( #onError, [adMediaInfo], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future onLoaded(_i2.AdMediaInfo? adMediaInfo) => + _i5.Future onLoaded(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( Invocation.method( #onLoaded, [adMediaInfo], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future onPause(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( + _i5.Future onPause(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( Invocation.method( #onPause, [adMediaInfo], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future onPlay(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( + _i5.Future onPlay(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( Invocation.method( #onPlay, [adMediaInfo], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future onResume(_i2.AdMediaInfo? adMediaInfo) => + _i5.Future onResume(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( Invocation.method( #onResume, [adMediaInfo], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future onVolumeChanged( + _i5.Future onVolumeChanged( _i2.AdMediaInfo? adMediaInfo, int? percentage, ) => @@ -817,9 +829,9 @@ class MockVideoAdPlayerCallback extends _i1.Mock percentage, ], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override _i2.VideoAdPlayerCallback pigeon_copy() => (super.noSuchMethod( @@ -930,24 +942,24 @@ class MockVideoView extends _i1.Mock implements _i2.VideoView { ) as _i2.PigeonInstanceManager); @override - _i6.Future setVideoUri(String? uri) => (super.noSuchMethod( + _i5.Future setVideoUri(String? uri) => (super.noSuchMethod( Invocation.method( #setVideoUri, [uri], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future getCurrentPosition() => (super.noSuchMethod( + _i5.Future getCurrentPosition() => (super.noSuchMethod( Invocation.method( #getCurrentPosition, [], ), - returnValue: _i6.Future.value(0), - returnValueForMissingStub: _i6.Future.value(0), - ) as _i6.Future); + returnValue: _i5.Future.value(0), + returnValueForMissingStub: _i5.Future.value(0), + ) as _i5.Future); @override _i2.VideoView pigeon_copy() => (super.noSuchMethod( @@ -1036,17 +1048,17 @@ class MockSurfaceAndroidViewController extends _i1.Mock ); @override - _i6.Future setOffset(_i3.Offset? off) => (super.noSuchMethod( + _i5.Future setOffset(_i3.Offset? off) => (super.noSuchMethod( Invocation.method( #setOffset, [off], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future create({ + _i5.Future create({ _i3.Size? size, _i3.Offset? position, }) => @@ -1059,42 +1071,42 @@ class MockSurfaceAndroidViewController extends _i1.Mock #position: position, }, ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future<_i3.Size> setSize(_i3.Size? size) => (super.noSuchMethod( + _i5.Future<_i3.Size> setSize(_i3.Size? size) => (super.noSuchMethod( Invocation.method( #setSize, [size], ), - returnValue: _i6.Future<_i3.Size>.value(_FakeSize_11( + returnValue: _i5.Future<_i3.Size>.value(_FakeSize_11( this, Invocation.method( #setSize, [size], ), )), - returnValueForMissingStub: _i6.Future<_i3.Size>.value(_FakeSize_11( + returnValueForMissingStub: _i5.Future<_i3.Size>.value(_FakeSize_11( this, Invocation.method( #setSize, [size], ), )), - ) as _i6.Future<_i3.Size>); + ) as _i5.Future<_i3.Size>); @override - _i6.Future sendMotionEvent(_i4.AndroidMotionEvent? event) => + _i5.Future sendMotionEvent(_i4.AndroidMotionEvent? event) => (super.noSuchMethod( Invocation.method( #sendMotionEvent, [event], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override void addOnPlatformViewCreatedListener( @@ -1119,46 +1131,46 @@ class MockSurfaceAndroidViewController extends _i1.Mock ); @override - _i6.Future setLayoutDirection(_i3.TextDirection? layoutDirection) => + _i5.Future setLayoutDirection(_i3.TextDirection? layoutDirection) => (super.noSuchMethod( Invocation.method( #setLayoutDirection, [layoutDirection], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future dispatchPointerEvent(_i4.PointerEvent? event) => + _i5.Future dispatchPointerEvent(_i4.PointerEvent? event) => (super.noSuchMethod( Invocation.method( #dispatchPointerEvent, [event], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future clearFocus() => (super.noSuchMethod( + _i5.Future clearFocus() => (super.noSuchMethod( Invocation.method( #clearFocus, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future dispose() => (super.noSuchMethod( + _i5.Future dispose() => (super.noSuchMethod( Invocation.method( #dispose, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); } /// A class which mocks [PlatformViewsServiceProxy]. diff --git a/packages/interactive_media_ads/test/android/ads_loader_test.mocks.dart b/packages/interactive_media_ads/test/android/ads_loader_test.mocks.dart index 3f0c287b080..620ffe04c7d 100644 --- a/packages/interactive_media_ads/test/android/ads_loader_test.mocks.dart +++ b/packages/interactive_media_ads/test/android/ads_loader_test.mocks.dart @@ -3,7 +3,7 @@ // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i6; +import 'dart:async' as _i5; import 'dart:ui' as _i3; import 'package:flutter/services.dart' as _i4; @@ -12,7 +12,7 @@ import 'package:interactive_media_ads/src/android/interactive_media_ads.g.dart' import 'package:interactive_media_ads/src/android/platform_views_service_proxy.dart' as _i7; import 'package:mockito/mockito.dart' as _i1; -import 'package:mockito/src/dummies.dart' as _i5; +import 'package:mockito/src/dummies.dart' as _i6; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -298,6 +298,18 @@ class MockAdDisplayContainer extends _i1.Mock ), ), ) as _i2.AdDisplayContainer); + + @override + _i5.Future setCompanionSlots( + List<_i2.CompanionAdSlot>? companionSlots) => + (super.noSuchMethod( + Invocation.method( + #setCompanionSlots, + [companionSlots], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); } /// A class which mocks [AdError]. @@ -328,11 +340,11 @@ class MockAdError extends _i1.Mock implements _i2.AdError { @override String get message => (super.noSuchMethod( Invocation.getter(#message), - returnValue: _i5.dummyValue( + returnValue: _i6.dummyValue( this, Invocation.getter(#message), ), - returnValueForMissingStub: _i5.dummyValue( + returnValueForMissingStub: _i6.dummyValue( this, Invocation.getter(#message), ), @@ -563,64 +575,64 @@ class MockAdsManager extends _i1.Mock implements _i2.AdsManager { ) as _i2.PigeonInstanceManager); @override - _i6.Future discardAdBreak() => (super.noSuchMethod( + _i5.Future discardAdBreak() => (super.noSuchMethod( Invocation.method( #discardAdBreak, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future pause() => (super.noSuchMethod( + _i5.Future pause() => (super.noSuchMethod( Invocation.method( #pause, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future start() => (super.noSuchMethod( + _i5.Future start() => (super.noSuchMethod( Invocation.method( #start, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future> getAdCuePoints() => (super.noSuchMethod( + _i5.Future> getAdCuePoints() => (super.noSuchMethod( Invocation.method( #getAdCuePoints, [], ), - returnValue: _i6.Future>.value([]), - returnValueForMissingStub: _i6.Future>.value([]), - ) as _i6.Future>); + returnValue: _i5.Future>.value([]), + returnValueForMissingStub: _i5.Future>.value([]), + ) as _i5.Future>); @override - _i6.Future resume() => (super.noSuchMethod( + _i5.Future resume() => (super.noSuchMethod( Invocation.method( #resume, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future skip() => (super.noSuchMethod( + _i5.Future skip() => (super.noSuchMethod( Invocation.method( #skip, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override _i2.AdsManager pigeon_copy() => (super.noSuchMethod( @@ -645,100 +657,100 @@ class MockAdsManager extends _i1.Mock implements _i2.AdsManager { ) as _i2.AdsManager); @override - _i6.Future addAdErrorListener(_i2.AdErrorListener? errorListener) => + _i5.Future addAdErrorListener(_i2.AdErrorListener? errorListener) => (super.noSuchMethod( Invocation.method( #addAdErrorListener, [errorListener], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future addAdEventListener(_i2.AdEventListener? adEventListener) => + _i5.Future addAdEventListener(_i2.AdEventListener? adEventListener) => (super.noSuchMethod( Invocation.method( #addAdEventListener, [adEventListener], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future destroy() => (super.noSuchMethod( + _i5.Future destroy() => (super.noSuchMethod( Invocation.method( #destroy, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future init(_i2.AdsRenderingSettings? settings) => + _i5.Future init(_i2.AdsRenderingSettings? settings) => (super.noSuchMethod( Invocation.method( #init, [settings], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future focus() => (super.noSuchMethod( + _i5.Future focus() => (super.noSuchMethod( Invocation.method( #focus, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future<_i2.AdProgressInfo?> getAdProgressInfo() => (super.noSuchMethod( + _i5.Future<_i2.AdProgressInfo?> getAdProgressInfo() => (super.noSuchMethod( Invocation.method( #getAdProgressInfo, [], ), - returnValue: _i6.Future<_i2.AdProgressInfo?>.value(), - returnValueForMissingStub: _i6.Future<_i2.AdProgressInfo?>.value(), - ) as _i6.Future<_i2.AdProgressInfo?>); + returnValue: _i5.Future<_i2.AdProgressInfo?>.value(), + returnValueForMissingStub: _i5.Future<_i2.AdProgressInfo?>.value(), + ) as _i5.Future<_i2.AdProgressInfo?>); @override - _i6.Future<_i2.Ad?> getCurrentAd() => (super.noSuchMethod( + _i5.Future<_i2.Ad?> getCurrentAd() => (super.noSuchMethod( Invocation.method( #getCurrentAd, [], ), - returnValue: _i6.Future<_i2.Ad?>.value(), - returnValueForMissingStub: _i6.Future<_i2.Ad?>.value(), - ) as _i6.Future<_i2.Ad?>); + returnValue: _i5.Future<_i2.Ad?>.value(), + returnValueForMissingStub: _i5.Future<_i2.Ad?>.value(), + ) as _i5.Future<_i2.Ad?>); @override - _i6.Future removeAdErrorListener(_i2.AdErrorListener? errorListener) => + _i5.Future removeAdErrorListener(_i2.AdErrorListener? errorListener) => (super.noSuchMethod( Invocation.method( #removeAdErrorListener, [errorListener], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future removeAdEventListener( + _i5.Future removeAdEventListener( _i2.AdEventListener? adEventListener) => (super.noSuchMethod( Invocation.method( #removeAdEventListener, [adEventListener], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); } /// A class which mocks [AdsManagerLoadedEvent]. @@ -813,36 +825,36 @@ class MockAdsLoader extends _i1.Mock implements _i2.AdsLoader { ) as _i2.PigeonInstanceManager); @override - _i6.Future addAdErrorListener(_i2.AdErrorListener? listener) => + _i5.Future addAdErrorListener(_i2.AdErrorListener? listener) => (super.noSuchMethod( Invocation.method( #addAdErrorListener, [listener], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future addAdsLoadedListener(_i2.AdsLoadedListener? listener) => + _i5.Future addAdsLoadedListener(_i2.AdsLoadedListener? listener) => (super.noSuchMethod( Invocation.method( #addAdsLoadedListener, [listener], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future requestAds(_i2.AdsRequest? request) => (super.noSuchMethod( + _i5.Future requestAds(_i2.AdsRequest? request) => (super.noSuchMethod( Invocation.method( #requestAds, [request], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override _i2.AdsLoader pigeon_copy() => (super.noSuchMethod( @@ -885,26 +897,26 @@ class MockAdsRequest extends _i1.Mock implements _i2.AdsRequest { ) as _i2.PigeonInstanceManager); @override - _i6.Future setAdTagUrl(String? adTagUrl) => (super.noSuchMethod( + _i5.Future setAdTagUrl(String? adTagUrl) => (super.noSuchMethod( Invocation.method( #setAdTagUrl, [adTagUrl], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future setContentProgressProvider( + _i5.Future setContentProgressProvider( _i2.ContentProgressProvider? provider) => (super.noSuchMethod( Invocation.method( #setContentProgressProvider, [provider], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override _i2.AdsRequest pigeon_copy() => (super.noSuchMethod( @@ -969,24 +981,24 @@ class MockFrameLayout extends _i1.Mock implements _i2.FrameLayout { ) as _i2.FrameLayout); @override - _i6.Future addView(_i2.View? view) => (super.noSuchMethod( + _i5.Future addView(_i2.View? view) => (super.noSuchMethod( Invocation.method( #addView, [view], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future removeView(_i2.View? view) => (super.noSuchMethod( + _i5.Future removeView(_i2.View? view) => (super.noSuchMethod( Invocation.method( #removeView, [view], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); } /// A class which mocks [ImaSdkFactory]. @@ -1007,14 +1019,14 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { ) as _i2.PigeonInstanceManager); @override - _i6.Future<_i2.CompanionAdSlot> createCompanionAdSlot() => + _i5.Future<_i2.CompanionAdSlot> createCompanionAdSlot() => (super.noSuchMethod( Invocation.method( #createCompanionAdSlot, [], ), returnValue: - _i6.Future<_i2.CompanionAdSlot>.value(_FakeCompanionAdSlot_11( + _i5.Future<_i2.CompanionAdSlot>.value(_FakeCompanionAdSlot_11( this, Invocation.method( #createCompanionAdSlot, @@ -1022,23 +1034,23 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { ), )), returnValueForMissingStub: - _i6.Future<_i2.CompanionAdSlot>.value(_FakeCompanionAdSlot_11( + _i5.Future<_i2.CompanionAdSlot>.value(_FakeCompanionAdSlot_11( this, Invocation.method( #createCompanionAdSlot, [], ), )), - ) as _i6.Future<_i2.CompanionAdSlot>); + ) as _i5.Future<_i2.CompanionAdSlot>); @override - _i6.Future<_i2.ImaSdkSettings> createImaSdkSettings() => (super.noSuchMethod( + _i5.Future<_i2.ImaSdkSettings> createImaSdkSettings() => (super.noSuchMethod( Invocation.method( #createImaSdkSettings, [], ), returnValue: - _i6.Future<_i2.ImaSdkSettings>.value(_FakeImaSdkSettings_12( + _i5.Future<_i2.ImaSdkSettings>.value(_FakeImaSdkSettings_12( this, Invocation.method( #createImaSdkSettings, @@ -1046,17 +1058,17 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { ), )), returnValueForMissingStub: - _i6.Future<_i2.ImaSdkSettings>.value(_FakeImaSdkSettings_12( + _i5.Future<_i2.ImaSdkSettings>.value(_FakeImaSdkSettings_12( this, Invocation.method( #createImaSdkSettings, [], ), )), - ) as _i6.Future<_i2.ImaSdkSettings>); + ) as _i5.Future<_i2.ImaSdkSettings>); @override - _i6.Future<_i2.AdsLoader> createAdsLoader( + _i5.Future<_i2.AdsLoader> createAdsLoader( _i2.ImaSdkSettings? settings, _i2.AdDisplayContainer? container, ) => @@ -1068,7 +1080,7 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { container, ], ), - returnValue: _i6.Future<_i2.AdsLoader>.value(_FakeAdsLoader_8( + returnValue: _i5.Future<_i2.AdsLoader>.value(_FakeAdsLoader_8( this, Invocation.method( #createAdsLoader, @@ -1079,7 +1091,7 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { ), )), returnValueForMissingStub: - _i6.Future<_i2.AdsLoader>.value(_FakeAdsLoader_8( + _i5.Future<_i2.AdsLoader>.value(_FakeAdsLoader_8( this, Invocation.method( #createAdsLoader, @@ -1089,15 +1101,15 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { ], ), )), - ) as _i6.Future<_i2.AdsLoader>); + ) as _i5.Future<_i2.AdsLoader>); @override - _i6.Future<_i2.AdsRequest> createAdsRequest() => (super.noSuchMethod( + _i5.Future<_i2.AdsRequest> createAdsRequest() => (super.noSuchMethod( Invocation.method( #createAdsRequest, [], ), - returnValue: _i6.Future<_i2.AdsRequest>.value(_FakeAdsRequest_9( + returnValue: _i5.Future<_i2.AdsRequest>.value(_FakeAdsRequest_9( this, Invocation.method( #createAdsRequest, @@ -1105,23 +1117,23 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { ), )), returnValueForMissingStub: - _i6.Future<_i2.AdsRequest>.value(_FakeAdsRequest_9( + _i5.Future<_i2.AdsRequest>.value(_FakeAdsRequest_9( this, Invocation.method( #createAdsRequest, [], ), )), - ) as _i6.Future<_i2.AdsRequest>); + ) as _i5.Future<_i2.AdsRequest>); @override - _i6.Future<_i2.AdsRenderingSettings> createAdsRenderingSettings() => + _i5.Future<_i2.AdsRenderingSettings> createAdsRenderingSettings() => (super.noSuchMethod( Invocation.method( #createAdsRenderingSettings, [], ), - returnValue: _i6.Future<_i2.AdsRenderingSettings>.value( + returnValue: _i5.Future<_i2.AdsRenderingSettings>.value( _FakeAdsRenderingSettings_13( this, Invocation.method( @@ -1129,7 +1141,7 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { [], ), )), - returnValueForMissingStub: _i6.Future<_i2.AdsRenderingSettings>.value( + returnValueForMissingStub: _i5.Future<_i2.AdsRenderingSettings>.value( _FakeAdsRenderingSettings_13( this, Invocation.method( @@ -1137,7 +1149,7 @@ class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { [], ), )), - ) as _i6.Future<_i2.AdsRenderingSettings>); + ) as _i5.Future<_i2.AdsRenderingSettings>); @override _i2.ImaSdkFactory pigeon_copy() => (super.noSuchMethod( @@ -1345,25 +1357,25 @@ class MockVideoAdPlayer extends _i1.Mock implements _i2.VideoAdPlayer { ) as _i2.PigeonInstanceManager); @override - _i6.Future setVolume(int? value) => (super.noSuchMethod( + _i5.Future setVolume(int? value) => (super.noSuchMethod( Invocation.method( #setVolume, [value], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future setAdProgress(_i2.VideoProgressUpdate? progress) => + _i5.Future setAdProgress(_i2.VideoProgressUpdate? progress) => (super.noSuchMethod( Invocation.method( #setAdProgress, [progress], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override _i2.VideoAdPlayer pigeon_copy() => (super.noSuchMethod( @@ -1407,7 +1419,7 @@ class MockVideoAdPlayerCallback extends _i1.Mock ) as _i2.PigeonInstanceManager); @override - _i6.Future onAdProgress( + _i5.Future onAdProgress( _i2.AdMediaInfo? adMediaInfo, _i2.VideoProgressUpdate? videoProgressUpdate, ) => @@ -1419,95 +1431,95 @@ class MockVideoAdPlayerCallback extends _i1.Mock videoProgressUpdate, ], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future onBuffering(_i2.AdMediaInfo? adMediaInfo) => + _i5.Future onBuffering(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( Invocation.method( #onBuffering, [adMediaInfo], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future onContentComplete() => (super.noSuchMethod( + _i5.Future onContentComplete() => (super.noSuchMethod( Invocation.method( #onContentComplete, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future onEnded(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( + _i5.Future onEnded(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( Invocation.method( #onEnded, [adMediaInfo], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future onError(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( + _i5.Future onError(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( Invocation.method( #onError, [adMediaInfo], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future onLoaded(_i2.AdMediaInfo? adMediaInfo) => + _i5.Future onLoaded(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( Invocation.method( #onLoaded, [adMediaInfo], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future onPause(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( + _i5.Future onPause(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( Invocation.method( #onPause, [adMediaInfo], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future onPlay(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( + _i5.Future onPlay(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( Invocation.method( #onPlay, [adMediaInfo], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future onResume(_i2.AdMediaInfo? adMediaInfo) => + _i5.Future onResume(_i2.AdMediaInfo? adMediaInfo) => (super.noSuchMethod( Invocation.method( #onResume, [adMediaInfo], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future onVolumeChanged( + _i5.Future onVolumeChanged( _i2.AdMediaInfo? adMediaInfo, int? percentage, ) => @@ -1519,9 +1531,9 @@ class MockVideoAdPlayerCallback extends _i1.Mock percentage, ], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override _i2.VideoAdPlayerCallback pigeon_copy() => (super.noSuchMethod( @@ -1591,24 +1603,24 @@ class MockVideoView extends _i1.Mock implements _i2.VideoView { ) as _i2.PigeonInstanceManager); @override - _i6.Future setVideoUri(String? uri) => (super.noSuchMethod( + _i5.Future setVideoUri(String? uri) => (super.noSuchMethod( Invocation.method( #setVideoUri, [uri], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future getCurrentPosition() => (super.noSuchMethod( + _i5.Future getCurrentPosition() => (super.noSuchMethod( Invocation.method( #getCurrentPosition, [], ), - returnValue: _i6.Future.value(0), - returnValueForMissingStub: _i6.Future.value(0), - ) as _i6.Future); + returnValue: _i5.Future.value(0), + returnValueForMissingStub: _i5.Future.value(0), + ) as _i5.Future); @override _i2.VideoView pigeon_copy() => (super.noSuchMethod( @@ -1697,17 +1709,17 @@ class MockSurfaceAndroidViewController extends _i1.Mock ); @override - _i6.Future setOffset(_i3.Offset? off) => (super.noSuchMethod( + _i5.Future setOffset(_i3.Offset? off) => (super.noSuchMethod( Invocation.method( #setOffset, [off], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future create({ + _i5.Future create({ _i3.Size? size, _i3.Offset? position, }) => @@ -1720,42 +1732,42 @@ class MockSurfaceAndroidViewController extends _i1.Mock #position: position, }, ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future<_i3.Size> setSize(_i3.Size? size) => (super.noSuchMethod( + _i5.Future<_i3.Size> setSize(_i3.Size? size) => (super.noSuchMethod( Invocation.method( #setSize, [size], ), - returnValue: _i6.Future<_i3.Size>.value(_FakeSize_19( + returnValue: _i5.Future<_i3.Size>.value(_FakeSize_19( this, Invocation.method( #setSize, [size], ), )), - returnValueForMissingStub: _i6.Future<_i3.Size>.value(_FakeSize_19( + returnValueForMissingStub: _i5.Future<_i3.Size>.value(_FakeSize_19( this, Invocation.method( #setSize, [size], ), )), - ) as _i6.Future<_i3.Size>); + ) as _i5.Future<_i3.Size>); @override - _i6.Future sendMotionEvent(_i4.AndroidMotionEvent? event) => + _i5.Future sendMotionEvent(_i4.AndroidMotionEvent? event) => (super.noSuchMethod( Invocation.method( #sendMotionEvent, [event], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override void addOnPlatformViewCreatedListener( @@ -1780,46 +1792,46 @@ class MockSurfaceAndroidViewController extends _i1.Mock ); @override - _i6.Future setLayoutDirection(_i3.TextDirection? layoutDirection) => + _i5.Future setLayoutDirection(_i3.TextDirection? layoutDirection) => (super.noSuchMethod( Invocation.method( #setLayoutDirection, [layoutDirection], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future dispatchPointerEvent(_i4.PointerEvent? event) => + _i5.Future dispatchPointerEvent(_i4.PointerEvent? event) => (super.noSuchMethod( Invocation.method( #dispatchPointerEvent, [event], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future clearFocus() => (super.noSuchMethod( + _i5.Future clearFocus() => (super.noSuchMethod( Invocation.method( #clearFocus, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); @override - _i6.Future dispose() => (super.noSuchMethod( + _i5.Future dispose() => (super.noSuchMethod( Invocation.method( #dispose, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); } /// A class which mocks [PlatformViewsServiceProxy]. From 2d3e3524ce2a8486a5b54ef3045d51b7c37da2a0 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 30 Apr 2025 18:56:32 -0400 Subject: [PATCH 04/37] switch to build widget creation params --- .../lib/src/ad_display_container.dart | 4 +- .../android/android_companion_ad_slot.dart | 7 +-- .../lib/src/companion_ad_slot.dart | 38 ++++---------- .../build_widget_creation_params.dart | 28 +++++++++++ .../platform_companion_ad_slot.dart | 20 ++------ .../platform_interface.dart | 1 + .../test/companion_ad_slot_test.dart | 50 ++++--------------- .../test/test_stubs.dart | 10 ++-- 8 files changed, 61 insertions(+), 97 deletions(-) create mode 100644 packages/interactive_media_ads/lib/src/platform_interface/build_widget_creation_params.dart diff --git a/packages/interactive_media_ads/lib/src/ad_display_container.dart b/packages/interactive_media_ads/lib/src/ad_display_container.dart index 94af5764521..463d3613da8 100644 --- a/packages/interactive_media_ads/lib/src/ad_display_container.dart +++ b/packages/interactive_media_ads/lib/src/ad_display_container.dart @@ -104,9 +104,7 @@ class AdDisplayContainer extends StatelessWidget { Iterable get companionAds => platform.params.companionSlots.map( - (PlatformCompanionAdSlot slot) { - return CompanionAdSlot.fromPlatform(platform: slot); - }, + (PlatformCompanionAdSlot slot) => CompanionAdSlot.fromPlatform(slot), ); /// The layout direction to use for the embedded AdDisplayContainer. diff --git a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart index 411c6bdba14..0335126c785 100644 --- a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart @@ -1,5 +1,6 @@ import 'package:flutter/cupertino.dart'; +import '../platform_interface/build_widget_creation_params.dart'; import '../platform_interface/platform_companion_ad_slot.dart'; import 'android_view_widget.dart'; import 'interactive_media_ads.g.dart' as ima; @@ -11,10 +12,8 @@ final class AndroidCompanionAdSlotCreationParams extends PlatformCompanionAdSlotCreationParams { /// Constructs a [AndroidCompanionAdSlotCreationParams]. const AndroidCompanionAdSlotCreationParams.size({ - super.key, required super.width, required super.height, - super.layoutDirection, @visibleForTesting InteractiveMediaAdsProxy? proxy, @visibleForTesting PlatformViewsServiceProxy? platformViewsProxy, }) : _proxy = proxy ?? const InteractiveMediaAdsProxy(), @@ -24,8 +23,6 @@ final class AndroidCompanionAdSlotCreationParams /// Constructs a [AndroidCompanionAdSlotCreationParams]. const AndroidCompanionAdSlotCreationParams.fluid({ - super.key, - super.layoutDirection, @visibleForTesting InteractiveMediaAdsProxy? proxy, @visibleForTesting PlatformViewsServiceProxy? platformViewsProxy, }) : _proxy = proxy ?? const InteractiveMediaAdsProxy(), @@ -101,7 +98,7 @@ base class AndroidCompanionAdSlot extends PlatformCompanionAdSlot { } @override - Widget build(BuildContext context) { + Widget buildWidget(BuildWidgetCreationParams params) { return AndroidViewWidget( key: params.key, view: _frameLayout, diff --git a/packages/interactive_media_ads/lib/src/companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/companion_ad_slot.dart index e82ac7b2171..fd8420aee5c 100644 --- a/packages/interactive_media_ads/lib/src/companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/companion_ad_slot.dart @@ -19,7 +19,7 @@ import 'platform_interface/platform_interface.dart'; /// iOS and Android: /// /// ```dart -/// final CompanionAdSlot slot = CompanionAdSlot(); +/// final CompanionAdSlot slot = CompanionAdSlot.size(width: 100, height: 100); /// /// if (InteractiveMediaAdsPlatform.instance is IOSInteractiveMediaAdsPlatform) { /// final IOSCompanionAdSlot iosSlot = slot.platform as IOSCompanionAdSlot; @@ -28,22 +28,18 @@ import 'platform_interface/platform_interface.dart'; /// slot.platform as AndroidCompanionAdSlot; /// } /// ``` -class CompanionAdSlot extends StatelessWidget { +class CompanionAdSlot { /// Constructs an [CompanionAdSlot]. /// /// See [CompanionAdSlot.fromPlatformCreationParams] for setting parameters /// for a specific platform. CompanionAdSlot.size({ - Key? key, required int width, required int height, - TextDirection layoutDirection = TextDirection.ltr, }) : this.fromPlatformCreationParams( - key: key, params: PlatformCompanionAdSlotCreationParams.size( width: width, height: height, - layoutDirection: layoutDirection, ), ); @@ -51,14 +47,9 @@ class CompanionAdSlot extends StatelessWidget { /// /// See [CompanionAdSlot.fromPlatformCreationParams] for setting parameters /// for a specific platform. - CompanionAdSlot.fluid({ - Key? key, - TextDirection layoutDirection = TextDirection.ltr, - }) : this.fromPlatformCreationParams( - key: key, - params: PlatformCompanionAdSlotCreationParams.fluid( - layoutDirection: layoutDirection, - ), + CompanionAdSlot.fluid() + : this.fromPlatformCreationParams( + params: const PlatformCompanionAdSlotCreationParams.fluid(), ); /// Constructs an [CompanionAdSlot] from creation params for a specific platform. @@ -87,26 +78,19 @@ class CompanionAdSlot extends StatelessWidget { /// params, /// ); /// ``` - /// {@endtemplate} + /// {@endtemplate}/// Builds the Widget that contains the native View. CompanionAdSlot.fromPlatformCreationParams({ - Key? key, required PlatformCompanionAdSlotCreationParams params, - }) : this.fromPlatform( - key: key, - platform: PlatformCompanionAdSlot(params), - ); + }) : this.fromPlatform(PlatformCompanionAdSlot(params)); /// Constructs an [CompanionAdSlot] from a specific platform implementation. - const CompanionAdSlot.fromPlatform({super.key, required this.platform}); + const CompanionAdSlot.fromPlatform(this.platform); /// Implementation of [PlatformCompanionAdSlot] for the current platform. final PlatformCompanionAdSlot platform; - /// The layout direction to use for the embedded CompanionAdSlot. - TextDirection get layoutDirection => platform.params.layoutDirection; - - @override - Widget build(BuildContext context) { - return platform.build(context); + /// Builds the Widget that contains the native View. + Widget buildWidget(BuildContext context) { + return platform.buildWidget(BuildWidgetCreationParams(context: context)); } } diff --git a/packages/interactive_media_ads/lib/src/platform_interface/build_widget_creation_params.dart b/packages/interactive_media_ads/lib/src/platform_interface/build_widget_creation_params.dart new file mode 100644 index 00000000000..48e6e2e8796 --- /dev/null +++ b/packages/interactive_media_ads/lib/src/platform_interface/build_widget_creation_params.dart @@ -0,0 +1,28 @@ +// 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. + +import 'package:flutter/widgets.dart'; + +/// Object specifying creation parameters for creating a native view. +base class BuildWidgetCreationParams { + /// Used by the platform implementation to create a new + /// [BuildWidgetCreationParams]. + const BuildWidgetCreationParams({ + this.key, + required this.context, + this.layoutDirection = TextDirection.ltr, + }); + + /// The [Key] passed to Widget of that represents the native view. + /// + /// See also: + /// * The discussions at [Key] and [GlobalKey]. + final Key? key; + + /// A handle to the location of a widget in the widget tree. + final BuildContext context; + + /// The layout direction to use for the native view. + final TextDirection layoutDirection; +} diff --git a/packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart index 26f25755d24..277efc6cd0c 100644 --- a/packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart @@ -4,6 +4,7 @@ import 'package:flutter/widgets.dart'; +import 'build_widget_creation_params.dart'; import 'interactive_media_ads_platform.dart'; /// Object specifying creation parameters for creating a @@ -46,27 +47,17 @@ base class PlatformCompanionAdSlotCreationParams { /// Used by the platform implementation to create a new /// [PlatformCompanionAdSlot]. const PlatformCompanionAdSlotCreationParams.size({ - this.key, required int this.width, required int this.height, - this.layoutDirection = TextDirection.ltr, }) : isFluid = false; /// Used by the platform implementation to create a new /// [PlatformCompanionAdSlot]. - const PlatformCompanionAdSlotCreationParams.fluid({ - this.key, - this.layoutDirection = TextDirection.ltr, - }) : width = null, + const PlatformCompanionAdSlotCreationParams.fluid() + : width = null, height = null, isFluid = true; - /// Controls how one widget replaces another widget in the tree. - /// - /// See also: - /// * The discussions at [Key] and [GlobalKey]. - final Key? key; - /// The width of the companion slot. /// /// Returns `null` when [isFluid] returns true; @@ -80,9 +71,6 @@ base class PlatformCompanionAdSlotCreationParams { /// Whether the companion ad has no fixed size, but rather adapts to fit the /// creative content they display. final bool isFluid; - - /// The layout direction to use for the embedded companion ad. - final TextDirection layoutDirection; } /// Ad slot for companion ads. @@ -117,5 +105,5 @@ abstract base class PlatformCompanionAdSlot { final PlatformCompanionAdSlotCreationParams params; /// Builds the Widget that contains the native View. - Widget build(BuildContext context); + Widget buildWidget(BuildWidgetCreationParams params); } diff --git a/packages/interactive_media_ads/lib/src/platform_interface/platform_interface.dart b/packages/interactive_media_ads/lib/src/platform_interface/platform_interface.dart index 8a808be70d8..5b4deb434e9 100644 --- a/packages/interactive_media_ads/lib/src/platform_interface/platform_interface.dart +++ b/packages/interactive_media_ads/lib/src/platform_interface/platform_interface.dart @@ -5,6 +5,7 @@ export 'ad_error.dart'; export 'ad_event.dart'; export 'ad_ui_element.dart'; +export 'build_widget_creation_params.dart'; export 'interactive_media_ads_platform.dart'; export 'platform_ad_display_container.dart'; export 'platform_ads_loader.dart'; diff --git a/packages/interactive_media_ads/test/companion_ad_slot_test.dart b/packages/interactive_media_ads/test/companion_ad_slot_test.dart index b56b852af8d..e55c139a38e 100644 --- a/packages/interactive_media_ads/test/companion_ad_slot_test.dart +++ b/packages/interactive_media_ads/test/companion_ad_slot_test.dart @@ -12,52 +12,20 @@ import 'test_stubs.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); - testWidgets('build', (WidgetTester tester) async { + testWidgets('buildWidget', (WidgetTester tester) async { final TestCompanionAdSlot slot = TestCompanionAdSlot( const PlatformCompanionAdSlotCreationParams.fluid(), - onBuild: (_) => Container(), + onBuildWidget: (_) => Container(), ); - await tester.pumpWidget(CompanionAdSlot.fromPlatform( - platform: slot, - )); - - expect(find.byType(Container), findsOneWidget); - }); - - testWidgets('constructor parameters are correctly passed to creation params', - (WidgetTester tester) async { - InteractiveMediaAdsPlatform.instance = TestInteractiveMediaAdsPlatform( - onCreatePlatformCompanionAdSlot: ( - PlatformCompanionAdSlotCreationParams params, - ) { - return TestCompanionAdSlot(params, onBuild: (_) => Container()); - }, - onCreatePlatformAdDisplayContainer: ( - PlatformAdDisplayContainerCreationParams params, - ) { - return TestPlatformAdDisplayContainer( - params, - onBuild: (_) => Container(), - ); - }, - onCreatePlatformAdsLoader: (PlatformAdsLoaderCreationParams params) { - throw UnimplementedError(); - }, - onCreatePlatformAdsManagerDelegate: ( - PlatformAdsManagerDelegateCreationParams params, - ) { - throw UnimplementedError(); - }, - onCreatePlatformContentProgressProvider: (_) { - throw UnimplementedError(); - }, + await tester.pumpWidget( + Builder( + builder: (BuildContext context) { + return CompanionAdSlot.fromPlatform(slot).buildWidget(context); + }, + ), ); - final CompanionAdSlot slot = CompanionAdSlot.fluid(key: GlobalKey()); - - // The key passed to the default constructor is used by the super class - // and not passed to the platform implementation. - expect(slot.platform.params.key, isNull); + expect(find.byType(Container), findsOneWidget); }); } diff --git a/packages/interactive_media_ads/test/test_stubs.dart b/packages/interactive_media_ads/test/test_stubs.dart index 193ab3dd116..e8c9964a597 100644 --- a/packages/interactive_media_ads/test/test_stubs.dart +++ b/packages/interactive_media_ads/test/test_stubs.dart @@ -82,7 +82,7 @@ final class TestInteractiveMediaAdsPlatform return onCreatePlatformCompanionAdSlot?.call(params) ?? TestCompanionAdSlot( params, - onBuild: (_) => Container(), + onBuildWidget: (_) => Container(), ); } } @@ -226,13 +226,13 @@ final class TestAdsRenderingSettings extends PlatformAdsRenderingSettings { final class TestCompanionAdSlot extends PlatformCompanionAdSlot { TestCompanionAdSlot( super.params, { - required this.onBuild, + required this.onBuildWidget, }) : super.implementation(); - Widget Function(BuildContext context) onBuild; + Widget Function(BuildWidgetCreationParams params) onBuildWidget; @override - Widget build(BuildContext context) { - return onBuild(context); + Widget buildWidget(BuildWidgetCreationParams params) { + return onBuildWidget(params); } } From 0c7e9b496b7a30a7e671bc17befe765e5da42d3d Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 30 Apr 2025 19:30:07 -0400 Subject: [PATCH 05/37] add example and fix android --- .../example/lib/main.dart | 51 ++++++++++++------- .../android_interactive_media_ads.dart | 8 +-- 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/packages/interactive_media_ads/example/lib/main.dart b/packages/interactive_media_ads/example/lib/main.dart index 49c080f7e54..afae411808e 100644 --- a/packages/interactive_media_ads/example/lib/main.dart +++ b/packages/interactive_media_ads/example/lib/main.dart @@ -67,8 +67,14 @@ class _AdExampleWidgetState extends State ContentProgressProvider(); // #enddocregion example_widget + late final CompanionAdSlot companionAd = CompanionAdSlot.size( + width: 300, + height: 250, + ); + // #docregion ad_and_content_players late final AdDisplayContainer _adDisplayContainer = AdDisplayContainer( + companionAds: [companionAd], onContainerAdded: (AdDisplayContainer container) { _adsLoader = AdsLoader( container: container, @@ -226,23 +232,34 @@ class _AdExampleWidgetState extends State // #enddocregion example_widget return Scaffold( body: Center( - child: SizedBox( - width: 300, - child: !_contentVideoController.value.isInitialized - ? Container() - : AspectRatio( - aspectRatio: _contentVideoController.value.aspectRatio, - child: Stack( - children: [ - // The display container must be on screen before any Ads can be - // loaded and can't be removed between ads. This handles clicks for - // ads. - _adDisplayContainer, - if (_shouldShowContentVideo) - VideoPlayer(_contentVideoController) - ], - ), - ), + child: Column( + children: [ + const SizedBox(width: 100, height: 150), + SizedBox( + width: 300, + child: !_contentVideoController.value.isInitialized + ? Container() + : AspectRatio( + aspectRatio: _contentVideoController.value.aspectRatio, + child: Stack( + children: [ + // The display container must be on screen before any Ads can be + // loaded and can't be removed between ads. This handles clicks for + // ads. + _adDisplayContainer, + if (_shouldShowContentVideo) + VideoPlayer(_contentVideoController) + ], + ), + ), + ), + const SizedBox(width: 100, height: 150), + SizedBox( + width: 300, + height: 250, + child: companionAd.buildWidget(context), + ), + ], ), ), floatingActionButton: diff --git a/packages/interactive_media_ads/lib/src/android/android_interactive_media_ads.dart b/packages/interactive_media_ads/lib/src/android/android_interactive_media_ads.dart index c262b331d37..b6f59eb081a 100644 --- a/packages/interactive_media_ads/lib/src/android/android_interactive_media_ads.dart +++ b/packages/interactive_media_ads/lib/src/android/android_interactive_media_ads.dart @@ -13,6 +13,7 @@ import 'android_ad_display_container.dart'; import 'android_ads_loader.dart'; import 'android_ads_manager_delegate.dart'; import 'android_ads_rendering_settings.dart'; +import 'android_companion_ad_slot.dart'; import 'android_content_progress_provider.dart'; /// Android implementation of [InteractiveMediaAdsPlatform]. @@ -58,8 +59,9 @@ final class AndroidInteractiveMediaAds extends InteractiveMediaAdsPlatform { } @override - PlatformCompanionAdSlot createPlatformCompanionAdSlot(PlatformCompanionAdSlotCreationParams params) { - // TODO: implement createPlatformCompanionAdSlot - throw UnimplementedError(); + AndroidCompanionAdSlot createPlatformCompanionAdSlot( + PlatformCompanionAdSlotCreationParams params, + ) { + return AndroidCompanionAdSlot(params); } } From 693912d8385a4987743d46340f21a45a47e27fd3 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 30 Apr 2025 20:54:29 -0400 Subject: [PATCH 06/37] ios attempt --- .../ios/Runner.xcodeproj/project.pbxproj | 22 + .../xcshareddata/xcschemes/Runner.xcscheme | 2 + .../example/ios/RunnerTests/ViewTests.swift | 20 + .../FlutterViewFactory.swift | 2 + .../InteractiveMediaAdsLibrary.g.swift | 2276 +++++++---------- .../ViewProxyAPIDelegate.swift | 6 +- .../lib/src/ios/interactive_media_ads.g.dart | 711 ++--- .../src/ios/interactive_media_ads_proxy.dart | 5 + .../lib/src/ios/ios_ad_display_container.dart | 5 + .../lib/src/ios/ios_companion_ad_slot.dart | 112 + .../src/ios/ios_interactive_media_ads.dart | 8 +- .../pigeons/interactive_media_ads_ios.dart | 4 +- .../test/ios/ad_display_container_test.dart | 1 + .../test/ios/ads_loader_test.dart | 1 + 14 files changed, 1396 insertions(+), 1779 deletions(-) create mode 100644 packages/interactive_media_ads/example/ios/RunnerTests/ViewTests.swift create mode 100644 packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart diff --git a/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj b/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj index ca9d6c51cf6..34139f5acde 100644 --- a/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj @@ -21,6 +21,7 @@ 8F599BBB2C332C010090A0DF /* AdsRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F599BBA2C332C010090A0DF /* AdsRequestTests.swift */; }; 8F599BBD2C332CFE0090A0DF /* ContentPlayheadTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F599BBC2C332CFE0090A0DF /* ContentPlayheadTests.swift */; }; 8F599BBF2C3335B40090A0DF /* ViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F599BBE2C3335B40090A0DF /* ViewControllerTests.swift */; }; + 8F61402F2DC2F01200D07EC3 /* ViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F61402E2DC2F00900D07EC3 /* ViewTests.swift */; }; 8F8382A32CBDB4A4007F28E0 /* CompanionAdProxyApiTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F8382A22CBDB4A4007F28E0 /* CompanionAdProxyApiTests.swift */; }; 8F9035362D00D9A1004F6450 /* AdPodInfoProxyAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F9035352D00D9A1004F6450 /* AdPodInfoProxyAPITests.swift */; }; 8F977DCF2C2B99C600A90D4B /* AdDisplayContainerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F977DCE2C2B99C600A90D4B /* AdDisplayContainerTests.swift */; }; @@ -83,6 +84,7 @@ 8F599BBA2C332C010090A0DF /* AdsRequestTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdsRequestTests.swift; sourceTree = ""; }; 8F599BBC2C332CFE0090A0DF /* ContentPlayheadTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentPlayheadTests.swift; sourceTree = ""; }; 8F599BBE2C3335B40090A0DF /* ViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewControllerTests.swift; sourceTree = ""; }; + 8F61402E2DC2F00900D07EC3 /* ViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewTests.swift; sourceTree = ""; }; 8F8382A22CBDB4A4007F28E0 /* CompanionAdProxyApiTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompanionAdProxyApiTests.swift; sourceTree = ""; }; 8F9035352D00D9A1004F6450 /* AdPodInfoProxyAPITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdPodInfoProxyAPITests.swift; sourceTree = ""; }; 8F977DCE2C2B99C600A90D4B /* AdDisplayContainerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdDisplayContainerTests.swift; sourceTree = ""; }; @@ -128,6 +130,7 @@ 331C8082294A63A400263BE5 /* RunnerTests */ = { isa = PBXGroup; children = ( + 8F61402E2DC2F00900D07EC3 /* ViewTests.swift */, 8FC919912CA5D86F00188068 /* FriendlyObstructionTests.swift */, 8F977DCE2C2B99C600A90D4B /* AdDisplayContainerTests.swift */, 8F977DD22C2BA15100A90D4B /* TestProxyApiRegistrar.swift */, @@ -253,6 +256,7 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 7517A670E82E5DC089B51E0E /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -368,6 +372,23 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; + 7517A670E82E5DC089B51E0E /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 8BF613E92E45E672229E9718 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -420,6 +441,7 @@ 8F977DD72C2C89A600A90D4B /* AdEventTests.swift in Sources */, 8F977DD32C2BA15100A90D4B /* TestProxyApiRegistrar.swift in Sources */, 8F599BBB2C332C010090A0DF /* AdsRequestTests.swift in Sources */, + 8F61402F2DC2F01200D07EC3 /* ViewTests.swift in Sources */, 8F599BB72C3327F10090A0DF /* AdsManagerDelegateTests.swift in Sources */, 8F599BBD2C332CFE0090A0DF /* ContentPlayheadTests.swift in Sources */, 8FFF0C182CC1A7F300A7CB98 /* CompanionAdSlotProxyApiTests.swift in Sources */, diff --git a/packages/interactive_media_ads/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/interactive_media_ads/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index d795332e1b7..c3fedb29c99 100644 --- a/packages/interactive_media_ads/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/interactive_media_ads/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -44,6 +44,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit" shouldUseLaunchSchemeArgsEnv = "YES"> [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 { @@ -74,12 +72,14 @@ private func nilOrValue(_ value: Any?) -> T? { if value is NSNull { return nil } return value as! T? } + /// Handles the callback when an object is deallocated. protocol InteractiveMediaAdsLibraryPigeonInternalFinalizerDelegate: AnyObject { /// Invoked when the strong reference of an object is deallocated in an `InstanceManager`. func onDeinit(identifier: Int64) } + // Attaches to an object to receive a callback when the object is deallocated. internal final class InteractiveMediaAdsLibraryPigeonInternalFinalizer { private static let associatedObjectKey = malloc(1)! @@ -89,19 +89,15 @@ internal final class InteractiveMediaAdsLibraryPigeonInternalFinalizer { // `InstanceManager` is deallocated. private weak var delegate: InteractiveMediaAdsLibraryPigeonInternalFinalizerDelegate? - private init( - identifier: Int64, delegate: InteractiveMediaAdsLibraryPigeonInternalFinalizerDelegate - ) { + private init(identifier: Int64, delegate: InteractiveMediaAdsLibraryPigeonInternalFinalizerDelegate) { self.identifier = identifier self.delegate = delegate } internal static func attach( - to instance: AnyObject, identifier: Int64, - delegate: InteractiveMediaAdsLibraryPigeonInternalFinalizerDelegate + to instance: AnyObject, identifier: Int64, delegate: InteractiveMediaAdsLibraryPigeonInternalFinalizerDelegate ) { - let finalizer = InteractiveMediaAdsLibraryPigeonInternalFinalizer( - identifier: identifier, delegate: delegate) + let finalizer = InteractiveMediaAdsLibraryPigeonInternalFinalizer(identifier: identifier, delegate: delegate) objc_setAssociatedObject(instance, associatedObjectKey, finalizer, .OBJC_ASSOCIATION_RETAIN) } @@ -114,6 +110,7 @@ internal final class InteractiveMediaAdsLibraryPigeonInternalFinalizer { } } + /// 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 @@ -217,8 +214,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)) - InteractiveMediaAdsLibraryPigeonInternalFinalizer.attach( - to: instance, identifier: identifier, delegate: finalizerDelegate) + InteractiveMediaAdsLibraryPigeonInternalFinalizer.attach(to: instance, identifier: identifier, delegate: finalizerDelegate) } /// Retrieves the identifier paired with an instance. @@ -295,6 +291,7 @@ final class InteractiveMediaAdsLibraryPigeonInstanceManager { } } + private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi { /// The codec used for serializing messages. var codec: FlutterStandardMessageCodec { InteractiveMediaAdsLibraryPigeonCodec.shared } @@ -307,15 +304,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 = InteractiveMediaAdsLibraryPigeonCodec.shared - let removeStrongReferenceChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.interactive_media_ads.PigeonInternalInstanceManager.removeStrongReference", - binaryMessenger: binaryMessenger, codec: codec) + let removeStrongReferenceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.PigeonInternalInstanceManager.removeStrongReference", binaryMessenger: binaryMessenger, codec: codec) if let instanceManager = instanceManager { removeStrongReferenceChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -330,9 +321,7 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi { } else { removeStrongReferenceChannel.setMessageHandler(nil) } - let clearChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.PigeonInternalInstanceManager.clear", - binaryMessenger: binaryMessenger, codec: codec) + let clearChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.PigeonInternalInstanceManager.clear", binaryMessenger: binaryMessenger, codec: codec) if let instanceManager = instanceManager { clearChannel.setMessageHandler { _, reply in do { @@ -348,13 +337,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.PigeonInternalInstanceManager.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.PigeonInternalInstanceManager.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))) @@ -366,7 +351,7 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi { let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } @@ -374,110 +359,74 @@ 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 /// An implementation of [PigeonApiIMAFriendlyObstruction] used to add a new Dart instance of /// `IMAFriendlyObstruction` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAFriendlyObstruction( - _ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar - ) -> PigeonApiIMAFriendlyObstruction + func pigeonApiIMAFriendlyObstruction(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAFriendlyObstruction /// An implementation of [PigeonApiIMACompanionAd] used to add a new Dart instance of /// `IMACompanionAd` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMACompanionAd(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiIMACompanionAd + func pigeonApiIMACompanionAd(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMACompanionAd /// An implementation of [PigeonApiIMACompanionAdSlot] used to add a new Dart instance of /// `IMACompanionAdSlot` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMACompanionAdSlot(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiIMACompanionAdSlot + func pigeonApiIMACompanionAdSlot(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMACompanionAdSlot /// An implementation of [PigeonApiIMACompanionDelegate] used to add a new Dart instance of /// `IMACompanionDelegate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMACompanionDelegate(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiIMACompanionDelegate + func pigeonApiIMACompanionDelegate(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMACompanionDelegate /// An implementation of [PigeonApiIMAAdPodInfo] used to add a new Dart instance of /// `IMAAdPodInfo` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdPodInfo(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiIMAAdPodInfo + func pigeonApiIMAAdPodInfo(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdPodInfo } extension InteractiveMediaAdsLibraryPigeonProxyApiDelegate { - func pigeonApiUIView(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiUIView - { - return PigeonApiUIView(pigeonRegistrar: registrar, delegate: PigeonApiDelegateUIView()) - } - func pigeonApiIMASettings(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiIMASettings - { - return PigeonApiIMASettings( - pigeonRegistrar: registrar, delegate: PigeonApiDelegateIMASettings()) - } - func pigeonApiNSObject(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) - -> PigeonApiNSObject - { + func pigeonApiIMASettings(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMASettings { + return PigeonApiIMASettings(pigeonRegistrar: registrar, delegate: PigeonApiDelegateIMASettings()) + } + func pigeonApiNSObject(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiNSObject { return PigeonApiNSObject(pigeonRegistrar: registrar, delegate: PigeonApiDelegateNSObject()) } } @@ -492,15 +441,12 @@ open class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar { var codec: FlutterStandardMessageCodec { if _codec == nil { _codec = FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: self)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: self)) } return _codec! } - private class InstanceManagerApiFinalizerDelegate: - InteractiveMediaAdsLibraryPigeonInternalFinalizerDelegate - { + private class InstanceManagerApiFinalizerDelegate: InteractiveMediaAdsLibraryPigeonInternalFinalizerDelegate { let api: InteractiveMediaAdsLibraryPigeonInstanceManagerApi init(_ api: InteractiveMediaAdsLibraryPigeonInstanceManagerApi) { @@ -514,10 +460,7 @@ open class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar { } } - init( - binaryMessenger: FlutterBinaryMessenger, - apiDelegate: InteractiveMediaAdsLibraryPigeonProxyApiDelegate - ) { + init(binaryMessenger: FlutterBinaryMessenger, apiDelegate: InteractiveMediaAdsLibraryPigeonProxyApiDelegate) { self.binaryMessenger = binaryMessenger self.apiDelegate = apiDelegate self.instanceManager = InteractiveMediaAdsLibraryPigeonInstanceManager( @@ -526,37 +469,25 @@ 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)) - PigeonApiIMAFriendlyObstruction.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAFriendlyObstruction(self)) - PigeonApiIMACompanionAdSlot.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMACompanionAdSlot(self)) - PigeonApiIMACompanionDelegate.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMACompanionDelegate(self)) + InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger: binaryMessenger, instanceManager: instanceManager) + PigeonApiIMAAdDisplayContainer.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdDisplayContainer(self)) + PigeonApiUIView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIView(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)) + PigeonApiIMAFriendlyObstruction.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAFriendlyObstruction(self)) + PigeonApiIMACompanionAdSlot.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMACompanionAdSlot(self)) + PigeonApiIMACompanionDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMACompanionDelegate(self)) } func tearDown() { - InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers( - binaryMessenger: binaryMessenger, instanceManager: nil) + InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger: binaryMessenger, instanceManager: nil) PigeonApiIMAAdDisplayContainer.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) + PigeonApiUIView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiUIViewController.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiIMAContentPlayhead.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiIMAAdsLoader.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) @@ -564,21 +495,16 @@ 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) PigeonApiIMAFriendlyObstruction.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiIMACompanionAdSlot.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiIMACompanionDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) } } -private class InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter: - FlutterStandardReaderWriter -{ +private class InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStandardReaderWriter { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar - private class InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReader: - InteractiveMediaAdsLibraryPigeonCodecReader - { + private class InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReader: InteractiveMediaAdsLibraryPigeonCodecReader { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar init(data: Data, pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { @@ -592,6 +518,9 @@ private class InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter: let identifier = self.readValue() let instance: AnyObject? = pigeonRegistrar.instanceManager.instance( forIdentifier: identifier is Int64 ? identifier as! Int64 : Int64(identifier as! Int32)) + if instance == nil { + print("Failed to find instance with identifier: \(identifier!)") + } return instance default: return super.readValue(ofType: type) @@ -599,9 +528,7 @@ private class InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter: } } - private class InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecWriter: - InteractiveMediaAdsLibraryPigeonCodecWriter - { + private class InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecWriter: InteractiveMediaAdsLibraryPigeonCodecWriter { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar init(data: NSMutableData, pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { @@ -610,266 +537,251 @@ private class InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter: } 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 || value is FriendlyObstructionPurpose - || value is UIElementType - { + 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 || value is FriendlyObstructionPurpose || value is UIElementType { 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? IMAFriendlyObstruction { - pigeonRegistrar.apiDelegate.pigeonApiIMAFriendlyObstruction(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiIMAFriendlyObstruction(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? IMACompanionAd { pigeonRegistrar.apiDelegate.pigeonApiIMACompanionAd(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? IMACompanionAdSlot { pigeonRegistrar.apiDelegate.pigeonApiIMACompanionAdSlot(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? IMACompanionDelegate { - pigeonRegistrar.apiDelegate.pigeonApiIMACompanionDelegate(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiIMACompanionDelegate(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? IMAAdPodInfo { pigeonRegistrar.apiDelegate.pigeonApiIMAAdPodInfo(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( pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance)!) } else { print("Unsupported value: \(value) of \(type(of: value))") - assert( - false, "Unsupported value for InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecWriter" - ) + assert(false, "Unsupported value for InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecWriter") } } @@ -880,13 +792,11 @@ private class InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter: } override func reader(with data: Data) -> FlutterStandardReader { - return InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReader( - data: data, pigeonRegistrar: pigeonRegistrar) + return InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReader(data: data, pigeonRegistrar: pigeonRegistrar) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecWriter( - data: data, pigeonRegistrar: pigeonRegistrar) + return InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecWriter(data: data, pigeonRegistrar: pigeonRegistrar) } } @@ -1210,49 +1120,35 @@ private class InteractiveMediaAdsLibraryPigeonCodecReaderWriter: FlutterStandard } class InteractiveMediaAdsLibraryPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { - static let shared = InteractiveMediaAdsLibraryPigeonCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonCodecReaderWriter()) + static let shared = InteractiveMediaAdsLibraryPigeonCodec(readerWriter: InteractiveMediaAdsLibraryPigeonCodecReaderWriter()) } protocol PigeonApiDelegateIMAAdDisplayContainer { /// Initializes IMAAdDisplayContainer for rendering the ad and displaying the /// sad UI. - func pigeonDefaultConstructor( - pigeonApi: PigeonApiIMAAdDisplayContainer, adContainer: UIView, - companionSlots: [IMACompanionAdSlot]?, adContainerViewController: UIViewController? - ) throws -> IMAAdDisplayContainer + func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdDisplayContainer, adContainer: UIView, companionSlots: [IMACompanionAdSlot]?, adContainerViewController: UIViewController?) throws -> IMAAdDisplayContainer /// View containing the video display and ad related UI. /// /// This view must be present in the view hierarchy in order to make ad or /// stream requests. - func adContainer(pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer) - throws -> UIView + func adContainer(pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer) throws -> UIView /// List of companion ad slots. - func companionSlots( - pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer - ) throws -> [IMACompanionAdSlot]? + func companionSlots(pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer) throws -> [IMACompanionAdSlot]? /// View controller containing the ad container. - func setAdContainerViewController( - pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer, - controller: UIViewController?) throws + func setAdContainerViewController(pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer, controller: UIViewController?) throws /// View controller containing the ad container. - func getAdContainerViewController( - pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer - ) throws -> UIViewController? + func getAdContainerViewController(pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer) throws -> UIViewController? /// Registers a view that overlays or obstructs this container as “friendly” /// for viewability measurement purposes. - func registerFriendlyObstruction( - pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer, - friendlyObstruction: IMAFriendlyObstruction) throws + func registerFriendlyObstruction(pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer, friendlyObstruction: IMAFriendlyObstruction) throws /// Unregisters all previously registered friendly obstructions. - func unregisterAllFriendlyObstructions( - pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer) throws + func unregisterAllFriendlyObstructions(pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer) throws } 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 @@ -1260,26 +1156,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: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(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?] @@ -1289,10 +1176,8 @@ final class PigeonApiIMAAdDisplayContainer: PigeonApiProtocolIMAAdDisplayContain let adContainerViewControllerArg: UIViewController? = nilOrValue(args[3]) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor( - pigeonApi: api, adContainer: adContainerArg, companionSlots: companionSlotsArg, - adContainerViewController: adContainerViewControllerArg), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, adContainer: adContainerArg, companionSlots: companionSlotsArg, adContainerViewController: adContainerViewControllerArg), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1301,18 +1186,14 @@ final class PigeonApiIMAAdDisplayContainer: PigeonApiProtocolIMAAdDisplayContain } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let setAdContainerViewControllerChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.setAdContainerViewController", - binaryMessenger: binaryMessenger, codec: codec) + let setAdContainerViewControllerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.setAdContainerViewController", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setAdContainerViewControllerChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdDisplayContainer let controllerArg: UIViewController? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setAdContainerViewController( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, controller: controllerArg) + try api.pigeonDelegate.setAdContainerViewController(pigeonApi: api, pigeonInstance: pigeonInstanceArg, controller: controllerArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1321,17 +1202,13 @@ final class PigeonApiIMAAdDisplayContainer: PigeonApiProtocolIMAAdDisplayContain } else { setAdContainerViewControllerChannel.setMessageHandler(nil) } - let getAdContainerViewControllerChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.getAdContainerViewController", - binaryMessenger: binaryMessenger, codec: codec) + let getAdContainerViewControllerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.getAdContainerViewController", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getAdContainerViewControllerChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdDisplayContainer do { - let result = try api.pigeonDelegate.getAdContainerViewController( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getAdContainerViewController(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -1340,19 +1217,14 @@ final class PigeonApiIMAAdDisplayContainer: PigeonApiProtocolIMAAdDisplayContain } else { getAdContainerViewControllerChannel.setMessageHandler(nil) } - let registerFriendlyObstructionChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.registerFriendlyObstruction", - binaryMessenger: binaryMessenger, codec: codec) + let registerFriendlyObstructionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.registerFriendlyObstruction", binaryMessenger: binaryMessenger, codec: codec) if let api = api { registerFriendlyObstructionChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdDisplayContainer let friendlyObstructionArg = args[1] as! IMAFriendlyObstruction do { - try api.pigeonDelegate.registerFriendlyObstruction( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, - friendlyObstruction: friendlyObstructionArg) + try api.pigeonDelegate.registerFriendlyObstruction(pigeonApi: api, pigeonInstance: pigeonInstanceArg, friendlyObstruction: friendlyObstructionArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1361,17 +1233,13 @@ final class PigeonApiIMAAdDisplayContainer: PigeonApiProtocolIMAAdDisplayContain } else { registerFriendlyObstructionChannel.setMessageHandler(nil) } - let unregisterAllFriendlyObstructionsChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.unregisterAllFriendlyObstructions", - binaryMessenger: binaryMessenger, codec: codec) + let unregisterAllFriendlyObstructionsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.unregisterAllFriendlyObstructions", binaryMessenger: binaryMessenger, codec: codec) if let api = api { unregisterAllFriendlyObstructionsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdDisplayContainer do { - try api.pigeonDelegate.unregisterAllFriendlyObstructions( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + try api.pigeonDelegate.unregisterAllFriendlyObstructions(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1383,57 +1251,48 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let adContainerArg = try! pigeonDelegate.adContainer( - pigeonApi: self, pigeonInstance: pigeonInstance) - let companionSlotsArg = try! pigeonDelegate.companionSlots( - pigeonApi: self, pigeonInstance: pigeonInstance) - 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) - channel.sendMessage([pigeonIdentifierArg, adContainerArg, companionSlotsArg] as [Any?]) { - response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + let adContainerArg = try! pigeonDelegate.adContainer(pigeonApi: self, pigeonInstance: pigeonInstance) + let companionSlotsArg = try! pigeonDelegate.companionSlots(pigeonApi: self, pigeonInstance: pigeonInstance) + 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) + channel.sendMessage([pigeonIdentifierArg, adContainerArg, companionSlotsArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } } -open class PigeonApiDelegateUIView { +protocol PigeonApiDelegateUIView { + func pigeonDefaultConstructor(pigeonApi: PigeonApiUIView) throws -> UIView } 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 @@ -1441,48 +1300,64 @@ 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 } + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIView?) { + let codec: FlutterStandardMessageCodec = + api != nil + ? FlutterStandardMessageCodec( + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + : FlutterStandardMessageCodec.sharedInstance() + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.UIView.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + pigeonDefaultConstructorChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonIdentifierArg = args[0] as! Int64 + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), +withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + pigeonDefaultConstructorChannel.setMessageHandler(nil) + } + } + ///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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - 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) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + 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) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -1500,12 +1375,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 @@ -1513,33 +1386,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: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(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] as! Int64 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)) @@ -1548,18 +1413,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] as! Int64 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)) @@ -1571,49 +1432,39 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - 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) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + 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) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } /// 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( @@ -1624,10 +1475,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))) @@ -1639,7 +1488,7 @@ final class PigeonApiUIViewController: PigeonApiProtocolUIViewController { let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } @@ -1648,15 +1497,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 @@ -1664,33 +1511,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: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(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] as! Int64 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)) @@ -1699,17 +1538,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)) @@ -1721,65 +1557,54 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - 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) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + 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) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } } 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 @@ -1787,25 +1612,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: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(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?] @@ -1813,8 +1630,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)) @@ -1823,9 +1640,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?] @@ -1840,17 +1655,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)) @@ -1859,17 +1671,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)) @@ -1881,41 +1690,34 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - 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) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + 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) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -1926,7 +1728,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 @@ -1934,49 +1736,39 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - 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) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + 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) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -1984,16 +1776,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 @@ -2001,25 +1790,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: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(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?] @@ -2029,10 +1810,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)) @@ -2044,64 +1823,50 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - 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) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + 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) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } } 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 @@ -2109,34 +1874,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: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(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] as! Int64 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)) @@ -2148,31 +1904,25 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + completion( + .failure( + PigeonError( + code: "new-instance-error", + message: "Error: Attempting to create a new Dart instance of IMAAdsLoaderDelegate, but the class has a nonnull callback method.", details: ""))) } - 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( @@ -2183,10 +1933,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))) @@ -2198,17 +1946,13 @@ final class PigeonApiIMAAdsLoaderDelegate: PigeonApiProtocolIMAAdsLoaderDelegate let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } /// 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( @@ -2219,10 +1963,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))) @@ -2234,7 +1976,7 @@ final class PigeonApiIMAAdsLoaderDelegate: PigeonApiProtocolIMAAdsLoaderDelegate let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } @@ -2244,14 +1986,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 @@ -2259,65 +2000,53 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - 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) - channel.sendMessage([pigeonIdentifierArg, adsManagerArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + 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) + channel.sendMessage([pigeonIdentifierArg, adsManagerArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } } 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 @@ -2325,50 +2054,40 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - 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) - channel.sendMessage([pigeonIdentifierArg, adErrorArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + 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) + channel.sendMessage([pigeonIdentifierArg, adErrorArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -2385,7 +2104,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 @@ -2393,65 +2112,51 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - 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) - channel.sendMessage([pigeonIdentifierArg, typeArg, codeArg, messageArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + 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) + channel.sendMessage([pigeonIdentifierArg, typeArg, codeArg, messageArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } } 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. @@ -2470,7 +2175,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 @@ -2478,33 +2183,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: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(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)) @@ -2513,18 +2209,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)) @@ -2533,9 +2225,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?] @@ -2550,9 +2240,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?] @@ -2567,9 +2255,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?] @@ -2584,9 +2270,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?] @@ -2601,9 +2285,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?] @@ -2618,9 +2300,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?] @@ -2638,74 +2318,54 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - 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) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + 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) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } } 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 @@ -2713,34 +2373,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: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(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] as! Int64 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)) @@ -2752,31 +2403,25 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + completion( + .failure( + PigeonError( + code: "new-instance-error", + message: "Error: Attempting to create a new Dart instance of IMAAdsManagerDelegate, but the class has a nonnull callback method.", details: ""))) } - 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( @@ -2787,10 +2432,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))) @@ -2802,17 +2445,13 @@ final class PigeonApiIMAAdsManagerDelegate: PigeonApiProtocolIMAAdsManagerDelega let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } /// 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( @@ -2823,10 +2462,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))) @@ -2838,17 +2475,13 @@ final class PigeonApiIMAAdsManagerDelegate: PigeonApiProtocolIMAAdsManagerDelega let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } /// 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( @@ -2859,10 +2492,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))) @@ -2874,17 +2505,13 @@ final class PigeonApiIMAAdsManagerDelegate: PigeonApiProtocolIMAAdsManagerDelega let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } /// 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( @@ -2895,10 +2522,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))) @@ -2910,7 +2535,7 @@ final class PigeonApiIMAAdsManagerDelegate: PigeonApiProtocolIMAAdsManagerDelega let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } @@ -2928,7 +2553,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 @@ -2936,103 +2561,76 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - 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 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 - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + 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 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 + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } } protocol PigeonApiDelegateIMAAdsRenderingSettings { - func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsRenderingSettings) throws - -> IMAAdsRenderingSettings + func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsRenderingSettings) throws -> IMAAdsRenderingSettings /// If specified, the SDK will play the media with MIME type on the list. - func setMimeTypes( - pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, - types: [String]?) throws + func setMimeTypes(pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, types: [String]?) throws /// Maximum recommended bitrate. /// /// The value is in kbit/s. - func setBitrate( - pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, - bitrate: Int64) throws + func setBitrate(pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, bitrate: Int64) throws /// Timeout (in seconds) when loading a video ad media file. /// /// Use -1 for the default of 8 seconds. - func setLoadVideoTimeout( - pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, - seconds: Double) throws + func setLoadVideoTimeout(pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, seconds: Double) throws /// For VMAP and ad rules playlists, only play ad breaks scheduled after this /// time (in seconds). - func setPlayAdsAfterTime( - pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, - seconds: Double) throws + func setPlayAdsAfterTime(pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, seconds: Double) throws /// Specifies the list of UI elements that should be visible. - func setUIElements( - pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, - types: [UIElementType]?) throws + func setUIElements(pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, types: [UIElementType]?) throws /// Whether or not the SDK will preload ad media. /// /// Default is YES. - func setEnablePreloading( - pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, - enable: Bool) throws + func setEnablePreloading(pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, enable: Bool) throws /// Specifies the optional UIViewController that will be used to open links /// in-app. - func setLinkOpenerPresentingController( - pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, - controller: UIViewController) throws + func setLinkOpenerPresentingController(pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, controller: UIViewController) throws } 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 @@ -3040,34 +2638,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: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(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] as! Int64 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)) @@ -3076,17 +2665,14 @@ final class PigeonApiIMAAdsRenderingSettings: PigeonApiProtocolIMAAdsRenderingSe } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let setMimeTypesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setMimeTypes", - binaryMessenger: binaryMessenger, codec: codec) + let setMimeTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setMimeTypes", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setMimeTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsRenderingSettings let typesArg: [String]? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setMimeTypes( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, types: typesArg) + try api.pigeonDelegate.setMimeTypes(pigeonApi: api, pigeonInstance: pigeonInstanceArg, types: typesArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3095,17 +2681,14 @@ final class PigeonApiIMAAdsRenderingSettings: PigeonApiProtocolIMAAdsRenderingSe } else { setMimeTypesChannel.setMessageHandler(nil) } - let setBitrateChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setBitrate", - binaryMessenger: binaryMessenger, codec: codec) + let setBitrateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setBitrate", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setBitrateChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsRenderingSettings let bitrateArg = args[1] as! Int64 do { - try api.pigeonDelegate.setBitrate( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, bitrate: bitrateArg) + try api.pigeonDelegate.setBitrate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, bitrate: bitrateArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3114,17 +2697,14 @@ final class PigeonApiIMAAdsRenderingSettings: PigeonApiProtocolIMAAdsRenderingSe } else { setBitrateChannel.setMessageHandler(nil) } - let setLoadVideoTimeoutChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setLoadVideoTimeout", - binaryMessenger: binaryMessenger, codec: codec) + let setLoadVideoTimeoutChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setLoadVideoTimeout", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setLoadVideoTimeoutChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsRenderingSettings let secondsArg = args[1] as! Double do { - try api.pigeonDelegate.setLoadVideoTimeout( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, seconds: secondsArg) + try api.pigeonDelegate.setLoadVideoTimeout(pigeonApi: api, pigeonInstance: pigeonInstanceArg, seconds: secondsArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3133,17 +2713,14 @@ final class PigeonApiIMAAdsRenderingSettings: PigeonApiProtocolIMAAdsRenderingSe } else { setLoadVideoTimeoutChannel.setMessageHandler(nil) } - let setPlayAdsAfterTimeChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setPlayAdsAfterTime", - binaryMessenger: binaryMessenger, codec: codec) + let setPlayAdsAfterTimeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setPlayAdsAfterTime", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setPlayAdsAfterTimeChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsRenderingSettings let secondsArg = args[1] as! Double do { - try api.pigeonDelegate.setPlayAdsAfterTime( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, seconds: secondsArg) + try api.pigeonDelegate.setPlayAdsAfterTime(pigeonApi: api, pigeonInstance: pigeonInstanceArg, seconds: secondsArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3152,17 +2729,14 @@ final class PigeonApiIMAAdsRenderingSettings: PigeonApiProtocolIMAAdsRenderingSe } else { setPlayAdsAfterTimeChannel.setMessageHandler(nil) } - let setUIElementsChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setUIElements", - binaryMessenger: binaryMessenger, codec: codec) + let setUIElementsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setUIElements", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setUIElementsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsRenderingSettings let typesArg: [UIElementType]? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setUIElements( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, types: typesArg) + try api.pigeonDelegate.setUIElements(pigeonApi: api, pigeonInstance: pigeonInstanceArg, types: typesArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3171,17 +2745,14 @@ final class PigeonApiIMAAdsRenderingSettings: PigeonApiProtocolIMAAdsRenderingSe } else { setUIElementsChannel.setMessageHandler(nil) } - let setEnablePreloadingChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setEnablePreloading", - binaryMessenger: binaryMessenger, codec: codec) + let setEnablePreloadingChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setEnablePreloading", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setEnablePreloadingChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsRenderingSettings let enableArg = args[1] as! Bool do { - try api.pigeonDelegate.setEnablePreloading( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, enable: enableArg) + try api.pigeonDelegate.setEnablePreloading(pigeonApi: api, pigeonInstance: pigeonInstanceArg, enable: enableArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3190,18 +2761,14 @@ final class PigeonApiIMAAdsRenderingSettings: PigeonApiProtocolIMAAdsRenderingSe } else { setEnablePreloadingChannel.setMessageHandler(nil) } - let setLinkOpenerPresentingControllerChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setLinkOpenerPresentingController", - binaryMessenger: binaryMessenger, codec: codec) + let setLinkOpenerPresentingControllerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setLinkOpenerPresentingController", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setLinkOpenerPresentingControllerChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsRenderingSettings let controllerArg = args[1] as! UIViewController do { - try api.pigeonDelegate.setLinkOpenerPresentingController( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, controller: controllerArg) + try api.pigeonDelegate.setLinkOpenerPresentingController(pigeonApi: api, pigeonInstance: pigeonInstanceArg, controller: controllerArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3213,42 +2780,34 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - 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) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + 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) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -3259,81 +2818,65 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - 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) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + 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) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } } protocol PigeonApiDelegateIMAFriendlyObstruction { /// Initializes a friendly obstruction. - func pigeonDefaultConstructor( - pigeonApi: PigeonApiIMAFriendlyObstruction, view: UIView, purpose: FriendlyObstructionPurpose, - detailedReason: String? - ) throws -> IMAFriendlyObstruction + func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAFriendlyObstruction, view: UIView, purpose: FriendlyObstructionPurpose, detailedReason: String?) throws -> IMAFriendlyObstruction /// The view causing the obstruction. - func view(pigeonApi: PigeonApiIMAFriendlyObstruction, pigeonInstance: IMAFriendlyObstruction) - throws -> UIView + func view(pigeonApi: PigeonApiIMAFriendlyObstruction, pigeonInstance: IMAFriendlyObstruction) throws -> UIView /// The purpose for registering the obstruction as friendly. - func purpose(pigeonApi: PigeonApiIMAFriendlyObstruction, pigeonInstance: IMAFriendlyObstruction) - throws -> FriendlyObstructionPurpose + func purpose(pigeonApi: PigeonApiIMAFriendlyObstruction, pigeonInstance: IMAFriendlyObstruction) throws -> FriendlyObstructionPurpose /// Optional, detailed reasoning for registering this obstruction as friendly. /// /// If the detailedReason is not null, it must follow the IAB standard by /// being 50 characters or less and only containing characters A-z, 0-9, or /// spaces. - func detailedReason( - pigeonApi: PigeonApiIMAFriendlyObstruction, pigeonInstance: IMAFriendlyObstruction - ) throws -> String? + func detailedReason(pigeonApi: PigeonApiIMAFriendlyObstruction, pigeonInstance: IMAFriendlyObstruction) throws -> String? } protocol PigeonApiProtocolIMAFriendlyObstruction { } -final class PigeonApiIMAFriendlyObstruction: PigeonApiProtocolIMAFriendlyObstruction { +final class PigeonApiIMAFriendlyObstruction: PigeonApiProtocolIMAFriendlyObstruction { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAFriendlyObstruction ///An implementation of [NSObject] used to access callback methods @@ -3341,26 +2884,17 @@ final class PigeonApiIMAFriendlyObstruction: PigeonApiProtocolIMAFriendlyObstruc return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateIMAFriendlyObstruction - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAFriendlyObstruction) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAFriendlyObstruction? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAFriendlyObstruction?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.interactive_media_ads.IMAFriendlyObstruction.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAFriendlyObstruction.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -3370,9 +2904,8 @@ final class PigeonApiIMAFriendlyObstruction: PigeonApiProtocolIMAFriendlyObstruc let detailedReasonArg: String? = nilOrValue(args[3]) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor( - pigeonApi: api, view: viewArg, purpose: purposeArg, detailedReason: detailedReasonArg), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, view: viewArg, purpose: purposeArg, detailedReason: detailedReasonArg), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3384,58 +2917,46 @@ final class PigeonApiIMAFriendlyObstruction: PigeonApiProtocolIMAFriendlyObstruc } ///Creates a Dart instance of IMAFriendlyObstruction and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: IMAFriendlyObstruction, - completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: IMAFriendlyObstruction, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let viewArg = try! pigeonDelegate.view(pigeonApi: self, pigeonInstance: pigeonInstance) - let purposeArg = try! pigeonDelegate.purpose(pigeonApi: self, pigeonInstance: pigeonInstance) - let detailedReasonArg = try! pigeonDelegate.detailedReason( - pigeonApi: self, pigeonInstance: pigeonInstance) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMAFriendlyObstruction.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg, viewArg, purposeArg, detailedReasonArg] as [Any?]) { - response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + let viewArg = try! pigeonDelegate.view(pigeonApi: self, pigeonInstance: pigeonInstance) + let purposeArg = try! pigeonDelegate.purpose(pigeonApi: self, pigeonInstance: pigeonInstance) + let detailedReasonArg = try! pigeonDelegate.detailedReason(pigeonApi: self, pigeonInstance: pigeonInstance) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAFriendlyObstruction.pigeon_newInstance" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg, viewArg, purposeArg, detailedReasonArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } } protocol PigeonApiDelegateIMACompanionAd { /// The value for the resource of this companion. - func resourceValue(pigeonApi: PigeonApiIMACompanionAd, pigeonInstance: IMACompanionAd) throws - -> String? + func resourceValue(pigeonApi: PigeonApiIMACompanionAd, pigeonInstance: IMACompanionAd) throws -> String? /// The API needed to execute this ad, or nil if unavailable. - func apiFramework(pigeonApi: PigeonApiIMACompanionAd, pigeonInstance: IMACompanionAd) throws - -> String? + func apiFramework(pigeonApi: PigeonApiIMACompanionAd, pigeonInstance: IMACompanionAd) throws -> String? /// The width of the companion in pixels. /// /// 0 if unavailable. @@ -3449,7 +2970,7 @@ protocol PigeonApiDelegateIMACompanionAd { protocol PigeonApiProtocolIMACompanionAd { } -final class PigeonApiIMACompanionAd: PigeonApiProtocolIMACompanionAd { +final class PigeonApiIMACompanionAd: PigeonApiProtocolIMACompanionAd { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMACompanionAd ///An implementation of [NSObject] used to access callback methods @@ -3457,110 +2978,83 @@ final class PigeonApiIMACompanionAd: PigeonApiProtocolIMACompanionAd { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateIMACompanionAd - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMACompanionAd) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of IMACompanionAd and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: IMACompanionAd, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: IMACompanionAd, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let resourceValueArg = try! pigeonDelegate.resourceValue( - pigeonApi: self, pigeonInstance: pigeonInstance) - let apiFrameworkArg = try! pigeonDelegate.apiFramework( - pigeonApi: self, pigeonInstance: pigeonInstance) - let widthArg = try! pigeonDelegate.width(pigeonApi: self, pigeonInstance: pigeonInstance) - let heightArg = try! pigeonDelegate.height(pigeonApi: self, pigeonInstance: pigeonInstance) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMACompanionAd.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage( - [pigeonIdentifierArg, resourceValueArg, apiFrameworkArg, widthArg, heightArg] as [Any?] - ) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + let resourceValueArg = try! pigeonDelegate.resourceValue(pigeonApi: self, pigeonInstance: pigeonInstance) + let apiFrameworkArg = try! pigeonDelegate.apiFramework(pigeonApi: self, pigeonInstance: pigeonInstance) + let widthArg = try! pigeonDelegate.width(pigeonApi: self, pigeonInstance: pigeonInstance) + let heightArg = try! pigeonDelegate.height(pigeonApi: self, pigeonInstance: pigeonInstance) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMACompanionAd.pigeon_newInstance" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg, resourceValueArg, apiFrameworkArg, widthArg, heightArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } } protocol PigeonApiDelegateIMACompanionAdSlot { /// Initializes an instance of a IMACompanionAdSlot with fluid size. - func pigeonDefaultConstructor(pigeonApi: PigeonApiIMACompanionAdSlot, view: UIView) throws - -> IMACompanionAdSlot + func pigeonDefaultConstructor(pigeonApi: PigeonApiIMACompanionAdSlot, view: UIView) throws -> IMACompanionAdSlot /// Initializes an instance of a IMACompanionAdSlot with design ad width and /// height. /// /// `width` and `height` are in pixels. - func size(pigeonApi: PigeonApiIMACompanionAdSlot, view: UIView, width: Int64, height: Int64) - throws -> IMACompanionAdSlot + func size(pigeonApi: PigeonApiIMACompanionAdSlot, view: UIView, width: Int64, height: Int64) throws -> IMACompanionAdSlot /// The view the companion will be rendered in. /// /// Display this view in your application before video ad starts. - func view(pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot) throws - -> UIView + func view(pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot) throws -> UIView /// The IMACompanionDelegate for receiving events from the companion ad slot. /// /// This instance only creates a weak reference to the delegate, so the Dart /// instance should create an explicit reference to receive callbacks. - func setDelegate( - pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot, - delegate: IMACompanionDelegate?) throws + func setDelegate(pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot, delegate: IMACompanionDelegate?) throws } protocol PigeonApiProtocolIMACompanionAdSlot { } -final class PigeonApiIMACompanionAdSlot: PigeonApiProtocolIMACompanionAdSlot { +final class PigeonApiIMACompanionAdSlot: PigeonApiProtocolIMACompanionAdSlot { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMACompanionAdSlot - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateIMACompanionAdSlot - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMACompanionAdSlot) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMACompanionAdSlot? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMACompanionAdSlot?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -3568,8 +3062,8 @@ final class PigeonApiIMACompanionAdSlot: PigeonApiProtocolIMACompanionAdSlot { let viewArg = args[1] as! UIView do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, view: viewArg), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, view: viewArg), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3578,9 +3072,7 @@ final class PigeonApiIMACompanionAdSlot: PigeonApiProtocolIMACompanionAdSlot { } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let sizeChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.size", - binaryMessenger: binaryMessenger, codec: codec) + let sizeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.size", binaryMessenger: binaryMessenger, codec: codec) if let api = api { sizeChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -3590,9 +3082,8 @@ final class PigeonApiIMACompanionAdSlot: PigeonApiProtocolIMACompanionAdSlot { let heightArg = args[3] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.size( - pigeonApi: api, view: viewArg, width: widthArg, height: heightArg), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.size(pigeonApi: api, view: viewArg, width: widthArg, height: heightArg), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3601,17 +3092,14 @@ final class PigeonApiIMACompanionAdSlot: PigeonApiProtocolIMACompanionAdSlot { } else { sizeChannel.setMessageHandler(nil) } - let setDelegateChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.setDelegate", - binaryMessenger: binaryMessenger, codec: codec) + let setDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.setDelegate", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setDelegateChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMACompanionAdSlot let delegateArg: IMACompanionDelegate? = 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)) @@ -3623,64 +3111,52 @@ final class PigeonApiIMACompanionAdSlot: PigeonApiProtocolIMACompanionAdSlot { } ///Creates a Dart instance of IMACompanionAdSlot and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: IMACompanionAdSlot, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: IMACompanionAdSlot, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let viewArg = try! pigeonDelegate.view(pigeonApi: self, pigeonInstance: pigeonInstance) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg, viewArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + let viewArg = try! pigeonDelegate.view(pigeonApi: self, pigeonInstance: pigeonInstance) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.pigeon_newInstance" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg, viewArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } } protocol PigeonApiDelegateIMACompanionDelegate { - func pigeonDefaultConstructor(pigeonApi: PigeonApiIMACompanionDelegate) throws - -> IMACompanionDelegate + func pigeonDefaultConstructor(pigeonApi: PigeonApiIMACompanionDelegate) throws -> IMACompanionDelegate } protocol PigeonApiProtocolIMACompanionDelegate { /// Called when the slot is either filled or not filled. - func companionAdSlotFilled( - pigeonInstance pigeonInstanceArg: IMACompanionDelegate, slot slotArg: IMACompanionAdSlot, - filled filledArg: Bool, completion: @escaping (Result) -> Void) + func companionAdSlotFilled(pigeonInstance pigeonInstanceArg: IMACompanionDelegate, slot slotArg: IMACompanionAdSlot, filled filledArg: Bool, completion: @escaping (Result) -> Void) /// Called when the slot is clicked on by the user and will successfully /// navigate away. - func companionSlotWasClicked( - pigeonInstance pigeonInstanceArg: IMACompanionDelegate, slot slotArg: IMACompanionAdSlot, - completion: @escaping (Result) -> Void) + func companionSlotWasClicked(pigeonInstance pigeonInstanceArg: IMACompanionDelegate, slot slotArg: IMACompanionAdSlot, completion: @escaping (Result) -> Void) } -final class PigeonApiIMACompanionDelegate: PigeonApiProtocolIMACompanionDelegate { +final class PigeonApiIMACompanionDelegate: PigeonApiProtocolIMACompanionDelegate { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMACompanionDelegate ///An implementation of [NSObject] used to access callback methods @@ -3688,34 +3164,25 @@ final class PigeonApiIMACompanionDelegate: PigeonApiProtocolIMACompanionDelegate return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateIMACompanionDelegate - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMACompanionDelegate) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMACompanionDelegate? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMACompanionDelegate?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.interactive_media_ads.IMACompanionDelegate.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionDelegate.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 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)) @@ -3727,49 +3194,39 @@ final class PigeonApiIMACompanionDelegate: PigeonApiProtocolIMACompanionDelegate } ///Creates a Dart instance of IMACompanionDelegate and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: IMACompanionDelegate, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: IMACompanionDelegate, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - 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.IMACompanionDelegate.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))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + 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.IMACompanionDelegate.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))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } /// Called when the slot is either filled or not filled. - func companionAdSlotFilled( - pigeonInstance pigeonInstanceArg: IMACompanionDelegate, slot slotArg: IMACompanionAdSlot, - filled filledArg: Bool, completion: @escaping (Result) -> Void - ) { + func companionAdSlotFilled(pigeonInstance pigeonInstanceArg: IMACompanionDelegate, slot slotArg: IMACompanionAdSlot, filled filledArg: Bool, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3780,10 +3237,8 @@ final class PigeonApiIMACompanionDelegate: PigeonApiProtocolIMACompanionDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMACompanionDelegate.companionAdSlotFilled" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMACompanionDelegate.companionAdSlotFilled" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, slotArg, filledArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -3795,17 +3250,14 @@ final class PigeonApiIMACompanionDelegate: PigeonApiProtocolIMACompanionDelegate let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } /// Called when the slot is clicked on by the user and will successfully /// navigate away. - func companionSlotWasClicked( - pigeonInstance pigeonInstanceArg: IMACompanionDelegate, slot slotArg: IMACompanionAdSlot, - completion: @escaping (Result) -> Void - ) { + func companionSlotWasClicked(pigeonInstance pigeonInstanceArg: IMACompanionDelegate, slot slotArg: IMACompanionAdSlot, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3816,10 +3268,8 @@ final class PigeonApiIMACompanionDelegate: PigeonApiProtocolIMACompanionDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMACompanionDelegate.companionSlotWasClicked" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMACompanionDelegate.companionSlotWasClicked" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, slotArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -3831,7 +3281,7 @@ final class PigeonApiIMACompanionDelegate: PigeonApiProtocolIMACompanionDelegate let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } @@ -3878,66 +3328,48 @@ protocol PigeonApiDelegateIMAAdPodInfo { protocol PigeonApiProtocolIMAAdPodInfo { } -final class PigeonApiIMAAdPodInfo: PigeonApiProtocolIMAAdPodInfo { +final class PigeonApiIMAAdPodInfo: PigeonApiProtocolIMAAdPodInfo { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdPodInfo - init( - pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateIMAAdPodInfo - ) { + init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdPodInfo) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of IMAAdPodInfo and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: IMAAdPodInfo, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: IMAAdPodInfo, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let adPositionArg = try! pigeonDelegate.adPosition( - pigeonApi: self, pigeonInstance: pigeonInstance) - let maxDurationArg = try! pigeonDelegate.maxDuration( - pigeonApi: self, pigeonInstance: pigeonInstance) - let podIndexArg = try! pigeonDelegate.podIndex(pigeonApi: self, pigeonInstance: pigeonInstance) - let timeOffsetArg = try! pigeonDelegate.timeOffset( - pigeonApi: self, pigeonInstance: pigeonInstance) - let totalAdsArg = try! pigeonDelegate.totalAds(pigeonApi: self, pigeonInstance: pigeonInstance) - let isBumperArg = try! pigeonDelegate.isBumper(pigeonApi: self, pigeonInstance: pigeonInstance) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.interactive_media_ads.IMAAdPodInfo.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage( - [ - pigeonIdentifierArg, adPositionArg, maxDurationArg, podIndexArg, timeOffsetArg, totalAdsArg, - isBumperArg, - ] as [Any?] - ) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + let adPositionArg = try! pigeonDelegate.adPosition(pigeonApi: self, pigeonInstance: pigeonInstance) + let maxDurationArg = try! pigeonDelegate.maxDuration(pigeonApi: self, pigeonInstance: pigeonInstance) + let podIndexArg = try! pigeonDelegate.podIndex(pigeonApi: self, pigeonInstance: pigeonInstance) + let timeOffsetArg = try! pigeonDelegate.timeOffset(pigeonApi: self, pigeonInstance: pigeonInstance) + let totalAdsArg = try! pigeonDelegate.totalAds(pigeonApi: self, pigeonInstance: pigeonInstance) + let isBumperArg = try! pigeonDelegate.isBumper(pigeonApi: self, pigeonInstance: pigeonInstance) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdPodInfo.pigeon_newInstance" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg, adPositionArg, maxDurationArg, podIndexArg, timeOffsetArg, totalAdsArg, isBumperArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } diff --git a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/ViewProxyAPIDelegate.swift b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/ViewProxyAPIDelegate.swift index 1352a6fa269..6d7c4645708 100644 --- a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/ViewProxyAPIDelegate.swift +++ b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/ViewProxyAPIDelegate.swift @@ -9,8 +9,8 @@ import UIKit /// /// 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 ViewProxyAPIDelegate: PigeonApiDelegateUIView { - func getWindow(pigeonApi: PigeonApiUIView, pigeonInstance: UIView) throws -> UIWindow? { - return pigeonInstance.window +class ViewProxyAPIDelegate: PigeonApiDelegateUIView { + func pigeonDefaultConstructor(pigeonApi: PigeonApiUIView) throws -> UIView { + return UIView() } } 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 f37cfb166f9..a928bacffac 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 @@ -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 (v22.7.2), do not edit directly. +// Autogenerated from Pigeon (v25.3.1), 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. /// @@ -113,10 +110,9 @@ class PigeonInstanceManager { // by calling instanceManager.getIdentifier() inside of `==` while this was a // HashMap). final Expando _identifiers = Expando(); - final Map> - _weakInstances = >{}; - final Map _strongInstances = - {}; + final Map> _weakInstances = + >{}; + final Map _strongInstances = {}; late final Finalizer _finalizer; int _nextIdentifier = 0; @@ -126,8 +122,7 @@ class PigeonInstanceManager { static PigeonInstanceManager _initInstance() { WidgetsFlutterBinding.ensureInitialized(); - final _PigeonInternalInstanceManagerApi api = - _PigeonInternalInstanceManagerApi(); + final _PigeonInternalInstanceManagerApi api = _PigeonInternalInstanceManagerApi(); // Clears the native `PigeonInstanceManager` on the initial use of the Dart one. api.clear(); final PigeonInstanceManager instanceManager = PigeonInstanceManager( @@ -135,49 +130,28 @@ class PigeonInstanceManager { api.removeStrongReference(identifier); }, ); - _PigeonInternalInstanceManagerApi.setUpMessageHandlers( - instanceManager: instanceManager); - IMAAdDisplayContainer.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); + _PigeonInternalInstanceManagerApi.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); - IMAFriendlyObstruction.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - IMACompanionAd.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - IMACompanionAdSlot.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - IMACompanionDelegate.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - IMAAdPodInfo.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); + IMAFriendlyObstruction.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + IMACompanionAd.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + IMACompanionAdSlot.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + IMACompanionDelegate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + IMAAdPodInfo.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); return instanceManager; } @@ -241,20 +215,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 PigeonInternalProxyApiBaseClass? weakInstance = - _weakInstances[identifier]?.target; + T? getInstanceWithWeakReference(int identifier) { + final PigeonInternalProxyApiBaseClass? weakInstance = _weakInstances[identifier]?.target; if (weakInstance == null) { - final PigeonInternalProxyApiBaseClass? strongInstance = - _strongInstances[identifier]; + final PigeonInternalProxyApiBaseClass? strongInstance = _strongInstances[identifier]; if (strongInstance != null) { - final PigeonInternalProxyApiBaseClass copy = - strongInstance.pigeon_copy(); + final PigeonInternalProxyApiBaseClass 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; } @@ -278,20 +247,17 @@ class PigeonInstanceManager { /// added. /// /// Returns unique identifier of the [instance] added. - void addHostCreatedInstance( - PigeonInternalProxyApiBaseClass instance, int identifier) { + void addHostCreatedInstance(PigeonInternalProxyApiBaseClass instance, int identifier) { _addInstanceWithIdentifier(instance, identifier); } - void _addInstanceWithIdentifier( - PigeonInternalProxyApiBaseClass instance, int identifier) { + void _addInstanceWithIdentifier(PigeonInternalProxyApiBaseClass 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 PigeonInternalProxyApiBaseClass copy = instance.pigeon_copy(); @@ -371,8 +337,10 @@ class _PigeonInternalInstanceManagerApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([identifier]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([identifier]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -398,8 +366,9 @@ class _PigeonInternalInstanceManagerApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final List? pigeonVar_replyList = - await pigeonVar_channel.send(null) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -415,40 +384,38 @@ class _PigeonInternalInstanceManagerApi { } class _PigeonInternalProxyApiBaseCodec extends _PigeonCodec { - const _PigeonInternalProxyApiBaseCodec(this.instanceManager); - final PigeonInstanceManager instanceManager; - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is PigeonInternalProxyApiBaseClass) { - 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 _PigeonInternalProxyApiBaseCodec(this.instanceManager); + final PigeonInstanceManager instanceManager; + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is PigeonInternalProxyApiBaseClass) { + 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 @@ -462,81 +429,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, } @@ -547,77 +491,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, } @@ -629,15 +549,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, @@ -649,15 +566,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, @@ -672,25 +586,20 @@ 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, } @@ -703,7 +612,6 @@ enum FriendlyObstructionPurpose { closeAd, notVisible, other, - /// The purpose type is not recognized by this wrapper. unknown, } @@ -714,14 +622,13 @@ enum FriendlyObstructionPurpose { enum UIElementType { /// Ad attribution UI element. adAttribution, - /// Ad countdown element. countdown, - /// The element is not recognized by this wrapper. unknown, } + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -729,28 +636,28 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is AdErrorType) { + } else 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 if (value is FriendlyObstructionPurpose) { + } else if (value is FriendlyObstructionPurpose) { buffer.putUint8(135); writeValue(buffer, value.index); - } else if (value is UIElementType) { + } else if (value is UIElementType) { buffer.putUint8(136); writeValue(buffer, value.index); } else { @@ -761,28 +668,28 @@ 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]; - case 135: + case 135: final int? value = readValue(buffer) as int?; return value == null ? null : FriendlyObstructionPurpose.values[value]; - case 136: + case 136: final int? value = readValue(buffer) as int?; return value == null ? null : UIElementType.values[value]; default: @@ -790,7 +697,6 @@ class _PigeonCodec extends StandardMessageCodec { } } } - /// The `IMAAdDisplayContainer` is responsible for managing the ad container /// view and companion ad slots used for ad playback. /// @@ -810,22 +716,24 @@ class IMAAdDisplayContainer extends NSObject { final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecIMAAdDisplayContainer; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.pigeon_defaultConstructor'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([ + pigeonVar_instanceIdentifier, + adContainer, + companionSlots, + adContainerViewController + ]); () async { - const String pigeonVar_channelName = - 'dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.pigeon_defaultConstructor'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); final List? pigeonVar_replyList = - await pigeonVar_channel.send([ - pigeonVar_instanceIdentifier, - adContainer, - companionSlots, - adContainerViewController - ]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -938,8 +846,10 @@ class IMAAdDisplayContainer extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([this, controller]) as List?; + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, controller]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -966,8 +876,10 @@ class IMAAdDisplayContainer extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([this]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -996,8 +908,10 @@ class IMAAdDisplayContainer extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([this, friendlyObstruction]) as List?; + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, friendlyObstruction]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -1024,8 +938,10 @@ class IMAAdDisplayContainer extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([this]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -1054,6 +970,42 @@ class IMAAdDisplayContainer extends NSObject { /// /// See https://developer.apple.com/documentation/uikit/uiview. class UIView extends NSObject { + UIView({ + super.pigeon_binaryMessenger, + super.pigeon_instanceManager, + }) : super.pigeon_detached() { + final int pigeonVar_instanceIdentifier = + pigeon_instanceManager.addDartCreatedInstance(this); + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecUIView; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.interactive_media_ads.UIView.pigeon_defaultConstructor'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([pigeonVar_instanceIdentifier]); + () async { + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + }(); + } + /// Constructs [UIView] without creating the associated native object. /// /// This should only be used by subclasses created by this library or to @@ -1064,6 +1016,9 @@ class UIView extends NSObject { super.pigeon_instanceManager, }) : super.pigeon_detached(); + late final _PigeonInternalProxyApiBaseCodec _pigeonVar_codecUIView = + _PigeonInternalProxyApiBaseCodec(pigeon_instanceManager); + static void pigeon_setUpMessageHandlers({ bool pigeon_clearHandlers = false, BinaryMessenger? pigeon_binaryMessenger, @@ -1136,17 +1091,19 @@ class UIViewController extends NSObject { final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecUIViewController; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.interactive_media_ads.UIViewController.pigeon_defaultConstructor'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([pigeonVar_instanceIdentifier]); () async { - const String pigeonVar_channelName = - 'dev.flutter.pigeon.interactive_media_ads.UIViewController.pigeon_defaultConstructor'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([pigeonVar_instanceIdentifier]) as List?; + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -1314,9 +1271,10 @@ class UIViewController extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([this, pigeonVar_instanceIdentifier]) - as List?; + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, pigeonVar_instanceIdentifier]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -1356,17 +1314,19 @@ class IMAContentPlayhead extends NSObject { final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecIMAContentPlayhead; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.interactive_media_ads.IMAContentPlayhead.pigeon_defaultConstructor'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([pigeonVar_instanceIdentifier]); () async { - const String pigeonVar_channelName = - 'dev.flutter.pigeon.interactive_media_ads.IMAContentPlayhead.pigeon_defaultConstructor'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([pigeonVar_instanceIdentifier]) as List?; + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -1457,8 +1417,10 @@ class IMAContentPlayhead extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([this, timeInterval]) as List?; + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, timeInterval]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -1495,18 +1457,19 @@ class IMAAdsLoader extends NSObject { final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecIMAAdsLoader; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.pigeon_defaultConstructor'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel + .send([pigeonVar_instanceIdentifier, settings]); () async { - const String pigeonVar_channelName = - 'dev.flutter.pigeon.interactive_media_ads.IMAAdsLoader.pigeon_defaultConstructor'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([pigeonVar_instanceIdentifier, settings]) - as List?; + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -1596,8 +1559,10 @@ class IMAAdsLoader extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([this]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -1624,8 +1589,10 @@ class IMAAdsLoader extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([this, request]) as List?; + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, request]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -1654,8 +1621,10 @@ class IMAAdsLoader extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([this, delegate]) as List?; + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, delegate]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -1768,22 +1737,24 @@ class IMAAdsRequest extends NSObject { final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecIMAAdsRequest; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.interactive_media_ads.IMAAdsRequest.pigeon_defaultConstructor'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel + .send([ + pigeonVar_instanceIdentifier, + adTagUrl, + adDisplayContainer, + contentPlayhead + ]); () async { - const String pigeonVar_channelName = - 'dev.flutter.pigeon.interactive_media_ads.IMAAdsRequest.pigeon_defaultConstructor'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([ - pigeonVar_instanceIdentifier, - adTagUrl, - adDisplayContainer, - contentPlayhead - ]) as List?; + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -1884,17 +1855,19 @@ class IMAAdsLoaderDelegate extends NSObject { final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecIMAAdsLoaderDelegate; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.interactive_media_ads.IMAAdsLoaderDelegate.pigeon_defaultConstructor'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([pigeonVar_instanceIdentifier]); () async { - const String pigeonVar_channelName = - 'dev.flutter.pigeon.interactive_media_ads.IMAAdsLoaderDelegate.pigeon_defaultConstructor'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([pigeonVar_instanceIdentifier]) as List?; + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2427,8 +2400,10 @@ class IMAAdsManager extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([this, delegate]) as List?; + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, delegate]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2455,8 +2430,10 @@ class IMAAdsManager extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([this, adsRenderingSettings]) as List?; + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, adsRenderingSettings]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2483,8 +2460,10 @@ class IMAAdsManager extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([this]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2511,8 +2490,10 @@ class IMAAdsManager extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([this]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2539,8 +2520,10 @@ class IMAAdsManager extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([this]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2568,8 +2551,10 @@ class IMAAdsManager extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([this]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2596,8 +2581,10 @@ class IMAAdsManager extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([this]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2624,8 +2611,10 @@ class IMAAdsManager extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([this]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2665,17 +2654,19 @@ class IMAAdsManagerDelegate extends NSObject { final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecIMAAdsManagerDelegate; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.pigeon_defaultConstructor'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([pigeonVar_instanceIdentifier]); () async { - const String pigeonVar_channelName = - 'dev.flutter.pigeon.interactive_media_ads.IMAAdsManagerDelegate.pigeon_defaultConstructor'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([pigeonVar_instanceIdentifier]) as List?; + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3111,17 +3102,19 @@ class IMAAdsRenderingSettings extends NSObject { final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecIMAAdsRenderingSettings; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.pigeon_defaultConstructor'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([pigeonVar_instanceIdentifier]); () async { - const String pigeonVar_channelName = - 'dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.pigeon_defaultConstructor'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([pigeonVar_instanceIdentifier]) as List?; + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3212,8 +3205,10 @@ class IMAAdsRenderingSettings extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, types]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([this, types]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3242,8 +3237,10 @@ class IMAAdsRenderingSettings extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([this, bitrate]) as List?; + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, bitrate]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3272,8 +3269,10 @@ class IMAAdsRenderingSettings extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([this, seconds]) as List?; + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, seconds]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3301,8 +3300,10 @@ class IMAAdsRenderingSettings extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([this, seconds]) as List?; + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, seconds]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3329,8 +3330,10 @@ class IMAAdsRenderingSettings extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, types]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([this, types]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3359,8 +3362,10 @@ class IMAAdsRenderingSettings extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, enable]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([this, enable]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3389,8 +3394,10 @@ class IMAAdsRenderingSettings extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([this, controller]) as List?; + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, controller]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3505,22 +3512,19 @@ class IMAFriendlyObstruction extends NSObject { final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecIMAFriendlyObstruction; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.interactive_media_ads.IMAFriendlyObstruction.pigeon_defaultConstructor'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [pigeonVar_instanceIdentifier, view, purpose, detailedReason]); () async { - const String pigeonVar_channelName = - 'dev.flutter.pigeon.interactive_media_ads.IMAFriendlyObstruction.pigeon_defaultConstructor'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([ - pigeonVar_instanceIdentifier, - view, - purpose, - detailedReason - ]) as List?; + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3771,18 +3775,19 @@ class IMACompanionAdSlot extends PigeonInternalProxyApiBaseClass { final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecIMACompanionAdSlot; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.pigeon_defaultConstructor'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([pigeonVar_instanceIdentifier, view]); () async { - const String pigeonVar_channelName = - 'dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.pigeon_defaultConstructor'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([pigeonVar_instanceIdentifier, view]) - as List?; + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3813,18 +3818,19 @@ class IMACompanionAdSlot extends PigeonInternalProxyApiBaseClass { final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecIMACompanionAdSlot; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.size'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel + .send([pigeonVar_instanceIdentifier, view, width, height]); () async { - const String pigeonVar_channelName = - 'dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.size'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel.send( - [pigeonVar_instanceIdentifier, view, width, height]) - as List?; + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3928,8 +3934,10 @@ class IMACompanionAdSlot extends PigeonInternalProxyApiBaseClass { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([this, delegate]) as List?; + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, delegate]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3968,17 +3976,19 @@ class IMACompanionDelegate extends NSObject { final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _pigeonVar_codecIMACompanionDelegate; final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.interactive_media_ads.IMACompanionDelegate.pigeon_defaultConstructor'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([pigeonVar_instanceIdentifier]); () async { - const String pigeonVar_channelName = - 'dev.flutter.pigeon.interactive_media_ads.IMACompanionDelegate.pigeon_defaultConstructor'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([pigeonVar_instanceIdentifier]) as List?; + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4364,3 +4374,4 @@ class IMAAdPodInfo extends PigeonInternalProxyApiBaseClass { ); } } + diff --git a/packages/interactive_media_ads/lib/src/ios/interactive_media_ads_proxy.dart b/packages/interactive_media_ads/lib/src/ios/interactive_media_ads_proxy.dart index 53b472f4fb6..a28810f9b0e 100644 --- a/packages/interactive_media_ads/lib/src/ios/interactive_media_ads_proxy.dart +++ b/packages/interactive_media_ads/lib/src/ios/interactive_media_ads_proxy.dart @@ -14,6 +14,7 @@ class InteractiveMediaAdsProxy { /// Constructs an [InteractiveMediaAdsProxy]. const InteractiveMediaAdsProxy({ this.newIMAAdDisplayContainer = IMAAdDisplayContainer.new, + this.newUIView = UIView.new, this.newUIViewController = UIViewController.new, this.newIMAContentPlayhead = IMAContentPlayhead.new, this.newIMAAdsLoader = IMAAdsLoader.new, @@ -31,8 +32,12 @@ class InteractiveMediaAdsProxy { final IMAAdDisplayContainer Function({ required UIView adContainer, UIViewController? adContainerViewController, + List? companionSlots, }) newIMAAdDisplayContainer; + /// Constructs [UIView]. + final UIView Function() newUIView; + /// Constructs [UIViewController]. final UIViewController Function({ void Function(UIViewController, bool)? viewDidAppear, diff --git a/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart b/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart index f0780d1a747..71d5ecb5d81 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart @@ -11,6 +11,7 @@ import 'package:meta/meta.dart'; import '../platform_interface/platform_interface.dart'; import 'interactive_media_ads.g.dart'; import 'interactive_media_ads_proxy.dart'; +import 'ios_companion_ad_slot.dart'; /// Implementation of [PlatformAdDisplayContainerCreationParams] for iOS. final class IOSAdDisplayContainerCreationParams @@ -72,6 +73,10 @@ base class IOSAdDisplayContainer extends PlatformAdDisplayContainer { adDisplayContainer = _iosParams._imaProxy.newIMAAdDisplayContainer( adContainer: _controller.view, adContainerViewController: _controller, + companionSlots: _iosParams.companionSlots + .cast() + .map((IOSCompanionAdSlot slot) => slot.nativeCompanionAdSlot) + .toList(), ); await _viewDidAppearCompleter.future; params.onContainerAdded(this); diff --git a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart new file mode 100644 index 00000000000..ce0bae68955 --- /dev/null +++ b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart @@ -0,0 +1,112 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:meta/meta.dart'; + +import '../platform_interface/build_widget_creation_params.dart'; +import '../platform_interface/platform_companion_ad_slot.dart'; +import 'interactive_media_ads.g.dart'; +import 'interactive_media_ads_proxy.dart'; + +/// iOS implementation of [PlatformCompanionAdSlotCreationParams]. +final class IOSCompanionAdSlotCreationParams + extends PlatformCompanionAdSlotCreationParams { + /// Constructs a [IOSCompanionAdSlotCreationParams]. + const IOSCompanionAdSlotCreationParams.size({ + required super.width, + required super.height, + @visibleForTesting InteractiveMediaAdsProxy? proxy, + }) : _proxy = proxy ?? const InteractiveMediaAdsProxy(), + super.size(); + + /// Constructs a [IOSCompanionAdSlotCreationParams]. + const IOSCompanionAdSlotCreationParams.fluid({ + @visibleForTesting InteractiveMediaAdsProxy? proxy, + }) : _proxy = proxy ?? const InteractiveMediaAdsProxy(), + super.fluid(); + + /// Creates a [IOSCompanionAdSlotCreationParams] from an instance of + /// [PlatformCompanionAdSlotCreationParams]. + factory IOSCompanionAdSlotCreationParams.fromPlatformCompanionAdSlotCreationParamsSize( + // Placeholder to prevent requiring a breaking change if params are added to + // PlatformCompanionAdSlotCreationParams. + // ignore: avoid_unused_constructor_parameters + PlatformCompanionAdSlotCreationParams params, { + @visibleForTesting InteractiveMediaAdsProxy? proxy, + }) { + return IOSCompanionAdSlotCreationParams.size( + width: params.width!, + height: params.height!, + proxy: proxy, + ); + } + + /// Creates a [IOSCompanionAdSlotCreationParams] from an instance of + /// [PlatformCompanionAdSlotCreationParams]. + factory IOSCompanionAdSlotCreationParams.fromPlatformCompanionAdSlotCreationParamsFluid( + // Placeholder to prevent requiring a breaking change if params are added to + // PlatformCompanionAdSlotCreationParams. + // ignore: avoid_unused_constructor_parameters + PlatformCompanionAdSlotCreationParams params, { + @visibleForTesting InteractiveMediaAdsProxy? proxy, + }) { + return IOSCompanionAdSlotCreationParams.fluid( + proxy: proxy, + ); + } + + final InteractiveMediaAdsProxy _proxy; +} + +base class IOSCompanionAdSlot extends PlatformCompanionAdSlot { + /// Constructs an [IOSCompanionAdSlot]. + IOSCompanionAdSlot(super.params) : super.implementation() { + _initCompanionAdSlot(); + } + + late final IOSCompanionAdSlotCreationParams _iosParams = + _initIOSParams(params); + + @internal + late final IMACompanionAdSlot nativeCompanionAdSlot = _initCompanionAdSlot(); + + @override + Widget buildWidget(BuildWidgetCreationParams params) { + print('BUILDING'); + return UiKitView( + key: params.key, + viewType: 'interactive_media_ads.packages.flutter.dev/view', + layoutDirection: params.layoutDirection, + creationParams: nativeCompanionAdSlot.view.pigeon_instanceManager + .getIdentifier(nativeCompanionAdSlot.view), + creationParamsCodec: const StandardMessageCodec(), + ); + } + + IOSCompanionAdSlotCreationParams _initIOSParams( + PlatformCompanionAdSlotCreationParams params, + ) { + if (params is IOSCompanionAdSlotCreationParams) { + return params; + } + + if (params.isFluid) { + return IOSCompanionAdSlotCreationParams + .fromPlatformCompanionAdSlotCreationParamsFluid(params); + } else { + return IOSCompanionAdSlotCreationParams + .fromPlatformCompanionAdSlotCreationParamsSize(params); + } + } + + IMACompanionAdSlot _initCompanionAdSlot() { + if (_iosParams.isFluid) { + return IMACompanionAdSlot(view: _iosParams._proxy.newUIView()); + } else { + return IMACompanionAdSlot.size( + view: _iosParams._proxy.newUIView(), + width: _iosParams.width!, + height: _iosParams.height!, + ); + } + } +} diff --git a/packages/interactive_media_ads/lib/src/ios/ios_interactive_media_ads.dart b/packages/interactive_media_ads/lib/src/ios/ios_interactive_media_ads.dart index 8d64b1219fa..9bd724087b6 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_interactive_media_ads.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_interactive_media_ads.dart @@ -13,6 +13,7 @@ import 'ios_ad_display_container.dart'; import 'ios_ads_loader.dart'; import 'ios_ads_manager_delegate.dart'; import 'ios_ads_rendering_settings.dart'; +import 'ios_companion_ad_slot.dart'; import 'ios_content_progress_provider.dart'; /// Implementation of [InteractiveMediaAdsPlatform] for iOS. @@ -56,8 +57,9 @@ final class IOSInteractiveMediaAds extends InteractiveMediaAdsPlatform { } @override - PlatformCompanionAdSlot createPlatformCompanionAdSlot(PlatformCompanionAdSlotCreationParams params) { - // TODO: implement createPlatformCompanionAdSlot - throw UnimplementedError(); + IOSCompanionAdSlot createPlatformCompanionAdSlot( + PlatformCompanionAdSlotCreationParams params, + ) { + return IOSCompanionAdSlot(params); } } 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 ef6a30f4ad3..470043d437e 100644 --- a/packages/interactive_media_ads/pigeons/interactive_media_ads_ios.dart +++ b/packages/interactive_media_ads/pigeons/interactive_media_ads_ios.dart @@ -340,7 +340,9 @@ abstract class IMAAdDisplayContainer extends NSObject { /// /// See https://developer.apple.com/documentation/uikit/uiview. @ProxyApi(swiftOptions: SwiftProxyApiOptions(import: 'UIKit')) -abstract class UIView extends NSObject {} +abstract class UIView extends NSObject { + UIView(); +} /// An object that manages a view hierarchy for your UIKit app. /// diff --git a/packages/interactive_media_ads/test/ios/ad_display_container_test.dart b/packages/interactive_media_ads/test/ios/ad_display_container_test.dart index b3eb0935639..cf9c9483922 100644 --- a/packages/interactive_media_ads/test/ios/ad_display_container_test.dart +++ b/packages/interactive_media_ads/test/ios/ad_display_container_test.dart @@ -61,6 +61,7 @@ void main() { newIMAAdDisplayContainer: ({ required UIView adContainer, UIViewController? adContainerViewController, + List? companionSlots, }) => MockIMAAdDisplayContainer(), ); diff --git a/packages/interactive_media_ads/test/ios/ads_loader_test.dart b/packages/interactive_media_ads/test/ios/ads_loader_test.dart index 633e96e9803..1934cb34977 100644 --- a/packages/interactive_media_ads/test/ios/ads_loader_test.dart +++ b/packages/interactive_media_ads/test/ios/ads_loader_test.dart @@ -235,6 +235,7 @@ Future _pumpAdDisplayContainer( newIMAAdDisplayContainer: ({ required ima.UIView adContainer, ima.UIViewController? adContainerViewController, + List? companionSlots, }) => MockIMAAdDisplayContainer(), ); From dde9140abbe80865eaf47367a4be6e2565c26777 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 1 May 2025 15:17:31 -0400 Subject: [PATCH 07/37] trying some fixes --- .../ios/Runner.xcodeproj/project.pbxproj | 22 ---------- .../example/lib/main.dart | 13 +++--- .../FlutterViewFactory.swift | 4 +- .../lib/src/ios/ios_ad_display_container.dart | 6 +-- .../lib/src/ios/ios_companion_ad_slot.dart | 44 +++++++++++++++---- 5 files changed, 48 insertions(+), 41 deletions(-) diff --git a/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj b/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj index 34139f5acde..ca9d6c51cf6 100644 --- a/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj @@ -21,7 +21,6 @@ 8F599BBB2C332C010090A0DF /* AdsRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F599BBA2C332C010090A0DF /* AdsRequestTests.swift */; }; 8F599BBD2C332CFE0090A0DF /* ContentPlayheadTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F599BBC2C332CFE0090A0DF /* ContentPlayheadTests.swift */; }; 8F599BBF2C3335B40090A0DF /* ViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F599BBE2C3335B40090A0DF /* ViewControllerTests.swift */; }; - 8F61402F2DC2F01200D07EC3 /* ViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F61402E2DC2F00900D07EC3 /* ViewTests.swift */; }; 8F8382A32CBDB4A4007F28E0 /* CompanionAdProxyApiTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F8382A22CBDB4A4007F28E0 /* CompanionAdProxyApiTests.swift */; }; 8F9035362D00D9A1004F6450 /* AdPodInfoProxyAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F9035352D00D9A1004F6450 /* AdPodInfoProxyAPITests.swift */; }; 8F977DCF2C2B99C600A90D4B /* AdDisplayContainerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F977DCE2C2B99C600A90D4B /* AdDisplayContainerTests.swift */; }; @@ -84,7 +83,6 @@ 8F599BBA2C332C010090A0DF /* AdsRequestTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdsRequestTests.swift; sourceTree = ""; }; 8F599BBC2C332CFE0090A0DF /* ContentPlayheadTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentPlayheadTests.swift; sourceTree = ""; }; 8F599BBE2C3335B40090A0DF /* ViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewControllerTests.swift; sourceTree = ""; }; - 8F61402E2DC2F00900D07EC3 /* ViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewTests.swift; sourceTree = ""; }; 8F8382A22CBDB4A4007F28E0 /* CompanionAdProxyApiTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompanionAdProxyApiTests.swift; sourceTree = ""; }; 8F9035352D00D9A1004F6450 /* AdPodInfoProxyAPITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdPodInfoProxyAPITests.swift; sourceTree = ""; }; 8F977DCE2C2B99C600A90D4B /* AdDisplayContainerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdDisplayContainerTests.swift; sourceTree = ""; }; @@ -130,7 +128,6 @@ 331C8082294A63A400263BE5 /* RunnerTests */ = { isa = PBXGroup; children = ( - 8F61402E2DC2F00900D07EC3 /* ViewTests.swift */, 8FC919912CA5D86F00188068 /* FriendlyObstructionTests.swift */, 8F977DCE2C2B99C600A90D4B /* AdDisplayContainerTests.swift */, 8F977DD22C2BA15100A90D4B /* TestProxyApiRegistrar.swift */, @@ -256,7 +253,6 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 7517A670E82E5DC089B51E0E /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -372,23 +368,6 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; - 7517A670E82E5DC089B51E0E /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 8BF613E92E45E672229E9718 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -441,7 +420,6 @@ 8F977DD72C2C89A600A90D4B /* AdEventTests.swift in Sources */, 8F977DD32C2BA15100A90D4B /* TestProxyApiRegistrar.swift in Sources */, 8F599BBB2C332C010090A0DF /* AdsRequestTests.swift in Sources */, - 8F61402F2DC2F01200D07EC3 /* ViewTests.swift in Sources */, 8F599BB72C3327F10090A0DF /* AdsManagerDelegateTests.swift in Sources */, 8F599BBD2C332CFE0090A0DF /* ContentPlayheadTests.swift in Sources */, 8FFF0C182CC1A7F300A7CB98 /* CompanionAdSlotProxyApiTests.swift in Sources */, diff --git a/packages/interactive_media_ads/example/lib/main.dart b/packages/interactive_media_ads/example/lib/main.dart index afae411808e..ed6e5b90eb2 100644 --- a/packages/interactive_media_ads/example/lib/main.dart +++ b/packages/interactive_media_ads/example/lib/main.dart @@ -37,7 +37,7 @@ class _AdExampleWidgetState extends State // IMA sample tag for a pre-, mid-, and post-roll, single inline video ad. See more IMA sample // tags at https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/tags static const String _adTagUrl = - 'https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpremidpost&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&cmsid=496&vid=short_onecue&correlator='; + 'https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_preroll_skippable&sz=640x480&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator='; // The AdsLoader instance exposes the request ads method. late final AdsLoader _adsLoader; @@ -254,10 +254,13 @@ class _AdExampleWidgetState extends State ), ), const SizedBox(width: 100, height: 150), - SizedBox( - width: 300, - height: 250, - child: companionAd.buildWidget(context), + ColoredBox( + color: Colors.green, + child: SizedBox( + width: 300, + height: 250, + child: companionAd.buildWidget(context), + ), ), ], ), diff --git a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/FlutterViewFactory.swift b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/FlutterViewFactory.swift index 9067a279860..198b25818a8 100644 --- a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/FlutterViewFactory.swift +++ b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/FlutterViewFactory.swift @@ -33,10 +33,10 @@ class FlutterViewFactory: NSObject, FlutterPlatformViewFactory { let instance: AnyObject? = instanceManager.instance(forIdentifier: identifier) if let instance = instance as? FlutterPlatformView { - //instance.view().frame = frame + instance.view().frame = frame return instance } else { - //(instance as! UIView).frame = frame + (instance as! UIView).frame = frame return PlatformViewImpl(uiView: instance as! UIView) } } diff --git a/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart b/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart index 71d5ecb5d81..1ae9a813d84 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart @@ -73,10 +73,10 @@ base class IOSAdDisplayContainer extends PlatformAdDisplayContainer { adDisplayContainer = _iosParams._imaProxy.newIMAAdDisplayContainer( adContainer: _controller.view, adContainerViewController: _controller, - companionSlots: _iosParams.companionSlots + companionSlots: await Future.wait(_iosParams.companionSlots .cast() - .map((IOSCompanionAdSlot slot) => slot.nativeCompanionAdSlot) - .toList(), + .map((IOSCompanionAdSlot slot) => + slot.getNativeCompanionAdSlot())), ); await _viewDidAppearCompleter.future; params.onContainerAdded(this); diff --git a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart index ce0bae68955..aa5ccaf9e14 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:flutter/cupertino.dart'; import 'package:flutter/services.dart'; import 'package:meta/meta.dart'; @@ -59,25 +61,28 @@ final class IOSCompanionAdSlotCreationParams base class IOSCompanionAdSlot extends PlatformCompanionAdSlot { /// Constructs an [IOSCompanionAdSlot]. - IOSCompanionAdSlot(super.params) : super.implementation() { - _initCompanionAdSlot(); - } + IOSCompanionAdSlot(super.params) : super.implementation(); late final IOSCompanionAdSlotCreationParams _iosParams = _initIOSParams(params); + final Completer viewDidAppearCompleter = Completer(); + + late final UIViewController viewController = _createViewController(WeakReference(this)); + @internal - late final IMACompanionAdSlot nativeCompanionAdSlot = _initCompanionAdSlot(); + Future getNativeCompanionAdSlot() { + return viewDidAppearCompleter.future; + } @override Widget buildWidget(BuildWidgetCreationParams params) { - print('BUILDING'); return UiKitView( key: params.key, viewType: 'interactive_media_ads.packages.flutter.dev/view', layoutDirection: params.layoutDirection, - creationParams: nativeCompanionAdSlot.view.pigeon_instanceManager - .getIdentifier(nativeCompanionAdSlot.view), + creationParams: viewController.view.pigeon_instanceManager + .getIdentifier(viewController.view), creationParamsCodec: const StandardMessageCodec(), ); } @@ -98,15 +103,36 @@ base class IOSCompanionAdSlot extends PlatformCompanionAdSlot { } } + IMACompanionAdSlot? s; + IMACompanionAdSlot _initCompanionAdSlot() { if (_iosParams.isFluid) { - return IMACompanionAdSlot(view: _iosParams._proxy.newUIView()); + return s = IMACompanionAdSlot(view: _iosParams._proxy.newUIView()); } else { - return IMACompanionAdSlot.size( + return s = IMACompanionAdSlot.size( view: _iosParams._proxy.newUIView(), width: _iosParams.width!, height: _iosParams.height!, ); } } + + // This value is created in a static method because the callback methods for + // any wrapped classes must not reference the encapsulating object. This is to + // prevent a circular reference that prevents garbage collection. + static UIViewController _createViewController( + WeakReference interfaceContainer, + ) { + return interfaceContainer.target!._iosParams._proxy.newUIViewController( + viewDidAppear: (_, bool animated) { + print('VIEW appeared'); + final IOSCompanionAdSlot? container = interfaceContainer.target; + if (container != null && + !container.viewDidAppearCompleter.isCompleted) { + print('complete'); + container.viewDidAppearCompleter.complete(container._initCompanionAdSlot()); + } + }, + ); + } } From 69fe7f0de467cdf7e69adb5696ce109af8cb057b Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 1 May 2025 15:36:30 -0400 Subject: [PATCH 08/37] nothing working yet --- .../CompanionAdSlotProxyAPIDelegate.swift | 8 +++ .../InteractiveMediaAdsLibrary.g.swift | 32 +++++++++ .../ViewProxyAPIDelegate.swift | 2 +- .../lib/src/ios/interactive_media_ads.g.dart | 68 +++++++++++++++++++ .../lib/src/ios/ios_companion_ad_slot.dart | 24 ++++--- .../pigeons/interactive_media_ads_ios.dart | 4 ++ 6 files changed, 129 insertions(+), 9 deletions(-) diff --git a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/CompanionAdSlotProxyAPIDelegate.swift b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/CompanionAdSlotProxyAPIDelegate.swift index 263063221a5..d8ac199e910 100644 --- a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/CompanionAdSlotProxyAPIDelegate.swift +++ b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/CompanionAdSlotProxyAPIDelegate.swift @@ -35,4 +35,12 @@ class CompanionAdSlotProxyAPIDelegate: PigeonApiDelegateIMACompanionAdSlot { ) throws { pigeonInstance.delegate = delegate } + + func width(pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot) throws -> Int64 { + return Int64(pigeonInstance.width) + } + + func height(pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot) throws -> Int64 { + return Int64(pigeonInstance.height) + } } 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 397c6c2067b..6d45c61a92f 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 @@ -3036,6 +3036,8 @@ protocol PigeonApiDelegateIMACompanionAdSlot { /// This instance only creates a weak reference to the delegate, so the Dart /// instance should create an explicit reference to receive callbacks. func setDelegate(pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot, delegate: IMACompanionDelegate?) throws + func width(pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot) throws -> Int64 + func height(pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot) throws -> Int64 } protocol PigeonApiProtocolIMACompanionAdSlot { @@ -3108,6 +3110,36 @@ withIdentifier: pigeonIdentifierArg) } else { setDelegateChannel.setMessageHandler(nil) } + let widthChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.width", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + widthChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! IMACompanionAdSlot + do { + let result = try api.pigeonDelegate.width(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } + } + } else { + widthChannel.setMessageHandler(nil) + } + let heightChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.height", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + heightChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! IMACompanionAdSlot + do { + let result = try api.pigeonDelegate.height(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } + } + } else { + heightChannel.setMessageHandler(nil) + } } ///Creates a Dart instance of IMACompanionAdSlot and attaches it to [pigeonInstance]. diff --git a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/ViewProxyAPIDelegate.swift b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/ViewProxyAPIDelegate.swift index 6d7c4645708..ef147a5ac54 100644 --- a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/ViewProxyAPIDelegate.swift +++ b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/ViewProxyAPIDelegate.swift @@ -11,6 +11,6 @@ import UIKit /// instance or handle method calls on the associated native class or an instance of that class. class ViewProxyAPIDelegate: PigeonApiDelegateUIView { func pigeonDefaultConstructor(pigeonApi: PigeonApiUIView) throws -> UIView { - return UIView() + return UIView(frame: CGRect(x: 0, y: 0, width: 300, height: 250)) } } 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 a928bacffac..e2bc816a986 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 @@ -3951,6 +3951,74 @@ class IMACompanionAdSlot extends PigeonInternalProxyApiBaseClass { } } + Future width() async { + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecIMACompanionAdSlot; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.width'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else if (pigeonVar_replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (pigeonVar_replyList[0] as int?)!; + } + } + + Future height() async { + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecIMACompanionAdSlot; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.height'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else if (pigeonVar_replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (pigeonVar_replyList[0] as int?)!; + } + } + @override IMACompanionAdSlot pigeon_copy() { return IMACompanionAdSlot.pigeon_detached( diff --git a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart index aa5ccaf9e14..f41325ce636 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart @@ -77,13 +77,17 @@ base class IOSCompanionAdSlot extends PlatformCompanionAdSlot { @override Widget buildWidget(BuildWidgetCreationParams params) { - return UiKitView( - key: params.key, - viewType: 'interactive_media_ads.packages.flutter.dev/view', - layoutDirection: params.layoutDirection, - creationParams: viewController.view.pigeon_instanceManager - .getIdentifier(viewController.view), - creationParamsCodec: const StandardMessageCodec(), + return SizedBox( + width: 300, + height: 250, + child: UiKitView( + key: params.key, + viewType: 'interactive_media_ads.packages.flutter.dev/view', + layoutDirection: params.layoutDirection, + creationParams: viewController.view.pigeon_instanceManager + .getIdentifier(viewController.view), + creationParamsCodec: const StandardMessageCodec(), + ), ); } @@ -109,11 +113,15 @@ base class IOSCompanionAdSlot extends PlatformCompanionAdSlot { if (_iosParams.isFluid) { return s = IMACompanionAdSlot(view: _iosParams._proxy.newUIView()); } else { - return s = IMACompanionAdSlot.size( + s = IMACompanionAdSlot.size( view: _iosParams._proxy.newUIView(), width: _iosParams.width!, height: _iosParams.height!, ); + print('SIZE'); + s!.width().then((int value) => print(value)); + s!.height().then((int value) => print(value)); + return s!; } } 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 470043d437e..8623191ed06 100644 --- a/packages/interactive_media_ads/pigeons/interactive_media_ads_ios.dart +++ b/packages/interactive_media_ads/pigeons/interactive_media_ads_ios.dart @@ -656,6 +656,10 @@ abstract class IMACompanionAdSlot { /// This instance only creates a weak reference to the delegate, so the Dart /// instance should create an explicit reference to receive callbacks. void setDelegate(IMACompanionDelegate? delegate); + + int width(); + + int height(); } /// Delegate to receive events from the companion ad slot. From 196b597b518fec7e745147c4bb824747c8d2c34c Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 16 May 2025 14:05:18 -0400 Subject: [PATCH 09/37] eureka --- .../lib/src/ios/ios_ad_display_container.dart | 11 +++++++++-- .../lib/src/ios/ios_companion_ad_slot.dart | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart b/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart index 1ae9a813d84..3e99abf4a7a 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart @@ -20,6 +20,7 @@ final class IOSAdDisplayContainerCreationParams const IOSAdDisplayContainerCreationParams({ super.key, required super.onContainerAdded, + super.companionSlots, @visibleForTesting InteractiveMediaAdsProxy? imaProxy, }) : _imaProxy = imaProxy ?? const InteractiveMediaAdsProxy(), super(); @@ -33,6 +34,7 @@ final class IOSAdDisplayContainerCreationParams return IOSAdDisplayContainerCreationParams( key: params.key, onContainerAdded: params.onContainerAdded, + companionSlots: params.companionSlots, imaProxy: imaProxy, ); } @@ -73,10 +75,10 @@ base class IOSAdDisplayContainer extends PlatformAdDisplayContainer { adDisplayContainer = _iosParams._imaProxy.newIMAAdDisplayContainer( adContainer: _controller.view, adContainerViewController: _controller, - companionSlots: await Future.wait(_iosParams.companionSlots + companionSlots: coolerPrint(await Future.wait(_iosParams.companionSlots .cast() .map((IOSCompanionAdSlot slot) => - slot.getNativeCompanionAdSlot())), + slot.getNativeCompanionAdSlot()))), ); await _viewDidAppearCompleter.future; params.onContainerAdded(this); @@ -105,3 +107,8 @@ base class IOSAdDisplayContainer extends PlatformAdDisplayContainer { ); } } + +T coolerPrint(T object) { + print(object); + return object; +} diff --git a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart index f41325ce636..81ff1438020 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart @@ -114,7 +114,7 @@ base class IOSCompanionAdSlot extends PlatformCompanionAdSlot { return s = IMACompanionAdSlot(view: _iosParams._proxy.newUIView()); } else { s = IMACompanionAdSlot.size( - view: _iosParams._proxy.newUIView(), + view: viewController.view, width: _iosParams.width!, height: _iosParams.height!, ); From 9cee787689fc94e4b9bdd1a937cb5e7ebf342c96 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 19 May 2025 20:34:47 -0400 Subject: [PATCH 10/37] revert to other sample ad tag --- .../ios/Flutter/AppFrameworkInfo.plist | 2 +- .../interactive_media_ads/example/ios/Podfile | 2 +- .../ios/Runner.xcodeproj/project.pbxproj | 24 ++++++++++++++++--- .../example/lib/main.dart | 2 +- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/packages/interactive_media_ads/example/ios/Flutter/AppFrameworkInfo.plist b/packages/interactive_media_ads/example/ios/Flutter/AppFrameworkInfo.plist index 7c569640062..1dc6cf7652b 100644 --- a/packages/interactive_media_ads/example/ios/Flutter/AppFrameworkInfo.plist +++ b/packages/interactive_media_ads/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 12.0 + 13.0 diff --git a/packages/interactive_media_ads/example/ios/Podfile b/packages/interactive_media_ads/example/ios/Podfile index e549ee22f3b..620e46eba60 100644 --- a/packages/interactive_media_ads/example/ios/Podfile +++ b/packages/interactive_media_ads/example/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '12.0' +# platform :ios, '13.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj b/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj index ca9d6c51cf6..2d59d1465c7 100644 --- a/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj @@ -253,6 +253,7 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 6B692542E00F08BF9516F3A1 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -368,6 +369,23 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; + 6B692542E00F08BF9516F3A1 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 8BF613E92E45E672229E9718 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -516,7 +534,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -646,7 +664,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -697,7 +715,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/packages/interactive_media_ads/example/lib/main.dart b/packages/interactive_media_ads/example/lib/main.dart index ed6e5b90eb2..aa908cf0754 100644 --- a/packages/interactive_media_ads/example/lib/main.dart +++ b/packages/interactive_media_ads/example/lib/main.dart @@ -37,7 +37,7 @@ class _AdExampleWidgetState extends State // IMA sample tag for a pre-, mid-, and post-roll, single inline video ad. See more IMA sample // tags at https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/tags static const String _adTagUrl = - 'https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_preroll_skippable&sz=640x480&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator='; + 'https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpremidpost&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&cmsid=496&vid=short_onecue&correlator='; // The AdsLoader instance exposes the request ads method. late final AdsLoader _adsLoader; From bc2d96b592d089f48880cb878158b8ece2272f34 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 19 May 2025 20:42:11 -0400 Subject: [PATCH 11/37] use general settings --- .../FlutterViewFactory.swift | 2 - .../ViewProxyAPIDelegate.swift | 2 +- .../lib/src/ios/ios_ad_display_container.dart | 9 +- .../lib/src/ios/ios_companion_ad_slot.dart | 83 ++++++++++--------- 4 files changed, 48 insertions(+), 48 deletions(-) diff --git a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/FlutterViewFactory.swift b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/FlutterViewFactory.swift index 198b25818a8..857ac8a14f5 100644 --- a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/FlutterViewFactory.swift +++ b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/FlutterViewFactory.swift @@ -33,10 +33,8 @@ class FlutterViewFactory: NSObject, FlutterPlatformViewFactory { let instance: AnyObject? = instanceManager.instance(forIdentifier: identifier) if let instance = instance as? FlutterPlatformView { - instance.view().frame = frame return instance } else { - (instance as! UIView).frame = frame return PlatformViewImpl(uiView: instance as! UIView) } } diff --git a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/ViewProxyAPIDelegate.swift b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/ViewProxyAPIDelegate.swift index ef147a5ac54..6d7c4645708 100644 --- a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/ViewProxyAPIDelegate.swift +++ b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/ViewProxyAPIDelegate.swift @@ -11,6 +11,6 @@ import UIKit /// instance or handle method calls on the associated native class or an instance of that class. class ViewProxyAPIDelegate: PigeonApiDelegateUIView { func pigeonDefaultConstructor(pigeonApi: PigeonApiUIView) throws -> UIView { - return UIView(frame: CGRect(x: 0, y: 0, width: 300, height: 250)) + return UIView() } } diff --git a/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart b/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart index 3e99abf4a7a..66d2d631a2b 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart @@ -75,10 +75,10 @@ base class IOSAdDisplayContainer extends PlatformAdDisplayContainer { adDisplayContainer = _iosParams._imaProxy.newIMAAdDisplayContainer( adContainer: _controller.view, adContainerViewController: _controller, - companionSlots: coolerPrint(await Future.wait(_iosParams.companionSlots + companionSlots: _iosParams.companionSlots .cast() .map((IOSCompanionAdSlot slot) => - slot.getNativeCompanionAdSlot()))), + slot.getNativeCompanionAdSlot()).toList(), ); await _viewDidAppearCompleter.future; params.onContainerAdded(this); @@ -107,8 +107,3 @@ base class IOSAdDisplayContainer extends PlatformAdDisplayContainer { ); } } - -T coolerPrint(T object) { - print(object); - return object; -} diff --git a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart index 81ff1438020..391dada899d 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart @@ -66,13 +66,20 @@ base class IOSCompanionAdSlot extends PlatformCompanionAdSlot { late final IOSCompanionAdSlotCreationParams _iosParams = _initIOSParams(params); - final Completer viewDidAppearCompleter = Completer(); + //final Completer viewDidAppearCompleter = Completer(); - late final UIViewController viewController = _createViewController(WeakReference(this)); + //late final UIViewController viewController = _createViewController(WeakReference(this)); + + late final UIView view = _iosParams._proxy.newUIView(); + late final IMACompanionAdSlot slot = IMACompanionAdSlot.size( + view: view, + width: _iosParams.width!, + height: _iosParams.height!, + ); @internal - Future getNativeCompanionAdSlot() { - return viewDidAppearCompleter.future; + IMACompanionAdSlot getNativeCompanionAdSlot() { + return slot; } @override @@ -84,8 +91,7 @@ base class IOSCompanionAdSlot extends PlatformCompanionAdSlot { key: params.key, viewType: 'interactive_media_ads.packages.flutter.dev/view', layoutDirection: params.layoutDirection, - creationParams: viewController.view.pigeon_instanceManager - .getIdentifier(viewController.view), + creationParams: view.pigeon_instanceManager.getIdentifier(view), creationParamsCodec: const StandardMessageCodec(), ), ); @@ -107,40 +113,41 @@ base class IOSCompanionAdSlot extends PlatformCompanionAdSlot { } } - IMACompanionAdSlot? s; - - IMACompanionAdSlot _initCompanionAdSlot() { - if (_iosParams.isFluid) { - return s = IMACompanionAdSlot(view: _iosParams._proxy.newUIView()); - } else { - s = IMACompanionAdSlot.size( - view: viewController.view, - width: _iosParams.width!, - height: _iosParams.height!, - ); - print('SIZE'); - s!.width().then((int value) => print(value)); - s!.height().then((int value) => print(value)); - return s!; - } - } + // IMACompanionAdSlot? s; + // + // IMACompanionAdSlot _initCompanionAdSlot() { + // if (_iosParams.isFluid) { + // return s = IMACompanionAdSlot(view: _iosParams._proxy.newUIView()); + // } else { + // s = IMACompanionAdSlot.size( + // view: viewController.view, + // width: _iosParams.width!, + // height: _iosParams.height!, + // ); + // print('SIZE'); + // s!.width().then((int value) => print(value)); + // s!.height().then((int value) => print(value)); + // return s!; + // } + // } // This value is created in a static method because the callback methods for // any wrapped classes must not reference the encapsulating object. This is to // prevent a circular reference that prevents garbage collection. - static UIViewController _createViewController( - WeakReference interfaceContainer, - ) { - return interfaceContainer.target!._iosParams._proxy.newUIViewController( - viewDidAppear: (_, bool animated) { - print('VIEW appeared'); - final IOSCompanionAdSlot? container = interfaceContainer.target; - if (container != null && - !container.viewDidAppearCompleter.isCompleted) { - print('complete'); - container.viewDidAppearCompleter.complete(container._initCompanionAdSlot()); - } - }, - ); - } + // static UIViewController _createViewController( + // WeakReference interfaceContainer, + // ) { + // return interfaceContainer.target!._iosParams._proxy.newUIViewController( + // viewDidAppear: (_, bool animated) { + // print('VIEW appeared'); + // final IOSCompanionAdSlot? container = interfaceContainer.target; + // if (container != null && + // !container.viewDidAppearCompleter.isCompleted) { + // print('complete'); + // container.viewDidAppearCompleter + // .complete(container._initCompanionAdSlot()); + // } + // }, + // ); + // } } From 3874e7e3297ea2610cb10b753cf73f617fcd5428 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 19 May 2025 20:48:27 -0400 Subject: [PATCH 12/37] update slot --- .../lib/src/ios/ios_ad_display_container.dart | 4 +- .../lib/src/ios/ios_companion_ad_slot.dart | 80 +++++-------------- 2 files changed, 20 insertions(+), 64 deletions(-) diff --git a/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart b/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart index 66d2d631a2b..002f1ba65c3 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_ad_display_container.dart @@ -77,8 +77,8 @@ base class IOSAdDisplayContainer extends PlatformAdDisplayContainer { adContainerViewController: _controller, companionSlots: _iosParams.companionSlots .cast() - .map((IOSCompanionAdSlot slot) => - slot.getNativeCompanionAdSlot()).toList(), + .map((IOSCompanionAdSlot slot) => slot.nativeCompanionAdSlot) + .toList(), ); await _viewDidAppearCompleter.future; params.onContainerAdded(this); diff --git a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart index 391dada899d..673900a2286 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart @@ -1,4 +1,6 @@ -import 'dart:async'; +// 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. import 'package:flutter/cupertino.dart'; import 'package:flutter/services.dart'; @@ -66,34 +68,26 @@ base class IOSCompanionAdSlot extends PlatformCompanionAdSlot { late final IOSCompanionAdSlotCreationParams _iosParams = _initIOSParams(params); - //final Completer viewDidAppearCompleter = Completer(); - - //late final UIViewController viewController = _createViewController(WeakReference(this)); - - late final UIView view = _iosParams._proxy.newUIView(); - late final IMACompanionAdSlot slot = IMACompanionAdSlot.size( - view: view, - width: _iosParams.width!, - height: _iosParams.height!, - ); + late final UIView _view = _iosParams._proxy.newUIView(); + /// The native iOS IMACompanionAdSlot. @internal - IMACompanionAdSlot getNativeCompanionAdSlot() { - return slot; - } + late final IMACompanionAdSlot nativeCompanionAdSlot = _iosParams.isFluid + ? _iosParams._proxy.newIMACompanionAdSlot(view: _view) + : _iosParams._proxy.sizeIMACompanionAdSlot( + view: _view, + width: _iosParams.width!, + height: _iosParams.height!, + ); @override Widget buildWidget(BuildWidgetCreationParams params) { - return SizedBox( - width: 300, - height: 250, - child: UiKitView( - key: params.key, - viewType: 'interactive_media_ads.packages.flutter.dev/view', - layoutDirection: params.layoutDirection, - creationParams: view.pigeon_instanceManager.getIdentifier(view), - creationParamsCodec: const StandardMessageCodec(), - ), + return UiKitView( + key: params.key, + viewType: 'interactive_media_ads.packages.flutter.dev/view', + layoutDirection: params.layoutDirection, + creationParams: _view.pigeon_instanceManager.getIdentifier(_view), + creationParamsCodec: const StandardMessageCodec(), ); } @@ -112,42 +106,4 @@ base class IOSCompanionAdSlot extends PlatformCompanionAdSlot { .fromPlatformCompanionAdSlotCreationParamsSize(params); } } - - // IMACompanionAdSlot? s; - // - // IMACompanionAdSlot _initCompanionAdSlot() { - // if (_iosParams.isFluid) { - // return s = IMACompanionAdSlot(view: _iosParams._proxy.newUIView()); - // } else { - // s = IMACompanionAdSlot.size( - // view: viewController.view, - // width: _iosParams.width!, - // height: _iosParams.height!, - // ); - // print('SIZE'); - // s!.width().then((int value) => print(value)); - // s!.height().then((int value) => print(value)); - // return s!; - // } - // } - - // This value is created in a static method because the callback methods for - // any wrapped classes must not reference the encapsulating object. This is to - // prevent a circular reference that prevents garbage collection. - // static UIViewController _createViewController( - // WeakReference interfaceContainer, - // ) { - // return interfaceContainer.target!._iosParams._proxy.newUIViewController( - // viewDidAppear: (_, bool animated) { - // print('VIEW appeared'); - // final IOSCompanionAdSlot? container = interfaceContainer.target; - // if (container != null && - // !container.viewDidAppearCompleter.isCompleted) { - // print('complete'); - // container.viewDidAppearCompleter - // .complete(container._initCompanionAdSlot()); - // } - // }, - // ); - // } } From 26982a14611a9ac4a7077bb13acd0eab43396606 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 19 May 2025 20:52:27 -0400 Subject: [PATCH 13/37] update --- .../BaseDisplayContainerProxyApi.kt | 12 +- .../InteractiveMediaAdsLibrary.g.kt | 4126 +++++++++++------ .../BaseDisplayContainerProxyApiTest.kt | 7 +- .../CompanionAdSlotProxyAPIDelegate.swift | 12 +- .../InteractiveMediaAdsLibrary.g.swift | 1594 +++++-- .../ViewProxyAPIDelegate.swift | 2 +- .../src/android/interactive_media_ads.g.dart | 284 +- .../lib/src/ios/interactive_media_ads.g.dart | 276 +- packages/interactive_media_ads/pubspec.yaml | 2 +- 9 files changed, 4085 insertions(+), 2230 deletions(-) diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApi.kt index a1766072c89..1baa52fd438 100644 --- a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApi.kt +++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApi.kt @@ -15,10 +15,10 @@ import com.google.ads.interactivemedia.v3.api.CompanionAdSlot */ class BaseDisplayContainerProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) : PigeonApiBaseDisplayContainer(pigeonRegistrar) { - override fun setCompanionSlots( - pigeon_instance: BaseDisplayContainer, - companionSlots: List? - ) { - return pigeon_instance.setCompanionSlots(companionSlots) - } + override fun setCompanionSlots( + pigeon_instance: BaseDisplayContainer, + companionSlots: List? + ) { + return pigeon_instance.setCompanionSlots(companionSlots) + } } 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 5586d67608b..259eaf4ce76 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,7 +1,7 @@ // 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 (v25.3.1), do not edit directly. +// Autogenerated from Pigeon (v25.3.2), do not edit directly. // See also: https://pub.dev/packages/pigeon @file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") @@ -10,16 +10,17 @@ package dev.flutter.packages.interactive_media_ads import android.util.Log import io.flutter.plugin.common.BasicMessageChannel import io.flutter.plugin.common.BinaryMessenger -import io.flutter.plugin.common.EventChannel import io.flutter.plugin.common.MessageCodec -import io.flutter.plugin.common.StandardMethodCodec import io.flutter.plugin.common.StandardMessageCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer + private object InteractiveMediaAdsLibraryPigeonUtils { 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'.", "") + } fun wrapResult(result: Any?): List { return listOf(result) @@ -27,50 +28,48 @@ private object InteractiveMediaAdsLibraryPigeonUtils { 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)) } } } /** * 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) } @@ -111,19 +110,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() @@ -133,15 +133,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() @@ -155,9 +153,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,13 +167,15 @@ class InteractiveMediaAdsLibraryPigeonInstanceManager(private val finalizationLi /** * Adds a new unique instance that was instantiated from the host platform. * - * If the manager contains [instance], this returns the corresponding identifier. If the - * manager does not contain [instance], this adds the instance and returns a unique - * identifier for that [instance]. + * If the manager contains [instance], this returns the corresponding identifier. If the manager + * does not contain [instance], this adds the instance and returns a unique identifier for that + * [instance]. */ 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 @@ -233,7 +233,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) @@ -259,39 +260,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 `InstanceManager`s. */ -private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi(val binaryMessenger: BinaryMessenger) { +private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi( + val binaryMessenger: BinaryMessenger +) { companion object { /** The codec used by InteractiveMediaAdsLibraryPigeonInstanceManagerApi. */ - val codec: MessageCodec by lazy { - InteractiveMediaAdsLibraryPigeonCodec() - } + val codec: MessageCodec by lazy { InteractiveMediaAdsLibraryPigeonCodec() } /** - * 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.PigeonInternalInstanceManager.removeStrongReference", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.PigeonInternalInstanceManager.removeStrongReference", + codec) if (instanceManager != null) { channel.setMessageHandler { message, reply -> val args = message as List val identifierArg = args[0] as Long - val wrapped: List = try { - instanceManager.remove(identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + instanceManager.remove(identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -299,15 +306,20 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi(val binaryMesse } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.PigeonInternalInstanceManager.clear", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.PigeonInternalInstanceManager.clear", + codec) if (instanceManager != null) { channel.setMessageHandler { _, reply -> - val wrapped: List = try { - instanceManager.clear() - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + instanceManager.clear() + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -317,9 +329,9 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi(val binaryMesse } } - fun removeStrongReference(identifierArg: Long, callback: (Result) -> Unit) -{ - val channelName = "dev.flutter.pigeon.interactive_media_ads.PigeonInternalInstanceManager.removeStrongReference" + fun removeStrongReference(identifierArg: Long, callback: (Result) -> Unit) { + val channelName = + "dev.flutter.pigeon.interactive_media_ads.PigeonInternalInstanceManager.removeStrongReference" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(identifierArg)) { if (it is List<*>) { @@ -329,16 +341,20 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi(val binaryMesse callback(Result.success(Unit)) } } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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 @@ -353,20 +369,19 @@ 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 @@ -378,14 +393,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 +410,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 @@ -420,20 +434,20 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(val binaryMesse abstract fun getPigeonApiContentProgressProvider(): PigeonApiContentProgressProvider /** - * 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 @@ -447,8 +461,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) } @@ -459,47 +472,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 @@ -546,8 +558,8 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(val binaryMesse abstract fun getPigeonApiAdProgressInfo(): PigeonApiAdProgressInfo /** - * An implementation of [PigeonApiCompanionAd] used to add a new Dart instance of - * `CompanionAd` to the Dart `InstanceManager`. + * An implementation of [PigeonApiCompanionAd] used to add a new Dart instance of `CompanionAd` to + * the Dart `InstanceManager`. */ abstract fun getPigeonApiCompanionAd(): PigeonApiCompanionAd @@ -558,8 +570,8 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(val binaryMesse abstract fun getPigeonApiUniversalAdId(): PigeonApiUniversalAdId /** - * An implementation of [PigeonApiAd] used to add a new Dart instance of - * `Ad` to the Dart `InstanceManager`. + * An implementation of [PigeonApiAd] used to add a new Dart instance of `Ad` to the Dart + * `InstanceManager`. */ abstract fun getPigeonApiAd(): PigeonApiAd @@ -576,28 +588,37 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(val binaryMesse abstract fun getPigeonApiCompanionAdSlot(): PigeonApiCompanionAdSlot fun setUp() { - InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger, instanceManager) - PigeonApiBaseDisplayContainer.setUpMessageHandlers(binaryMessenger, getPigeonApiBaseDisplayContainer()) + InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers( + binaryMessenger, instanceManager) + PigeonApiBaseDisplayContainer.setUpMessageHandlers( + binaryMessenger, getPigeonApiBaseDisplayContainer()) PigeonApiAdsLoader.setUpMessageHandlers(binaryMessenger, getPigeonApiAdsLoader()) PigeonApiAdsRequest.setUpMessageHandlers(binaryMessenger, getPigeonApiAdsRequest()) - PigeonApiContentProgressProvider.setUpMessageHandlers(binaryMessenger, getPigeonApiContentProgressProvider()) + PigeonApiContentProgressProvider.setUpMessageHandlers( + binaryMessenger, getPigeonApiContentProgressProvider()) 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()) - PigeonApiAdsRenderingSettings.setUpMessageHandlers(binaryMessenger, getPigeonApiAdsRenderingSettings()) - PigeonApiCompanionAdSlotClickListener.setUpMessageHandlers(binaryMessenger, getPigeonApiCompanionAdSlotClickListener()) + PigeonApiAdsRenderingSettings.setUpMessageHandlers( + binaryMessenger, getPigeonApiAdsRenderingSettings()) + PigeonApiCompanionAdSlotClickListener.setUpMessageHandlers( + binaryMessenger, getPigeonApiCompanionAdSlotClickListener()) PigeonApiCompanionAdSlot.setUpMessageHandlers(binaryMessenger, getPigeonApiCompanionAdSlot()) } + fun tearDown() { InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger, null) PigeonApiBaseDisplayContainer.setUpMessageHandlers(binaryMessenger, null) @@ -622,17 +643,17 @@ abstract class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar(val binaryMesse PigeonApiCompanionAdSlot.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() -> { val identifier: Long = readValue(buffer) as Long val instance: Any? = registrar.instanceManager.getInstance(identifier) if (instance == null) { - Log.e( - "PigeonProxyApiBaseCodec", - "Failed to find instance with identifier: $identifier" - ) + Log.e("PigeonProxyApiBaseCodec", "Failed to find instance with identifier: $identifier") } return instance } @@ -641,109 +662,94 @@ 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 is UiElement || 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 is UiElement || + 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) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.AdsRenderingSettings) { - registrar.getPigeonApiAdsRenderingSettings().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.AdProgressInfo) { - registrar.getPigeonApiAdProgressInfo().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.CompanionAd) { - registrar.getPigeonApiCompanionAd().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.UniversalAdId) { - registrar.getPigeonApiUniversalAdId().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.Ad) { - registrar.getPigeonApiAd().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener) { - registrar.getPigeonApiCompanionAdSlotClickListener().pigeon_newInstance(value) { } - } - else if (value is com.google.ads.interactivemedia.v3.api.CompanionAdSlot) { - registrar.getPigeonApiCompanionAdSlot().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) {} + } else if (value is com.google.ads.interactivemedia.v3.api.AdsRenderingSettings) { + registrar.getPigeonApiAdsRenderingSettings().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.AdProgressInfo) { + registrar.getPigeonApiAdProgressInfo().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.CompanionAd) { + registrar.getPigeonApiCompanionAd().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.UniversalAdId) { + registrar.getPigeonApiUniversalAdId().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.Ad) { + registrar.getPigeonApiAd().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener) { + registrar.getPigeonApiCompanionAdSlotClickListener().pigeon_newInstance(value) {} + } else if (value is com.google.ads.interactivemedia.v3.api.CompanionAdSlot) { + registrar.getPigeonApiCompanionAdSlot().pigeon_newInstance(value) {} } when { @@ -751,7 +757,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}'") } } } @@ -759,7 +767,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. */ @@ -791,13 +800,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. */ @@ -805,8 +814,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. */ @@ -816,8 +825,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. */ @@ -835,7 +843,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. */ @@ -855,7 +864,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. */ @@ -872,14 +882,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. */ @@ -900,10 +907,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), @@ -934,7 +938,8 @@ enum class AdEventType(val raw: Int) { /** * Describes an element of the ad UI, to be requested or rendered by the SDK. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/UiElement.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/UiElement.html. */ enum class UiElement(val raw: Int) { /** The ad attribution UI element, for example, "Ad". */ @@ -950,33 +955,27 @@ enum class UiElement(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 Long?)?.let { - AdErrorCode.ofRaw(it.toInt()) - } + return (readValue(buffer) as Long?)?.let { AdErrorCode.ofRaw(it.toInt()) } } 130.toByte() -> { - return (readValue(buffer) as Long?)?.let { - AdErrorType.ofRaw(it.toInt()) - } + return (readValue(buffer) as Long?)?.let { AdErrorType.ofRaw(it.toInt()) } } 131.toByte() -> { - return (readValue(buffer) as Long?)?.let { - AdEventType.ofRaw(it.toInt()) - } + return (readValue(buffer) as Long?)?.let { AdEventType.ofRaw(it.toInt()) } } 132.toByte() -> { - return (readValue(buffer) as Long?)?.let { - UiElement.ofRaw(it.toInt()) - } + return (readValue(buffer) as Long?)?.let { UiElement.ofRaw(it.toInt()) } } 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) @@ -1002,34 +1001,50 @@ 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") -abstract class PigeonApiBaseDisplayContainer(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiBaseDisplayContainer( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { /** * Sets slots for displaying companions. * * Passing null will reset the container to having no companion slots. */ - abstract fun setCompanionSlots(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseDisplayContainer, companionSlots: List?) + abstract fun setCompanionSlots( + pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseDisplayContainer, + companionSlots: List? + ) companion object { @Suppress("LocalVariableName") - fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiBaseDisplayContainer?) { + fun setUpMessageHandlers( + binaryMessenger: BinaryMessenger, + api: PigeonApiBaseDisplayContainer? + ) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseDisplayContainer.setCompanionSlots", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.BaseDisplayContainer.setCompanionSlots", + 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.BaseDisplayContainer - val companionSlotsArg = args[1] as List? - val wrapped: List = try { - api.setCompanionSlots(pigeon_instanceArg, companionSlotsArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.BaseDisplayContainer + val companionSlotsArg = + args[1] as List? + val wrapped: List = + try { + api.setCompanionSlots(pigeon_instanceArg, companionSlotsArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1041,114 +1056,146 @@ abstract class PigeonApiBaseDisplayContainer(open val pigeonRegistrar: Interacti @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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } } @Suppress("FunctionName") /** An implementation of [PigeonApiBaseDisplayContainer] used to access callback methods */ - fun pigeon_getPigeonApiBaseDisplayContainer(): PigeonApiBaseDisplayContainer - { + 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 ?: InteractiveMediaAdsLibraryPigeonCodec() 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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1156,18 +1203,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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1175,18 +1228,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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.requestAds(pigeon_instanceArg, requestArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1198,16 +1256,19 @@ 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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -1215,85 +1276,106 @@ abstract class PigeonApiAdsLoader(open val pigeonRegistrar: InteractiveMediaAdsL channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val errorArg = error(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec @@ -1302,49 +1384,63 @@ abstract class PigeonApiAdErrorEvent(open val pigeonRegistrar: InteractiveMediaA channel.send(listOf(pigeon_identifierArg, errorArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val errorCodeArg = errorCode(pigeon_instanceArg) val errorCodeNumberArg = errorCodeNumber(pigeon_instanceArg) val errorTypeArg = errorType(pigeon_instanceArg) @@ -1353,54 +1449,73 @@ 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( + InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } - } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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 ?: InteractiveMediaAdsLibraryPigeonCodec() 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setAdTagUrl(pigeon_instanceArg, adTagUrlArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1408,18 +1523,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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1431,16 +1552,19 @@ 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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -1448,51 +1572,69 @@ abstract class PigeonApiAdsRequest(open val pigeonRegistrar: InteractiveMediaAds channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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") -abstract class PigeonApiContentProgressProvider(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { - abstract fun pigeon_defaultConstructor(): com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider +abstract class PigeonApiContentProgressProvider( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { + abstract fun pigeon_defaultConstructor(): + com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider /** * Sets an update on the progress of the video. * - * This is a custom method added to the native class because the native - * method `getContentProgress` requires a synchronous return value. + * This is a custom method added to the native class because the native method + * `getContentProgress` requires a synchronous return value. */ - abstract fun setContentProgress(pigeon_instance: com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider, update: com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate) + abstract fun setContentProgress( + pigeon_instance: com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider, + update: com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate + ) companion object { @Suppress("LocalVariableName") - fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiContentProgressProvider?) { + fun setUpMessageHandlers( + binaryMessenger: BinaryMessenger, + api: PigeonApiContentProgressProvider? + ) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ContentProgressProvider.pigeon_defaultConstructor", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.ContentProgressProvider.pigeon_defaultConstructor", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1500,18 +1642,25 @@ abstract class PigeonApiContentProgressProvider(open val pigeonRegistrar: Intera } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ContentProgressProvider.setContentProgress", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.ContentProgressProvider.setContentProgress", + 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.ContentProgressProvider - val updateArg = args[1] as com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate - val wrapped: List = try { - api.setContentProgress(pigeon_instanceArg, updateArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider + val updateArg = + args[1] as com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate + val wrapped: List = + try { + api.setContentProgress(pigeon_instanceArg, updateArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1523,43 +1672,51 @@ abstract class PigeonApiContentProgressProvider(open val pigeonRegistrar: Intera @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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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) @@ -1574,7 +1731,9 @@ abstract class PigeonApiAdsManager(open val pigeonRegistrar: InteractiveMediaAds * * The list will be empty if no ad breaks are scheduled. */ - abstract fun getAdCuePoints(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsManager): List + abstract fun getAdCuePoints( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsManager + ): List /** Resumes the current ad. */ abstract fun resume(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsManager) @@ -1582,8 +1741,7 @@ abstract class PigeonApiAdsManager(open val pigeonRegistrar: InteractiveMediaAds /** * Skips the current ad. * - * `AdsManager.skip()` only skips ads if IMA does not render the 'Skip ad' - * button. + * `AdsManager.skip()` only skips ads if IMA does not render the 'Skip ad' button. */ abstract fun skip(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsManager) @@ -1592,17 +1750,22 @@ abstract class PigeonApiAdsManager(open val pigeonRegistrar: InteractiveMediaAds fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAdsManager?) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.discardAdBreak(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1610,17 +1773,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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pause(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1628,17 +1794,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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.start(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1646,16 +1815,21 @@ abstract class PigeonApiAdsManager(open val pigeonRegistrar: InteractiveMediaAds } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.getAdCuePoints", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsManager.getAdCuePoints", + 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 { - listOf(api.getAdCuePoints(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getAdCuePoints(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1663,17 +1837,22 @@ abstract class PigeonApiAdsManager(open val pigeonRegistrar: InteractiveMediaAds } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.resume", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsManager.resume", + 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.resume(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.resume(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1681,17 +1860,20 @@ abstract class PigeonApiAdsManager(open val pigeonRegistrar: InteractiveMediaAds } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.skip", codec) + val channel = + BasicMessageChannel( + binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.skip", 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.skip(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.skip(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1703,16 +1885,19 @@ 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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -1720,85 +1905,109 @@ abstract class PigeonApiAdsManager(open val pigeonRegistrar: InteractiveMediaAds channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } } @Suppress("FunctionName") /** An implementation of [PigeonApiBaseManager] used to access callback methods */ - fun pigeon_getPigeonApiBaseManager(): PigeonApiBaseManager - { + 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 on the manager. */ - abstract fun init(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, settings: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings?) + abstract fun init( + pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, + settings: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings? + ) /** Generic focus endpoint that puts focus on the skip button if present. */ abstract fun focus(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager) /** Returns the latest AdProgressInfo for the current playing ad. */ - abstract fun getAdProgressInfo(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager): com.google.ads.interactivemedia.v3.api.AdProgressInfo? + abstract fun getAdProgressInfo( + pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager + ): com.google.ads.interactivemedia.v3.api.AdProgressInfo? /** Get currently playing ad. */ - abstract fun getCurrentAd(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager): com.google.ads.interactivemedia.v3.api.Ad? + abstract fun getCurrentAd( + pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager + ): com.google.ads.interactivemedia.v3.api.Ad? /** Removes a listener for error events. */ - abstract fun removeAdErrorListener(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, errorListener: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener) + abstract fun removeAdErrorListener( + pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, + errorListener: com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener + ) /** Removes a listener for ad events. */ - abstract fun removeAdEventListener(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, adEventListener: com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener) + abstract fun removeAdEventListener( + pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager, + adEventListener: com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener + ) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiBaseManager?) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() 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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1806,18 +2015,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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1825,17 +2040,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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.destroy(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1843,18 +2063,22 @@ 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 settingsArg = args[1] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings? - val wrapped: List = try { - api.init(pigeon_instanceArg, settingsArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val settingsArg = + args[1] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings? + val wrapped: List = + try { + api.init(pigeon_instanceArg, settingsArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1862,17 +2086,22 @@ abstract class PigeonApiBaseManager(open val pigeonRegistrar: InteractiveMediaAd } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.focus", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.BaseManager.focus", + 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.focus(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.focus(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1880,16 +2109,21 @@ abstract class PigeonApiBaseManager(open val pigeonRegistrar: InteractiveMediaAd } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.getAdProgressInfo", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.BaseManager.getAdProgressInfo", + 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 { - listOf(api.getAdProgressInfo(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getAdProgressInfo(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1897,16 +2131,21 @@ abstract class PigeonApiBaseManager(open val pigeonRegistrar: InteractiveMediaAd } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.getCurrentAd", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.BaseManager.getCurrentAd", + 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 { - listOf(api.getCurrentAd(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getCurrentAd(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1914,18 +2153,24 @@ abstract class PigeonApiBaseManager(open val pigeonRegistrar: InteractiveMediaAd } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.removeAdErrorListener", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.BaseManager.removeAdErrorListener", + 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.removeAdErrorListener(pigeon_instanceArg, errorListenerArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val errorListenerArg = + args[1] as com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener + val wrapped: List = + try { + api.removeAdErrorListener(pigeon_instanceArg, errorListenerArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1933,18 +2178,24 @@ abstract class PigeonApiBaseManager(open val pigeonRegistrar: InteractiveMediaAd } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.removeAdEventListener", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.BaseManager.removeAdEventListener", + 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.removeAdEventListener(pigeon_instanceArg, adEventListenerArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val adEventListenerArg = + args[1] as com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener + val wrapped: List = + try { + api.removeAdEventListener(pigeon_instanceArg, adEventListenerArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1956,16 +2207,19 @@ 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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -1973,43 +2227,53 @@ abstract class PigeonApiBaseManager(open val pigeonRegistrar: InteractiveMediaAd channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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 /** 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? + 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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val typeArg = type(pigeon_instanceArg) val adDataArg = adData(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger @@ -2019,66 +2283,89 @@ abstract class PigeonApiAdEvent(open val pigeonRegistrar: InteractiveMediaAdsLib 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?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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 a CompanionAdSlot for the SDK to fill with companion ads. */ - abstract fun createCompanionAdSlot(pigeon_instance: com.google.ads.interactivemedia.v3.api.ImaSdkFactory): com.google.ads.interactivemedia.v3.api.CompanionAdSlot + abstract fun createCompanionAdSlot( + pigeon_instance: com.google.ads.interactivemedia.v3.api.ImaSdkFactory + ): com.google.ads.interactivemedia.v3.api.CompanionAdSlot /** 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 /** - * Creates an `AdsRenderingSettings` object to give the AdsManager parameters - * that control the rendering of ads. + * Creates an `AdsRenderingSettings` object to give the AdsManager parameters that control the + * rendering of ads. */ - abstract fun createAdsRenderingSettings(pigeon_instance: com.google.ads.interactivemedia.v3.api.ImaSdkFactory): com.google.ads.interactivemedia.v3.api.AdsRenderingSettings + abstract fun createAdsRenderingSettings( + pigeon_instance: com.google.ads.interactivemedia.v3.api.ImaSdkFactory + ): com.google.ads.interactivemedia.v3.api.AdsRenderingSettings companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiImaSdkFactory?) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() 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] as Long - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.instance(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.instance(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2086,17 +2373,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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.createAdDisplayContainer(containerArg, playerArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2104,16 +2396,21 @@ abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: InteractiveMedia } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createCompanionAdSlot", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createCompanionAdSlot", + 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.createCompanionAdSlot(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.createCompanionAdSlot(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2121,16 +2418,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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.createImaSdkSettings(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2138,18 +2440,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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.createAdsLoader(pigeon_instanceArg, settingsArg, containerArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2157,16 +2464,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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.createAdsRequest(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2174,16 +2486,21 @@ abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: InteractiveMedia } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createAdsRenderingSettings", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createAdsRenderingSettings", + 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.createAdsRenderingSettings(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.createAdsRenderingSettings(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2195,16 +2512,19 @@ 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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -2212,37 +2532,45 @@ abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: InteractiveMedia channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -2250,51 +2578,64 @@ open class PigeonApiImaSdkSettings(open val pigeonRegistrar: InteractiveMediaAds channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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 ?: InteractiveMediaAdsLibraryPigeonCodec() 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] as Long val currentTimeMsArg = args[1] as Long val durationMsArg = args[2] as Long - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(currentTimeMsArg,durationMsArg), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(currentTimeMsArg, durationMsArg), + pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2302,17 +2643,23 @@ 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] as Long - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.videoTimeNotReady(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.videoTimeNotReady(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2324,56 +2671,70 @@ 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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val urlArg = url(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec @@ -2382,30 +2743,35 @@ abstract class PigeonApiAdMediaInfo(open val pigeonRegistrar: InteractiveMediaAd channel.send(listOf(pigeon_identifierArg, urlArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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 @@ -2414,7 +2780,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 @@ -2422,9 +2790,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 @@ -2436,16 +2804,19 @@ abstract class PigeonApiAdPodInfo(open val pigeonRegistrar: InteractiveMediaAdsL @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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val adPositionArg = adPosition(pigeon_instanceArg) val maxDurationArg = maxDuration(pigeon_instanceArg) val podIndexArg = podIndex(pigeon_instanceArg) @@ -2456,29 +2827,41 @@ 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( + InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } - } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.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 { @@ -2486,17 +2869,23 @@ abstract class PigeonApiFrameLayout(open val pigeonRegistrar: InteractiveMediaAd fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiFrameLayout?) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() 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] as Long - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2508,16 +2897,19 @@ 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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -2525,24 +2917,25 @@ abstract class PigeonApiFrameLayout(open val pigeonRegistrar: InteractiveMediaAd channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } } @Suppress("FunctionName") /** An implementation of [PigeonApiViewGroup] used to access callback methods */ - fun pigeon_getPigeonApiViewGroup(): PigeonApiViewGroup - { + fun pigeon_getPigeonApiViewGroup(): PigeonApiViewGroup { return pigeonRegistrar.getPigeonApiViewGroup() } - } /** * A special view that can contain other views (called children.) @@ -2550,14 +2943,15 @@ 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 +) { /** Adds a child view. */ abstract fun addView(pigeon_instance: android.view.ViewGroup, view: android.view.View) /** - * Called by a ViewGroup subclass to remove child views from itself, when it - * must first know its size on screen before it can calculate how many child - * views it will render. + * Called by a ViewGroup subclass to remove child views from itself, when it must first know its + * size on screen before it can calculate how many child views it will render. */ abstract fun removeView(pigeon_instance: android.view.ViewGroup, view: android.view.View) @@ -2566,18 +2960,23 @@ abstract class PigeonApiViewGroup(open val pigeonRegistrar: InteractiveMediaAdsL fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiViewGroup?) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.addView(pigeon_instanceArg, viewArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2585,18 +2984,23 @@ abstract class PigeonApiViewGroup(open val pigeonRegistrar: InteractiveMediaAdsL } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.ViewGroup.removeView", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.ViewGroup.removeView", + 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.removeView(pigeon_instanceArg, viewArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.removeView(pigeon_instanceArg, viewArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2608,16 +3012,19 @@ 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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -2625,24 +3032,25 @@ abstract class PigeonApiViewGroup(open val pigeonRegistrar: InteractiveMediaAdsL channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } } @Suppress("FunctionName") /** An implementation of [PigeonApiView] used to access callback methods */ - fun pigeon_getPigeonApiView(): PigeonApiView - { + fun pigeon_getPigeonApiView(): PigeonApiView { return pigeonRegistrar.getPigeonApiView() } - } /** * Displays a video file. @@ -2650,7 +3058,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. */ @@ -2668,17 +3078,23 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: InteractiveMediaAdsL fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiVideoView?) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() 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] as Long - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2686,18 +3102,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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setVideoUri(pigeon_instanceArg, uriArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2705,16 +3126,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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getCurrentPosition(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2726,24 +3152,32 @@ 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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { + } else { callback( Result.failure( - FlutterError("new-instance-error", "Attempting to create a new Dart instance of VideoView, but the class has a nonnull callback method.", ""))) + FlutterError( + "new-instance-error", + "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( @@ -2762,14 +3196,19 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: InteractiveMediaAdsL callback(Result.success(Unit)) } } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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( @@ -2788,17 +3227,21 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: InteractiveMediaAdsL callback(Result.success(Unit)) } } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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( @@ -2817,18 +3260,18 @@ abstract class PigeonApiVideoView(open val pigeonRegistrar: InteractiveMediaAdsL callback(Result.success(Unit)) } } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } @Suppress("FunctionName") /** An implementation of [PigeonApiView] used to access callback methods */ - fun pigeon_getPigeonApiView(): PigeonApiView - { + fun pigeon_getPigeonApiView(): PigeonApiView { return pigeonRegistrar.getPigeonApiView() } - } /** * This class represents the basic building block for user interface components. @@ -2836,19 +3279,21 @@ 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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -2856,26 +3301,29 @@ open class PigeonApiView(open val pigeonRegistrar: InteractiveMediaAdsLibraryPig channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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 @@ -2896,16 +3344,21 @@ abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: InteractiveMediaAd fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiMediaPlayer?) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() 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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getDuration(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2913,18 +3366,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] as Long - val wrapped: List = try { - api.seekTo(pigeon_instanceArg, mSecArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.seekTo(pigeon_instanceArg, mSecArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2932,17 +3390,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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.start(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2950,17 +3413,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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pause(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2968,17 +3436,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) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.stop(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2990,16 +3461,19 @@ 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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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" @@ -3007,73 +3481,132 @@ abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: InteractiveMediaAd channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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 ?: InteractiveMediaAdsLibraryPigeonCodec() 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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3081,18 +3614,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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3100,17 +3642,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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3118,18 +3668,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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3137,18 +3696,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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3156,18 +3724,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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3175,18 +3752,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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3194,18 +3780,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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3213,18 +3808,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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3232,19 +3836,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] as Long - val wrapped: List = try { - api.onVolumeChanged(pigeon_instanceArg, adMediaInfoArg, percentageArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.onVolumeChanged(pigeon_instanceArg, adMediaInfoArg, percentageArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3256,70 +3869,90 @@ 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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + 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<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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 ?: InteractiveMediaAdsLibraryPigeonCodec() 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] as Long - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3327,18 +3960,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] as Long - val wrapped: List = try { - api.setVolume(pigeon_instanceArg, valueArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setVolume(pigeon_instanceArg, valueArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3346,18 +3985,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) { - InteractiveMediaAdsLibraryPigeonUtils.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) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3369,24 +4015,33 @@ 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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { + } else { callback( Result.failure( - FlutterError("new-instance-error", "Attempting to create a new Dart instance of VideoAdPlayer, but the class has a nonnull callback method.", ""))) + FlutterError( + "new-instance-error", + "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( @@ -3405,14 +4060,20 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMedia callback(Result.success(Unit)) } } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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( @@ -3431,14 +4092,19 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMedia callback(Result.success(Unit)) } } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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( @@ -3457,17 +4123,22 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMedia callback(Result.success(Unit)) } } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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( @@ -3486,14 +4157,18 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMedia callback(Result.success(Unit)) } } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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( @@ -3512,14 +4187,20 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMedia callback(Result.success(Unit)) } } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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( @@ -3538,14 +4219,19 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMedia callback(Result.success(Unit)) } } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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( @@ -3564,37 +4250,48 @@ abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: InteractiveMedia callback(Result.success(Unit)) } } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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 ?: InteractiveMediaAdsLibraryPigeonCodec() 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] as Long - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3606,24 +4303,32 @@ 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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { + } else { callback( Result.failure( - FlutterError("new-instance-error", "Attempting to create a new Dart instance of AdsLoadedListener, but the class has a nonnull callback method.", ""))) + FlutterError( + "new-instance-error", + "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( @@ -3632,7 +4337,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<*>) { @@ -3642,37 +4348,48 @@ abstract class PigeonApiAdsLoadedListener(open val pigeonRegistrar: InteractiveM callback(Result.success(Unit)) } } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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 ?: InteractiveMediaAdsLibraryPigeonCodec() 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] as Long - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3684,24 +4401,32 @@ 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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { + } else { callback( Result.failure( - FlutterError("new-instance-error", "Attempting to create a new Dart instance of AdErrorListener, but the class has a nonnull callback method.", ""))) + FlutterError( + "new-instance-error", + "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( @@ -3720,37 +4445,48 @@ abstract class PigeonApiAdErrorListener(open val pigeonRegistrar: InteractiveMed callback(Result.success(Unit)) } } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.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 ?: InteractiveMediaAdsLibraryPigeonCodec() 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] as Long - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3762,24 +4498,32 @@ 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) -{ + 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.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { + } else { callback( Result.failure( - FlutterError("new-instance-error", "Attempting to create a new Dart instance of AdEventListener, but the class has a nonnull callback method.", ""))) + FlutterError( + "new-instance-error", + "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( @@ -3798,120 +4542,155 @@ abstract class PigeonApiAdEventListener(open val pigeonRegistrar: InteractiveMed callback(Result.success(Unit)) } } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } - } /** * Defines parameters that control the rendering of ads. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsRenderingSettings.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsRenderingSettings.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdsRenderingSettings(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiAdsRenderingSettings( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { /** Maximum recommended bitrate. */ - abstract fun getBitrateKbps(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings): Long + abstract fun getBitrateKbps( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings + ): Long - /** - * Returns whether the click-through URL will be opened using Custom Tabs - * feature. - */ - abstract fun getEnableCustomTabs(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings): Boolean + /** Returns whether the click-through URL will be opened using Custom Tabs feature. */ + abstract fun getEnableCustomTabs( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings + ): Boolean /** - * Whether the SDK will instruct the player to load the creative in response - * to `BaseManager.init()`. + * Whether the SDK will instruct the player to load the creative in response to + * `BaseManager.init()`. */ - abstract fun getEnablePreloading(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings): Boolean + abstract fun getEnablePreloading( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings + ): Boolean /** - * Whether to focus on the skip button when the skippable ad can be skipped - * on Android TV. + * Whether to focus on the skip button when the skippable ad can be skipped on Android TV. * * This is a no-op on non-Android TV devices. */ - abstract fun getFocusSkipButtonWhenAvailable(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings): Boolean + abstract fun getFocusSkipButtonWhenAvailable( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings + ): Boolean /** The SDK will prioritize the media with MIME type on the list. */ - abstract fun getMimeTypes(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings): List + abstract fun getMimeTypes( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings + ): List /** * Maximum recommended bitrate. * - * The value is in kbit/s. Default value, -1, means the bitrate will be - * selected by the SDK. + * The value is in kbit/s. Default value, -1, means the bitrate will be selected by the SDK. */ - abstract fun setBitrateKbps(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, bitrate: Long) + abstract fun setBitrateKbps( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, + bitrate: Long + ) /** - * Notifies the SDK whether to launch the click-through URL using Custom Tabs - * feature. + * Notifies the SDK whether to launch the click-through URL using Custom Tabs feature. * * Default is false. */ - abstract fun setEnableCustomTabs(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, enableCustomTabs: Boolean) + abstract fun setEnableCustomTabs( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, + enableCustomTabs: Boolean + ) /** - * If set, the SDK will instruct the player to load the creative in response - * to `BaseManager.init()`. + * If set, the SDK will instruct the player to load the creative in response to + * `BaseManager.init()`. * - * This allows the player to preload the ad at any point before calling - * `AdsManager.start()`. + * This allows the player to preload the ad at any point before calling `AdsManager.start()`. */ - abstract fun setEnablePreloading(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, enablePreloading: Boolean) + abstract fun setEnablePreloading( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, + enablePreloading: Boolean + ) /** - * Set whether to focus on the skip button when the skippable ad can be - * skipped on Android TV. + * Set whether to focus on the skip button when the skippable ad can be skipped on Android TV. * * This is a no-op on non-Android TV devices. * * Default is true. */ - abstract fun setFocusSkipButtonWhenAvailable(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, enableFocusSkipButton: Boolean) + abstract fun setFocusSkipButtonWhenAvailable( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, + enableFocusSkipButton: Boolean + ) /** - * Specifies a non-default amount of time to wait for media to load before - * timing out, in milliseconds. + * Specifies a non-default amount of time to wait for media to load before timing out, in + * milliseconds. * * This only applies to the IMA client-side SDK. * * Default time is 8000 ms. */ - abstract fun setLoadVideoTimeout(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, loadVideoTimeout: Long) + abstract fun setLoadVideoTimeout( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, + loadVideoTimeout: Long + ) - /** - * If specified, the SDK will prioritize the media with MIME type on the - * list. - */ - abstract fun setMimeTypes(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, mimeTypes: List) + /** If specified, the SDK will prioritize the media with MIME type on the list. */ + abstract fun setMimeTypes( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, + mimeTypes: List + ) /** - * For VMAP and ad rules playlists, only play ad breaks scheduled after this - * time (in seconds). + * For VMAP and ad rules playlists, only play ad breaks scheduled after this time (in seconds). */ - abstract fun setPlayAdsAfterTime(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, time: Double) + abstract fun setPlayAdsAfterTime( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, + time: Double + ) /** Sets the ad UI elements to be rendered by the IMA SDK. */ - abstract fun setUiElements(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, uiElements: List) + abstract fun setUiElements( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, + uiElements: List + ) companion object { @Suppress("LocalVariableName") - fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAdsRenderingSettings?) { + fun setUpMessageHandlers( + binaryMessenger: BinaryMessenger, + api: PigeonApiAdsRenderingSettings? + ) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getBitrateKbps", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getBitrateKbps", + 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.AdsRenderingSettings - val wrapped: List = try { - listOf(api.getBitrateKbps(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings + val wrapped: List = + try { + listOf(api.getBitrateKbps(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3919,16 +4698,22 @@ abstract class PigeonApiAdsRenderingSettings(open val pigeonRegistrar: Interacti } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getEnableCustomTabs", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getEnableCustomTabs", + 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.AdsRenderingSettings - val wrapped: List = try { - listOf(api.getEnableCustomTabs(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings + val wrapped: List = + try { + listOf(api.getEnableCustomTabs(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3936,16 +4721,22 @@ abstract class PigeonApiAdsRenderingSettings(open val pigeonRegistrar: Interacti } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getEnablePreloading", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getEnablePreloading", + 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.AdsRenderingSettings - val wrapped: List = try { - listOf(api.getEnablePreloading(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings + val wrapped: List = + try { + listOf(api.getEnablePreloading(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3953,16 +4744,22 @@ abstract class PigeonApiAdsRenderingSettings(open val pigeonRegistrar: Interacti } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getFocusSkipButtonWhenAvailable", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getFocusSkipButtonWhenAvailable", + 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.AdsRenderingSettings - val wrapped: List = try { - listOf(api.getFocusSkipButtonWhenAvailable(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings + val wrapped: List = + try { + listOf(api.getFocusSkipButtonWhenAvailable(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3970,16 +4767,22 @@ abstract class PigeonApiAdsRenderingSettings(open val pigeonRegistrar: Interacti } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getMimeTypes", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.getMimeTypes", + 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.AdsRenderingSettings - val wrapped: List = try { - listOf(api.getMimeTypes(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings + val wrapped: List = + try { + listOf(api.getMimeTypes(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3987,18 +4790,24 @@ abstract class PigeonApiAdsRenderingSettings(open val pigeonRegistrar: Interacti } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setBitrateKbps", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setBitrateKbps", + 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.AdsRenderingSettings + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings val bitrateArg = args[1] as Long - val wrapped: List = try { - api.setBitrateKbps(pigeon_instanceArg, bitrateArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setBitrateKbps(pigeon_instanceArg, bitrateArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4006,18 +4815,24 @@ abstract class PigeonApiAdsRenderingSettings(open val pigeonRegistrar: Interacti } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setEnableCustomTabs", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setEnableCustomTabs", + 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.AdsRenderingSettings + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings val enableCustomTabsArg = args[1] as Boolean - val wrapped: List = try { - api.setEnableCustomTabs(pigeon_instanceArg, enableCustomTabsArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setEnableCustomTabs(pigeon_instanceArg, enableCustomTabsArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4025,18 +4840,24 @@ abstract class PigeonApiAdsRenderingSettings(open val pigeonRegistrar: Interacti } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setEnablePreloading", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setEnablePreloading", + 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.AdsRenderingSettings + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings val enablePreloadingArg = args[1] as Boolean - val wrapped: List = try { - api.setEnablePreloading(pigeon_instanceArg, enablePreloadingArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setEnablePreloading(pigeon_instanceArg, enablePreloadingArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4044,18 +4865,24 @@ abstract class PigeonApiAdsRenderingSettings(open val pigeonRegistrar: Interacti } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setFocusSkipButtonWhenAvailable", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setFocusSkipButtonWhenAvailable", + 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.AdsRenderingSettings + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings val enableFocusSkipButtonArg = args[1] as Boolean - val wrapped: List = try { - api.setFocusSkipButtonWhenAvailable(pigeon_instanceArg, enableFocusSkipButtonArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setFocusSkipButtonWhenAvailable(pigeon_instanceArg, enableFocusSkipButtonArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4063,18 +4890,24 @@ abstract class PigeonApiAdsRenderingSettings(open val pigeonRegistrar: Interacti } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setLoadVideoTimeout", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setLoadVideoTimeout", + 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.AdsRenderingSettings + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings val loadVideoTimeoutArg = args[1] as Long - val wrapped: List = try { - api.setLoadVideoTimeout(pigeon_instanceArg, loadVideoTimeoutArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setLoadVideoTimeout(pigeon_instanceArg, loadVideoTimeoutArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4082,18 +4915,24 @@ abstract class PigeonApiAdsRenderingSettings(open val pigeonRegistrar: Interacti } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setMimeTypes", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setMimeTypes", + 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.AdsRenderingSettings + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings val mimeTypesArg = args[1] as List - val wrapped: List = try { - api.setMimeTypes(pigeon_instanceArg, mimeTypesArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setMimeTypes(pigeon_instanceArg, mimeTypesArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4101,18 +4940,24 @@ abstract class PigeonApiAdsRenderingSettings(open val pigeonRegistrar: Interacti } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setPlayAdsAfterTime", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setPlayAdsAfterTime", + 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.AdsRenderingSettings + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings val timeArg = args[1] as Double - val wrapped: List = try { - api.setPlayAdsAfterTime(pigeon_instanceArg, timeArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setPlayAdsAfterTime(pigeon_instanceArg, timeArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4120,18 +4965,24 @@ abstract class PigeonApiAdsRenderingSettings(open val pigeonRegistrar: Interacti } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setUiElements", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.setUiElements", + 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.AdsRenderingSettings + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.AdsRenderingSettings val uiElementsArg = args[1] as List - val wrapped: List = try { - api.setUiElements(pigeon_instanceArg, uiElementsArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setUiElements(pigeon_instanceArg, uiElementsArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4143,72 +4994,96 @@ abstract class PigeonApiAdsRenderingSettings(open val pigeonRegistrar: Interacti @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of AdsRenderingSettings and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdsRenderingSettings, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.interactive_media_ads.AdsRenderingSettings.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - } /** * Represents the progress within this ad break. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdProgressInfo.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdProgressInfo.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAdProgressInfo(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiAdProgressInfo( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { /** Total ad break duration (in seconds). */ - abstract fun adBreakDuration(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo): Double + abstract fun adBreakDuration( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo + ): Double /** Total ad period duration (in seconds). */ - abstract fun adPeriodDuration(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo): Double + abstract fun adPeriodDuration( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo + ): Double /** The position of current ad within the ad break, starting with 1. */ - abstract fun adPosition(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo): Long + abstract fun adPosition( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo + ): Long /** Current time within the ad (in seconds). */ - abstract fun currentTime(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo): Double + abstract fun currentTime( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo + ): Double /** Duration of current ad (in seconds). */ - abstract fun duration(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo): Double + abstract fun duration( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo + ): Double /** The total number of ads in this ad break. */ - abstract fun totalAds(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo): Long + abstract fun totalAds( + pigeon_instance: com.google.ads.interactivemedia.v3.api.AdProgressInfo + ): Long @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of AdProgressInfo and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdProgressInfo, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdProgressInfo, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val adBreakDurationArg = adBreakDuration(pigeon_instanceArg) val adPeriodDurationArg = adPeriodDuration(pigeon_instanceArg) val adPositionArg = adPosition(pigeon_instanceArg) @@ -4219,30 +5094,46 @@ abstract class PigeonApiAdProgressInfo(open val pigeonRegistrar: InteractiveMedi val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.AdProgressInfo.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(listOf(pigeon_identifierArg, adBreakDurationArg, adPeriodDurationArg, adPositionArg, currentTimeArg, durationArg, totalAdsArg)) { - 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, + adBreakDurationArg, + adPeriodDurationArg, + adPositionArg, + currentTimeArg, + durationArg, + totalAdsArg)) { + 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( + InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } - } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } - } } } - } /** * An object that holds data corresponding to the companion Ad. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/CompanionAd.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/CompanionAd.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiCompanionAd(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiCompanionAd( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { /** The API needed to execute this ad, or null if unavailable. */ - abstract fun apiFramework(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAd): String? + abstract fun apiFramework( + pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAd + ): String? /** * The height of the companion in pixels. @@ -4252,7 +5143,9 @@ abstract class PigeonApiCompanionAd(open val pigeonRegistrar: InteractiveMediaAd abstract fun height(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAd): Long /** The URL for the static resource of this companion. */ - abstract fun resourceValue(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAd): String + abstract fun resourceValue( + pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAd + ): String /** * The width of the companion in pixels. @@ -4263,16 +5156,19 @@ abstract class PigeonApiCompanionAd(open val pigeonRegistrar: InteractiveMediaAd @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of CompanionAd and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.CompanionAd, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.CompanionAd, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val apiFrameworkArg = apiFramework(pigeon_instanceArg) val heightArg = height(pigeon_instanceArg) val resourceValueArg = resourceValue(pigeon_instanceArg) @@ -4281,54 +5177,68 @@ abstract class PigeonApiCompanionAd(open val pigeonRegistrar: InteractiveMediaAd val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.CompanionAd.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(listOf(pigeon_identifierArg, apiFrameworkArg, heightArg, resourceValueArg, widthArg)) { - 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, apiFrameworkArg, heightArg, resourceValueArg, widthArg)) { + 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( + InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } - } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } - } } } - } /** * This object exposes information about the universal ad ID. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/UniversalAdId.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/UniversalAdId.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiUniversalAdId(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiUniversalAdId( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { /** * Returns the ad ID registry associated with the ad ID value. * * Returns "unknown" if the registry is not known. */ - abstract fun adIdRegistry(pigeon_instance: com.google.ads.interactivemedia.v3.api.UniversalAdId): String + abstract fun adIdRegistry( + pigeon_instance: com.google.ads.interactivemedia.v3.api.UniversalAdId + ): String /** * Returns the universal ad ID value. * * Returns "unknown" if the value is not known. */ - abstract fun adIdValue(pigeon_instance: com.google.ads.interactivemedia.v3.api.UniversalAdId): String + abstract fun adIdValue( + pigeon_instance: com.google.ads.interactivemedia.v3.api.UniversalAdId + ): String @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of UniversalAdId and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.UniversalAdId, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.UniversalAdId, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val adIdRegistryArg = adIdRegistry(pigeon_instanceArg) val adIdValueArg = adIdValue(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger @@ -4338,42 +5248,55 @@ abstract class PigeonApiUniversalAdId(open val pigeonRegistrar: InteractiveMedia channel.send(listOf(pigeon_identifierArg, adIdRegistryArg, adIdValueArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - } /** * An object that holds data corresponding to the main Ad. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/Ad.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/Ad.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAd(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiAd( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { /** The ad ID as specified in the VAST response. */ abstract fun adId(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): String /** The pod metadata object. */ - abstract fun adPodInfo(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): com.google.ads.interactivemedia.v3.api.AdPodInfo + abstract fun adPodInfo( + pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad + ): com.google.ads.interactivemedia.v3.api.AdPodInfo /** The ad system as specified in the VAST response. */ abstract fun adSystem(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): String /** The IDs of the ads' creatives, starting with the first wrapper ad. */ - abstract fun adWrapperCreativeIds(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): List + abstract fun adWrapperCreativeIds( + pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad + ): List /** The wrapper ad IDs as specified in the VAST response. */ - abstract fun adWrapperIds(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): List + abstract fun adWrapperIds( + pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad + ): List /** The wrapper ad systems as specified in the VAST response. */ - abstract fun adWrapperSystems(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): List + abstract fun adWrapperSystems( + pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad + ): List /** The advertiser name as defined by the serving party. */ abstract fun advertiserName(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): String @@ -4383,11 +5306,13 @@ abstract class PigeonApiAd(open val pigeonRegistrar: InteractiveMediaAdsLibraryP * * Returns an empty list in any other scenario. */ - abstract fun companionAds(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): List + abstract fun companionAds( + pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad + ): List /** - * The content type of the currently selected creative, or null if no - * creative is selected or the content type is unavailable. + * The content type of the currently selected creative, or null if no creative is selected or the + * content type is unavailable. */ abstract fun contentType(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): String? @@ -4397,10 +5322,7 @@ abstract class PigeonApiAd(open val pigeonRegistrar: InteractiveMediaAdsLibraryP /** The ID of the selected creative for the ad, */ abstract fun creativeId(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): String - /** - * The first deal ID present in the wrapper chain for the current ad, - * starting from the top. - */ + /** The first deal ID present in the wrapper chain for the current ad, starting from the top. */ abstract fun dealId(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): String /** The description of this ad from the VAST response. */ @@ -4421,17 +5343,20 @@ abstract class PigeonApiAd(open val pigeonRegistrar: InteractiveMediaAdsLibraryP /** The title of this ad from the VAST response. */ abstract fun title(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): String? - /** - * The custom parameters associated with the ad at the time of ad - * trafficking. - */ - abstract fun traffickingParameters(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): String + /** The custom parameters associated with the ad at the time of ad trafficking. */ + abstract fun traffickingParameters( + pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad + ): String /** Te set of ad UI elements rendered by the IMA SDK for this ad. */ - abstract fun uiElements(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): List + abstract fun uiElements( + pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad + ): List /** The list of all universal ad IDs for this ad. */ - abstract fun universalAdIds(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): List + abstract fun universalAdIds( + pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad + ): List /** The VAST bitrate in Kbps of the selected creative. */ abstract fun vastMediaBitrate(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): Long @@ -4445,10 +5370,7 @@ abstract class PigeonApiAd(open val pigeonRegistrar: InteractiveMediaAdsLibraryP /** The width of the selected creative if non-linear, else returns 0. */ abstract fun width(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): Long - /** - * Indicates whether the ad’s current mode of operation is linear or - * non-linear. - */ + /** Indicates whether the ad’s current mode of operation is linear or non-linear. */ abstract fun isLinear(pigeon_instance: com.google.ads.interactivemedia.v3.api.Ad): Boolean /** Indicates whether the ad can be skipped by the user. */ @@ -4456,16 +5378,19 @@ abstract class PigeonApiAd(open val pigeonRegistrar: InteractiveMediaAdsLibraryP @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of Ad and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.Ad, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.Ad, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val adIdArg = adId(pigeon_instanceArg) val adPodInfoArg = adPodInfo(pigeon_instanceArg) val adSystemArg = adSystem(pigeon_instanceArg) @@ -4497,46 +5422,91 @@ abstract class PigeonApiAd(open val pigeonRegistrar: InteractiveMediaAdsLibraryP val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.interactive_media_ads.Ad.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(listOf(pigeon_identifierArg, adIdArg, adPodInfoArg, adSystemArg, adWrapperCreativeIdsArg, adWrapperIdsArg, adWrapperSystemsArg, advertiserNameArg, companionAdsArg, contentTypeArg, creativeAdIdArg, creativeIdArg, dealIdArg, descriptionArg, durationArg, heightArg, skipTimeOffsetArg, surveyUrlArg, titleArg, traffickingParametersArg, uiElementsArg, universalAdIdsArg, vastMediaBitrateArg, vastMediaHeightArg, vastMediaWidthArg, widthArg, isLinearArg, isSkippableArg)) { - 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, + adIdArg, + adPodInfoArg, + adSystemArg, + adWrapperCreativeIdsArg, + adWrapperIdsArg, + adWrapperSystemsArg, + advertiserNameArg, + companionAdsArg, + contentTypeArg, + creativeAdIdArg, + creativeIdArg, + dealIdArg, + descriptionArg, + durationArg, + heightArg, + skipTimeOffsetArg, + surveyUrlArg, + titleArg, + traffickingParametersArg, + uiElementsArg, + universalAdIdsArg, + vastMediaBitrateArg, + vastMediaHeightArg, + vastMediaWidthArg, + widthArg, + isLinearArg, + isSkippableArg)) { + 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( + InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } - } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } - } } } - } /** * Listener interface for click events. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/CompanionAdSlot.ClickListener.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/CompanionAdSlot.ClickListener.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiCompanionAdSlotClickListener(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { - abstract fun pigeon_defaultConstructor(): com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener +abstract class PigeonApiCompanionAdSlotClickListener( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { + abstract fun pigeon_defaultConstructor(): + com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener companion object { @Suppress("LocalVariableName") - fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiCompanionAdSlotClickListener?) { + fun setUpMessageHandlers( + binaryMessenger: BinaryMessenger, + api: PigeonApiCompanionAdSlotClickListener? + ) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlotClickListener.pigeon_defaultConstructor", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlotClickListener.pigeon_defaultConstructor", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4547,25 +5517,35 @@ abstract class PigeonApiCompanionAdSlotClickListener(open val pigeonRegistrar: I } @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of CompanionAdSlotClickListener and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener, callback: (Result) -> Unit) -{ + /** + * Creates a Dart instance of CompanionAdSlotClickListener and attaches it to + * [pigeon_instanceArg]. + */ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { + } else { callback( Result.failure( - FlutterError("new-instance-error", "Attempting to create a new Dart instance of CompanionAdSlotClickListener, but the class has a nonnull callback method.", ""))) + FlutterError( + "new-instance-error", + "Attempting to create a new Dart instance of CompanionAdSlotClickListener, but the class has a nonnull callback method.", + ""))) } } /** Respond to a click on this companion ad slot. */ - fun onCompanionAdClick(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener, callback: (Result) -> Unit) -{ + fun onCompanionAdClick( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4574,7 +5554,8 @@ abstract class PigeonApiCompanionAdSlotClickListener(open val pigeonRegistrar: I } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlotClickListener.onCompanionAdClick" + val channelName = + "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlotClickListener.onCompanionAdClick" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg)) { if (it is List<*>) { @@ -4584,50 +5565,75 @@ abstract class PigeonApiCompanionAdSlotClickListener(open val pigeonRegistrar: I callback(Result.success(Unit)) } } else { - callback(Result.failure(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } - } /** * A companion ad slot for which the SDK should retrieve ads. * - * See https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/CompanionAdSlot.html. + * See + * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/CompanionAdSlot.html. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiCompanionAdSlot(open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiCompanionAdSlot( + open val pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar +) { /** Registers a listener for companion clicks. */ - abstract fun addClickListener(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, clickListener: com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener) + abstract fun addClickListener( + pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, + clickListener: com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener + ) /** Returns the ViewGroup into which the companion will be rendered. */ - abstract fun getContainer(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot): android.view.ViewGroup + abstract fun getContainer( + pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot + ): android.view.ViewGroup /** Returns the height of the companion slot. */ - abstract fun getHeight(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot): Long + abstract fun getHeight( + pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot + ): Long /** Returns the width of the companion slot. */ - abstract fun getWidth(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot): Long + abstract fun getWidth( + pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot + ): Long /** Returns true if the companion slot is filled, false otherwise. */ - abstract fun isFilled(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot): Boolean + abstract fun isFilled( + pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot + ): Boolean /** Removes a listener for companion clicks. */ - abstract fun removeClickListener(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, clickListener: com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener) + abstract fun removeClickListener( + pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, + clickListener: com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener + ) /** * Sets the ViewGroup into which the companion will be rendered. * * Required. */ - abstract fun setContainer(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, container: android.view.ViewGroup) + abstract fun setContainer( + pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, + container: android.view.ViewGroup + ) /** * Sets the size of the slot. * * Only companions matching the slot size will be displayed in the slot. */ - abstract fun setSize(pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, width: Long, height: Long) + abstract fun setSize( + pigeon_instance: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, + width: Long, + height: Long + ) /** * Sets the size of the slot as fluid. @@ -4642,18 +5648,25 @@ abstract class PigeonApiCompanionAdSlot(open val pigeonRegistrar: InteractiveMed fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiCompanionAdSlot?) { val codec = api?.pigeonRegistrar?.codec ?: InteractiveMediaAdsLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.addClickListener", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.addClickListener", + 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.CompanionAdSlot - val clickListenerArg = args[1] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener - val wrapped: List = try { - api.addClickListener(pigeon_instanceArg, clickListenerArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot + val clickListenerArg = + args[1] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener + val wrapped: List = + try { + api.addClickListener(pigeon_instanceArg, clickListenerArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4661,16 +5674,22 @@ abstract class PigeonApiCompanionAdSlot(open val pigeonRegistrar: InteractiveMed } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.getContainer", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.getContainer", + 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.CompanionAdSlot - val wrapped: List = try { - listOf(api.getContainer(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot + val wrapped: List = + try { + listOf(api.getContainer(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4678,16 +5697,22 @@ abstract class PigeonApiCompanionAdSlot(open val pigeonRegistrar: InteractiveMed } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.getHeight", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.getHeight", + 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.CompanionAdSlot - val wrapped: List = try { - listOf(api.getHeight(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot + val wrapped: List = + try { + listOf(api.getHeight(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4695,16 +5720,22 @@ abstract class PigeonApiCompanionAdSlot(open val pigeonRegistrar: InteractiveMed } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.getWidth", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.getWidth", + 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.CompanionAdSlot - val wrapped: List = try { - listOf(api.getWidth(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot + val wrapped: List = + try { + listOf(api.getWidth(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4712,16 +5743,22 @@ abstract class PigeonApiCompanionAdSlot(open val pigeonRegistrar: InteractiveMed } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.isFilled", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.isFilled", + 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.CompanionAdSlot - val wrapped: List = try { - listOf(api.isFilled(pigeon_instanceArg)) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot + val wrapped: List = + try { + listOf(api.isFilled(pigeon_instanceArg)) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4729,18 +5766,25 @@ abstract class PigeonApiCompanionAdSlot(open val pigeonRegistrar: InteractiveMed } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.removeClickListener", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.removeClickListener", + 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.CompanionAdSlot - val clickListenerArg = args[1] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener - val wrapped: List = try { - api.removeClickListener(pigeon_instanceArg, clickListenerArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot + val clickListenerArg = + args[1] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener + val wrapped: List = + try { + api.removeClickListener(pigeon_instanceArg, clickListenerArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4748,18 +5792,24 @@ abstract class PigeonApiCompanionAdSlot(open val pigeonRegistrar: InteractiveMed } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.setContainer", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.setContainer", + 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.CompanionAdSlot + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot val containerArg = args[1] as android.view.ViewGroup - val wrapped: List = try { - api.setContainer(pigeon_instanceArg, containerArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setContainer(pigeon_instanceArg, containerArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4767,19 +5817,25 @@ abstract class PigeonApiCompanionAdSlot(open val pigeonRegistrar: InteractiveMed } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.setSize", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.setSize", + 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.CompanionAdSlot + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot val widthArg = args[1] as Long val heightArg = args[2] as Long - val wrapped: List = try { - api.setSize(pigeon_instanceArg, widthArg, heightArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setSize(pigeon_instanceArg, widthArg, heightArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4787,17 +5843,23 @@ abstract class PigeonApiCompanionAdSlot(open val pigeonRegistrar: InteractiveMed } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.setFluidSize", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.setFluidSize", + 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.CompanionAdSlot - val wrapped: List = try { - api.setFluidSize(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) - } + val pigeon_instanceArg = + args[0] as com.google.ads.interactivemedia.v3.api.CompanionAdSlot + val wrapped: List = + try { + api.setFluidSize(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + InteractiveMediaAdsLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4809,32 +5871,38 @@ abstract class PigeonApiCompanionAdSlot(open val pigeonRegistrar: InteractiveMed @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of CompanionAdSlot and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.CompanionAdSlot, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( FlutterError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.interactive_media_ads.CompanionAdSlot.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + 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(InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure( + InteractiveMediaAdsLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - } diff --git a/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApiTest.kt b/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApiTest.kt index 15c33b2a3fe..5fa43bfafcd 100644 --- a/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApiTest.kt +++ b/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApiTest.kt @@ -1,13 +1,10 @@ package dev.flutter.packages.interactive_media_ads -import com.google.ads.interactivemedia.v3.api.AdsRenderingSettings import com.google.ads.interactivemedia.v3.api.BaseDisplayContainer import com.google.ads.interactivemedia.v3.api.CompanionAdSlot +import kotlin.test.Test import org.mockito.kotlin.mock import org.mockito.kotlin.verify -import org.mockito.kotlin.whenever -import kotlin.test.Test -import kotlin.test.assertEquals class BaseDisplayContainerProxyApiTest { @Test @@ -20,4 +17,4 @@ class BaseDisplayContainerProxyApiTest { verify(instance).setCompanionSlots(companionSlots) } -} \ No newline at end of file +} diff --git a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/CompanionAdSlotProxyAPIDelegate.swift b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/CompanionAdSlotProxyAPIDelegate.swift index d8ac199e910..1c3cd510e5e 100644 --- a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/CompanionAdSlotProxyAPIDelegate.swift +++ b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/CompanionAdSlotProxyAPIDelegate.swift @@ -35,12 +35,16 @@ class CompanionAdSlotProxyAPIDelegate: PigeonApiDelegateIMACompanionAdSlot { ) throws { pigeonInstance.delegate = delegate } - - func width(pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot) throws -> Int64 { + + func width(pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot) throws + -> Int64 + { return Int64(pigeonInstance.width) } - - func height(pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot) throws -> Int64 { + + func height(pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot) throws + -> Int64 + { return Int64(pigeonInstance.height) } } 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 6d45c61a92f..abda0e15bd6 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 @@ -1,7 +1,7 @@ // 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 (v25.3.1), do not edit directly. +// Autogenerated from Pigeon (v25.3.2), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation @@ -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 { @@ -79,30 +81,39 @@ protocol InteractiveMediaAdsLibraryPigeonInternalFinalizerDelegate: AnyObject { func onDeinit(identifier: Int64) } - // Attaches to an object to receive a callback when the object is deallocated. internal final class InteractiveMediaAdsLibraryPigeonInternalFinalizer { - private static let associatedObjectKey = malloc(1)! + internal static let associatedObjectKey = malloc(1)! private let identifier: Int64 // Reference to the delegate is weak because the callback should be ignored if the // `InstanceManager` is deallocated. - private weak var delegate: InteractiveMediaAdsLibraryPigeonInternalFinalizerDelegate? + internal weak var delegate: InteractiveMediaAdsLibraryPigeonInternalFinalizerDelegate? - private init(identifier: Int64, delegate: InteractiveMediaAdsLibraryPigeonInternalFinalizerDelegate) { + private init( + identifier: Int64, delegate: InteractiveMediaAdsLibraryPigeonInternalFinalizerDelegate + ) { self.identifier = identifier self.delegate = delegate } internal static func attach( - to instance: AnyObject, identifier: Int64, delegate: InteractiveMediaAdsLibraryPigeonInternalFinalizerDelegate + to instance: AnyObject, identifier: Int64, + delegate: InteractiveMediaAdsLibraryPigeonInternalFinalizerDelegate ) { - let finalizer = InteractiveMediaAdsLibraryPigeonInternalFinalizer(identifier: identifier, delegate: delegate) + let finalizer = InteractiveMediaAdsLibraryPigeonInternalFinalizer( + identifier: identifier, delegate: delegate) objc_setAssociatedObject(instance, associatedObjectKey, finalizer, .OBJC_ASSOCIATION_RETAIN) } static func detach(from instance: AnyObject) { - objc_setAssociatedObject(instance, associatedObjectKey, nil, .OBJC_ASSOCIATION_ASSIGN) + let finalizer = + objc_getAssociatedObject(instance, associatedObjectKey) + as? InteractiveMediaAdsLibraryPigeonInternalFinalizer + if let finalizer = finalizer { + finalizer.delegate = nil + objc_setAssociatedObject(instance, associatedObjectKey, nil, .OBJC_ASSOCIATION_ASSIGN) + } } deinit { @@ -110,7 +121,6 @@ internal final class InteractiveMediaAdsLibraryPigeonInternalFinalizer { } } - /// 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 @@ -214,7 +224,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)) - InteractiveMediaAdsLibraryPigeonInternalFinalizer.attach(to: instance, identifier: identifier, delegate: finalizerDelegate) + InteractiveMediaAdsLibraryPigeonInternalFinalizer.attach( + to: instance, identifier: identifier, delegate: finalizerDelegate) } /// Retrieves the identifier paired with an instance. @@ -260,6 +271,10 @@ final class InteractiveMediaAdsLibraryPigeonInstanceManager { /// The manager will be empty after this call returns. func removeAllObjects() throws { lockQueue.sync { + let weakInstancesEnumerator = weakInstances.objectEnumerator()! + while let instance = weakInstancesEnumerator.nextObject() { + InteractiveMediaAdsLibraryPigeonInternalFinalizer.detach(from: instance as AnyObject) + } identifiers.removeAllObjects() weakInstances.removeAllObjects() strongInstances.removeAllObjects() @@ -291,7 +306,6 @@ final class InteractiveMediaAdsLibraryPigeonInstanceManager { } } - private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi { /// The codec used for serializing messages. var codec: FlutterStandardMessageCodec { InteractiveMediaAdsLibraryPigeonCodec.shared } @@ -304,9 +318,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 = InteractiveMediaAdsLibraryPigeonCodec.shared - let removeStrongReferenceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.PigeonInternalInstanceManager.removeStrongReference", binaryMessenger: binaryMessenger, codec: codec) + let removeStrongReferenceChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.interactive_media_ads.PigeonInternalInstanceManager.removeStrongReference", + binaryMessenger: binaryMessenger, codec: codec) if let instanceManager = instanceManager { removeStrongReferenceChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -321,7 +341,9 @@ private class InteractiveMediaAdsLibraryPigeonInstanceManagerApi { } else { removeStrongReferenceChannel.setMessageHandler(nil) } - let clearChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.PigeonInternalInstanceManager.clear", binaryMessenger: binaryMessenger, codec: codec) + let clearChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.PigeonInternalInstanceManager.clear", + binaryMessenger: binaryMessenger, codec: codec) if let instanceManager = instanceManager { clearChannel.setMessageHandler { _, reply in do { @@ -337,9 +359,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.PigeonInternalInstanceManager.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.PigeonInternalInstanceManager.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))) @@ -359,74 +385,105 @@ 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 /// An implementation of [PigeonApiIMAFriendlyObstruction] used to add a new Dart instance of /// `IMAFriendlyObstruction` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAFriendlyObstruction(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAFriendlyObstruction + func pigeonApiIMAFriendlyObstruction( + _ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar + ) -> PigeonApiIMAFriendlyObstruction /// An implementation of [PigeonApiIMACompanionAd] used to add a new Dart instance of /// `IMACompanionAd` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMACompanionAd(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMACompanionAd + func pigeonApiIMACompanionAd(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiIMACompanionAd /// An implementation of [PigeonApiIMACompanionAdSlot] used to add a new Dart instance of /// `IMACompanionAdSlot` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMACompanionAdSlot(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMACompanionAdSlot + func pigeonApiIMACompanionAdSlot(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiIMACompanionAdSlot /// An implementation of [PigeonApiIMACompanionDelegate] used to add a new Dart instance of /// `IMACompanionDelegate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMACompanionDelegate(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMACompanionDelegate + func pigeonApiIMACompanionDelegate(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiIMACompanionDelegate /// An implementation of [PigeonApiIMAAdPodInfo] used to add a new Dart instance of /// `IMAAdPodInfo` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiIMAAdPodInfo(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMAAdPodInfo + func pigeonApiIMAAdPodInfo(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiIMAAdPodInfo } extension InteractiveMediaAdsLibraryPigeonProxyApiDelegate { - func pigeonApiIMASettings(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiIMASettings { - return PigeonApiIMASettings(pigeonRegistrar: registrar, delegate: PigeonApiDelegateIMASettings()) - } - func pigeonApiNSObject(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) -> PigeonApiNSObject { + func pigeonApiIMASettings(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiIMASettings + { + return PigeonApiIMASettings( + pigeonRegistrar: registrar, delegate: PigeonApiDelegateIMASettings()) + } + func pigeonApiNSObject(_ registrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) + -> PigeonApiNSObject + { return PigeonApiNSObject(pigeonRegistrar: registrar, delegate: PigeonApiDelegateNSObject()) } } @@ -441,12 +498,15 @@ open class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar { var codec: FlutterStandardMessageCodec { if _codec == nil { _codec = FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: self)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: self)) } return _codec! } - private class InstanceManagerApiFinalizerDelegate: InteractiveMediaAdsLibraryPigeonInternalFinalizerDelegate { + private class InstanceManagerApiFinalizerDelegate: + InteractiveMediaAdsLibraryPigeonInternalFinalizerDelegate + { let api: InteractiveMediaAdsLibraryPigeonInstanceManagerApi init(_ api: InteractiveMediaAdsLibraryPigeonInstanceManagerApi) { @@ -460,7 +520,10 @@ open class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar { } } - init(binaryMessenger: FlutterBinaryMessenger, apiDelegate: InteractiveMediaAdsLibraryPigeonProxyApiDelegate) { + init( + binaryMessenger: FlutterBinaryMessenger, + apiDelegate: InteractiveMediaAdsLibraryPigeonProxyApiDelegate + ) { self.binaryMessenger = binaryMessenger self.apiDelegate = apiDelegate self.instanceManager = InteractiveMediaAdsLibraryPigeonInstanceManager( @@ -469,23 +532,38 @@ open class InteractiveMediaAdsLibraryPigeonProxyApiRegistrar { } func setUp() { - InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger: binaryMessenger, instanceManager: instanceManager) - PigeonApiIMAAdDisplayContainer.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdDisplayContainer(self)) - PigeonApiUIView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIView(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)) - PigeonApiIMAFriendlyObstruction.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAFriendlyObstruction(self)) - PigeonApiIMACompanionAdSlot.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMACompanionAdSlot(self)) - PigeonApiIMACompanionDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMACompanionDelegate(self)) + InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers( + binaryMessenger: binaryMessenger, instanceManager: instanceManager) + PigeonApiIMAAdDisplayContainer.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAAdDisplayContainer(self)) + PigeonApiUIView.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIView(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)) + PigeonApiIMAFriendlyObstruction.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMAFriendlyObstruction(self)) + PigeonApiIMACompanionAdSlot.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMACompanionAdSlot(self)) + PigeonApiIMACompanionDelegate.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiIMACompanionDelegate(self)) } func tearDown() { - InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger: binaryMessenger, instanceManager: nil) + InteractiveMediaAdsLibraryPigeonInstanceManagerApi.setUpMessageHandlers( + binaryMessenger: binaryMessenger, instanceManager: nil) PigeonApiIMAAdDisplayContainer.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiUIView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiUIViewController.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) @@ -495,16 +573,21 @@ 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) PigeonApiIMAFriendlyObstruction.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiIMACompanionAdSlot.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiIMACompanionDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) } } -private class InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStandardReaderWriter { +private class InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter: + FlutterStandardReaderWriter +{ unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar - private class InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReader: InteractiveMediaAdsLibraryPigeonCodecReader { + private class InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReader: + InteractiveMediaAdsLibraryPigeonCodecReader + { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar init(data: Data, pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { @@ -528,7 +611,9 @@ private class InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter: } } - private class InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecWriter: InteractiveMediaAdsLibraryPigeonCodecWriter { + private class InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecWriter: + InteractiveMediaAdsLibraryPigeonCodecWriter + { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar init(data: NSMutableData, pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar) { @@ -537,251 +622,266 @@ private class InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter: } 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 || value is FriendlyObstructionPurpose || value is UIElementType { + 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 || value is FriendlyObstructionPurpose + || value is UIElementType + { 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? IMAFriendlyObstruction { - pigeonRegistrar.apiDelegate.pigeonApiIMAFriendlyObstruction(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiIMAFriendlyObstruction(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? IMACompanionAd { pigeonRegistrar.apiDelegate.pigeonApiIMACompanionAd(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? IMACompanionAdSlot { pigeonRegistrar.apiDelegate.pigeonApiIMACompanionAdSlot(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? IMACompanionDelegate { - pigeonRegistrar.apiDelegate.pigeonApiIMACompanionDelegate(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiIMACompanionDelegate(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? IMAAdPodInfo { pigeonRegistrar.apiDelegate.pigeonApiIMAAdPodInfo(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( pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance)!) } else { print("Unsupported value: \(value) of \(type(of: value))") - assert(false, "Unsupported value for InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecWriter") + assert( + false, "Unsupported value for InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecWriter" + ) } } @@ -792,11 +892,13 @@ private class InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter: } override func reader(with data: Data) -> FlutterStandardReader { - return InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReader(data: data, pigeonRegistrar: pigeonRegistrar) + return InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReader( + data: data, pigeonRegistrar: pigeonRegistrar) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecWriter(data: data, pigeonRegistrar: pigeonRegistrar) + return InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecWriter( + data: data, pigeonRegistrar: pigeonRegistrar) } } @@ -1120,35 +1222,49 @@ private class InteractiveMediaAdsLibraryPigeonCodecReaderWriter: FlutterStandard } class InteractiveMediaAdsLibraryPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { - static let shared = InteractiveMediaAdsLibraryPigeonCodec(readerWriter: InteractiveMediaAdsLibraryPigeonCodecReaderWriter()) + static let shared = InteractiveMediaAdsLibraryPigeonCodec( + readerWriter: InteractiveMediaAdsLibraryPigeonCodecReaderWriter()) } protocol PigeonApiDelegateIMAAdDisplayContainer { /// Initializes IMAAdDisplayContainer for rendering the ad and displaying the /// sad UI. - func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdDisplayContainer, adContainer: UIView, companionSlots: [IMACompanionAdSlot]?, adContainerViewController: UIViewController?) throws -> IMAAdDisplayContainer + func pigeonDefaultConstructor( + pigeonApi: PigeonApiIMAAdDisplayContainer, adContainer: UIView, + companionSlots: [IMACompanionAdSlot]?, adContainerViewController: UIViewController? + ) throws -> IMAAdDisplayContainer /// View containing the video display and ad related UI. /// /// This view must be present in the view hierarchy in order to make ad or /// stream requests. - func adContainer(pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer) throws -> UIView + func adContainer(pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer) + throws -> UIView /// List of companion ad slots. - func companionSlots(pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer) throws -> [IMACompanionAdSlot]? + func companionSlots( + pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer + ) throws -> [IMACompanionAdSlot]? /// View controller containing the ad container. - func setAdContainerViewController(pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer, controller: UIViewController?) throws + func setAdContainerViewController( + pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer, + controller: UIViewController?) throws /// View controller containing the ad container. - func getAdContainerViewController(pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer) throws -> UIViewController? + func getAdContainerViewController( + pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer + ) throws -> UIViewController? /// Registers a view that overlays or obstructs this container as “friendly” /// for viewability measurement purposes. - func registerFriendlyObstruction(pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer, friendlyObstruction: IMAFriendlyObstruction) throws + func registerFriendlyObstruction( + pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer, + friendlyObstruction: IMAFriendlyObstruction) throws /// Unregisters all previously registered friendly obstructions. - func unregisterAllFriendlyObstructions(pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer) throws + func unregisterAllFriendlyObstructions( + pigeonApi: PigeonApiIMAAdDisplayContainer, pigeonInstance: IMAAdDisplayContainer) throws } 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 @@ -1156,17 +1272,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: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( + 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?] @@ -1176,8 +1301,10 @@ final class PigeonApiIMAAdDisplayContainer: PigeonApiProtocolIMAAdDisplayContain let adContainerViewControllerArg: UIViewController? = nilOrValue(args[3]) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, adContainer: adContainerArg, companionSlots: companionSlotsArg, adContainerViewController: adContainerViewControllerArg), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor( + pigeonApi: api, adContainer: adContainerArg, companionSlots: companionSlotsArg, + adContainerViewController: adContainerViewControllerArg), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1186,14 +1313,18 @@ withIdentifier: pigeonIdentifierArg) } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let setAdContainerViewControllerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.setAdContainerViewController", binaryMessenger: binaryMessenger, codec: codec) + let setAdContainerViewControllerChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.setAdContainerViewController", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setAdContainerViewControllerChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdDisplayContainer let controllerArg: UIViewController? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setAdContainerViewController(pigeonApi: api, pigeonInstance: pigeonInstanceArg, controller: controllerArg) + try api.pigeonDelegate.setAdContainerViewController( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, controller: controllerArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1202,13 +1333,17 @@ withIdentifier: pigeonIdentifierArg) } else { setAdContainerViewControllerChannel.setMessageHandler(nil) } - let getAdContainerViewControllerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.getAdContainerViewController", binaryMessenger: binaryMessenger, codec: codec) + let getAdContainerViewControllerChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.getAdContainerViewController", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getAdContainerViewControllerChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdDisplayContainer do { - let result = try api.pigeonDelegate.getAdContainerViewController(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getAdContainerViewController( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -1217,14 +1352,19 @@ withIdentifier: pigeonIdentifierArg) } else { getAdContainerViewControllerChannel.setMessageHandler(nil) } - let registerFriendlyObstructionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.registerFriendlyObstruction", binaryMessenger: binaryMessenger, codec: codec) + let registerFriendlyObstructionChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.registerFriendlyObstruction", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { registerFriendlyObstructionChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdDisplayContainer let friendlyObstructionArg = args[1] as! IMAFriendlyObstruction do { - try api.pigeonDelegate.registerFriendlyObstruction(pigeonApi: api, pigeonInstance: pigeonInstanceArg, friendlyObstruction: friendlyObstructionArg) + try api.pigeonDelegate.registerFriendlyObstruction( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, + friendlyObstruction: friendlyObstructionArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1233,13 +1373,17 @@ withIdentifier: pigeonIdentifierArg) } else { registerFriendlyObstructionChannel.setMessageHandler(nil) } - let unregisterAllFriendlyObstructionsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.unregisterAllFriendlyObstructions", binaryMessenger: binaryMessenger, codec: codec) + let unregisterAllFriendlyObstructionsChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.unregisterAllFriendlyObstructions", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { unregisterAllFriendlyObstructionsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdDisplayContainer do { - try api.pigeonDelegate.unregisterAllFriendlyObstructions(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + try api.pigeonDelegate.unregisterAllFriendlyObstructions( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1251,24 +1395,32 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) - let adContainerArg = try! pigeonDelegate.adContainer(pigeonApi: self, pigeonInstance: pigeonInstance) - let companionSlotsArg = try! pigeonDelegate.companionSlots(pigeonApi: self, pigeonInstance: pigeonInstance) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let adContainerArg = try! pigeonDelegate.adContainer( + pigeonApi: self, pigeonInstance: pigeonInstance) + let companionSlotsArg = try! pigeonDelegate.companionSlots( + pigeonApi: self, pigeonInstance: pigeonInstance) 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) - channel.sendMessage([pigeonIdentifierArg, adContainerArg, companionSlotsArg] as [Any?]) { response in + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMAAdDisplayContainer.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg, adContainerArg, companionSlotsArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -1292,7 +1444,7 @@ protocol 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 @@ -1300,7 +1452,10 @@ 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 } @@ -1308,17 +1463,20 @@ final class PigeonApiUIView: PigeonApiProtocolUIView { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.UIView.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.UIView.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 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)) @@ -1330,21 +1488,25 @@ withIdentifier: pigeonIdentifierArg) } ///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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } else { + 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))) @@ -1375,10 +1537,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 @@ -1386,25 +1550,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: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( + 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] as! Int64 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)) @@ -1413,14 +1585,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] as! Int64 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)) @@ -1432,21 +1608,26 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } else { + 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))) @@ -1464,7 +1645,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( @@ -1475,8 +1659,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))) @@ -1497,13 +1683,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 @@ -1511,25 +1699,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: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( + 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] as! Int64 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)) @@ -1538,14 +1734,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)) @@ -1557,21 +1756,26 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } else { + 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))) @@ -1590,21 +1794,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 @@ -1612,17 +1820,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: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( + 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?] @@ -1630,8 +1846,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)) @@ -1640,7 +1856,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?] @@ -1655,14 +1873,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)) @@ -1671,14 +1892,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)) @@ -1690,21 +1914,26 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } else { + 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))) @@ -1728,7 +1957,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 @@ -1736,26 +1965,34 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } else { + 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))) @@ -1776,13 +2013,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 @@ -1790,17 +2030,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: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( + 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?] @@ -1810,8 +2058,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)) @@ -1823,21 +2073,26 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } else { + 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))) @@ -1856,17 +2111,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 @@ -1874,25 +2136,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: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( + 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] as! Int64 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)) @@ -1904,25 +2175,33 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { + } else { completion( .failure( PigeonError( code: "new-instance-error", - message: "Error: Attempting to create a new Dart instance of IMAAdsLoaderDelegate, but the class has a nonnull callback method.", details: ""))) + message: + "Error: Attempting to create a new Dart instance of IMAAdsLoaderDelegate, but the class has a nonnull callback method.", + details: ""))) } } /// 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( @@ -1933,8 +2212,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))) @@ -1952,7 +2233,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( @@ -1963,8 +2248,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))) @@ -1986,13 +2273,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 @@ -2000,27 +2288,36 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) - let adsManagerArg = try! pigeonDelegate.adsManager(pigeonApi: self, pigeonInstance: pigeonInstance) + } else { + 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))) @@ -2040,13 +2337,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 @@ -2054,27 +2352,35 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } else { + 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))) @@ -2104,7 +2410,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 @@ -2112,30 +2418,39 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } else { + 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) - channel.sendMessage([pigeonIdentifierArg, typeArg, codeArg, messageArg] as [Any?]) { response in + 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))) return @@ -2154,9 +2469,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. @@ -2175,7 +2494,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 @@ -2183,24 +2502,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: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( + 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)) @@ -2209,14 +2537,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)) @@ -2225,7 +2557,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?] @@ -2240,7 +2574,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?] @@ -2255,7 +2591,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?] @@ -2270,7 +2608,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?] @@ -2285,7 +2625,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?] @@ -2300,7 +2642,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?] @@ -2318,21 +2662,26 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } else { + 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))) @@ -2351,21 +2700,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 @@ -2373,25 +2735,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: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( + 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] as! Int64 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)) @@ -2403,25 +2774,33 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { + } else { completion( .failure( PigeonError( code: "new-instance-error", - message: "Error: Attempting to create a new Dart instance of IMAAdsManagerDelegate, but the class has a nonnull callback method.", details: ""))) + message: + "Error: Attempting to create a new Dart instance of IMAAdsManagerDelegate, but the class has a nonnull callback method.", + details: ""))) } } /// 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( @@ -2432,8 +2811,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))) @@ -2451,7 +2832,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( @@ -2462,8 +2847,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))) @@ -2481,7 +2868,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( @@ -2492,8 +2883,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))) @@ -2511,7 +2904,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( @@ -2522,8 +2919,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))) @@ -2553,7 +2952,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 @@ -2561,30 +2960,40 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } else { + 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 @@ -2602,35 +3011,50 @@ final class PigeonApiIMAAdEvent: PigeonApiProtocolIMAAdEvent { } } protocol PigeonApiDelegateIMAAdsRenderingSettings { - func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsRenderingSettings) throws -> IMAAdsRenderingSettings + func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAAdsRenderingSettings) throws + -> IMAAdsRenderingSettings /// If specified, the SDK will play the media with MIME type on the list. - func setMimeTypes(pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, types: [String]?) throws + func setMimeTypes( + pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, + types: [String]?) throws /// Maximum recommended bitrate. /// /// The value is in kbit/s. - func setBitrate(pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, bitrate: Int64) throws + func setBitrate( + pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, + bitrate: Int64) throws /// Timeout (in seconds) when loading a video ad media file. /// /// Use -1 for the default of 8 seconds. - func setLoadVideoTimeout(pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, seconds: Double) throws + func setLoadVideoTimeout( + pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, + seconds: Double) throws /// For VMAP and ad rules playlists, only play ad breaks scheduled after this /// time (in seconds). - func setPlayAdsAfterTime(pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, seconds: Double) throws + func setPlayAdsAfterTime( + pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, + seconds: Double) throws /// Specifies the list of UI elements that should be visible. - func setUIElements(pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, types: [UIElementType]?) throws + func setUIElements( + pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, + types: [UIElementType]?) throws /// Whether or not the SDK will preload ad media. /// /// Default is YES. - func setEnablePreloading(pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, enable: Bool) throws + func setEnablePreloading( + pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, + enable: Bool) throws /// Specifies the optional UIViewController that will be used to open links /// in-app. - func setLinkOpenerPresentingController(pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, controller: UIViewController) throws + func setLinkOpenerPresentingController( + pigeonApi: PigeonApiIMAAdsRenderingSettings, pigeonInstance: IMAAdsRenderingSettings, + controller: UIViewController) throws } 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 @@ -2638,25 +3062,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: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( + 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] as! Int64 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)) @@ -2665,14 +3098,17 @@ withIdentifier: pigeonIdentifierArg) } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let setMimeTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setMimeTypes", binaryMessenger: binaryMessenger, codec: codec) + let setMimeTypesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setMimeTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setMimeTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsRenderingSettings let typesArg: [String]? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setMimeTypes(pigeonApi: api, pigeonInstance: pigeonInstanceArg, types: typesArg) + try api.pigeonDelegate.setMimeTypes( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, types: typesArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2681,14 +3117,17 @@ withIdentifier: pigeonIdentifierArg) } else { setMimeTypesChannel.setMessageHandler(nil) } - let setBitrateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setBitrate", binaryMessenger: binaryMessenger, codec: codec) + let setBitrateChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setBitrate", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setBitrateChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsRenderingSettings let bitrateArg = args[1] as! Int64 do { - try api.pigeonDelegate.setBitrate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, bitrate: bitrateArg) + try api.pigeonDelegate.setBitrate( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, bitrate: bitrateArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2697,14 +3136,17 @@ withIdentifier: pigeonIdentifierArg) } else { setBitrateChannel.setMessageHandler(nil) } - let setLoadVideoTimeoutChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setLoadVideoTimeout", binaryMessenger: binaryMessenger, codec: codec) + let setLoadVideoTimeoutChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setLoadVideoTimeout", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setLoadVideoTimeoutChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsRenderingSettings let secondsArg = args[1] as! Double do { - try api.pigeonDelegate.setLoadVideoTimeout(pigeonApi: api, pigeonInstance: pigeonInstanceArg, seconds: secondsArg) + try api.pigeonDelegate.setLoadVideoTimeout( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, seconds: secondsArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2713,14 +3155,17 @@ withIdentifier: pigeonIdentifierArg) } else { setLoadVideoTimeoutChannel.setMessageHandler(nil) } - let setPlayAdsAfterTimeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setPlayAdsAfterTime", binaryMessenger: binaryMessenger, codec: codec) + let setPlayAdsAfterTimeChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setPlayAdsAfterTime", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setPlayAdsAfterTimeChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsRenderingSettings let secondsArg = args[1] as! Double do { - try api.pigeonDelegate.setPlayAdsAfterTime(pigeonApi: api, pigeonInstance: pigeonInstanceArg, seconds: secondsArg) + try api.pigeonDelegate.setPlayAdsAfterTime( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, seconds: secondsArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2729,14 +3174,17 @@ withIdentifier: pigeonIdentifierArg) } else { setPlayAdsAfterTimeChannel.setMessageHandler(nil) } - let setUIElementsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setUIElements", binaryMessenger: binaryMessenger, codec: codec) + let setUIElementsChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setUIElements", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setUIElementsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsRenderingSettings let typesArg: [UIElementType]? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setUIElements(pigeonApi: api, pigeonInstance: pigeonInstanceArg, types: typesArg) + try api.pigeonDelegate.setUIElements( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, types: typesArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2745,14 +3193,17 @@ withIdentifier: pigeonIdentifierArg) } else { setUIElementsChannel.setMessageHandler(nil) } - let setEnablePreloadingChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setEnablePreloading", binaryMessenger: binaryMessenger, codec: codec) + let setEnablePreloadingChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setEnablePreloading", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setEnablePreloadingChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsRenderingSettings let enableArg = args[1] as! Bool do { - try api.pigeonDelegate.setEnablePreloading(pigeonApi: api, pigeonInstance: pigeonInstanceArg, enable: enableArg) + try api.pigeonDelegate.setEnablePreloading( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, enable: enableArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2761,14 +3212,18 @@ withIdentifier: pigeonIdentifierArg) } else { setEnablePreloadingChannel.setMessageHandler(nil) } - let setLinkOpenerPresentingControllerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setLinkOpenerPresentingController", binaryMessenger: binaryMessenger, codec: codec) + let setLinkOpenerPresentingControllerChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.interactive_media_ads.IMAAdsRenderingSettings.setLinkOpenerPresentingController", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setLinkOpenerPresentingControllerChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMAAdsRenderingSettings let controllerArg = args[1] as! UIViewController do { - try api.pigeonDelegate.setLinkOpenerPresentingController(pigeonApi: api, pigeonInstance: pigeonInstanceArg, controller: controllerArg) + try api.pigeonDelegate.setLinkOpenerPresentingController( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, controller: controllerArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2780,21 +3235,27 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } else { + 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))) @@ -2818,29 +3279,37 @@ 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( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } else { + 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 channelName: String = + "dev.flutter.pigeon.interactive_media_ads.NSObject.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))) @@ -2860,23 +3329,30 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { } protocol PigeonApiDelegateIMAFriendlyObstruction { /// Initializes a friendly obstruction. - func pigeonDefaultConstructor(pigeonApi: PigeonApiIMAFriendlyObstruction, view: UIView, purpose: FriendlyObstructionPurpose, detailedReason: String?) throws -> IMAFriendlyObstruction + func pigeonDefaultConstructor( + pigeonApi: PigeonApiIMAFriendlyObstruction, view: UIView, purpose: FriendlyObstructionPurpose, + detailedReason: String? + ) throws -> IMAFriendlyObstruction /// The view causing the obstruction. - func view(pigeonApi: PigeonApiIMAFriendlyObstruction, pigeonInstance: IMAFriendlyObstruction) throws -> UIView + func view(pigeonApi: PigeonApiIMAFriendlyObstruction, pigeonInstance: IMAFriendlyObstruction) + throws -> UIView /// The purpose for registering the obstruction as friendly. - func purpose(pigeonApi: PigeonApiIMAFriendlyObstruction, pigeonInstance: IMAFriendlyObstruction) throws -> FriendlyObstructionPurpose + func purpose(pigeonApi: PigeonApiIMAFriendlyObstruction, pigeonInstance: IMAFriendlyObstruction) + throws -> FriendlyObstructionPurpose /// Optional, detailed reasoning for registering this obstruction as friendly. /// /// If the detailedReason is not null, it must follow the IAB standard by /// being 50 characters or less and only containing characters A-z, 0-9, or /// spaces. - func detailedReason(pigeonApi: PigeonApiIMAFriendlyObstruction, pigeonInstance: IMAFriendlyObstruction) throws -> String? + func detailedReason( + pigeonApi: PigeonApiIMAFriendlyObstruction, pigeonInstance: IMAFriendlyObstruction + ) throws -> String? } protocol PigeonApiProtocolIMAFriendlyObstruction { } -final class PigeonApiIMAFriendlyObstruction: PigeonApiProtocolIMAFriendlyObstruction { +final class PigeonApiIMAFriendlyObstruction: PigeonApiProtocolIMAFriendlyObstruction { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAFriendlyObstruction ///An implementation of [NSObject] used to access callback methods @@ -2884,17 +3360,26 @@ final class PigeonApiIMAFriendlyObstruction: PigeonApiProtocolIMAFriendlyObstruc return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAFriendlyObstruction) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateIMAFriendlyObstruction + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAFriendlyObstruction?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMAFriendlyObstruction? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMAFriendlyObstruction.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.interactive_media_ads.IMAFriendlyObstruction.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2904,8 +3389,9 @@ final class PigeonApiIMAFriendlyObstruction: PigeonApiProtocolIMAFriendlyObstruc let detailedReasonArg: String? = nilOrValue(args[3]) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, view: viewArg, purpose: purposeArg, detailedReason: detailedReasonArg), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor( + pigeonApi: api, view: viewArg, purpose: purposeArg, detailedReason: detailedReasonArg), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2917,25 +3403,33 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of IMAFriendlyObstruction and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: IMAFriendlyObstruction, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: IMAFriendlyObstruction, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) let viewArg = try! pigeonDelegate.view(pigeonApi: self, pigeonInstance: pigeonInstance) let purposeArg = try! pigeonDelegate.purpose(pigeonApi: self, pigeonInstance: pigeonInstance) - let detailedReasonArg = try! pigeonDelegate.detailedReason(pigeonApi: self, pigeonInstance: pigeonInstance) + let detailedReasonArg = try! pigeonDelegate.detailedReason( + pigeonApi: self, pigeonInstance: pigeonInstance) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAFriendlyObstruction.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg, viewArg, purposeArg, detailedReasonArg] as [Any?]) { response in + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMAFriendlyObstruction.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg, viewArg, purposeArg, detailedReasonArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -2954,9 +3448,11 @@ withIdentifier: pigeonIdentifierArg) } protocol PigeonApiDelegateIMACompanionAd { /// The value for the resource of this companion. - func resourceValue(pigeonApi: PigeonApiIMACompanionAd, pigeonInstance: IMACompanionAd) throws -> String? + func resourceValue(pigeonApi: PigeonApiIMACompanionAd, pigeonInstance: IMACompanionAd) throws + -> String? /// The API needed to execute this ad, or nil if unavailable. - func apiFramework(pigeonApi: PigeonApiIMACompanionAd, pigeonInstance: IMACompanionAd) throws -> String? + func apiFramework(pigeonApi: PigeonApiIMACompanionAd, pigeonInstance: IMACompanionAd) throws + -> String? /// The width of the companion in pixels. /// /// 0 if unavailable. @@ -2970,7 +3466,7 @@ protocol PigeonApiDelegateIMACompanionAd { protocol PigeonApiProtocolIMACompanionAd { } -final class PigeonApiIMACompanionAd: PigeonApiProtocolIMACompanionAd { +final class PigeonApiIMACompanionAd: PigeonApiProtocolIMACompanionAd { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMACompanionAd ///An implementation of [NSObject] used to access callback methods @@ -2978,31 +3474,43 @@ final class PigeonApiIMACompanionAd: PigeonApiProtocolIMACompanionAd { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMACompanionAd) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateIMACompanionAd + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of IMACompanionAd and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: IMACompanionAd, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: IMACompanionAd, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) - let resourceValueArg = try! pigeonDelegate.resourceValue(pigeonApi: self, pigeonInstance: pigeonInstance) - let apiFrameworkArg = try! pigeonDelegate.apiFramework(pigeonApi: self, pigeonInstance: pigeonInstance) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let resourceValueArg = try! pigeonDelegate.resourceValue( + pigeonApi: self, pigeonInstance: pigeonInstance) + let apiFrameworkArg = try! pigeonDelegate.apiFramework( + pigeonApi: self, pigeonInstance: pigeonInstance) let widthArg = try! pigeonDelegate.width(pigeonApi: self, pigeonInstance: pigeonInstance) let heightArg = try! pigeonDelegate.height(pigeonApi: self, pigeonInstance: pigeonInstance) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMACompanionAd.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg, resourceValueArg, apiFrameworkArg, widthArg, heightArg] as [Any?]) { response in + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMACompanionAd.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage( + [pigeonIdentifierArg, resourceValueArg, apiFrameworkArg, widthArg, heightArg] as [Any?] + ) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -3021,42 +3529,57 @@ final class PigeonApiIMACompanionAd: PigeonApiProtocolIMACompanionAd { } protocol PigeonApiDelegateIMACompanionAdSlot { /// Initializes an instance of a IMACompanionAdSlot with fluid size. - func pigeonDefaultConstructor(pigeonApi: PigeonApiIMACompanionAdSlot, view: UIView) throws -> IMACompanionAdSlot + func pigeonDefaultConstructor(pigeonApi: PigeonApiIMACompanionAdSlot, view: UIView) throws + -> IMACompanionAdSlot /// Initializes an instance of a IMACompanionAdSlot with design ad width and /// height. /// /// `width` and `height` are in pixels. - func size(pigeonApi: PigeonApiIMACompanionAdSlot, view: UIView, width: Int64, height: Int64) throws -> IMACompanionAdSlot + func size(pigeonApi: PigeonApiIMACompanionAdSlot, view: UIView, width: Int64, height: Int64) + throws -> IMACompanionAdSlot /// The view the companion will be rendered in. /// /// Display this view in your application before video ad starts. - func view(pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot) throws -> UIView + func view(pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot) throws + -> UIView /// The IMACompanionDelegate for receiving events from the companion ad slot. /// /// This instance only creates a weak reference to the delegate, so the Dart /// instance should create an explicit reference to receive callbacks. - func setDelegate(pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot, delegate: IMACompanionDelegate?) throws - func width(pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot) throws -> Int64 - func height(pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot) throws -> Int64 + func setDelegate( + pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot, + delegate: IMACompanionDelegate?) throws + func width(pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot) throws + -> Int64 + func height(pigeonApi: PigeonApiIMACompanionAdSlot, pigeonInstance: IMACompanionAdSlot) throws + -> Int64 } protocol PigeonApiProtocolIMACompanionAdSlot { } -final class PigeonApiIMACompanionAdSlot: PigeonApiProtocolIMACompanionAdSlot { +final class PigeonApiIMACompanionAdSlot: PigeonApiProtocolIMACompanionAdSlot { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMACompanionAdSlot - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMACompanionAdSlot) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateIMACompanionAdSlot + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMACompanionAdSlot?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMACompanionAdSlot? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -3064,8 +3587,8 @@ final class PigeonApiIMACompanionAdSlot: PigeonApiProtocolIMACompanionAdSlot { let viewArg = args[1] as! UIView do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, view: viewArg), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, view: viewArg), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3074,7 +3597,9 @@ withIdentifier: pigeonIdentifierArg) } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let sizeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.size", binaryMessenger: binaryMessenger, codec: codec) + let sizeChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.size", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { sizeChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -3084,8 +3609,9 @@ withIdentifier: pigeonIdentifierArg) let heightArg = args[3] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.size(pigeonApi: api, view: viewArg, width: widthArg, height: heightArg), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.size( + pigeonApi: api, view: viewArg, width: widthArg, height: heightArg), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3094,14 +3620,17 @@ withIdentifier: pigeonIdentifierArg) } else { sizeChannel.setMessageHandler(nil) } - let setDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.setDelegate", binaryMessenger: binaryMessenger, codec: codec) + let setDelegateChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.setDelegate", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setDelegateChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMACompanionAdSlot let delegateArg: IMACompanionDelegate? = 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)) @@ -3110,13 +3639,16 @@ withIdentifier: pigeonIdentifierArg) } else { setDelegateChannel.setMessageHandler(nil) } - let widthChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.width", binaryMessenger: binaryMessenger, codec: codec) + let widthChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.width", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { widthChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMACompanionAdSlot do { - let result = try api.pigeonDelegate.width(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.width( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -3125,13 +3657,16 @@ withIdentifier: pigeonIdentifierArg) } else { widthChannel.setMessageHandler(nil) } - let heightChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.height", binaryMessenger: binaryMessenger, codec: codec) + let heightChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.height", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { heightChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! IMACompanionAdSlot do { - let result = try api.pigeonDelegate.height(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.height( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -3143,22 +3678,27 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of IMACompanionAdSlot and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: IMACompanionAdSlot, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: IMACompanionAdSlot, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) let viewArg = try! pigeonDelegate.view(pigeonApi: self, pigeonInstance: pigeonInstance) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMACompanionAdSlot.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg, viewArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -3177,18 +3717,23 @@ withIdentifier: pigeonIdentifierArg) } } protocol PigeonApiDelegateIMACompanionDelegate { - func pigeonDefaultConstructor(pigeonApi: PigeonApiIMACompanionDelegate) throws -> IMACompanionDelegate + func pigeonDefaultConstructor(pigeonApi: PigeonApiIMACompanionDelegate) throws + -> IMACompanionDelegate } protocol PigeonApiProtocolIMACompanionDelegate { /// Called when the slot is either filled or not filled. - func companionAdSlotFilled(pigeonInstance pigeonInstanceArg: IMACompanionDelegate, slot slotArg: IMACompanionAdSlot, filled filledArg: Bool, completion: @escaping (Result) -> Void) + func companionAdSlotFilled( + pigeonInstance pigeonInstanceArg: IMACompanionDelegate, slot slotArg: IMACompanionAdSlot, + filled filledArg: Bool, completion: @escaping (Result) -> Void) /// Called when the slot is clicked on by the user and will successfully /// navigate away. - func companionSlotWasClicked(pigeonInstance pigeonInstanceArg: IMACompanionDelegate, slot slotArg: IMACompanionAdSlot, completion: @escaping (Result) -> Void) + func companionSlotWasClicked( + pigeonInstance pigeonInstanceArg: IMACompanionDelegate, slot slotArg: IMACompanionAdSlot, + completion: @escaping (Result) -> Void) } -final class PigeonApiIMACompanionDelegate: PigeonApiProtocolIMACompanionDelegate { +final class PigeonApiIMACompanionDelegate: PigeonApiProtocolIMACompanionDelegate { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMACompanionDelegate ///An implementation of [NSObject] used to access callback methods @@ -3196,25 +3741,34 @@ final class PigeonApiIMACompanionDelegate: PigeonApiProtocolIMACompanionDelegate return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMACompanionDelegate) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateIMACompanionDelegate + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMACompanionDelegate?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiIMACompanionDelegate? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: InteractiveMediaAdsLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.interactive_media_ads.IMACompanionDelegate.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.interactive_media_ads.IMACompanionDelegate.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 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)) @@ -3226,21 +3780,26 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of IMACompanionDelegate and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: IMACompanionDelegate, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: IMACompanionDelegate, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } else { + 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.IMACompanionDelegate.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMACompanionDelegate.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))) @@ -3258,7 +3817,10 @@ withIdentifier: pigeonIdentifierArg) } } /// Called when the slot is either filled or not filled. - func companionAdSlotFilled(pigeonInstance pigeonInstanceArg: IMACompanionDelegate, slot slotArg: IMACompanionAdSlot, filled filledArg: Bool, completion: @escaping (Result) -> Void) { + func companionAdSlotFilled( + pigeonInstance pigeonInstanceArg: IMACompanionDelegate, slot slotArg: IMACompanionAdSlot, + filled filledArg: Bool, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3269,8 +3831,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMACompanionDelegate.companionAdSlotFilled" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMACompanionDelegate.companionAdSlotFilled" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, slotArg, filledArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -3289,7 +3853,10 @@ withIdentifier: pigeonIdentifierArg) /// Called when the slot is clicked on by the user and will successfully /// navigate away. - func companionSlotWasClicked(pigeonInstance pigeonInstanceArg: IMACompanionDelegate, slot slotArg: IMACompanionAdSlot, completion: @escaping (Result) -> Void) { + func companionSlotWasClicked( + pigeonInstance pigeonInstanceArg: IMACompanionDelegate, slot slotArg: IMACompanionAdSlot, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3300,8 +3867,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMACompanionDelegate.companionSlotWasClicked" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMACompanionDelegate.companionSlotWasClicked" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, slotArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -3360,36 +3929,55 @@ protocol PigeonApiDelegateIMAAdPodInfo { protocol PigeonApiProtocolIMAAdPodInfo { } -final class PigeonApiIMAAdPodInfo: PigeonApiProtocolIMAAdPodInfo { +final class PigeonApiIMAAdPodInfo: PigeonApiProtocolIMAAdPodInfo { unowned let pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateIMAAdPodInfo - init(pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateIMAAdPodInfo) { + init( + pigeonRegistrar: InteractiveMediaAdsLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateIMAAdPodInfo + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of IMAAdPodInfo and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: IMAAdPodInfo, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: IMAAdPodInfo, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) - let adPositionArg = try! pigeonDelegate.adPosition(pigeonApi: self, pigeonInstance: pigeonInstance) - let maxDurationArg = try! pigeonDelegate.maxDuration(pigeonApi: self, pigeonInstance: pigeonInstance) - let podIndexArg = try! pigeonDelegate.podIndex(pigeonApi: self, pigeonInstance: pigeonInstance) - let timeOffsetArg = try! pigeonDelegate.timeOffset(pigeonApi: self, pigeonInstance: pigeonInstance) - let totalAdsArg = try! pigeonDelegate.totalAds(pigeonApi: self, pigeonInstance: pigeonInstance) - let isBumperArg = try! pigeonDelegate.isBumper(pigeonApi: self, pigeonInstance: pigeonInstance) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let adPositionArg = try! pigeonDelegate.adPosition( + pigeonApi: self, pigeonInstance: pigeonInstance) + let maxDurationArg = try! pigeonDelegate.maxDuration( + pigeonApi: self, pigeonInstance: pigeonInstance) + let podIndexArg = try! pigeonDelegate.podIndex( + pigeonApi: self, pigeonInstance: pigeonInstance) + let timeOffsetArg = try! pigeonDelegate.timeOffset( + pigeonApi: self, pigeonInstance: pigeonInstance) + let totalAdsArg = try! pigeonDelegate.totalAds( + pigeonApi: self, pigeonInstance: pigeonInstance) + let isBumperArg = try! pigeonDelegate.isBumper( + pigeonApi: self, pigeonInstance: pigeonInstance) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.interactive_media_ads.IMAAdPodInfo.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg, adPositionArg, maxDurationArg, podIndexArg, timeOffsetArg, totalAdsArg, isBumperArg] as [Any?]) { response in + let channelName: String = + "dev.flutter.pigeon.interactive_media_ads.IMAAdPodInfo.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage( + [ + pigeonIdentifierArg, adPositionArg, maxDurationArg, podIndexArg, timeOffsetArg, + totalAdsArg, isBumperArg, + ] as [Any?] + ) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return diff --git a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/ViewProxyAPIDelegate.swift b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/ViewProxyAPIDelegate.swift index 6d7c4645708..a06353c3583 100644 --- a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/ViewProxyAPIDelegate.swift +++ b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/ViewProxyAPIDelegate.swift @@ -9,7 +9,7 @@ import UIKit /// /// 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 ViewProxyAPIDelegate: PigeonApiDelegateUIView { +class ViewProxyAPIDelegate: PigeonApiDelegateUIView { func pigeonDefaultConstructor(pigeonApi: PigeonApiUIView) throws -> UIView { return UIView() } 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 46df757f668..4c4aed56752 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,14 +1,15 @@ // 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 (v25.3.1), do not edit directly. +// Autogenerated from Pigeon (v25.3.2), 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; @@ -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. /// @@ -110,9 +113,10 @@ class PigeonInstanceManager { // by calling instanceManager.getIdentifier() inside of `==` while this was a // HashMap). final Expando _identifiers = Expando(); - final Map> _weakInstances = - >{}; - final Map _strongInstances = {}; + final Map> + _weakInstances = >{}; + final Map _strongInstances = + {}; late final Finalizer _finalizer; int _nextIdentifier = 0; @@ -122,7 +126,8 @@ class PigeonInstanceManager { static PigeonInstanceManager _initInstance() { WidgetsFlutterBinding.ensureInitialized(); - final _PigeonInternalInstanceManagerApi api = _PigeonInternalInstanceManagerApi(); + final _PigeonInternalInstanceManagerApi api = + _PigeonInternalInstanceManagerApi(); // Clears the native `PigeonInstanceManager` on the initial use of the Dart one. api.clear(); final PigeonInstanceManager instanceManager = PigeonInstanceManager( @@ -130,40 +135,72 @@ class PigeonInstanceManager { api.removeStrongReference(identifier); }, ); - _PigeonInternalInstanceManagerApi.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); + _PigeonInternalInstanceManagerApi.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); - AdsRenderingSettings.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - AdProgressInfo.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - CompanionAd.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - UniversalAdId.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); + AdsRenderingSettings.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + AdProgressInfo.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + CompanionAd.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + UniversalAdId.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); Ad.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - CompanionAdSlotClickListener.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - CompanionAdSlot.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + CompanionAdSlotClickListener.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + CompanionAdSlot.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); return instanceManager; } @@ -176,8 +213,17 @@ class PigeonInstanceManager { /// /// Returns the randomly generated id of the [instance] added. int addDartCreatedInstance(PigeonInternalProxyApiBaseClass instance) { + assert(getIdentifier(instance) == null); + final int identifier = _nextUniqueIdentifier(); - _addInstanceWithIdentifier(instance, identifier); + _identifiers[instance] = identifier; + _weakInstances[identifier] = + WeakReference(instance); + _finalizer.attach(instance, identifier, detach: instance); + + final PigeonInternalProxyApiBaseClass copy = instance.pigeon_copy(); + _identifiers[copy] = identifier; + _strongInstances[identifier] = copy; return identifier; } @@ -209,9 +255,15 @@ class PigeonInstanceManager { /// it was removed. Returns `null` if [identifier] was not associated with /// any strong reference. /// - /// This does not remove the weak referenced instance associated with - /// [identifier]. This can be done with [removeWeakReference]. + /// Throws an `AssertionError` if the weak referenced instance associated with + /// [identifier] is not removed first. This can be done with + /// [removeWeakReference]. T? remove(int identifier) { + final T? instance = _weakInstances[identifier]?.target as T?; + assert( + instance == null, + 'A strong instance with identifier $identifier is being removed despite the weak reference still existing: $instance', + ); return _strongInstances.remove(identifier) as T?; } @@ -227,15 +279,20 @@ 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 PigeonInternalProxyApiBaseClass? weakInstance = _weakInstances[identifier]?.target; + T? getInstanceWithWeakReference( + int identifier) { + final PigeonInternalProxyApiBaseClass? weakInstance = + _weakInstances[identifier]?.target; if (weakInstance == null) { - final PigeonInternalProxyApiBaseClass? strongInstance = _strongInstances[identifier]; + final PigeonInternalProxyApiBaseClass? strongInstance = + _strongInstances[identifier]; if (strongInstance != null) { - final PigeonInternalProxyApiBaseClass copy = strongInstance.pigeon_copy(); + final PigeonInternalProxyApiBaseClass 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; } @@ -257,24 +314,14 @@ class PigeonInstanceManager { /// /// Throws assertion error if the instance or its identifier has already been /// added. - /// - /// Returns unique identifier of the [instance] added. - void addHostCreatedInstance(PigeonInternalProxyApiBaseClass instance, int identifier) { - _addInstanceWithIdentifier(instance, identifier); - } - - void _addInstanceWithIdentifier(PigeonInternalProxyApiBaseClass instance, int identifier) { + void addHostCreatedInstance( + PigeonInternalProxyApiBaseClass instance, int identifier) { assert(!containsIdentifier(identifier)); assert(getIdentifier(instance) == null); assert(identifier >= 0); _identifiers[instance] = identifier; - _weakInstances[identifier] = WeakReference(instance); - _finalizer.attach(instance, identifier, detach: instance); - - final PigeonInternalProxyApiBaseClass copy = instance.pigeon_copy(); - _identifiers[copy] = identifier; - _strongInstances[identifier] = copy; + _strongInstances[identifier] = instance; } /// Whether this manager contains the given [identifier]. @@ -396,29 +443,29 @@ class _PigeonInternalInstanceManagerApi { } class _PigeonInternalProxyApiBaseCodec extends _PigeonCodec { - const _PigeonInternalProxyApiBaseCodec(this.instanceManager); - final PigeonInstanceManager instanceManager; - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is PigeonInternalProxyApiBaseClass) { - 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 _PigeonInternalProxyApiBaseCodec(this.instanceManager); + final PigeonInstanceManager instanceManager; + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is PigeonInternalProxyApiBaseClass) { + 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. /// @@ -426,56 +473,79 @@ class _PigeonInternalProxyApiBaseCodec 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, } @@ -486,8 +556,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, } @@ -498,61 +570,88 @@ 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, } @@ -563,13 +662,14 @@ enum AdEventType { enum UiElement { /// The ad attribution UI element, for example, "Ad". adAttribution, + /// Ad attribution is required for a countdown timer to be displayed. countdown, + /// The element is not recognized by this wrapper. unknown, } - class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -577,16 +677,16 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is AdErrorCode) { + } else 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 if (value is UiElement) { + } else if (value is UiElement) { buffer.putUint8(132); writeValue(buffer, value.index); } else { @@ -597,16 +697,16 @@ 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]; - case 132: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : UiElement.values[value]; default: @@ -614,6 +714,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. @@ -7048,4 +7149,3 @@ class CompanionAdSlot extends PigeonInternalProxyApiBaseClass { ); } } - 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 e2bc816a986..622941f9836 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 @@ -1,14 +1,15 @@ // 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 (v25.3.1), do not edit directly. +// Autogenerated from Pigeon (v25.3.2), 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; @@ -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. /// @@ -110,9 +113,10 @@ class PigeonInstanceManager { // by calling instanceManager.getIdentifier() inside of `==` while this was a // HashMap). final Expando _identifiers = Expando(); - final Map> _weakInstances = - >{}; - final Map _strongInstances = {}; + final Map> + _weakInstances = >{}; + final Map _strongInstances = + {}; late final Finalizer _finalizer; int _nextIdentifier = 0; @@ -122,7 +126,8 @@ class PigeonInstanceManager { static PigeonInstanceManager _initInstance() { WidgetsFlutterBinding.ensureInitialized(); - final _PigeonInternalInstanceManagerApi api = _PigeonInternalInstanceManagerApi(); + final _PigeonInternalInstanceManagerApi api = + _PigeonInternalInstanceManagerApi(); // Clears the native `PigeonInstanceManager` on the initial use of the Dart one. api.clear(); final PigeonInstanceManager instanceManager = PigeonInstanceManager( @@ -130,28 +135,49 @@ class PigeonInstanceManager { api.removeStrongReference(identifier); }, ); - _PigeonInternalInstanceManagerApi.setUpMessageHandlers(instanceManager: instanceManager); - IMAAdDisplayContainer.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + _PigeonInternalInstanceManagerApi.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); - IMAFriendlyObstruction.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - IMACompanionAd.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - IMACompanionAdSlot.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - IMACompanionDelegate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - IMAAdPodInfo.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); + IMAFriendlyObstruction.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + IMACompanionAd.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + IMACompanionAdSlot.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + IMACompanionDelegate.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + IMAAdPodInfo.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); return instanceManager; } @@ -164,8 +190,17 @@ class PigeonInstanceManager { /// /// Returns the randomly generated id of the [instance] added. int addDartCreatedInstance(PigeonInternalProxyApiBaseClass instance) { + assert(getIdentifier(instance) == null); + final int identifier = _nextUniqueIdentifier(); - _addInstanceWithIdentifier(instance, identifier); + _identifiers[instance] = identifier; + _weakInstances[identifier] = + WeakReference(instance); + _finalizer.attach(instance, identifier, detach: instance); + + final PigeonInternalProxyApiBaseClass copy = instance.pigeon_copy(); + _identifiers[copy] = identifier; + _strongInstances[identifier] = copy; return identifier; } @@ -197,9 +232,15 @@ class PigeonInstanceManager { /// it was removed. Returns `null` if [identifier] was not associated with /// any strong reference. /// - /// This does not remove the weak referenced instance associated with - /// [identifier]. This can be done with [removeWeakReference]. + /// Throws an `AssertionError` if the weak referenced instance associated with + /// [identifier] is not removed first. This can be done with + /// [removeWeakReference]. T? remove(int identifier) { + final T? instance = _weakInstances[identifier]?.target as T?; + assert( + instance == null, + 'A strong instance with identifier $identifier is being removed despite the weak reference still existing: $instance', + ); return _strongInstances.remove(identifier) as T?; } @@ -215,15 +256,20 @@ 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 PigeonInternalProxyApiBaseClass? weakInstance = _weakInstances[identifier]?.target; + T? getInstanceWithWeakReference( + int identifier) { + final PigeonInternalProxyApiBaseClass? weakInstance = + _weakInstances[identifier]?.target; if (weakInstance == null) { - final PigeonInternalProxyApiBaseClass? strongInstance = _strongInstances[identifier]; + final PigeonInternalProxyApiBaseClass? strongInstance = + _strongInstances[identifier]; if (strongInstance != null) { - final PigeonInternalProxyApiBaseClass copy = strongInstance.pigeon_copy(); + final PigeonInternalProxyApiBaseClass 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; } @@ -245,24 +291,14 @@ class PigeonInstanceManager { /// /// Throws assertion error if the instance or its identifier has already been /// added. - /// - /// Returns unique identifier of the [instance] added. - void addHostCreatedInstance(PigeonInternalProxyApiBaseClass instance, int identifier) { - _addInstanceWithIdentifier(instance, identifier); - } - - void _addInstanceWithIdentifier(PigeonInternalProxyApiBaseClass instance, int identifier) { + void addHostCreatedInstance( + PigeonInternalProxyApiBaseClass instance, int identifier) { assert(!containsIdentifier(identifier)); assert(getIdentifier(instance) == null); assert(identifier >= 0); _identifiers[instance] = identifier; - _weakInstances[identifier] = WeakReference(instance); - _finalizer.attach(instance, identifier, detach: instance); - - final PigeonInternalProxyApiBaseClass copy = instance.pigeon_copy(); - _identifiers[copy] = identifier; - _strongInstances[identifier] = copy; + _strongInstances[identifier] = instance; } /// Whether this manager contains the given [identifier]. @@ -384,29 +420,29 @@ class _PigeonInternalInstanceManagerApi { } class _PigeonInternalProxyApiBaseCodec extends _PigeonCodec { - const _PigeonInternalProxyApiBaseCodec(this.instanceManager); - final PigeonInstanceManager instanceManager; - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is PigeonInternalProxyApiBaseClass) { - 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 _PigeonInternalProxyApiBaseCodec(this.instanceManager); + final PigeonInstanceManager instanceManager; + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is PigeonInternalProxyApiBaseClass) { + 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. /// @@ -414,8 +450,10 @@ class _PigeonInternalProxyApiBaseCodec 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 @@ -429,58 +467,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, } @@ -491,53 +552,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, } @@ -549,12 +634,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, @@ -566,12 +654,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, @@ -586,20 +677,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, } @@ -612,6 +708,7 @@ enum FriendlyObstructionPurpose { closeAd, notVisible, other, + /// The purpose type is not recognized by this wrapper. unknown, } @@ -622,13 +719,14 @@ enum FriendlyObstructionPurpose { enum UIElementType { /// Ad attribution UI element. adAttribution, + /// Ad countdown element. countdown, + /// The element is not recognized by this wrapper. unknown, } - class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -636,28 +734,28 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is AdErrorType) { + } else 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 if (value is FriendlyObstructionPurpose) { + } else if (value is FriendlyObstructionPurpose) { buffer.putUint8(135); writeValue(buffer, value.index); - } else if (value is UIElementType) { + } else if (value is UIElementType) { buffer.putUint8(136); writeValue(buffer, value.index); } else { @@ -668,28 +766,28 @@ 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]; - case 135: + case 135: final int? value = readValue(buffer) as int?; return value == null ? null : FriendlyObstructionPurpose.values[value]; - case 136: + case 136: final int? value = readValue(buffer) as int?; return value == null ? null : UIElementType.values[value]; default: @@ -697,6 +795,7 @@ class _PigeonCodec extends StandardMessageCodec { } } } + /// The `IMAAdDisplayContainer` is responsible for managing the ad container /// view and companion ad slots used for ad playback. /// @@ -4442,4 +4541,3 @@ class IMAAdPodInfo extends PigeonInternalProxyApiBaseClass { ); } } - diff --git a/packages/interactive_media_ads/pubspec.yaml b/packages/interactive_media_ads/pubspec.yaml index 69a19874a87..0829e616937 100644 --- a/packages/interactive_media_ads/pubspec.yaml +++ b/packages/interactive_media_ads/pubspec.yaml @@ -31,7 +31,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: ^25.3.1 + pigeon: ^25.3.2 topics: - ads From 50ff6c40b5a4bc206fcdf813a0926c05730a4079 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 19 May 2025 21:08:27 -0400 Subject: [PATCH 14/37] quality update --- .../BaseDisplayContainerProxyApiTest.kt | 4 ++++ .../ios/Flutter/AppFrameworkInfo.plist | 2 +- .../interactive_media_ads/example/ios/Podfile | 2 +- .../ios/Runner.xcodeproj/project.pbxproj | 24 +++---------------- .../xcshareddata/xcschemes/Runner.xcscheme | 2 -- .../lib/src/ad_display_container.dart | 2 +- .../android/android_companion_ad_slot.dart | 6 +++++ .../lib/src/companion_ad_slot.dart | 2 +- .../pigeons/interactive_media_ads_ios.dart | 2 ++ 9 files changed, 19 insertions(+), 27 deletions(-) diff --git a/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApiTest.kt b/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApiTest.kt index 5fa43bfafcd..d161130d895 100644 --- a/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApiTest.kt +++ b/packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApiTest.kt @@ -1,3 +1,7 @@ +// 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. + package dev.flutter.packages.interactive_media_ads import com.google.ads.interactivemedia.v3.api.BaseDisplayContainer diff --git a/packages/interactive_media_ads/example/ios/Flutter/AppFrameworkInfo.plist b/packages/interactive_media_ads/example/ios/Flutter/AppFrameworkInfo.plist index 1dc6cf7652b..7c569640062 100644 --- a/packages/interactive_media_ads/example/ios/Flutter/AppFrameworkInfo.plist +++ b/packages/interactive_media_ads/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 13.0 + 12.0 diff --git a/packages/interactive_media_ads/example/ios/Podfile b/packages/interactive_media_ads/example/ios/Podfile index 620e46eba60..e549ee22f3b 100644 --- a/packages/interactive_media_ads/example/ios/Podfile +++ b/packages/interactive_media_ads/example/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '13.0' +# platform :ios, '12.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj b/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj index 2d59d1465c7..ca9d6c51cf6 100644 --- a/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj @@ -253,7 +253,6 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 6B692542E00F08BF9516F3A1 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -369,23 +368,6 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; - 6B692542E00F08BF9516F3A1 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 8BF613E92E45E672229E9718 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -534,7 +516,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -664,7 +646,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -715,7 +697,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/packages/interactive_media_ads/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/interactive_media_ads/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index c3fedb29c99..d795332e1b7 100644 --- a/packages/interactive_media_ads/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/interactive_media_ads/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -44,7 +44,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit" shouldUseLaunchSchemeArgsEnv = "YES"> _adSlotFuture; + @internal Future getNativeCompanionAdSlot() => _adSlotFuture; Future _initCompanionAdSlot() async { diff --git a/packages/interactive_media_ads/lib/src/companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/companion_ad_slot.dart index fd8420aee5c..76a427f8257 100644 --- a/packages/interactive_media_ads/lib/src/companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/companion_ad_slot.dart @@ -6,7 +6,7 @@ import 'package:flutter/material.dart'; import 'platform_interface/platform_interface.dart'; -/// A [Widget] for displaying loaded ads. +/// Ad slot for companion ads. /// /// ## Platform-Specific Features /// This class contains an underlying implementation provided by the current 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 8623191ed06..dbc1a96bd89 100644 --- a/packages/interactive_media_ads/pigeons/interactive_media_ads_ios.dart +++ b/packages/interactive_media_ads/pigeons/interactive_media_ads_ios.dart @@ -657,8 +657,10 @@ abstract class IMACompanionAdSlot { /// instance should create an explicit reference to receive callbacks. void setDelegate(IMACompanionDelegate? delegate); + /// Width of the slot, in pixels. int width(); + /// Height of the slot, in pixels. int height(); } From 6b303ffcbd5702d296661ee9bc50cd12339ab2e4 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 19 May 2025 21:46:04 -0400 Subject: [PATCH 15/37] analyze errors --- .../interactive_media_ads/lib/src/ad_display_container.dart | 1 - .../lib/src/android/android_companion_ad_slot.dart | 2 ++ .../lib/src/ios/ios_companion_ad_slot.dart | 3 ++- .../src/platform_interface/platform_ad_display_container.dart | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/interactive_media_ads/lib/src/ad_display_container.dart b/packages/interactive_media_ads/lib/src/ad_display_container.dart index d53148f9007..df631ca1914 100644 --- a/packages/interactive_media_ads/lib/src/ad_display_container.dart +++ b/packages/interactive_media_ads/lib/src/ad_display_container.dart @@ -5,7 +5,6 @@ import 'package:flutter/cupertino.dart'; import 'companion_ad_slot.dart'; -import 'platform_interface/platform_ad_display_container.dart'; import 'platform_interface/platform_interface.dart'; /// A [Widget] for displaying loaded ads. diff --git a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart index 534f90b27f2..5d7a93776ce 100644 --- a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart @@ -73,6 +73,7 @@ final class AndroidCompanionAdSlotCreationParams final PlatformViewsServiceProxy _platformViewsProxy; } +/// Android implementation of [PlatformCompanionAdSlot]. base class AndroidCompanionAdSlot extends PlatformCompanionAdSlot { /// Constructs an [AndroidCompanionAdSlot]. AndroidCompanionAdSlot(super.params) : super.implementation() { @@ -87,6 +88,7 @@ base class AndroidCompanionAdSlot extends PlatformCompanionAdSlot { late final Future _adSlotFuture; + /// The future returning the native CompanionAdSlot. @internal Future getNativeCompanionAdSlot() => _adSlotFuture; diff --git a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart index 673900a2286..6263cfecfd7 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart @@ -11,7 +11,7 @@ import '../platform_interface/platform_companion_ad_slot.dart'; import 'interactive_media_ads.g.dart'; import 'interactive_media_ads_proxy.dart'; -/// iOS implementation of [PlatformCompanionAdSlotCreationParams]. +/// Implementation of [PlatformCompanionAdSlotCreationParams] for iOS. final class IOSCompanionAdSlotCreationParams extends PlatformCompanionAdSlotCreationParams { /// Constructs a [IOSCompanionAdSlotCreationParams]. @@ -61,6 +61,7 @@ final class IOSCompanionAdSlotCreationParams final InteractiveMediaAdsProxy _proxy; } +/// Implementation of [PlatformCompanionAdSlot] for iOS. base class IOSCompanionAdSlot extends PlatformCompanionAdSlot { /// Constructs an [IOSCompanionAdSlot]. IOSCompanionAdSlot(super.params) : super.implementation(); diff --git a/packages/interactive_media_ads/lib/src/platform_interface/platform_ad_display_container.dart b/packages/interactive_media_ads/lib/src/platform_interface/platform_ad_display_container.dart index cb3bf632dfa..9478afbacb3 100644 --- a/packages/interactive_media_ads/lib/src/platform_interface/platform_ad_display_container.dart +++ b/packages/interactive_media_ads/lib/src/platform_interface/platform_ad_display_container.dart @@ -63,6 +63,7 @@ base class PlatformAdDisplayContainerCreationParams { /// The layout direction to use for the embedded AdDisplayContainer. final TextDirection layoutDirection; + /// List of companion ad slots. final Iterable companionSlots; } From 6b92bbe9d85f8dd6342abbf84aafbad795a2dc3f Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 19 May 2025 21:47:07 -0400 Subject: [PATCH 16/37] missing docs --- packages/interactive_media_ads/lib/src/ad_display_container.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/interactive_media_ads/lib/src/ad_display_container.dart b/packages/interactive_media_ads/lib/src/ad_display_container.dart index df631ca1914..639769a3fce 100644 --- a/packages/interactive_media_ads/lib/src/ad_display_container.dart +++ b/packages/interactive_media_ads/lib/src/ad_display_container.dart @@ -101,6 +101,7 @@ class AdDisplayContainer extends StatelessWidget { void Function(PlatformAdDisplayContainer container) get onContainerAdded => platform.params.onContainerAdded; + /// List of companion ad slots. Iterable get companionAds => platform.params.companionSlots.map( (PlatformCompanionAdSlot slot) => CompanionAdSlot.fromPlatform(slot), From 65ad93461825ba15ea74dc8228fd060ca0c75062 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 19 May 2025 21:57:08 -0400 Subject: [PATCH 17/37] change style --- .../android/android_companion_ad_slot.dart | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart index 5d7a93776ce..8b8d4be456a 100644 --- a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart @@ -77,7 +77,7 @@ final class AndroidCompanionAdSlotCreationParams base class AndroidCompanionAdSlot extends PlatformCompanionAdSlot { /// Constructs an [AndroidCompanionAdSlot]. AndroidCompanionAdSlot(super.params) : super.implementation() { - _initCompanionAdSlot(); + _adSlotFuture = _initCompanionAdSlot(); } late final AndroidCompanionAdSlotCreationParams _androidParams = @@ -92,19 +92,6 @@ base class AndroidCompanionAdSlot extends PlatformCompanionAdSlot { @internal Future getNativeCompanionAdSlot() => _adSlotFuture; - Future _initCompanionAdSlot() async { - _adSlotFuture = - _androidParams._proxy.instanceImaSdkFactory().createCompanionAdSlot(); - final ima.CompanionAdSlot adSlot = await _adSlotFuture; - - await adSlot.setContainer(_frameLayout); - if (_androidParams.isFluid) { - await adSlot.setFluidSize(); - } else { - await adSlot.setSize(params.width!, params.height!); - } - } - @override Widget buildWidget(BuildWidgetCreationParams params) { return AndroidViewWidget( @@ -130,4 +117,19 @@ base class AndroidCompanionAdSlot extends PlatformCompanionAdSlot { .fromPlatformCompanionAdSlotCreationParamsSize(params); } } + + Future _initCompanionAdSlot() async { + final ima.CompanionAdSlot adSlot = await _androidParams._proxy + .instanceImaSdkFactory() + .createCompanionAdSlot(); + + await adSlot.setContainer(_frameLayout); + if (_androidParams.isFluid) { + await adSlot.setFluidSize(); + } else { + await adSlot.setSize(params.width!, params.height!); + } + + return adSlot; + } } From dd6b2d49abb31238aba85c8bd739b2a557e34191 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 20 May 2025 13:42:19 -0400 Subject: [PATCH 18/37] add onclicked --- .../android/android_companion_ad_slot.dart | 21 ++++++++++-- .../android/interactive_media_ads_proxy.dart | 6 ++++ .../lib/src/companion_ad_slot.dart | 12 +++++-- .../src/ios/interactive_media_ads_proxy.dart | 12 ++++++- .../lib/src/ios/ios_companion_ad_slot.dart | 34 +++++++++++++++---- .../platform_companion_ad_slot.dart | 7 +++- 6 files changed, 79 insertions(+), 13 deletions(-) diff --git a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart index 8b8d4be456a..a7fb51457a0 100644 --- a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:nativewrappers/_internal/vm/lib/ffi_allocation_patch.dart'; + import 'package:flutter/cupertino.dart'; import 'package:meta/meta.dart'; @@ -19,6 +21,7 @@ final class AndroidCompanionAdSlotCreationParams const AndroidCompanionAdSlotCreationParams.size({ required super.width, required super.height, + super.onClicked, @visibleForTesting InteractiveMediaAdsProxy? proxy, @visibleForTesting PlatformViewsServiceProxy? platformViewsProxy, }) : _proxy = proxy ?? const InteractiveMediaAdsProxy(), @@ -28,6 +31,7 @@ final class AndroidCompanionAdSlotCreationParams /// Constructs a [AndroidCompanionAdSlotCreationParams]. const AndroidCompanionAdSlotCreationParams.fluid({ + super.onClicked, @visibleForTesting InteractiveMediaAdsProxy? proxy, @visibleForTesting PlatformViewsServiceProxy? platformViewsProxy, }) : _proxy = proxy ?? const InteractiveMediaAdsProxy(), @@ -48,6 +52,7 @@ final class AndroidCompanionAdSlotCreationParams return AndroidCompanionAdSlotCreationParams.size( width: params.width!, height: params.height!, + onClicked: params.onClicked, proxy: proxy, platformViewsProxy: platformViewsProxy, ); @@ -58,12 +63,12 @@ final class AndroidCompanionAdSlotCreationParams factory AndroidCompanionAdSlotCreationParams.fromPlatformCompanionAdSlotCreationParamsFluid( // Placeholder to prevent requiring a breaking change if params are added to // PlatformCompanionAdSlotCreationParams. - // ignore: avoid_unused_constructor_parameters PlatformCompanionAdSlotCreationParams params, { @visibleForTesting InteractiveMediaAdsProxy? proxy, @visibleForTesting PlatformViewsServiceProxy? platformViewsProxy, }) { return AndroidCompanionAdSlotCreationParams.fluid( + onClicked: params.onClicked, proxy: proxy, platformViewsProxy: platformViewsProxy, ); @@ -83,6 +88,7 @@ base class AndroidCompanionAdSlot extends PlatformCompanionAdSlot { late final AndroidCompanionAdSlotCreationParams _androidParams = _initAndroidParams(params); + // ViewGroup used to display the Ad. late final ima.ViewGroup _frameLayout = _androidParams._proxy.newFrameLayout(); @@ -124,12 +130,23 @@ base class AndroidCompanionAdSlot extends PlatformCompanionAdSlot { .createCompanionAdSlot(); await adSlot.setContainer(_frameLayout); - if (_androidParams.isFluid) { + if (params.isFluid) { await adSlot.setFluidSize(); } else { await adSlot.setSize(params.width!, params.height!); } + if (params.onClicked != null) { + await adSlot.addClickListener( + _androidParams._proxy.newCompanionAdSlotClickListener( + onCompanionAdClick: (_) { + // TODO: + params.onClicked!.call(); + }, + ), + ); + } + return adSlot; } } diff --git a/packages/interactive_media_ads/lib/src/android/interactive_media_ads_proxy.dart b/packages/interactive_media_ads/lib/src/android/interactive_media_ads_proxy.dart index 7aa120654e8..e2349ec2fa8 100644 --- a/packages/interactive_media_ads/lib/src/android/interactive_media_ads_proxy.dart +++ b/packages/interactive_media_ads/lib/src/android/interactive_media_ads_proxy.dart @@ -24,6 +24,7 @@ class InteractiveMediaAdsProxy { this.newAdsLoadedListener = AdsLoadedListener.new, this.newAdErrorListener = AdErrorListener.new, this.newAdEventListener = AdEventListener.new, + this.newCompanionAdSlotClickListener = CompanionAdSlotClickListener.new, this.createAdDisplayContainerImaSdkFactory = ImaSdkFactory.createAdDisplayContainer, this.instanceImaSdkFactory = _instanceImaSdkFactory, @@ -77,6 +78,11 @@ class InteractiveMediaAdsProxy { required void Function(AdEventListener, AdEvent) onAdEvent, }) newAdEventListener; + /// Constructs [CompanionAdSlotClickListener]. + final CompanionAdSlotClickListener Function({ + required void Function(CompanionAdSlotClickListener) onCompanionAdClick, + }) newCompanionAdSlotClickListener; + /// Calls to [ImaSdkFactory.createAdDisplayContainer]. final Future Function(ViewGroup, VideoAdPlayer) createAdDisplayContainerImaSdkFactory; diff --git a/packages/interactive_media_ads/lib/src/companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/companion_ad_slot.dart index 76a427f8257..9a7cacdd76d 100644 --- a/packages/interactive_media_ads/lib/src/companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/companion_ad_slot.dart @@ -36,10 +36,12 @@ class CompanionAdSlot { CompanionAdSlot.size({ required int width, required int height, + void Function()? onClicked, }) : this.fromPlatformCreationParams( params: PlatformCompanionAdSlotCreationParams.size( width: width, height: height, + onClicked: onClicked, ), ); @@ -47,9 +49,11 @@ class CompanionAdSlot { /// /// See [CompanionAdSlot.fromPlatformCreationParams] for setting parameters /// for a specific platform. - CompanionAdSlot.fluid() + CompanionAdSlot.fluid({void Function()? onClicked}) : this.fromPlatformCreationParams( - params: const PlatformCompanionAdSlotCreationParams.fluid(), + params: PlatformCompanionAdSlotCreationParams.fluid( + onClicked: onClicked, + ), ); /// Constructs an [CompanionAdSlot] from creation params for a specific platform. @@ -89,6 +93,10 @@ class CompanionAdSlot { /// Implementation of [PlatformCompanionAdSlot] for the current platform. final PlatformCompanionAdSlot platform; + /// Called when the slot is clicked on by the user and will successfully + /// navigate away. + void Function()? get onClicked => platform.params.onClicked; + /// Builds the Widget that contains the native View. Widget buildWidget(BuildContext context) { return platform.buildWidget(BuildWidgetCreationParams(context: context)); diff --git a/packages/interactive_media_ads/lib/src/ios/interactive_media_ads_proxy.dart b/packages/interactive_media_ads/lib/src/ios/interactive_media_ads_proxy.dart index a28810f9b0e..3acc304a261 100644 --- a/packages/interactive_media_ads/lib/src/ios/interactive_media_ads_proxy.dart +++ b/packages/interactive_media_ads/lib/src/ios/interactive_media_ads_proxy.dart @@ -101,5 +101,15 @@ class InteractiveMediaAdsProxy { }) sizeIMACompanionAdSlot; /// Constructs [IMACompanionDelegate]. - final IMACompanionDelegate Function() newIMACompanionDelegate; + final IMACompanionDelegate Function({ + void Function( + IMACompanionDelegate, + IMACompanionAdSlot, + bool, + )? companionAdSlotFilled, + void Function( + IMACompanionDelegate, + IMACompanionAdSlot, + )? companionSlotWasClicked, + }) newIMACompanionDelegate; } diff --git a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart index 6263cfecfd7..957c9266d8a 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:nativewrappers/_internal/vm/lib/ffi_allocation_patch.dart'; + import 'package:flutter/cupertino.dart'; import 'package:flutter/services.dart'; import 'package:meta/meta.dart'; @@ -69,17 +71,12 @@ base class IOSCompanionAdSlot extends PlatformCompanionAdSlot { late final IOSCompanionAdSlotCreationParams _iosParams = _initIOSParams(params); + // View used to display the Ad. late final UIView _view = _iosParams._proxy.newUIView(); /// The native iOS IMACompanionAdSlot. @internal - late final IMACompanionAdSlot nativeCompanionAdSlot = _iosParams.isFluid - ? _iosParams._proxy.newIMACompanionAdSlot(view: _view) - : _iosParams._proxy.sizeIMACompanionAdSlot( - view: _view, - width: _iosParams.width!, - height: _iosParams.height!, - ); + late final IMACompanionAdSlot nativeCompanionAdSlot = _initCompanionAdSlot(); @override Widget buildWidget(BuildWidgetCreationParams params) { @@ -107,4 +104,27 @@ base class IOSCompanionAdSlot extends PlatformCompanionAdSlot { .fromPlatformCompanionAdSlotCreationParamsSize(params); } } + + IMACompanionAdSlot _initCompanionAdSlot() { + final IMACompanionAdSlot adSlot = params.isFluid + ? _iosParams._proxy.newIMACompanionAdSlot(view: _view) + : _iosParams._proxy.sizeIMACompanionAdSlot( + view: _view, + width: _iosParams.width!, + height: _iosParams.height!, + ); + + if (params.onClicked != null) { + adSlot.setDelegate( + _iosParams._proxy.newIMACompanionDelegate( + companionSlotWasClicked: (_, __) { + // TODO: + params.onClicked!.call(); + }, + ), + ); + } + + return adSlot; + } } diff --git a/packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart index 277efc6cd0c..b11bec604ee 100644 --- a/packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart @@ -49,11 +49,12 @@ base class PlatformCompanionAdSlotCreationParams { const PlatformCompanionAdSlotCreationParams.size({ required int this.width, required int this.height, + this.onClicked, }) : isFluid = false; /// Used by the platform implementation to create a new /// [PlatformCompanionAdSlot]. - const PlatformCompanionAdSlotCreationParams.fluid() + const PlatformCompanionAdSlotCreationParams.fluid({this.onClicked}) : width = null, height = null, isFluid = true; @@ -68,6 +69,10 @@ base class PlatformCompanionAdSlotCreationParams { /// Returns `null` when [isFluid] returns true; final int? height; + /// Called when the slot is clicked on by the user and will successfully + /// navigate away. + final void Function()? onClicked; + /// Whether the companion ad has no fixed size, but rather adapts to fit the /// creative content they display. final bool isFluid; From 4c8c61dcb0d357dbf4579dd7520497ff2dcabd91 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 20 May 2025 13:45:19 -0400 Subject: [PATCH 19/37] weird import --- .../lib/src/android/android_companion_ad_slot.dart | 2 -- .../lib/src/ios/ios_companion_ad_slot.dart | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart index a7fb51457a0..25949453b12 100644 --- a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:nativewrappers/_internal/vm/lib/ffi_allocation_patch.dart'; - import 'package:flutter/cupertino.dart'; import 'package:meta/meta.dart'; diff --git a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart index 957c9266d8a..eddee07ce56 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart @@ -1,8 +1,6 @@ // 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. - -import 'dart:nativewrappers/_internal/vm/lib/ffi_allocation_patch.dart'; +// found in the LICENSE file.g import 'package:flutter/cupertino.dart'; import 'package:flutter/services.dart'; From 0db2d517944aaaa5ff97b13506c63918ab2155ad Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 20 May 2025 14:24:38 -0400 Subject: [PATCH 20/37] use weak references --- .../ios/Runner.xcodeproj/project.pbxproj | 18 ++++++++ .../example/lib/main.dart | 1 + .../android/android_companion_ad_slot.dart | 42 ++++++++++++------- .../lib/src/ios/ios_companion_ad_slot.dart | 26 ++++++++---- 4 files changed, 63 insertions(+), 24 deletions(-) diff --git a/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj b/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj index ca9d6c51cf6..015b1ed812e 100644 --- a/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj @@ -253,6 +253,7 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + BB970E7F04E08A0891B49625 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -405,6 +406,23 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + BB970E7F04E08A0891B49625 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/packages/interactive_media_ads/example/lib/main.dart b/packages/interactive_media_ads/example/lib/main.dart index aa908cf0754..43e5486bfc7 100644 --- a/packages/interactive_media_ads/example/lib/main.dart +++ b/packages/interactive_media_ads/example/lib/main.dart @@ -70,6 +70,7 @@ class _AdExampleWidgetState extends State late final CompanionAdSlot companionAd = CompanionAdSlot.size( width: 300, height: 250, + onClicked: () => debugPrint('Companion Ad Clicked'), ); // #docregion ad_and_content_players diff --git a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart index 25949453b12..695be9f15a5 100644 --- a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart @@ -127,24 +127,34 @@ base class AndroidCompanionAdSlot extends PlatformCompanionAdSlot { .instanceImaSdkFactory() .createCompanionAdSlot(); - await adSlot.setContainer(_frameLayout); - if (params.isFluid) { - await adSlot.setFluidSize(); - } else { - await adSlot.setSize(params.width!, params.height!); - } - - if (params.onClicked != null) { - await adSlot.addClickListener( - _androidParams._proxy.newCompanionAdSlotClickListener( - onCompanionAdClick: (_) { - // TODO: - params.onClicked!.call(); - }, + await Future.wait(>[ + adSlot.setContainer(_frameLayout), + if (params.isFluid) + adSlot.setFluidSize() + else + adSlot.setSize(params.width!, params.height!), + if (params.onClicked != null) + adSlot.addClickListener( + _createAdSlotClickListener( + WeakReference(this), + ), ), - ); - } + ]); return adSlot; } + + // This value is created in a static method because the callback methods for + // any wrapped classes must not reference the encapsulating object. This is to + // prevent a circular reference that prevents garbage collection. + static ima.CompanionAdSlotClickListener _createAdSlotClickListener( + WeakReference weakThis, + ) { + return weakThis.target!._androidParams._proxy + .newCompanionAdSlotClickListener( + onCompanionAdClick: (_) { + weakThis.target?.params.onClicked!.call(); + }, + ); + } } diff --git a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart index eddee07ce56..4cafaeeec7f 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart @@ -72,6 +72,10 @@ base class IOSCompanionAdSlot extends PlatformCompanionAdSlot { // View used to display the Ad. late final UIView _view = _iosParams._proxy.newUIView(); + late final IMACompanionDelegate _delegate = _createCompanionDelegate( + WeakReference(this), + ); + /// The native iOS IMACompanionAdSlot. @internal late final IMACompanionAdSlot nativeCompanionAdSlot = _initCompanionAdSlot(); @@ -113,16 +117,22 @@ base class IOSCompanionAdSlot extends PlatformCompanionAdSlot { ); if (params.onClicked != null) { - adSlot.setDelegate( - _iosParams._proxy.newIMACompanionDelegate( - companionSlotWasClicked: (_, __) { - // TODO: - params.onClicked!.call(); - }, - ), - ); + adSlot.setDelegate(_delegate); } return adSlot; } + + // This value is created in a static method because the callback methods for + // any wrapped classes must not reference the encapsulating object. This is to + // prevent a circular reference that prevents garbage collection. + static IMACompanionDelegate _createCompanionDelegate( + WeakReference weakThis, + ) { + return weakThis.target!._iosParams._proxy.newIMACompanionDelegate( + companionSlotWasClicked: (_, __) { + weakThis.target?.params.onClicked!.call(); + }, + ); + } } From a9a7553911da6bac0371b9d7864d91084d4f4a53 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 20 May 2025 14:25:01 -0400 Subject: [PATCH 21/37] undo project changes --- .../ios/Runner.xcodeproj/project.pbxproj | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj b/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj index 015b1ed812e..ca9d6c51cf6 100644 --- a/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/interactive_media_ads/example/ios/Runner.xcodeproj/project.pbxproj @@ -253,7 +253,6 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - BB970E7F04E08A0891B49625 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -406,23 +405,6 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - BB970E7F04E08A0891B49625 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ From 4136840554c5c74c6ae164160ceca3e3508ca832 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 29 May 2025 16:42:49 -0400 Subject: [PATCH 22/37] add platform tests --- .../android/android_companion_ad_slot.dart | 7 +- .../lib/src/ios/ios_companion_ad_slot.dart | 4 + .../test/android/companion_ad_slot_test.dart | 100 ++++ .../android/companion_ad_slot_test.mocks.dart | 505 ++++++++++++++++++ .../test/ios/companion_ad_slot_test.dart | 103 ++++ .../ios/companion_ad_slot_test.mocks.dart | 141 +++++ 6 files changed, 856 insertions(+), 4 deletions(-) create mode 100644 packages/interactive_media_ads/test/android/companion_ad_slot_test.dart create mode 100644 packages/interactive_media_ads/test/android/companion_ad_slot_test.mocks.dart create mode 100644 packages/interactive_media_ads/test/ios/companion_ad_slot_test.dart create mode 100644 packages/interactive_media_ads/test/ios/companion_ad_slot_test.mocks.dart diff --git a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart index 695be9f15a5..c3b2a5b46bc 100644 --- a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart @@ -3,6 +3,7 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart'; import 'package:meta/meta.dart'; import '../platform_interface/build_widget_creation_params.dart'; @@ -79,9 +80,7 @@ final class AndroidCompanionAdSlotCreationParams /// Android implementation of [PlatformCompanionAdSlot]. base class AndroidCompanionAdSlot extends PlatformCompanionAdSlot { /// Constructs an [AndroidCompanionAdSlot]. - AndroidCompanionAdSlot(super.params) : super.implementation() { - _adSlotFuture = _initCompanionAdSlot(); - } + AndroidCompanionAdSlot(super.params) : super.implementation(); late final AndroidCompanionAdSlotCreationParams _androidParams = _initAndroidParams(params); @@ -90,7 +89,7 @@ base class AndroidCompanionAdSlot extends PlatformCompanionAdSlot { late final ima.ViewGroup _frameLayout = _androidParams._proxy.newFrameLayout(); - late final Future _adSlotFuture; + late final Future _adSlotFuture = _initCompanionAdSlot(); /// The future returning the native CompanionAdSlot. @internal diff --git a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart index 4cafaeeec7f..b38b6400e75 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart @@ -18,12 +18,14 @@ final class IOSCompanionAdSlotCreationParams const IOSCompanionAdSlotCreationParams.size({ required super.width, required super.height, + super.onClicked, @visibleForTesting InteractiveMediaAdsProxy? proxy, }) : _proxy = proxy ?? const InteractiveMediaAdsProxy(), super.size(); /// Constructs a [IOSCompanionAdSlotCreationParams]. const IOSCompanionAdSlotCreationParams.fluid({ + super.onClicked, @visibleForTesting InteractiveMediaAdsProxy? proxy, }) : _proxy = proxy ?? const InteractiveMediaAdsProxy(), super.fluid(); @@ -40,6 +42,7 @@ final class IOSCompanionAdSlotCreationParams return IOSCompanionAdSlotCreationParams.size( width: params.width!, height: params.height!, + onClicked: params.onClicked, proxy: proxy, ); } @@ -54,6 +57,7 @@ final class IOSCompanionAdSlotCreationParams @visibleForTesting InteractiveMediaAdsProxy? proxy, }) { return IOSCompanionAdSlotCreationParams.fluid( + onClicked: params.onClicked, proxy: proxy, ); } diff --git a/packages/interactive_media_ads/test/android/companion_ad_slot_test.dart b/packages/interactive_media_ads/test/android/companion_ad_slot_test.dart new file mode 100644 index 00000000000..c9af72016b7 --- /dev/null +++ b/packages/interactive_media_ads/test/android/companion_ad_slot_test.dart @@ -0,0 +1,100 @@ +// 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. + +import 'package:flutter_test/flutter_test.dart'; +import 'package:interactive_media_ads/src/android/android_companion_ad_slot.dart'; +import 'package:interactive_media_ads/src/android/interactive_media_ads.g.dart' + as ima; +import 'package:interactive_media_ads/src/android/interactive_media_ads_proxy.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; + +import 'companion_ad_slot_test.mocks.dart'; + +@GenerateNiceMocks(>[ + MockSpec(), + MockSpec(), + MockSpec(), +]) +void main() { + group('AndroidCompanionAdSlot', () { + test('instantiate CompanionAdSlot with size', () async { + final ima.FrameLayout frameLayout = ima.FrameLayout.pigeon_detached( + pigeon_instanceManager: _TestInstanceManager(), + ); + final MockCompanionAdSlot mockCompanionAdSlot = MockCompanionAdSlot(); + final AndroidCompanionAdSlotCreationParams params = + AndroidCompanionAdSlotCreationParams.size( + width: 300, + height: 400, + proxy: InteractiveMediaAdsProxy( + newFrameLayout: () { + return frameLayout; + }, + instanceImaSdkFactory: () { + final MockImaSdkFactory mockFactory = MockImaSdkFactory(); + when(mockFactory.createCompanionAdSlot()).thenAnswer( + (_) async => mockCompanionAdSlot, + ); + return mockFactory; + }, + ), + ); + + final AndroidCompanionAdSlot adSlot = AndroidCompanionAdSlot(params); + await adSlot.getNativeCompanionAdSlot(); + + verify(mockCompanionAdSlot.setContainer(frameLayout)); + verify(mockCompanionAdSlot.setSize(300, 400)); + }); + + test('AndroidCompanionAdSlot receives onClick', () async { + final MockCompanionAdSlot mockCompanionAdSlot = MockCompanionAdSlot(); + final AndroidCompanionAdSlotCreationParams params = + AndroidCompanionAdSlotCreationParams.size( + width: 300, + height: 400, + onClicked: expectAsync0(() {}), + proxy: InteractiveMediaAdsProxy( + newFrameLayout: () { + return ima.FrameLayout.pigeon_detached( + pigeon_instanceManager: _TestInstanceManager(), + ); + }, + instanceImaSdkFactory: () { + final MockImaSdkFactory mockFactory = MockImaSdkFactory(); + when(mockFactory.createCompanionAdSlot()).thenAnswer( + (_) async => mockCompanionAdSlot, + ); + return mockFactory; + }, + newCompanionAdSlotClickListener: ({ + required void Function( + ima.CompanionAdSlotClickListener, + ) onCompanionAdClick, + }) { + return ima.CompanionAdSlotClickListener.pigeon_detached( + onCompanionAdClick: onCompanionAdClick, + pigeon_instanceManager: _TestInstanceManager(), + ); + }, + ), + ); + + final AndroidCompanionAdSlot adSlot = AndroidCompanionAdSlot(params); + await adSlot.getNativeCompanionAdSlot(); + + final ima.CompanionAdSlotClickListener clickListener = + verify(mockCompanionAdSlot.addClickListener(captureAny)) + .captured + .single as ima.CompanionAdSlotClickListener; + + clickListener.onCompanionAdClick(clickListener); + }); + }); +} + +class _TestInstanceManager extends ima.PigeonInstanceManager { + _TestInstanceManager() : super(onWeakReferenceRemoved: (_) {}); +} diff --git a/packages/interactive_media_ads/test/android/companion_ad_slot_test.mocks.dart b/packages/interactive_media_ads/test/android/companion_ad_slot_test.mocks.dart new file mode 100644 index 00000000000..4a905596e1a --- /dev/null +++ b/packages/interactive_media_ads/test/android/companion_ad_slot_test.mocks.dart @@ -0,0 +1,505 @@ +// Mocks generated by Mockito 5.4.6 from annotations +// in interactive_media_ads/test/android/companion_ad_slot_test.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i3; + +import 'package:interactive_media_ads/src/android/interactive_media_ads.g.dart' + as _i2; +import 'package:mockito/mockito.dart' as _i1; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +class _FakePigeonInstanceManager_0 extends _i1.SmartFake + implements _i2.PigeonInstanceManager { + _FakePigeonInstanceManager_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeViewGroup_1 extends _i1.SmartFake implements _i2.ViewGroup { + _FakeViewGroup_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeCompanionAdSlot_2 extends _i1.SmartFake + implements _i2.CompanionAdSlot { + _FakeCompanionAdSlot_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeFrameLayout_3 extends _i1.SmartFake implements _i2.FrameLayout { + _FakeFrameLayout_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeImaSdkSettings_4 extends _i1.SmartFake + implements _i2.ImaSdkSettings { + _FakeImaSdkSettings_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeAdsLoader_5 extends _i1.SmartFake implements _i2.AdsLoader { + _FakeAdsLoader_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeAdsRequest_6 extends _i1.SmartFake implements _i2.AdsRequest { + _FakeAdsRequest_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeAdsRenderingSettings_7 extends _i1.SmartFake + implements _i2.AdsRenderingSettings { + _FakeAdsRenderingSettings_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeImaSdkFactory_8 extends _i1.SmartFake implements _i2.ImaSdkFactory { + _FakeImaSdkFactory_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +/// A class which mocks [CompanionAdSlot]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockCompanionAdSlot extends _i1.Mock implements _i2.CompanionAdSlot { + @override + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + returnValueForMissingStub: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); + + @override + _i3.Future addClickListener( + _i2.CompanionAdSlotClickListener? clickListener) => + (super.noSuchMethod( + Invocation.method( + #addClickListener, + [clickListener], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future<_i2.ViewGroup> getContainer() => (super.noSuchMethod( + Invocation.method( + #getContainer, + [], + ), + returnValue: _i3.Future<_i2.ViewGroup>.value(_FakeViewGroup_1( + this, + Invocation.method( + #getContainer, + [], + ), + )), + returnValueForMissingStub: + _i3.Future<_i2.ViewGroup>.value(_FakeViewGroup_1( + this, + Invocation.method( + #getContainer, + [], + ), + )), + ) as _i3.Future<_i2.ViewGroup>); + + @override + _i3.Future getHeight() => (super.noSuchMethod( + Invocation.method( + #getHeight, + [], + ), + returnValue: _i3.Future.value(0), + returnValueForMissingStub: _i3.Future.value(0), + ) as _i3.Future); + + @override + _i3.Future getWidth() => (super.noSuchMethod( + Invocation.method( + #getWidth, + [], + ), + returnValue: _i3.Future.value(0), + returnValueForMissingStub: _i3.Future.value(0), + ) as _i3.Future); + + @override + _i3.Future isFilled() => (super.noSuchMethod( + Invocation.method( + #isFilled, + [], + ), + returnValue: _i3.Future.value(false), + returnValueForMissingStub: _i3.Future.value(false), + ) as _i3.Future); + + @override + _i3.Future removeClickListener( + _i2.CompanionAdSlotClickListener? clickListener) => + (super.noSuchMethod( + Invocation.method( + #removeClickListener, + [clickListener], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future setContainer(_i2.ViewGroup? container) => + (super.noSuchMethod( + Invocation.method( + #setContainer, + [container], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future setSize( + int? width, + int? height, + ) => + (super.noSuchMethod( + Invocation.method( + #setSize, + [ + width, + height, + ], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future setFluidSize() => (super.noSuchMethod( + Invocation.method( + #setFluidSize, + [], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i2.CompanionAdSlot pigeon_copy() => (super.noSuchMethod( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeCompanionAdSlot_2( + this, + Invocation.method( + #pigeon_copy, + [], + ), + ), + returnValueForMissingStub: _FakeCompanionAdSlot_2( + this, + Invocation.method( + #pigeon_copy, + [], + ), + ), + ) as _i2.CompanionAdSlot); +} + +/// A class which mocks [FrameLayout]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockFrameLayout extends _i1.Mock implements _i2.FrameLayout { + @override + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + returnValueForMissingStub: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); + + @override + _i2.FrameLayout pigeon_copy() => (super.noSuchMethod( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeFrameLayout_3( + this, + Invocation.method( + #pigeon_copy, + [], + ), + ), + returnValueForMissingStub: _FakeFrameLayout_3( + this, + Invocation.method( + #pigeon_copy, + [], + ), + ), + ) as _i2.FrameLayout); + + @override + _i3.Future addView(_i2.View? view) => (super.noSuchMethod( + Invocation.method( + #addView, + [view], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future removeView(_i2.View? view) => (super.noSuchMethod( + Invocation.method( + #removeView, + [view], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); +} + +/// A class which mocks [ImaSdkFactory]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { + @override + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + returnValueForMissingStub: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); + + @override + _i3.Future<_i2.CompanionAdSlot> createCompanionAdSlot() => + (super.noSuchMethod( + Invocation.method( + #createCompanionAdSlot, + [], + ), + returnValue: + _i3.Future<_i2.CompanionAdSlot>.value(_FakeCompanionAdSlot_2( + this, + Invocation.method( + #createCompanionAdSlot, + [], + ), + )), + returnValueForMissingStub: + _i3.Future<_i2.CompanionAdSlot>.value(_FakeCompanionAdSlot_2( + this, + Invocation.method( + #createCompanionAdSlot, + [], + ), + )), + ) as _i3.Future<_i2.CompanionAdSlot>); + + @override + _i3.Future<_i2.ImaSdkSettings> createImaSdkSettings() => (super.noSuchMethod( + Invocation.method( + #createImaSdkSettings, + [], + ), + returnValue: _i3.Future<_i2.ImaSdkSettings>.value(_FakeImaSdkSettings_4( + this, + Invocation.method( + #createImaSdkSettings, + [], + ), + )), + returnValueForMissingStub: + _i3.Future<_i2.ImaSdkSettings>.value(_FakeImaSdkSettings_4( + this, + Invocation.method( + #createImaSdkSettings, + [], + ), + )), + ) as _i3.Future<_i2.ImaSdkSettings>); + + @override + _i3.Future<_i2.AdsLoader> createAdsLoader( + _i2.ImaSdkSettings? settings, + _i2.AdDisplayContainer? container, + ) => + (super.noSuchMethod( + Invocation.method( + #createAdsLoader, + [ + settings, + container, + ], + ), + returnValue: _i3.Future<_i2.AdsLoader>.value(_FakeAdsLoader_5( + this, + Invocation.method( + #createAdsLoader, + [ + settings, + container, + ], + ), + )), + returnValueForMissingStub: + _i3.Future<_i2.AdsLoader>.value(_FakeAdsLoader_5( + this, + Invocation.method( + #createAdsLoader, + [ + settings, + container, + ], + ), + )), + ) as _i3.Future<_i2.AdsLoader>); + + @override + _i3.Future<_i2.AdsRequest> createAdsRequest() => (super.noSuchMethod( + Invocation.method( + #createAdsRequest, + [], + ), + returnValue: _i3.Future<_i2.AdsRequest>.value(_FakeAdsRequest_6( + this, + Invocation.method( + #createAdsRequest, + [], + ), + )), + returnValueForMissingStub: + _i3.Future<_i2.AdsRequest>.value(_FakeAdsRequest_6( + this, + Invocation.method( + #createAdsRequest, + [], + ), + )), + ) as _i3.Future<_i2.AdsRequest>); + + @override + _i3.Future<_i2.AdsRenderingSettings> createAdsRenderingSettings() => + (super.noSuchMethod( + Invocation.method( + #createAdsRenderingSettings, + [], + ), + returnValue: _i3.Future<_i2.AdsRenderingSettings>.value( + _FakeAdsRenderingSettings_7( + this, + Invocation.method( + #createAdsRenderingSettings, + [], + ), + )), + returnValueForMissingStub: _i3.Future<_i2.AdsRenderingSettings>.value( + _FakeAdsRenderingSettings_7( + this, + Invocation.method( + #createAdsRenderingSettings, + [], + ), + )), + ) as _i3.Future<_i2.AdsRenderingSettings>); + + @override + _i2.ImaSdkFactory pigeon_copy() => (super.noSuchMethod( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeImaSdkFactory_8( + this, + Invocation.method( + #pigeon_copy, + [], + ), + ), + returnValueForMissingStub: _FakeImaSdkFactory_8( + this, + Invocation.method( + #pigeon_copy, + [], + ), + ), + ) as _i2.ImaSdkFactory); +} diff --git a/packages/interactive_media_ads/test/ios/companion_ad_slot_test.dart b/packages/interactive_media_ads/test/ios/companion_ad_slot_test.dart new file mode 100644 index 00000000000..b392bf0a835 --- /dev/null +++ b/packages/interactive_media_ads/test/ios/companion_ad_slot_test.dart @@ -0,0 +1,103 @@ +// 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. + +import 'package:flutter_test/flutter_test.dart'; +import 'package:interactive_media_ads/src/ios/interactive_media_ads.g.dart'; +import 'package:interactive_media_ads/src/ios/interactive_media_ads_proxy.dart'; +import 'package:interactive_media_ads/src/ios/ios_companion_ad_slot.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; + +import 'companion_ad_slot_test.mocks.dart'; + +@GenerateNiceMocks(>[ + MockSpec(), +]) +void main() { + group('IOSCompanionAdSlot', () { + test('instantiate CompanionAdSlot with size', () async { + final MockIMACompanionAdSlot mockCompanionAdSlot = + MockIMACompanionAdSlot(); + final IOSCompanionAdSlotCreationParams params = + IOSCompanionAdSlotCreationParams.size( + width: 300, + height: 400, + proxy: InteractiveMediaAdsProxy( + sizeIMACompanionAdSlot: ({ + required int width, + required int height, + required UIView view, + }) { + expect(width, 300); + expect(height, 400); + return mockCompanionAdSlot; + }, + newUIView: () { + return UIView.pigeon_detached( + pigeon_instanceManager: _TestInstanceManager(), + ); + }, + ), + ); + + final IOSCompanionAdSlot adSlot = IOSCompanionAdSlot(params); + expect(adSlot.nativeCompanionAdSlot, mockCompanionAdSlot); + }); + + test('IOSCompanionAdSlot receives onClick', () async { + final MockIMACompanionAdSlot mockCompanionAdSlot = + MockIMACompanionAdSlot(); + final IOSCompanionAdSlotCreationParams params = + IOSCompanionAdSlotCreationParams.size( + width: 300, + height: 400, + onClicked: expectAsync0(() {}), + proxy: InteractiveMediaAdsProxy( + sizeIMACompanionAdSlot: ({ + required int width, + required int height, + required UIView view, + }) { + return mockCompanionAdSlot; + }, + newUIView: () { + return UIView.pigeon_detached( + pigeon_instanceManager: _TestInstanceManager(), + ); + }, + newIMACompanionDelegate: ({ + void Function( + IMACompanionDelegate, + IMACompanionAdSlot, + bool, + )? companionAdSlotFilled, + void Function( + IMACompanionDelegate, + IMACompanionAdSlot, + )? companionSlotWasClicked, + }) { + return IMACompanionDelegate.pigeon_detached( + companionAdSlotFilled: companionAdSlotFilled, + companionSlotWasClicked: companionSlotWasClicked, + pigeon_instanceManager: _TestInstanceManager(), + ); + }, + ), + ); + + final IOSCompanionAdSlot adSlot = IOSCompanionAdSlot(params); + expect(adSlot.nativeCompanionAdSlot, mockCompanionAdSlot); + + final IMACompanionDelegate delegate = + verify(mockCompanionAdSlot.setDelegate(captureAny)).captured.single + as IMACompanionDelegate; + + delegate.companionSlotWasClicked!(delegate, adSlot.nativeCompanionAdSlot); + }); + }); +} + +class _TestInstanceManager extends PigeonInstanceManager { + _TestInstanceManager() : super(onWeakReferenceRemoved: (_) {}); +} diff --git a/packages/interactive_media_ads/test/ios/companion_ad_slot_test.mocks.dart b/packages/interactive_media_ads/test/ios/companion_ad_slot_test.mocks.dart new file mode 100644 index 00000000000..ba82b9c8de8 --- /dev/null +++ b/packages/interactive_media_ads/test/ios/companion_ad_slot_test.mocks.dart @@ -0,0 +1,141 @@ +// Mocks generated by Mockito 5.4.6 from annotations +// in interactive_media_ads/test/ios/companion_ad_slot_test.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i3; + +import 'package:interactive_media_ads/src/ios/interactive_media_ads.g.dart' + as _i2; +import 'package:mockito/mockito.dart' as _i1; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +class _FakeUIView_0 extends _i1.SmartFake implements _i2.UIView { + _FakeUIView_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakePigeonInstanceManager_1 extends _i1.SmartFake + implements _i2.PigeonInstanceManager { + _FakePigeonInstanceManager_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeIMACompanionAdSlot_2 extends _i1.SmartFake + implements _i2.IMACompanionAdSlot { + _FakeIMACompanionAdSlot_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +/// A class which mocks [IMACompanionAdSlot]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockIMACompanionAdSlot extends _i1.Mock + implements _i2.IMACompanionAdSlot { + @override + _i2.UIView get view => (super.noSuchMethod( + Invocation.getter(#view), + returnValue: _FakeUIView_0( + this, + Invocation.getter(#view), + ), + returnValueForMissingStub: _FakeUIView_0( + this, + Invocation.getter(#view), + ), + ) as _i2.UIView); + + @override + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_1( + this, + Invocation.getter(#pigeon_instanceManager), + ), + returnValueForMissingStub: _FakePigeonInstanceManager_1( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); + + @override + _i3.Future setDelegate(_i2.IMACompanionDelegate? delegate) => + (super.noSuchMethod( + Invocation.method( + #setDelegate, + [delegate], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future width() => (super.noSuchMethod( + Invocation.method( + #width, + [], + ), + returnValue: _i3.Future.value(0), + returnValueForMissingStub: _i3.Future.value(0), + ) as _i3.Future); + + @override + _i3.Future height() => (super.noSuchMethod( + Invocation.method( + #height, + [], + ), + returnValue: _i3.Future.value(0), + returnValueForMissingStub: _i3.Future.value(0), + ) as _i3.Future); + + @override + _i2.IMACompanionAdSlot pigeon_copy() => (super.noSuchMethod( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeIMACompanionAdSlot_2( + this, + Invocation.method( + #pigeon_copy, + [], + ), + ), + returnValueForMissingStub: _FakeIMACompanionAdSlot_2( + this, + Invocation.method( + #pigeon_copy, + [], + ), + ), + ) as _i2.IMACompanionAdSlot); +} From 0841b0e135667ad4f87238e0ff7be70ff8019539 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 30 May 2025 10:49:41 -0400 Subject: [PATCH 23/37] analyze errors --- .../lib/src/android/android_companion_ad_slot.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart index c3b2a5b46bc..10e8f61e58e 100644 --- a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart @@ -3,7 +3,6 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; import 'package:meta/meta.dart'; import '../platform_interface/build_widget_creation_params.dart'; From f85d2b6e664d9a528599cee47791d1baefa81e93 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 30 May 2025 11:23:33 -0400 Subject: [PATCH 24/37] android test --- .../android/ad_display_container_test.dart | 105 ++++ .../ad_display_container_test.mocks.dart | 480 ++++++++++++++++-- 2 files changed, 545 insertions(+), 40 deletions(-) diff --git a/packages/interactive_media_ads/test/android/ad_display_container_test.dart b/packages/interactive_media_ads/test/android/ad_display_container_test.dart index 5578c338986..717cd7404ad 100644 --- a/packages/interactive_media_ads/test/android/ad_display_container_test.dart +++ b/packages/interactive_media_ads/test/android/ad_display_container_test.dart @@ -2,14 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; + import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:interactive_media_ads/src/android/android_ad_display_container.dart'; +import 'package:interactive_media_ads/src/android/android_companion_ad_slot.dart'; import 'package:interactive_media_ads/src/android/interactive_media_ads.g.dart' as ima; import 'package:interactive_media_ads/src/android/interactive_media_ads_proxy.dart'; import 'package:interactive_media_ads/src/android/platform_views_service_proxy.dart'; +import 'package:interactive_media_ads/src/platform_interface/platform_interface.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; @@ -19,7 +23,9 @@ import 'ad_display_container_test.mocks.dart'; MockSpec(), MockSpec(), MockSpec(), + MockSpec(), MockSpec(), + MockSpec(), MockSpec(), MockSpec(), MockSpec(), @@ -681,5 +687,104 @@ void main() { verify(mockFrameLayout.removeView(mockVideoView)); verify(mockFrameLayout.addView(mockVideoView2)); }); + + testWidgets('AdDisplayContainer adds CompanionAdSlots', + (WidgetTester tester) async { + final MockAdDisplayContainer mockAdDisplayContainer = + MockAdDisplayContainer(); + final MockCompanionAdSlot mockCompanionAdSlot = MockCompanionAdSlot(); + final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + newFrameLayout: () => MockFrameLayout(), + newVideoView: ({ + required dynamic onError, + dynamic onPrepared, + dynamic onCompletion, + }) => + MockVideoView(), + createAdDisplayContainerImaSdkFactory: ( + _, + __, + ) async { + return mockAdDisplayContainer; + }, + newVideoAdPlayer: ({ + required dynamic addCallback, + required dynamic loadAd, + required dynamic pauseAd, + required dynamic playAd, + required dynamic release, + required dynamic removeCallback, + required dynamic stopAd, + }) => + MockVideoAdPlayer(), + instanceImaSdkFactory: () { + final MockImaSdkFactory mockFactory = MockImaSdkFactory(); + when(mockFactory.createCompanionAdSlot()).thenAnswer( + (_) async => mockCompanionAdSlot, + ); + return mockFactory; + }, + ); + + final MockPlatformViewsServiceProxy mockPlatformViewsProxy = + MockPlatformViewsServiceProxy(); + final MockSurfaceAndroidViewController mockAndroidViewController = + MockSurfaceAndroidViewController(); + + late final int platformViewId; + when( + mockPlatformViewsProxy.initSurfaceAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ).thenAnswer((Invocation invocation) { + platformViewId = invocation.namedArguments[const Symbol('id')] as int; + return mockAndroidViewController; + }); + + final Completer onContainerAddedCompleter = Completer(); + + final AndroidAdDisplayContainer container = AndroidAdDisplayContainer( + AndroidAdDisplayContainerCreationParams( + onContainerAdded: (_) => onContainerAddedCompleter.complete(), + platformViewsProxy: mockPlatformViewsProxy, + companionSlots: [ + AndroidCompanionAdSlot( + AndroidCompanionAdSlotCreationParams.size( + width: 300, + height: 444, + proxy: imaProxy, + ), + ) + ], + imaProxy: imaProxy, + ), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) => container.build(context), + )); + + final void Function(int) onPlatformCreatedCallback = verify( + mockAndroidViewController + .addOnPlatformViewCreatedListener(captureAny)) + .captured[0] as void Function(int); + + onPlatformCreatedCallback(platformViewId); + + await tester.pumpAndSettle(); + + await onContainerAddedCompleter.future; + + verify( + mockAdDisplayContainer.setCompanionSlots( + [mockCompanionAdSlot], + ), + ); + }); }); } diff --git a/packages/interactive_media_ads/test/android/ad_display_container_test.mocks.dart b/packages/interactive_media_ads/test/android/ad_display_container_test.mocks.dart index 84f4744da47..94a84b02604 100644 --- a/packages/interactive_media_ads/test/android/ad_display_container_test.mocks.dart +++ b/packages/interactive_media_ads/test/android/ad_display_container_test.mocks.dart @@ -70,8 +70,8 @@ class _FakeAdPodInfo_3 extends _i1.SmartFake implements _i2.AdPodInfo { ); } -class _FakeFrameLayout_4 extends _i1.SmartFake implements _i2.FrameLayout { - _FakeFrameLayout_4( +class _FakeViewGroup_4 extends _i1.SmartFake implements _i2.ViewGroup { + _FakeViewGroup_4( Object parent, Invocation parentInvocation, ) : super( @@ -80,8 +80,9 @@ class _FakeFrameLayout_4 extends _i1.SmartFake implements _i2.FrameLayout { ); } -class _FakeMediaPlayer_5 extends _i1.SmartFake implements _i2.MediaPlayer { - _FakeMediaPlayer_5( +class _FakeCompanionAdSlot_5 extends _i1.SmartFake + implements _i2.CompanionAdSlot { + _FakeCompanionAdSlot_5( Object parent, Invocation parentInvocation, ) : super( @@ -90,8 +91,8 @@ class _FakeMediaPlayer_5 extends _i1.SmartFake implements _i2.MediaPlayer { ); } -class _FakeVideoAdPlayer_6 extends _i1.SmartFake implements _i2.VideoAdPlayer { - _FakeVideoAdPlayer_6( +class _FakeFrameLayout_6 extends _i1.SmartFake implements _i2.FrameLayout { + _FakeFrameLayout_6( Object parent, Invocation parentInvocation, ) : super( @@ -100,9 +101,81 @@ class _FakeVideoAdPlayer_6 extends _i1.SmartFake implements _i2.VideoAdPlayer { ); } -class _FakeVideoAdPlayerCallback_7 extends _i1.SmartFake +class _FakeImaSdkSettings_7 extends _i1.SmartFake + implements _i2.ImaSdkSettings { + _FakeImaSdkSettings_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeAdsLoader_8 extends _i1.SmartFake implements _i2.AdsLoader { + _FakeAdsLoader_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeAdsRequest_9 extends _i1.SmartFake implements _i2.AdsRequest { + _FakeAdsRequest_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeAdsRenderingSettings_10 extends _i1.SmartFake + implements _i2.AdsRenderingSettings { + _FakeAdsRenderingSettings_10( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeImaSdkFactory_11 extends _i1.SmartFake implements _i2.ImaSdkFactory { + _FakeImaSdkFactory_11( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeMediaPlayer_12 extends _i1.SmartFake implements _i2.MediaPlayer { + _FakeMediaPlayer_12( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeVideoAdPlayer_13 extends _i1.SmartFake implements _i2.VideoAdPlayer { + _FakeVideoAdPlayer_13( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeVideoAdPlayerCallback_14 extends _i1.SmartFake implements _i2.VideoAdPlayerCallback { - _FakeVideoAdPlayerCallback_7( + _FakeVideoAdPlayerCallback_14( Object parent, Invocation parentInvocation, ) : super( @@ -111,9 +184,9 @@ class _FakeVideoAdPlayerCallback_7 extends _i1.SmartFake ); } -class _FakeVideoProgressUpdate_8 extends _i1.SmartFake +class _FakeVideoProgressUpdate_15 extends _i1.SmartFake implements _i2.VideoProgressUpdate { - _FakeVideoProgressUpdate_8( + _FakeVideoProgressUpdate_15( Object parent, Invocation parentInvocation, ) : super( @@ -122,8 +195,8 @@ class _FakeVideoProgressUpdate_8 extends _i1.SmartFake ); } -class _FakeVideoView_9 extends _i1.SmartFake implements _i2.VideoView { - _FakeVideoView_9( +class _FakeVideoView_16 extends _i1.SmartFake implements _i2.VideoView { + _FakeVideoView_16( Object parent, Invocation parentInvocation, ) : super( @@ -132,8 +205,8 @@ class _FakeVideoView_9 extends _i1.SmartFake implements _i2.VideoView { ); } -class _FakeOffset_10 extends _i1.SmartFake implements _i3.Offset { - _FakeOffset_10( +class _FakeOffset_17 extends _i1.SmartFake implements _i3.Offset { + _FakeOffset_17( Object parent, Invocation parentInvocation, ) : super( @@ -142,8 +215,8 @@ class _FakeOffset_10 extends _i1.SmartFake implements _i3.Offset { ); } -class _FakeSize_11 extends _i1.SmartFake implements _i3.Size { - _FakeSize_11( +class _FakeSize_18 extends _i1.SmartFake implements _i3.Size { + _FakeSize_18( Object parent, Invocation parentInvocation, ) : super( @@ -152,9 +225,9 @@ class _FakeSize_11 extends _i1.SmartFake implements _i3.Size { ); } -class _FakeExpensiveAndroidViewController_12 extends _i1.SmartFake +class _FakeExpensiveAndroidViewController_19 extends _i1.SmartFake implements _i4.ExpensiveAndroidViewController { - _FakeExpensiveAndroidViewController_12( + _FakeExpensiveAndroidViewController_19( Object parent, Invocation parentInvocation, ) : super( @@ -163,9 +236,9 @@ class _FakeExpensiveAndroidViewController_12 extends _i1.SmartFake ); } -class _FakeSurfaceAndroidViewController_13 extends _i1.SmartFake +class _FakeSurfaceAndroidViewController_20 extends _i1.SmartFake implements _i4.SurfaceAndroidViewController { - _FakeSurfaceAndroidViewController_13( + _FakeSurfaceAndroidViewController_20( Object parent, Invocation parentInvocation, ) : super( @@ -362,6 +435,161 @@ class MockAdPodInfo extends _i1.Mock implements _i2.AdPodInfo { ) as _i2.AdPodInfo); } +/// A class which mocks [CompanionAdSlot]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockCompanionAdSlot extends _i1.Mock implements _i2.CompanionAdSlot { + @override + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + returnValueForMissingStub: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); + + @override + _i5.Future addClickListener( + _i2.CompanionAdSlotClickListener? clickListener) => + (super.noSuchMethod( + Invocation.method( + #addClickListener, + [clickListener], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future<_i2.ViewGroup> getContainer() => (super.noSuchMethod( + Invocation.method( + #getContainer, + [], + ), + returnValue: _i5.Future<_i2.ViewGroup>.value(_FakeViewGroup_4( + this, + Invocation.method( + #getContainer, + [], + ), + )), + returnValueForMissingStub: + _i5.Future<_i2.ViewGroup>.value(_FakeViewGroup_4( + this, + Invocation.method( + #getContainer, + [], + ), + )), + ) as _i5.Future<_i2.ViewGroup>); + + @override + _i5.Future getHeight() => (super.noSuchMethod( + Invocation.method( + #getHeight, + [], + ), + returnValue: _i5.Future.value(0), + returnValueForMissingStub: _i5.Future.value(0), + ) as _i5.Future); + + @override + _i5.Future getWidth() => (super.noSuchMethod( + Invocation.method( + #getWidth, + [], + ), + returnValue: _i5.Future.value(0), + returnValueForMissingStub: _i5.Future.value(0), + ) as _i5.Future); + + @override + _i5.Future isFilled() => (super.noSuchMethod( + Invocation.method( + #isFilled, + [], + ), + returnValue: _i5.Future.value(false), + returnValueForMissingStub: _i5.Future.value(false), + ) as _i5.Future); + + @override + _i5.Future removeClickListener( + _i2.CompanionAdSlotClickListener? clickListener) => + (super.noSuchMethod( + Invocation.method( + #removeClickListener, + [clickListener], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future setContainer(_i2.ViewGroup? container) => + (super.noSuchMethod( + Invocation.method( + #setContainer, + [container], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future setSize( + int? width, + int? height, + ) => + (super.noSuchMethod( + Invocation.method( + #setSize, + [ + width, + height, + ], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future setFluidSize() => (super.noSuchMethod( + Invocation.method( + #setFluidSize, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i2.CompanionAdSlot pigeon_copy() => (super.noSuchMethod( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeCompanionAdSlot_5( + this, + Invocation.method( + #pigeon_copy, + [], + ), + ), + returnValueForMissingStub: _FakeCompanionAdSlot_5( + this, + Invocation.method( + #pigeon_copy, + [], + ), + ), + ) as _i2.CompanionAdSlot); +} + /// A class which mocks [FrameLayout]. /// /// See the documentation for Mockito's code generation for more information. @@ -385,14 +613,14 @@ class MockFrameLayout extends _i1.Mock implements _i2.FrameLayout { #pigeon_copy, [], ), - returnValue: _FakeFrameLayout_4( + returnValue: _FakeFrameLayout_6( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeFrameLayout_4( + returnValueForMissingStub: _FakeFrameLayout_6( this, Invocation.method( #pigeon_copy, @@ -422,6 +650,178 @@ class MockFrameLayout extends _i1.Mock implements _i2.FrameLayout { ) as _i5.Future); } +/// A class which mocks [ImaSdkFactory]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockImaSdkFactory extends _i1.Mock implements _i2.ImaSdkFactory { + @override + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + returnValueForMissingStub: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); + + @override + _i5.Future<_i2.CompanionAdSlot> createCompanionAdSlot() => + (super.noSuchMethod( + Invocation.method( + #createCompanionAdSlot, + [], + ), + returnValue: + _i5.Future<_i2.CompanionAdSlot>.value(_FakeCompanionAdSlot_5( + this, + Invocation.method( + #createCompanionAdSlot, + [], + ), + )), + returnValueForMissingStub: + _i5.Future<_i2.CompanionAdSlot>.value(_FakeCompanionAdSlot_5( + this, + Invocation.method( + #createCompanionAdSlot, + [], + ), + )), + ) as _i5.Future<_i2.CompanionAdSlot>); + + @override + _i5.Future<_i2.ImaSdkSettings> createImaSdkSettings() => (super.noSuchMethod( + Invocation.method( + #createImaSdkSettings, + [], + ), + returnValue: _i5.Future<_i2.ImaSdkSettings>.value(_FakeImaSdkSettings_7( + this, + Invocation.method( + #createImaSdkSettings, + [], + ), + )), + returnValueForMissingStub: + _i5.Future<_i2.ImaSdkSettings>.value(_FakeImaSdkSettings_7( + this, + Invocation.method( + #createImaSdkSettings, + [], + ), + )), + ) as _i5.Future<_i2.ImaSdkSettings>); + + @override + _i5.Future<_i2.AdsLoader> createAdsLoader( + _i2.ImaSdkSettings? settings, + _i2.AdDisplayContainer? container, + ) => + (super.noSuchMethod( + Invocation.method( + #createAdsLoader, + [ + settings, + container, + ], + ), + returnValue: _i5.Future<_i2.AdsLoader>.value(_FakeAdsLoader_8( + this, + Invocation.method( + #createAdsLoader, + [ + settings, + container, + ], + ), + )), + returnValueForMissingStub: + _i5.Future<_i2.AdsLoader>.value(_FakeAdsLoader_8( + this, + Invocation.method( + #createAdsLoader, + [ + settings, + container, + ], + ), + )), + ) as _i5.Future<_i2.AdsLoader>); + + @override + _i5.Future<_i2.AdsRequest> createAdsRequest() => (super.noSuchMethod( + Invocation.method( + #createAdsRequest, + [], + ), + returnValue: _i5.Future<_i2.AdsRequest>.value(_FakeAdsRequest_9( + this, + Invocation.method( + #createAdsRequest, + [], + ), + )), + returnValueForMissingStub: + _i5.Future<_i2.AdsRequest>.value(_FakeAdsRequest_9( + this, + Invocation.method( + #createAdsRequest, + [], + ), + )), + ) as _i5.Future<_i2.AdsRequest>); + + @override + _i5.Future<_i2.AdsRenderingSettings> createAdsRenderingSettings() => + (super.noSuchMethod( + Invocation.method( + #createAdsRenderingSettings, + [], + ), + returnValue: _i5.Future<_i2.AdsRenderingSettings>.value( + _FakeAdsRenderingSettings_10( + this, + Invocation.method( + #createAdsRenderingSettings, + [], + ), + )), + returnValueForMissingStub: _i5.Future<_i2.AdsRenderingSettings>.value( + _FakeAdsRenderingSettings_10( + this, + Invocation.method( + #createAdsRenderingSettings, + [], + ), + )), + ) as _i5.Future<_i2.AdsRenderingSettings>); + + @override + _i2.ImaSdkFactory pigeon_copy() => (super.noSuchMethod( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeImaSdkFactory_11( + this, + Invocation.method( + #pigeon_copy, + [], + ), + ), + returnValueForMissingStub: _FakeImaSdkFactory_11( + this, + Invocation.method( + #pigeon_copy, + [], + ), + ), + ) as _i2.ImaSdkFactory); +} + /// A class which mocks [MediaPlayer]. /// /// See the documentation for Mockito's code generation for more information. @@ -495,14 +895,14 @@ class MockMediaPlayer extends _i1.Mock implements _i2.MediaPlayer { #pigeon_copy, [], ), - returnValue: _FakeMediaPlayer_5( + returnValue: _FakeMediaPlayer_12( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeMediaPlayer_5( + returnValueForMissingStub: _FakeMediaPlayer_12( this, Invocation.method( #pigeon_copy, @@ -681,14 +1081,14 @@ class MockVideoAdPlayer extends _i1.Mock implements _i2.VideoAdPlayer { #pigeon_copy, [], ), - returnValue: _FakeVideoAdPlayer_6( + returnValue: _FakeVideoAdPlayer_13( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeVideoAdPlayer_6( + returnValueForMissingStub: _FakeVideoAdPlayer_13( this, Invocation.method( #pigeon_copy, @@ -839,14 +1239,14 @@ class MockVideoAdPlayerCallback extends _i1.Mock #pigeon_copy, [], ), - returnValue: _FakeVideoAdPlayerCallback_7( + returnValue: _FakeVideoAdPlayerCallback_14( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeVideoAdPlayerCallback_7( + returnValueForMissingStub: _FakeVideoAdPlayerCallback_14( this, Invocation.method( #pigeon_copy, @@ -880,14 +1280,14 @@ class MockVideoProgressUpdate extends _i1.Mock #pigeon_copy, [], ), - returnValue: _FakeVideoProgressUpdate_8( + returnValue: _FakeVideoProgressUpdate_15( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeVideoProgressUpdate_8( + returnValueForMissingStub: _FakeVideoProgressUpdate_15( this, Invocation.method( #pigeon_copy, @@ -967,14 +1367,14 @@ class MockVideoView extends _i1.Mock implements _i2.VideoView { #pigeon_copy, [], ), - returnValue: _FakeVideoView_9( + returnValue: _FakeVideoView_16( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeVideoView_9( + returnValueForMissingStub: _FakeVideoView_16( this, Invocation.method( #pigeon_copy, @@ -1013,11 +1413,11 @@ class MockSurfaceAndroidViewController extends _i1.Mock @override _i4.PointTransformer get pointTransformer => (super.noSuchMethod( Invocation.getter(#pointTransformer), - returnValue: (_i3.Offset position) => _FakeOffset_10( + returnValue: (_i3.Offset position) => _FakeOffset_17( this, Invocation.getter(#pointTransformer), ), - returnValueForMissingStub: (_i3.Offset position) => _FakeOffset_10( + returnValueForMissingStub: (_i3.Offset position) => _FakeOffset_17( this, Invocation.getter(#pointTransformer), ), @@ -1081,14 +1481,14 @@ class MockSurfaceAndroidViewController extends _i1.Mock #setSize, [size], ), - returnValue: _i5.Future<_i3.Size>.value(_FakeSize_11( + returnValue: _i5.Future<_i3.Size>.value(_FakeSize_18( this, Invocation.method( #setSize, [size], ), )), - returnValueForMissingStub: _i5.Future<_i3.Size>.value(_FakeSize_11( + returnValueForMissingStub: _i5.Future<_i3.Size>.value(_FakeSize_18( this, Invocation.method( #setSize, @@ -1201,7 +1601,7 @@ class MockPlatformViewsServiceProxy extends _i1.Mock #onFocus: onFocus, }, ), - returnValue: _FakeExpensiveAndroidViewController_12( + returnValue: _FakeExpensiveAndroidViewController_19( this, Invocation.method( #initExpensiveAndroidView, @@ -1216,7 +1616,7 @@ class MockPlatformViewsServiceProxy extends _i1.Mock }, ), ), - returnValueForMissingStub: _FakeExpensiveAndroidViewController_12( + returnValueForMissingStub: _FakeExpensiveAndroidViewController_19( this, Invocation.method( #initExpensiveAndroidView, @@ -1255,7 +1655,7 @@ class MockPlatformViewsServiceProxy extends _i1.Mock #onFocus: onFocus, }, ), - returnValue: _FakeSurfaceAndroidViewController_13( + returnValue: _FakeSurfaceAndroidViewController_20( this, Invocation.method( #initSurfaceAndroidView, @@ -1270,7 +1670,7 @@ class MockPlatformViewsServiceProxy extends _i1.Mock }, ), ), - returnValueForMissingStub: _FakeSurfaceAndroidViewController_13( + returnValueForMissingStub: _FakeSurfaceAndroidViewController_20( this, Invocation.method( #initSurfaceAndroidView, From 17b6d31bbd5f17279d1bef4d378e27d9688215a9 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 30 May 2025 11:59:59 -0400 Subject: [PATCH 25/37] ios tests --- .../test/ios/ad_display_container_test.dart | 89 +++++++++++++++ .../ios/ad_display_container_test.mocks.dart | 104 +++++++++++++++++- 2 files changed, 189 insertions(+), 4 deletions(-) diff --git a/packages/interactive_media_ads/test/ios/ad_display_container_test.dart b/packages/interactive_media_ads/test/ios/ad_display_container_test.dart index cf9c9483922..2326157cf21 100644 --- a/packages/interactive_media_ads/test/ios/ad_display_container_test.dart +++ b/packages/interactive_media_ads/test/ios/ad_display_container_test.dart @@ -9,6 +9,8 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:interactive_media_ads/src/ios/interactive_media_ads.g.dart'; import 'package:interactive_media_ads/src/ios/interactive_media_ads_proxy.dart'; import 'package:interactive_media_ads/src/ios/ios_ad_display_container.dart'; +import 'package:interactive_media_ads/src/ios/ios_companion_ad_slot.dart'; +import 'package:interactive_media_ads/src/platform_interface/platform_interface.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; @@ -16,6 +18,7 @@ import 'ad_display_container_test.mocks.dart'; @GenerateNiceMocks(>[ MockSpec(), + MockSpec(), MockSpec(), MockSpec(), ]) @@ -91,5 +94,91 @@ void main() { expect(onContainerAddedCompleter.isCompleted, isTrue); }); + + testWidgets('AdDisplayContainer ads CompanionAdSlots', + (WidgetTester tester) async { + final PigeonInstanceManager instanceManager = PigeonInstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + final MockIMACompanionAdSlot mockCompanionAdSlot = + MockIMACompanionAdSlot(); + late final void Function(UIViewController, bool) viewDidAppearCallback; + final Completer?> addedAdSlotsCompleter = + Completer?>(); + final InteractiveMediaAdsProxy imaProxy = InteractiveMediaAdsProxy( + newUIViewController: ({ + void Function(UIViewController, bool)? viewDidAppear, + }) { + viewDidAppearCallback = viewDidAppear!; + + final UIView view = + UIView.pigeon_detached(pigeon_instanceManager: instanceManager); + instanceManager.addDartCreatedInstance(view); + + final MockUIViewController mockController = MockUIViewController(); + when(mockController.view).thenReturn(view); + return mockController; + }, + newIMAAdDisplayContainer: ({ + required UIView adContainer, + UIViewController? adContainerViewController, + List? companionSlots, + }) { + addedAdSlotsCompleter.complete(companionSlots); + return MockIMAAdDisplayContainer(); + }, + sizeIMACompanionAdSlot: ({ + required int width, + required int height, + required UIView view, + }) { + expect(width, 300); + expect(height, 400); + return mockCompanionAdSlot; + }, + newUIView: () { + return UIView.pigeon_detached( + pigeon_instanceManager: instanceManager, + ); + }, + ); + + final Completer onContainerAddedCompleter = Completer(); + + final IOSAdDisplayContainer container = IOSAdDisplayContainer( + IOSAdDisplayContainerCreationParams( + onContainerAdded: (_) => onContainerAddedCompleter.complete(), + companionSlots: [ + IOSCompanionAdSlot( + IOSCompanionAdSlotCreationParams.size( + width: 300, + height: 400, + proxy: imaProxy, + ), + ) + ], + imaProxy: imaProxy, + ), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) => container.build(context), + )); + + final UiKitView view = + find.byType(UiKitView).evaluate().single.widget as UiKitView; + view.onPlatformViewCreated!.call(0); + + viewDidAppearCallback(MockUIViewController(), true); + await tester.pumpAndSettle(); + + await onContainerAddedCompleter.future; + + expect( + await addedAdSlotsCompleter.future, + [mockCompanionAdSlot], + ); + }); }); } diff --git a/packages/interactive_media_ads/test/ios/ad_display_container_test.mocks.dart b/packages/interactive_media_ads/test/ios/ad_display_container_test.mocks.dart index d0a0473b165..1bfa309a9e0 100644 --- a/packages/interactive_media_ads/test/ios/ad_display_container_test.mocks.dart +++ b/packages/interactive_media_ads/test/ios/ad_display_container_test.mocks.dart @@ -55,9 +55,20 @@ class _FakeIMAAdDisplayContainer_2 extends _i1.SmartFake ); } -class _FakeUIViewController_3 extends _i1.SmartFake +class _FakeIMACompanionAdSlot_3 extends _i1.SmartFake + implements _i2.IMACompanionAdSlot { + _FakeIMACompanionAdSlot_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeUIViewController_4 extends _i1.SmartFake implements _i2.UIViewController { - _FakeUIViewController_3( + _FakeUIViewController_4( Object parent, Invocation parentInvocation, ) : super( @@ -165,6 +176,91 @@ class MockIMAAdDisplayContainer extends _i1.Mock ) as _i2.IMAAdDisplayContainer); } +/// A class which mocks [IMACompanionAdSlot]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockIMACompanionAdSlot extends _i1.Mock + implements _i2.IMACompanionAdSlot { + @override + _i2.UIView get view => (super.noSuchMethod( + Invocation.getter(#view), + returnValue: _FakeUIView_0( + this, + Invocation.getter(#view), + ), + returnValueForMissingStub: _FakeUIView_0( + this, + Invocation.getter(#view), + ), + ) as _i2.UIView); + + @override + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_1( + this, + Invocation.getter(#pigeon_instanceManager), + ), + returnValueForMissingStub: _FakePigeonInstanceManager_1( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); + + @override + _i3.Future setDelegate(_i2.IMACompanionDelegate? delegate) => + (super.noSuchMethod( + Invocation.method( + #setDelegate, + [delegate], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future width() => (super.noSuchMethod( + Invocation.method( + #width, + [], + ), + returnValue: _i3.Future.value(0), + returnValueForMissingStub: _i3.Future.value(0), + ) as _i3.Future); + + @override + _i3.Future height() => (super.noSuchMethod( + Invocation.method( + #height, + [], + ), + returnValue: _i3.Future.value(0), + returnValueForMissingStub: _i3.Future.value(0), + ) as _i3.Future); + + @override + _i2.IMACompanionAdSlot pigeon_copy() => (super.noSuchMethod( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeIMACompanionAdSlot_3( + this, + Invocation.method( + #pigeon_copy, + [], + ), + ), + returnValueForMissingStub: _FakeIMACompanionAdSlot_3( + this, + Invocation.method( + #pigeon_copy, + [], + ), + ), + ) as _i2.IMACompanionAdSlot); +} + /// A class which mocks [UIView]. /// /// See the documentation for Mockito's code generation for more information. @@ -263,14 +359,14 @@ class MockUIViewController extends _i1.Mock implements _i2.UIViewController { #pigeon_copy, [], ), - returnValue: _FakeUIViewController_3( + returnValue: _FakeUIViewController_4( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeUIViewController_3( + returnValueForMissingStub: _FakeUIViewController_4( this, Invocation.method( #pigeon_copy, From 6d00ba4931da401c7abea83fd90c7863f14f0d29 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 30 May 2025 12:03:25 -0400 Subject: [PATCH 26/37] improve docs --- .../interactive_media_ads/lib/src/companion_ad_slot.dart | 5 +++-- .../src/platform_interface/platform_companion_ad_slot.dart | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/interactive_media_ads/lib/src/companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/companion_ad_slot.dart index 9a7cacdd76d..971ec52eff4 100644 --- a/packages/interactive_media_ads/lib/src/companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/companion_ad_slot.dart @@ -29,7 +29,8 @@ import 'platform_interface/platform_interface.dart'; /// } /// ``` class CompanionAdSlot { - /// Constructs an [CompanionAdSlot]. + /// Constructs an instance of a [CompanionAdSlot] with design ad width and + /// height. /// /// See [CompanionAdSlot.fromPlatformCreationParams] for setting parameters /// for a specific platform. @@ -45,7 +46,7 @@ class CompanionAdSlot { ), ); - /// Constructs an [CompanionAdSlot]. + /// Constructs an instance of a [CompanionAdSlot] with fluid size. /// /// See [CompanionAdSlot.fromPlatformCreationParams] for setting parameters /// for a specific platform. diff --git a/packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart index b11bec604ee..08e1d3bd995 100644 --- a/packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart @@ -45,7 +45,7 @@ import 'interactive_media_ads_platform.dart'; @immutable base class PlatformCompanionAdSlotCreationParams { /// Used by the platform implementation to create a new - /// [PlatformCompanionAdSlot]. + /// [PlatformCompanionAdSlot] with ad width and height. const PlatformCompanionAdSlotCreationParams.size({ required int this.width, required int this.height, @@ -53,7 +53,7 @@ base class PlatformCompanionAdSlotCreationParams { }) : isFluid = false; /// Used by the platform implementation to create a new - /// [PlatformCompanionAdSlot]. + /// [PlatformCompanionAdSlot] with fluid size. const PlatformCompanionAdSlotCreationParams.fluid({this.onClicked}) : width = null, height = null, From aa6dfcba2dfff4d18402b966608a46d98531c30d Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 30 May 2025 12:47:09 -0400 Subject: [PATCH 27/37] version bump --- packages/interactive_media_ads/CHANGELOG.md | 4 ++++ .../packages/interactive_media_ads/AdsRequestProxyApi.kt | 2 +- .../interactive_media_ads/AdsRequestProxyAPIDelegate.swift | 2 +- packages/interactive_media_ads/pubspec.yaml | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/interactive_media_ads/CHANGELOG.md b/packages/interactive_media_ads/CHANGELOG.md index 347340ae32b..1065335d5b6 100644 --- a/packages/interactive_media_ads/CHANGELOG.md +++ b/packages/interactive_media_ads/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.4 + +* Adds support for companion ads. See `CompanionAdSlot` and `AdDisplayContainer(companionAds)`. + ## 0.2.3+12 * Fixes appending request agent to ad tags that contain a query. 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 2e46d3435d5..6352bd50d15 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.2.3+12" + const val pluginVersion = "0.2.4" } 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 c6ce12f4793..96be7e5b716 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.2.3+12" + static let pluginVersion = "0.2.4" func pigeonDefaultConstructor( pigeonApi: PigeonApiIMAAdsRequest, adTagUrl: String, adDisplayContainer: IMAAdDisplayContainer, diff --git a/packages/interactive_media_ads/pubspec.yaml b/packages/interactive_media_ads/pubspec.yaml index 0829e616937..12e319b9ec1 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.2.3+12 # This must match the version in +version: 0.2.4 # 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` From 9b902da43a638f3d1fc007846744aeb0372d6432 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Sun, 1 Jun 2025 18:08:21 -0400 Subject: [PATCH 28/37] separate example app --- packages/interactive_media_ads/README.md | 12 +- .../example/lib/main.dart | 26 +- .../example/lib/readme_example.dart | 270 ++++++++++++++++++ 3 files changed, 278 insertions(+), 30 deletions(-) create mode 100644 packages/interactive_media_ads/example/lib/readme_example.dart diff --git a/packages/interactive_media_ads/README.md b/packages/interactive_media_ads/README.md index e558e0c8ba4..b80b5a10d5f 100644 --- a/packages/interactive_media_ads/README.md +++ b/packages/interactive_media_ads/README.md @@ -55,7 +55,7 @@ If building on Android, add the user permissions required by the IMA SDK for req Add the import statements for the `interactive_media_ads` and [video_player][7]. Both plugins should already be added to your `pubspec.yaml`. - + ```dart import 'package:interactive_media_ads/interactive_media_ads.dart'; import 'package:video_player/video_player.dart'; @@ -66,7 +66,7 @@ import 'package:video_player/video_player.dart'; Create a new [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) that handles displaying Ads and playing content. - + ```dart /// Example widget displaying an Ad before a video. class AdExampleWidget extends StatefulWidget { @@ -120,7 +120,7 @@ Instantiate the [AdDisplayContainer][3] for playing Ads and the [VideoPlayerController](https://pub.dev/documentation/video_player/latest/video_player/VideoPlayerController-class.html) for playing content. - + ```dart late final AdDisplayContainer _adDisplayContainer = AdDisplayContainer( onContainerAdded: (AdDisplayContainer container) { @@ -194,7 +194,7 @@ void initState() { Return a `Widget` that contains the ad player and the content player. - + ```dart @override Widget build(BuildContext context) { @@ -244,7 +244,7 @@ Widget build(BuildContext context) { Handle requesting ads and add event listeners to handle when content should be displayed or hidden. - + ```dart Future _requestAds(AdDisplayContainer container) { return _adsLoader.requestAds(AdsRequest( @@ -292,7 +292,7 @@ Future _pauseContent() { Dispose the content player and destroy the [AdsManager][6]. - + ```dart @override void dispose() { diff --git a/packages/interactive_media_ads/example/lib/main.dart b/packages/interactive_media_ads/example/lib/main.dart index 43e5486bfc7..d0e66b7061d 100644 --- a/packages/interactive_media_ads/example/lib/main.dart +++ b/packages/interactive_media_ads/example/lib/main.dart @@ -6,10 +6,8 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_driver/driver_extension.dart'; -// #docregion imports import 'package:interactive_media_ads/interactive_media_ads.dart'; import 'package:video_player/video_player.dart'; -// #enddocregion imports /// Entry point for integration tests that require espresso. @pragma('vm:entry-point') @@ -22,7 +20,6 @@ void main() { runApp(const MaterialApp(home: AdExampleWidget())); } -// #docregion example_widget /// Example widget displaying an Ad before a video. class AdExampleWidget extends StatefulWidget { /// Constructs an [AdExampleWidget]. @@ -45,11 +42,9 @@ class _AdExampleWidgetState extends State // AdsManager exposes methods to control ad playback and listen to ad events. AdsManager? _adsManager; - // #enddocregion example_widget // Last state received in `didChangeAppLifecycleState`. AppLifecycleState _lastLifecycleState = AppLifecycleState.resumed; - // #docregion example_widget // Whether the widget should be displaying the content video. The content // player is hidden while Ads are playing. bool _shouldShowContentVideo = false; @@ -65,7 +60,6 @@ class _AdExampleWidgetState extends State // This is required to support mid-roll ads. final ContentProgressProvider _contentProgressProvider = ContentProgressProvider(); - // #enddocregion example_widget late final CompanionAdSlot companionAd = CompanionAdSlot.size( width: 300, @@ -73,7 +67,6 @@ class _AdExampleWidgetState extends State onClicked: () => debugPrint('Companion Ad Clicked'), ); - // #docregion ad_and_content_players late final AdDisplayContainer _adDisplayContainer = AdDisplayContainer( companionAds: [companionAd], onContainerAdded: (AdDisplayContainer container) { @@ -124,11 +117,9 @@ class _AdExampleWidgetState extends State @override void initState() { super.initState(); - // #enddocregion ad_and_content_players // Adds this instance as an observer for `AppLifecycleState` changes. WidgetsBinding.instance.addObserver(this); - // #docregion ad_and_content_players _contentVideoController = VideoPlayerController.networkUrl( Uri.parse( 'https://storage.googleapis.com/gvabox/media/samples/stock.mp4', @@ -145,7 +136,6 @@ class _AdExampleWidgetState extends State setState(() {}); }); } - // #enddocregion ad_and_content_players @override void didChangeAppLifecycleState(AppLifecycleState state) { @@ -170,7 +160,6 @@ class _AdExampleWidgetState extends State _lastLifecycleState = state; } - // #docregion request_ads Future _requestAds(AdDisplayContainer container) { return _adsLoader.requestAds(AdsRequest( adTagUrl: _adTagUrl, @@ -211,31 +200,24 @@ class _AdExampleWidgetState extends State _contentProgressTimer = null; return _contentVideoController.pause(); } - // #enddocregion request_ads - // #docregion dispose @override void dispose() { super.dispose(); _contentProgressTimer?.cancel(); _contentVideoController.dispose(); _adsManager?.destroy(); - // #enddocregion dispose WidgetsBinding.instance.removeObserver(this); - // #docregion dispose } - // #enddocregion dispose - // #docregion example_widget - // #docregion widget_build @override Widget build(BuildContext context) { - // #enddocregion example_widget return Scaffold( body: Center( child: Column( + spacing: 100, + mainAxisAlignment: MainAxisAlignment.center, children: [ - const SizedBox(width: 100, height: 150), SizedBox( width: 300, child: !_contentVideoController.value.isInitialized @@ -254,7 +236,6 @@ class _AdExampleWidgetState extends State ), ), ), - const SizedBox(width: 100, height: 150), ColoredBox( color: Colors.green, child: SizedBox( @@ -284,8 +265,5 @@ class _AdExampleWidgetState extends State ) : null, ); - // #docregion example_widget } - // #enddocregion widget_build } -// #enddocregion example_widget diff --git a/packages/interactive_media_ads/example/lib/readme_example.dart b/packages/interactive_media_ads/example/lib/readme_example.dart new file mode 100644 index 00000000000..fe4124c3a7b --- /dev/null +++ b/packages/interactive_media_ads/example/lib/readme_example.dart @@ -0,0 +1,270 @@ +// 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. + +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:flutter_driver/driver_extension.dart'; +// #docregion imports +import 'package:interactive_media_ads/interactive_media_ads.dart'; +import 'package:video_player/video_player.dart'; +// #enddocregion imports + +/// Entry point for integration tests that require espresso. +@pragma('vm:entry-point') +void integrationTestMain() { + enableFlutterDriverExtension(); + main(); +} + +void main() { + runApp(const MaterialApp(home: AdExampleWidget())); +} + +// #docregion example_widget +/// Example widget displaying an Ad before a video. +class AdExampleWidget extends StatefulWidget { + /// Constructs an [AdExampleWidget]. + const AdExampleWidget({super.key}); + + @override + State createState() => _AdExampleWidgetState(); +} + +class _AdExampleWidgetState extends State + with WidgetsBindingObserver { + // IMA sample tag for a pre-, mid-, and post-roll, single inline video ad. See more IMA sample + // tags at https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/tags + static const String _adTagUrl = + 'https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpremidpost&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&cmsid=496&vid=short_onecue&correlator='; + + // The AdsLoader instance exposes the request ads method. + late final AdsLoader _adsLoader; + + // AdsManager exposes methods to control ad playback and listen to ad events. + AdsManager? _adsManager; + + // #enddocregion example_widget + // Last state received in `didChangeAppLifecycleState`. + AppLifecycleState _lastLifecycleState = AppLifecycleState.resumed; + + // #docregion example_widget + // Whether the widget should be displaying the content video. The content + // player is hidden while Ads are playing. + bool _shouldShowContentVideo = false; + + // Controls the content video player. + late final VideoPlayerController _contentVideoController; + + // Periodically updates the SDK of the current playback progress of the + // content video. + Timer? _contentProgressTimer; + + // Provides the SDK with the current playback progress of the content video. + // This is required to support mid-roll ads. + final ContentProgressProvider _contentProgressProvider = + ContentProgressProvider(); + // #enddocregion example_widget + + // #docregion ad_and_content_players + late final AdDisplayContainer _adDisplayContainer = AdDisplayContainer( + onContainerAdded: (AdDisplayContainer container) { + _adsLoader = AdsLoader( + container: container, + onAdsLoaded: (OnAdsLoadedData data) { + final AdsManager manager = data.manager; + _adsManager = data.manager; + + manager.setAdsManagerDelegate(AdsManagerDelegate( + onAdEvent: (AdEvent event) { + debugPrint('OnAdEvent: ${event.type} => ${event.adData}'); + switch (event.type) { + case AdEventType.loaded: + manager.start(); + case AdEventType.contentPauseRequested: + _pauseContent(); + case AdEventType.contentResumeRequested: + _resumeContent(); + case AdEventType.allAdsCompleted: + manager.destroy(); + _adsManager = null; + case AdEventType.clicked: + case AdEventType.complete: + case _: + } + }, + onAdErrorEvent: (AdErrorEvent event) { + debugPrint('AdErrorEvent: ${event.error.message}'); + _resumeContent(); + }, + )); + + manager.init(settings: AdsRenderingSettings(enablePreloading: true)); + }, + onAdsLoadError: (AdsLoadErrorData data) { + debugPrint('OnAdsLoadError: ${data.error.message}'); + _resumeContent(); + }, + ); + + // Ads can't be requested until the `AdDisplayContainer` has been added to + // the native View hierarchy. + _requestAds(container); + }, + ); + + @override + void initState() { + super.initState(); + // #enddocregion ad_and_content_players + // Adds this instance as an observer for `AppLifecycleState` changes. + WidgetsBinding.instance.addObserver(this); + + // #docregion ad_and_content_players + _contentVideoController = VideoPlayerController.networkUrl( + Uri.parse( + 'https://storage.googleapis.com/gvabox/media/samples/stock.mp4', + ), + ) + ..addListener(() { + if (_contentVideoController.value.isCompleted) { + _adsLoader.contentComplete(); + } + setState(() {}); + }) + ..initialize().then((_) { + // Ensure the first frame is shown after the video is initialized, even before the play button has been pressed. + setState(() {}); + }); + } + // #enddocregion ad_and_content_players + + @override + void didChangeAppLifecycleState(AppLifecycleState state) { + switch (state) { + case AppLifecycleState.resumed: + if (!_shouldShowContentVideo) { + _adsManager?.resume(); + } + case AppLifecycleState.inactive: + // Pausing the Ad video player on Android can only be done in this state + // because it corresponds to `Activity.onPause`. This state is also + // triggered before resume, so this will only pause the Ad if the app is + // in the process of being sent to the background. + if (!_shouldShowContentVideo && + _lastLifecycleState == AppLifecycleState.resumed) { + _adsManager?.pause(); + } + case AppLifecycleState.hidden: + case AppLifecycleState.paused: + case AppLifecycleState.detached: + } + _lastLifecycleState = state; + } + + // #docregion request_ads + Future _requestAds(AdDisplayContainer container) { + return _adsLoader.requestAds(AdsRequest( + adTagUrl: _adTagUrl, + contentProgressProvider: _contentProgressProvider, + )); + } + + Future _resumeContent() async { + setState(() { + _shouldShowContentVideo = true; + }); + + if (_adsManager != null) { + _contentProgressTimer = Timer.periodic( + const Duration(milliseconds: 200), + (Timer timer) async { + if (_contentVideoController.value.isInitialized) { + final Duration? progress = await _contentVideoController.position; + if (progress != null) { + await _contentProgressProvider.setProgress( + progress: progress, + duration: _contentVideoController.value.duration, + ); + } + } + }, + ); + } + + await _contentVideoController.play(); + } + + Future _pauseContent() { + setState(() { + _shouldShowContentVideo = false; + }); + _contentProgressTimer?.cancel(); + _contentProgressTimer = null; + return _contentVideoController.pause(); + } + // #enddocregion request_ads + + // #docregion dispose + @override + void dispose() { + super.dispose(); + _contentProgressTimer?.cancel(); + _contentVideoController.dispose(); + _adsManager?.destroy(); + // #enddocregion dispose + WidgetsBinding.instance.removeObserver(this); + // #docregion dispose + } + // #enddocregion dispose + + // #docregion example_widget + // #docregion widget_build + @override + Widget build(BuildContext context) { + // #enddocregion example_widget + return Scaffold( + body: Center( + child: SizedBox( + width: 300, + child: !_contentVideoController.value.isInitialized + ? Container() + : AspectRatio( + aspectRatio: _contentVideoController.value.aspectRatio, + child: Stack( + children: [ + // The display container must be on screen before any Ads can be + // loaded and can't be removed between ads. This handles clicks for + // ads. + _adDisplayContainer, + if (_shouldShowContentVideo) + VideoPlayer(_contentVideoController) + ], + ), + ), + ), + ), + floatingActionButton: + _contentVideoController.value.isInitialized && _shouldShowContentVideo + ? FloatingActionButton( + onPressed: () { + setState(() { + _contentVideoController.value.isPlaying + ? _contentVideoController.pause() + : _contentVideoController.play(); + }); + }, + child: Icon( + _contentVideoController.value.isPlaying + ? Icons.pause + : Icons.play_arrow, + ), + ) + : null, + ); + // #docregion example_widget + } +// #enddocregion widget_build +} +// #enddocregion example_widget From 69596f70957c9192c59bdddd7de37ef2208a271d Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Sun, 1 Jun 2025 18:24:32 -0400 Subject: [PATCH 29/37] accidental g --- .../lib/src/ios/ios_companion_ad_slot.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart index b38b6400e75..f8009ec238f 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart @@ -1,6 +1,6 @@ // 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.g +// found in the LICENSE file. import 'package:flutter/cupertino.dart'; import 'package:flutter/services.dart'; From 2289ac4717299f43347d178d8caf8f4a7c7ae37f Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 2 Jun 2025 17:06:45 -0400 Subject: [PATCH 30/37] fix flake --- .../test/android/content_progress_provider_test.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/interactive_media_ads/test/android/content_progress_provider_test.dart b/packages/interactive_media_ads/test/android/content_progress_provider_test.dart index bf7885bb77c..9566988bf52 100644 --- a/packages/interactive_media_ads/test/android/content_progress_provider_test.dart +++ b/packages/interactive_media_ads/test/android/content_progress_provider_test.dart @@ -32,7 +32,11 @@ void main() { }) { expect(currentTimeMs, 1000); expect(durationMs, 10000); - return ima.VideoProgressUpdate.pigeon_detached(); + return ima.VideoProgressUpdate.pigeon_detached( + pigeon_instanceManager: ima.PigeonInstanceManager( + onWeakReferenceRemoved: (_) {}, + ), + ); }, ), ), From cd27ff12f8e2fa49840b010b42fb0d3eb8d0f382 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 2 Jun 2025 20:02:35 -0400 Subject: [PATCH 31/37] docs and unused code --- .../example/lib/readme_example.dart | 11 ----------- .../lib/src/companion_ad_slot.dart | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/packages/interactive_media_ads/example/lib/readme_example.dart b/packages/interactive_media_ads/example/lib/readme_example.dart index fe4124c3a7b..7862d3a0005 100644 --- a/packages/interactive_media_ads/example/lib/readme_example.dart +++ b/packages/interactive_media_ads/example/lib/readme_example.dart @@ -11,17 +11,6 @@ import 'package:interactive_media_ads/interactive_media_ads.dart'; import 'package:video_player/video_player.dart'; // #enddocregion imports -/// Entry point for integration tests that require espresso. -@pragma('vm:entry-point') -void integrationTestMain() { - enableFlutterDriverExtension(); - main(); -} - -void main() { - runApp(const MaterialApp(home: AdExampleWidget())); -} - // #docregion example_widget /// Example widget displaying an Ad before a video. class AdExampleWidget extends StatefulWidget { diff --git a/packages/interactive_media_ads/lib/src/companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/companion_ad_slot.dart index 971ec52eff4..3e34497a802 100644 --- a/packages/interactive_media_ads/lib/src/companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/companion_ad_slot.dart @@ -83,7 +83,7 @@ class CompanionAdSlot { /// params, /// ); /// ``` - /// {@endtemplate}/// Builds the Widget that contains the native View. + /// {@endtemplate} CompanionAdSlot.fromPlatformCreationParams({ required PlatformCompanionAdSlotCreationParams params, }) : this.fromPlatform(PlatformCompanionAdSlot(params)); From a3357d8ba72e235ee82ff07b5fe15ac81f5da030 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 2 Jun 2025 20:33:00 -0400 Subject: [PATCH 32/37] analyze warning --- packages/interactive_media_ads/example/lib/readme_example.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/interactive_media_ads/example/lib/readme_example.dart b/packages/interactive_media_ads/example/lib/readme_example.dart index 7862d3a0005..1c2c5f42f60 100644 --- a/packages/interactive_media_ads/example/lib/readme_example.dart +++ b/packages/interactive_media_ads/example/lib/readme_example.dart @@ -5,7 +5,6 @@ import 'dart:async'; import 'package:flutter/material.dart'; -import 'package:flutter_driver/driver_extension.dart'; // #docregion imports import 'package:interactive_media_ads/interactive_media_ads.dart'; import 'package:video_player/video_player.dart'; From 82f64629a50e1d1ab183af7c2407926dbfe3ab4a Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Sat, 7 Jun 2025 17:18:36 -0400 Subject: [PATCH 33/37] add companion ad slot size --- .../companion_ad_slot_size.dart | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 packages/interactive_media_ads/lib/src/platform_interface/companion_ad_slot_size.dart diff --git a/packages/interactive_media_ads/lib/src/platform_interface/companion_ad_slot_size.dart b/packages/interactive_media_ads/lib/src/platform_interface/companion_ad_slot_size.dart new file mode 100644 index 00000000000..525d763b065 --- /dev/null +++ b/packages/interactive_media_ads/lib/src/platform_interface/companion_ad_slot_size.dart @@ -0,0 +1,47 @@ +// 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. + +import 'package:flutter/foundation.dart'; + +/// The size of the slot for a companion ad. +@immutable +sealed class CompanionAdSlotSize { + const CompanionAdSlotSize._(); + + /// A slot for a companion ad with a fixed with and height. + factory CompanionAdSlotSize.fixed({ + required int width, + required int height, + }) { + return CompanionAdSlotSizeFixed._(width: width, height: height); + } + + /// A slot for a companion had with no fixed size, but rather adapts to fit the + /// creative content they display. + factory CompanionAdSlotSize.fluid() { + return const CompanionAdSizeSlotFluid._(); + } +} + +/// A slot for a companion ad with a fixed with and height. +@immutable +class CompanionAdSlotSizeFixed extends CompanionAdSlotSize { + const CompanionAdSlotSizeFixed._({ + required this.width, + required this.height, + }) : super._(); + + /// The width of the ad slot in pixels. + final int width; + + /// The height of the ad slot in pixels. + final int height; +} + +/// A slot for a companion had with no fixed size, but rather adapts to fit the +/// creative content they display. +@immutable +class CompanionAdSizeSlotFluid extends CompanionAdSlotSize { + const CompanionAdSizeSlotFluid._() : super._(); +} From e207221b19d09b34107b646955bbabaf3c653043 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Sat, 7 Jun 2025 17:19:57 -0400 Subject: [PATCH 34/37] removed unused ignores --- .../lib/src/android/android_companion_ad_slot.dart | 5 ----- .../lib/src/ios/ios_companion_ad_slot.dart | 6 ------ 2 files changed, 11 deletions(-) diff --git a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart index 10e8f61e58e..0b1b411eb5d 100644 --- a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart @@ -40,9 +40,6 @@ final class AndroidCompanionAdSlotCreationParams /// Creates a [AndroidCompanionAdSlotCreationParams] from an instance of /// [PlatformCompanionAdSlotCreationParams]. factory AndroidCompanionAdSlotCreationParams.fromPlatformCompanionAdSlotCreationParamsSize( - // Placeholder to prevent requiring a breaking change if params are added to - // PlatformCompanionAdSlotCreationParams. - // ignore: avoid_unused_constructor_parameters PlatformCompanionAdSlotCreationParams params, { @visibleForTesting InteractiveMediaAdsProxy? proxy, @visibleForTesting PlatformViewsServiceProxy? platformViewsProxy, @@ -59,8 +56,6 @@ final class AndroidCompanionAdSlotCreationParams /// Creates a [AndroidCompanionAdSlotCreationParams] from an instance of /// [PlatformCompanionAdSlotCreationParams]. factory AndroidCompanionAdSlotCreationParams.fromPlatformCompanionAdSlotCreationParamsFluid( - // Placeholder to prevent requiring a breaking change if params are added to - // PlatformCompanionAdSlotCreationParams. PlatformCompanionAdSlotCreationParams params, { @visibleForTesting InteractiveMediaAdsProxy? proxy, @visibleForTesting PlatformViewsServiceProxy? platformViewsProxy, diff --git a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart index f8009ec238f..81218f1cff1 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart @@ -33,9 +33,6 @@ final class IOSCompanionAdSlotCreationParams /// Creates a [IOSCompanionAdSlotCreationParams] from an instance of /// [PlatformCompanionAdSlotCreationParams]. factory IOSCompanionAdSlotCreationParams.fromPlatformCompanionAdSlotCreationParamsSize( - // Placeholder to prevent requiring a breaking change if params are added to - // PlatformCompanionAdSlotCreationParams. - // ignore: avoid_unused_constructor_parameters PlatformCompanionAdSlotCreationParams params, { @visibleForTesting InteractiveMediaAdsProxy? proxy, }) { @@ -50,9 +47,6 @@ final class IOSCompanionAdSlotCreationParams /// Creates a [IOSCompanionAdSlotCreationParams] from an instance of /// [PlatformCompanionAdSlotCreationParams]. factory IOSCompanionAdSlotCreationParams.fromPlatformCompanionAdSlotCreationParamsFluid( - // Placeholder to prevent requiring a breaking change if params are added to - // PlatformCompanionAdSlotCreationParams. - // ignore: avoid_unused_constructor_parameters PlatformCompanionAdSlotCreationParams params, { @visibleForTesting InteractiveMediaAdsProxy? proxy, }) { From ca30b3b1d6e5f43cf85177dc865155e46fc0d40e Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Sat, 7 Jun 2025 17:48:45 -0400 Subject: [PATCH 35/37] update companion ad slot to use companionadslotsize --- .../example/lib/main.dart | 5 +- .../lib/interactive_media_ads.dart | 5 +- .../android/android_companion_ad_slot.dart | 59 +++++------------- .../lib/src/companion_ad_slot.dart | 27 +++----- .../lib/src/ios/ios_companion_ad_slot.dart | 62 ++++++------------- .../companion_ad_slot_size.dart | 6 +- .../platform_companion_ad_slot.dart | 32 +++------- .../platform_interface.dart | 1 + .../android/ad_display_container_test.dart | 5 +- .../test/android/companion_ad_slot_test.dart | 11 ++-- .../test/companion_ad_slot_test.dart | 2 +- .../test/ios/ad_display_container_test.dart | 5 +- .../test/ios/companion_ad_slot_test.dart | 11 ++-- 13 files changed, 74 insertions(+), 157 deletions(-) diff --git a/packages/interactive_media_ads/example/lib/main.dart b/packages/interactive_media_ads/example/lib/main.dart index d0e66b7061d..86341bae125 100644 --- a/packages/interactive_media_ads/example/lib/main.dart +++ b/packages/interactive_media_ads/example/lib/main.dart @@ -61,9 +61,8 @@ class _AdExampleWidgetState extends State final ContentProgressProvider _contentProgressProvider = ContentProgressProvider(); - late final CompanionAdSlot companionAd = CompanionAdSlot.size( - width: 300, - height: 250, + late final CompanionAdSlot companionAd = CompanionAdSlot( + size: CompanionAdSlotSize.fixed(width: 300, height: 250), onClicked: () => debugPrint('Companion Ad Clicked'), ); diff --git a/packages/interactive_media_ads/lib/interactive_media_ads.dart b/packages/interactive_media_ads/lib/interactive_media_ads.dart index 86985d67a24..99948a8ccb6 100644 --- a/packages/interactive_media_ads/lib/interactive_media_ads.dart +++ b/packages/interactive_media_ads/lib/interactive_media_ads.dart @@ -21,4 +21,7 @@ export 'src/platform_interface/platform_interface.dart' AdEvent, AdEventType, AdUIElement, - AdsLoadErrorData; + AdsLoadErrorData, + CompanionAdSlotSize, + CompanionAdSlotSizeFixed, + CompanionAdSlotSizeFluid; diff --git a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart index 0b1b411eb5d..2ce3fbf2bbc 100644 --- a/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/android/android_companion_ad_slot.dart @@ -6,6 +6,7 @@ import 'package:flutter/cupertino.dart'; import 'package:meta/meta.dart'; import '../platform_interface/build_widget_creation_params.dart'; +import '../platform_interface/companion_ad_slot_size.dart'; import '../platform_interface/platform_companion_ad_slot.dart'; import 'android_view_widget.dart'; import 'interactive_media_ads.g.dart' as ima; @@ -15,52 +16,26 @@ import 'platform_views_service_proxy.dart'; /// Android implementation of [PlatformCompanionAdSlotCreationParams]. final class AndroidCompanionAdSlotCreationParams extends PlatformCompanionAdSlotCreationParams { - /// Constructs a [AndroidCompanionAdSlotCreationParams]. - const AndroidCompanionAdSlotCreationParams.size({ - required super.width, - required super.height, + /// Constructs an [AndroidCompanionAdSlotCreationParams]. + const AndroidCompanionAdSlotCreationParams({ + required super.size, super.onClicked, @visibleForTesting InteractiveMediaAdsProxy? proxy, @visibleForTesting PlatformViewsServiceProxy? platformViewsProxy, }) : _proxy = proxy ?? const InteractiveMediaAdsProxy(), _platformViewsProxy = platformViewsProxy ?? const PlatformViewsServiceProxy(), - super.size(); + super(); - /// Constructs a [AndroidCompanionAdSlotCreationParams]. - const AndroidCompanionAdSlotCreationParams.fluid({ - super.onClicked, - @visibleForTesting InteractiveMediaAdsProxy? proxy, - @visibleForTesting PlatformViewsServiceProxy? platformViewsProxy, - }) : _proxy = proxy ?? const InteractiveMediaAdsProxy(), - _platformViewsProxy = - platformViewsProxy ?? const PlatformViewsServiceProxy(), - super.fluid(); - - /// Creates a [AndroidCompanionAdSlotCreationParams] from an instance of + /// Creates a [AndroidCompanionAdSlotCreationParams] from an instance of /// [PlatformCompanionAdSlotCreationParams]. factory AndroidCompanionAdSlotCreationParams.fromPlatformCompanionAdSlotCreationParamsSize( PlatformCompanionAdSlotCreationParams params, { @visibleForTesting InteractiveMediaAdsProxy? proxy, @visibleForTesting PlatformViewsServiceProxy? platformViewsProxy, }) { - return AndroidCompanionAdSlotCreationParams.size( - width: params.width!, - height: params.height!, - onClicked: params.onClicked, - proxy: proxy, - platformViewsProxy: platformViewsProxy, - ); - } - - /// Creates a [AndroidCompanionAdSlotCreationParams] from an instance of - /// [PlatformCompanionAdSlotCreationParams]. - factory AndroidCompanionAdSlotCreationParams.fromPlatformCompanionAdSlotCreationParamsFluid( - PlatformCompanionAdSlotCreationParams params, { - @visibleForTesting InteractiveMediaAdsProxy? proxy, - @visibleForTesting PlatformViewsServiceProxy? platformViewsProxy, - }) { - return AndroidCompanionAdSlotCreationParams.fluid( + return AndroidCompanionAdSlotCreationParams( + size: params.size, onClicked: params.onClicked, proxy: proxy, platformViewsProxy: platformViewsProxy, @@ -106,13 +81,8 @@ base class AndroidCompanionAdSlot extends PlatformCompanionAdSlot { return params; } - if (params.isFluid) { - return AndroidCompanionAdSlotCreationParams - .fromPlatformCompanionAdSlotCreationParamsFluid(params); - } else { - return AndroidCompanionAdSlotCreationParams - .fromPlatformCompanionAdSlotCreationParamsSize(params); - } + return AndroidCompanionAdSlotCreationParams + .fromPlatformCompanionAdSlotCreationParamsSize(params); } Future _initCompanionAdSlot() async { @@ -122,10 +92,11 @@ base class AndroidCompanionAdSlot extends PlatformCompanionAdSlot { await Future.wait(>[ adSlot.setContainer(_frameLayout), - if (params.isFluid) - adSlot.setFluidSize() - else - adSlot.setSize(params.width!, params.height!), + switch (params.size) { + final CompanionAdSlotSizeFixed size => + adSlot.setSize(size.width, size.height), + CompanionAdSlotSizeFluid() => adSlot.setFluidSize(), + }, if (params.onClicked != null) adSlot.addClickListener( _createAdSlotClickListener( diff --git a/packages/interactive_media_ads/lib/src/companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/companion_ad_slot.dart index 3e34497a802..abd90a7c28f 100644 --- a/packages/interactive_media_ads/lib/src/companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/companion_ad_slot.dart @@ -29,35 +29,22 @@ import 'platform_interface/platform_interface.dart'; /// } /// ``` class CompanionAdSlot { - /// Constructs an instance of a [CompanionAdSlot] with design ad width and - /// height. + /// Constructs an instance of a [CompanionAdSlot]. /// /// See [CompanionAdSlot.fromPlatformCreationParams] for setting parameters /// for a specific platform. - CompanionAdSlot.size({ - required int width, - required int height, + CompanionAdSlot({ + required CompanionAdSlotSize size, void Function()? onClicked, }) : this.fromPlatformCreationParams( - params: PlatformCompanionAdSlotCreationParams.size( - width: width, - height: height, + params: PlatformCompanionAdSlotCreationParams( + size: size, onClicked: onClicked, ), ); - /// Constructs an instance of a [CompanionAdSlot] with fluid size. - /// - /// See [CompanionAdSlot.fromPlatformCreationParams] for setting parameters - /// for a specific platform. - CompanionAdSlot.fluid({void Function()? onClicked}) - : this.fromPlatformCreationParams( - params: PlatformCompanionAdSlotCreationParams.fluid( - onClicked: onClicked, - ), - ); - - /// Constructs an [CompanionAdSlot] from creation params for a specific platform. + /// Constructs an [CompanionAdSlot] from creation params for a specific + /// platform. /// /// {@template interactive_media_ads.CompanionAdSlot.fromPlatformCreationParams} /// Below is an example of setting platform-specific creation parameters for diff --git a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart index 81218f1cff1..3bb096bb0fa 100644 --- a/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/ios/ios_companion_ad_slot.dart @@ -7,6 +7,7 @@ import 'package:flutter/services.dart'; import 'package:meta/meta.dart'; import '../platform_interface/build_widget_creation_params.dart'; +import '../platform_interface/companion_ad_slot_size.dart'; import '../platform_interface/platform_companion_ad_slot.dart'; import 'interactive_media_ads.g.dart'; import 'interactive_media_ads_proxy.dart'; @@ -14,43 +15,22 @@ import 'interactive_media_ads_proxy.dart'; /// Implementation of [PlatformCompanionAdSlotCreationParams] for iOS. final class IOSCompanionAdSlotCreationParams extends PlatformCompanionAdSlotCreationParams { - /// Constructs a [IOSCompanionAdSlotCreationParams]. - const IOSCompanionAdSlotCreationParams.size({ - required super.width, - required super.height, + /// Constructs an [IOSCompanionAdSlotCreationParams]. + const IOSCompanionAdSlotCreationParams({ + required super.size, super.onClicked, @visibleForTesting InteractiveMediaAdsProxy? proxy, }) : _proxy = proxy ?? const InteractiveMediaAdsProxy(), - super.size(); + super(); - /// Constructs a [IOSCompanionAdSlotCreationParams]. - const IOSCompanionAdSlotCreationParams.fluid({ - super.onClicked, - @visibleForTesting InteractiveMediaAdsProxy? proxy, - }) : _proxy = proxy ?? const InteractiveMediaAdsProxy(), - super.fluid(); - - /// Creates a [IOSCompanionAdSlotCreationParams] from an instance of + /// Creates an [IOSCompanionAdSlotCreationParams] from an instance of /// [PlatformCompanionAdSlotCreationParams]. factory IOSCompanionAdSlotCreationParams.fromPlatformCompanionAdSlotCreationParamsSize( PlatformCompanionAdSlotCreationParams params, { @visibleForTesting InteractiveMediaAdsProxy? proxy, }) { - return IOSCompanionAdSlotCreationParams.size( - width: params.width!, - height: params.height!, - onClicked: params.onClicked, - proxy: proxy, - ); - } - - /// Creates a [IOSCompanionAdSlotCreationParams] from an instance of - /// [PlatformCompanionAdSlotCreationParams]. - factory IOSCompanionAdSlotCreationParams.fromPlatformCompanionAdSlotCreationParamsFluid( - PlatformCompanionAdSlotCreationParams params, { - @visibleForTesting InteractiveMediaAdsProxy? proxy, - }) { - return IOSCompanionAdSlotCreationParams.fluid( + return IOSCompanionAdSlotCreationParams( + size: params.size, onClicked: params.onClicked, proxy: proxy, ); @@ -96,23 +76,21 @@ base class IOSCompanionAdSlot extends PlatformCompanionAdSlot { return params; } - if (params.isFluid) { - return IOSCompanionAdSlotCreationParams - .fromPlatformCompanionAdSlotCreationParamsFluid(params); - } else { - return IOSCompanionAdSlotCreationParams - .fromPlatformCompanionAdSlotCreationParamsSize(params); - } + return IOSCompanionAdSlotCreationParams + .fromPlatformCompanionAdSlotCreationParamsSize(params); } IMACompanionAdSlot _initCompanionAdSlot() { - final IMACompanionAdSlot adSlot = params.isFluid - ? _iosParams._proxy.newIMACompanionAdSlot(view: _view) - : _iosParams._proxy.sizeIMACompanionAdSlot( - view: _view, - width: _iosParams.width!, - height: _iosParams.height!, - ); + final IMACompanionAdSlot adSlot = switch (params.size) { + final CompanionAdSlotSizeFixed size => + _iosParams._proxy.sizeIMACompanionAdSlot( + view: _view, + width: size.width, + height: size.height, + ), + CompanionAdSlotSizeFluid() => + _iosParams._proxy.newIMACompanionAdSlot(view: _view), + }; if (params.onClicked != null) { adSlot.setDelegate(_delegate); diff --git a/packages/interactive_media_ads/lib/src/platform_interface/companion_ad_slot_size.dart b/packages/interactive_media_ads/lib/src/platform_interface/companion_ad_slot_size.dart index 525d763b065..e0c3e1c8483 100644 --- a/packages/interactive_media_ads/lib/src/platform_interface/companion_ad_slot_size.dart +++ b/packages/interactive_media_ads/lib/src/platform_interface/companion_ad_slot_size.dart @@ -20,7 +20,7 @@ sealed class CompanionAdSlotSize { /// A slot for a companion had with no fixed size, but rather adapts to fit the /// creative content they display. factory CompanionAdSlotSize.fluid() { - return const CompanionAdSizeSlotFluid._(); + return const CompanionAdSlotSizeFluid._(); } } @@ -42,6 +42,6 @@ class CompanionAdSlotSizeFixed extends CompanionAdSlotSize { /// A slot for a companion had with no fixed size, but rather adapts to fit the /// creative content they display. @immutable -class CompanionAdSizeSlotFluid extends CompanionAdSlotSize { - const CompanionAdSizeSlotFluid._() : super._(); +class CompanionAdSlotSizeFluid extends CompanionAdSlotSize { + const CompanionAdSlotSizeFluid._() : super._(); } diff --git a/packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart index 08e1d3bd995..e47aeef1700 100644 --- a/packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/platform_interface/platform_companion_ad_slot.dart @@ -5,6 +5,7 @@ import 'package:flutter/widgets.dart'; import 'build_widget_creation_params.dart'; +import 'companion_ad_slot_size.dart'; import 'interactive_media_ads_platform.dart'; /// Object specifying creation parameters for creating a @@ -45,37 +46,18 @@ import 'interactive_media_ads_platform.dart'; @immutable base class PlatformCompanionAdSlotCreationParams { /// Used by the platform implementation to create a new - /// [PlatformCompanionAdSlot] with ad width and height. - const PlatformCompanionAdSlotCreationParams.size({ - required int this.width, - required int this.height, + /// [PlatformCompanionAdSlot]. + const PlatformCompanionAdSlotCreationParams({ + required this.size, this.onClicked, - }) : isFluid = false; - - /// Used by the platform implementation to create a new - /// [PlatformCompanionAdSlot] with fluid size. - const PlatformCompanionAdSlotCreationParams.fluid({this.onClicked}) - : width = null, - height = null, - isFluid = true; + }); - /// The width of the companion slot. - /// - /// Returns `null` when [isFluid] returns true; - final int? width; - - /// The height of the companion slot. - /// - /// Returns `null` when [isFluid] returns true; - final int? height; + /// The size of the slot. + final CompanionAdSlotSize size; /// Called when the slot is clicked on by the user and will successfully /// navigate away. final void Function()? onClicked; - - /// Whether the companion ad has no fixed size, but rather adapts to fit the - /// creative content they display. - final bool isFluid; } /// Ad slot for companion ads. diff --git a/packages/interactive_media_ads/lib/src/platform_interface/platform_interface.dart b/packages/interactive_media_ads/lib/src/platform_interface/platform_interface.dart index 5b4deb434e9..5f724f48b6d 100644 --- a/packages/interactive_media_ads/lib/src/platform_interface/platform_interface.dart +++ b/packages/interactive_media_ads/lib/src/platform_interface/platform_interface.dart @@ -6,6 +6,7 @@ export 'ad_error.dart'; export 'ad_event.dart'; export 'ad_ui_element.dart'; export 'build_widget_creation_params.dart'; +export 'companion_ad_slot_size.dart'; export 'interactive_media_ads_platform.dart'; export 'platform_ad_display_container.dart'; export 'platform_ads_loader.dart'; diff --git a/packages/interactive_media_ads/test/android/ad_display_container_test.dart b/packages/interactive_media_ads/test/android/ad_display_container_test.dart index 717cd7404ad..460ad337557 100644 --- a/packages/interactive_media_ads/test/android/ad_display_container_test.dart +++ b/packages/interactive_media_ads/test/android/ad_display_container_test.dart @@ -754,9 +754,8 @@ void main() { platformViewsProxy: mockPlatformViewsProxy, companionSlots: [ AndroidCompanionAdSlot( - AndroidCompanionAdSlotCreationParams.size( - width: 300, - height: 444, + AndroidCompanionAdSlotCreationParams( + size: CompanionAdSlotSize.fixed(width: 300, height: 444), proxy: imaProxy, ), ) diff --git a/packages/interactive_media_ads/test/android/companion_ad_slot_test.dart b/packages/interactive_media_ads/test/android/companion_ad_slot_test.dart index c9af72016b7..950fdee9d8f 100644 --- a/packages/interactive_media_ads/test/android/companion_ad_slot_test.dart +++ b/packages/interactive_media_ads/test/android/companion_ad_slot_test.dart @@ -7,6 +7,7 @@ import 'package:interactive_media_ads/src/android/android_companion_ad_slot.dart import 'package:interactive_media_ads/src/android/interactive_media_ads.g.dart' as ima; import 'package:interactive_media_ads/src/android/interactive_media_ads_proxy.dart'; +import 'package:interactive_media_ads/src/platform_interface/companion_ad_slot_size.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; @@ -25,9 +26,8 @@ void main() { ); final MockCompanionAdSlot mockCompanionAdSlot = MockCompanionAdSlot(); final AndroidCompanionAdSlotCreationParams params = - AndroidCompanionAdSlotCreationParams.size( - width: 300, - height: 400, + AndroidCompanionAdSlotCreationParams( + size: CompanionAdSlotSize.fixed(width: 300, height: 400), proxy: InteractiveMediaAdsProxy( newFrameLayout: () { return frameLayout; @@ -52,9 +52,8 @@ void main() { test('AndroidCompanionAdSlot receives onClick', () async { final MockCompanionAdSlot mockCompanionAdSlot = MockCompanionAdSlot(); final AndroidCompanionAdSlotCreationParams params = - AndroidCompanionAdSlotCreationParams.size( - width: 300, - height: 400, + AndroidCompanionAdSlotCreationParams( + size: CompanionAdSlotSize.fixed(width: 300, height: 400), onClicked: expectAsync0(() {}), proxy: InteractiveMediaAdsProxy( newFrameLayout: () { diff --git a/packages/interactive_media_ads/test/companion_ad_slot_test.dart b/packages/interactive_media_ads/test/companion_ad_slot_test.dart index e55c139a38e..d9066297a25 100644 --- a/packages/interactive_media_ads/test/companion_ad_slot_test.dart +++ b/packages/interactive_media_ads/test/companion_ad_slot_test.dart @@ -14,7 +14,7 @@ void main() { testWidgets('buildWidget', (WidgetTester tester) async { final TestCompanionAdSlot slot = TestCompanionAdSlot( - const PlatformCompanionAdSlotCreationParams.fluid(), + PlatformCompanionAdSlotCreationParams(size: CompanionAdSlotSize.fluid()), onBuildWidget: (_) => Container(), ); diff --git a/packages/interactive_media_ads/test/ios/ad_display_container_test.dart b/packages/interactive_media_ads/test/ios/ad_display_container_test.dart index 2326157cf21..eb481968620 100644 --- a/packages/interactive_media_ads/test/ios/ad_display_container_test.dart +++ b/packages/interactive_media_ads/test/ios/ad_display_container_test.dart @@ -151,9 +151,8 @@ void main() { onContainerAdded: (_) => onContainerAddedCompleter.complete(), companionSlots: [ IOSCompanionAdSlot( - IOSCompanionAdSlotCreationParams.size( - width: 300, - height: 400, + IOSCompanionAdSlotCreationParams( + size: CompanionAdSlotSize.fixed(width: 300, height: 400), proxy: imaProxy, ), ) diff --git a/packages/interactive_media_ads/test/ios/companion_ad_slot_test.dart b/packages/interactive_media_ads/test/ios/companion_ad_slot_test.dart index b392bf0a835..750001baa68 100644 --- a/packages/interactive_media_ads/test/ios/companion_ad_slot_test.dart +++ b/packages/interactive_media_ads/test/ios/companion_ad_slot_test.dart @@ -6,6 +6,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:interactive_media_ads/src/ios/interactive_media_ads.g.dart'; import 'package:interactive_media_ads/src/ios/interactive_media_ads_proxy.dart'; import 'package:interactive_media_ads/src/ios/ios_companion_ad_slot.dart'; +import 'package:interactive_media_ads/src/platform_interface/companion_ad_slot_size.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; @@ -20,9 +21,8 @@ void main() { final MockIMACompanionAdSlot mockCompanionAdSlot = MockIMACompanionAdSlot(); final IOSCompanionAdSlotCreationParams params = - IOSCompanionAdSlotCreationParams.size( - width: 300, - height: 400, + IOSCompanionAdSlotCreationParams( + size: CompanionAdSlotSize.fixed(width: 300, height: 400), proxy: InteractiveMediaAdsProxy( sizeIMACompanionAdSlot: ({ required int width, @@ -49,9 +49,8 @@ void main() { final MockIMACompanionAdSlot mockCompanionAdSlot = MockIMACompanionAdSlot(); final IOSCompanionAdSlotCreationParams params = - IOSCompanionAdSlotCreationParams.size( - width: 300, - height: 400, + IOSCompanionAdSlotCreationParams( + size: CompanionAdSlotSize.fixed(width: 300, height: 400), onClicked: expectAsync0(() {}), proxy: InteractiveMediaAdsProxy( sizeIMACompanionAdSlot: ({ From 97ce35fa274244e69defdf0b98cc67cba3e1faf8 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Sat, 7 Jun 2025 22:40:37 -0400 Subject: [PATCH 36/37] typo --- .../lib/src/platform_interface/companion_ad_slot_size.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/interactive_media_ads/lib/src/platform_interface/companion_ad_slot_size.dart b/packages/interactive_media_ads/lib/src/platform_interface/companion_ad_slot_size.dart index e0c3e1c8483..cbaeb4416ca 100644 --- a/packages/interactive_media_ads/lib/src/platform_interface/companion_ad_slot_size.dart +++ b/packages/interactive_media_ads/lib/src/platform_interface/companion_ad_slot_size.dart @@ -17,7 +17,7 @@ sealed class CompanionAdSlotSize { return CompanionAdSlotSizeFixed._(width: width, height: height); } - /// A slot for a companion had with no fixed size, but rather adapts to fit the + /// A slot for a companion ad with no fixed size, but rather adapts to fit the /// creative content they display. factory CompanionAdSlotSize.fluid() { return const CompanionAdSlotSizeFluid._(); From ca7ed0fbb4c1075d2fca282d86d4c57ce9f32951 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 10 Jun 2025 22:41:41 -0400 Subject: [PATCH 37/37] docs immutable and companionSlots as name --- packages/interactive_media_ads/example/lib/main.dart | 2 +- .../interactive_media_ads/lib/src/ad_display_container.dart | 6 +++--- .../interactive_media_ads/lib/src/companion_ad_slot.dart | 4 ++-- .../platform_interface/build_widget_creation_params.dart | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/interactive_media_ads/example/lib/main.dart b/packages/interactive_media_ads/example/lib/main.dart index 86341bae125..1f591fc49ea 100644 --- a/packages/interactive_media_ads/example/lib/main.dart +++ b/packages/interactive_media_ads/example/lib/main.dart @@ -67,7 +67,7 @@ class _AdExampleWidgetState extends State ); late final AdDisplayContainer _adDisplayContainer = AdDisplayContainer( - companionAds: [companionAd], + companionSlots: [companionAd], onContainerAdded: (AdDisplayContainer container) { _adsLoader = AdsLoader( container: container, diff --git a/packages/interactive_media_ads/lib/src/ad_display_container.dart b/packages/interactive_media_ads/lib/src/ad_display_container.dart index 639769a3fce..6a814f1b365 100644 --- a/packages/interactive_media_ads/lib/src/ad_display_container.dart +++ b/packages/interactive_media_ads/lib/src/ad_display_container.dart @@ -37,7 +37,7 @@ class AdDisplayContainer extends StatelessWidget { AdDisplayContainer({ Key? key, required void Function(AdDisplayContainer container) onContainerAdded, - Iterable companionAds = const [], + Iterable companionSlots = const [], TextDirection layoutDirection = TextDirection.ltr, }) : this.fromPlatformCreationParams( key: key, @@ -47,7 +47,7 @@ class AdDisplayContainer extends StatelessWidget { platform: container, )); }, - companionSlots: companionAds.map( + companionSlots: companionSlots.map( (CompanionAdSlot slot) => slot.platform, ), layoutDirection: layoutDirection, @@ -102,7 +102,7 @@ class AdDisplayContainer extends StatelessWidget { platform.params.onContainerAdded; /// List of companion ad slots. - Iterable get companionAds => + Iterable get companionSlots => platform.params.companionSlots.map( (PlatformCompanionAdSlot slot) => CompanionAdSlot.fromPlatform(slot), ); diff --git a/packages/interactive_media_ads/lib/src/companion_ad_slot.dart b/packages/interactive_media_ads/lib/src/companion_ad_slot.dart index abd90a7c28f..407bf2332df 100644 --- a/packages/interactive_media_ads/lib/src/companion_ad_slot.dart +++ b/packages/interactive_media_ads/lib/src/companion_ad_slot.dart @@ -43,7 +43,7 @@ class CompanionAdSlot { ), ); - /// Constructs an [CompanionAdSlot] from creation params for a specific + /// Constructs a [CompanionAdSlot] from creation params for a specific /// platform. /// /// {@template interactive_media_ads.CompanionAdSlot.fromPlatformCreationParams} @@ -75,7 +75,7 @@ class CompanionAdSlot { required PlatformCompanionAdSlotCreationParams params, }) : this.fromPlatform(PlatformCompanionAdSlot(params)); - /// Constructs an [CompanionAdSlot] from a specific platform implementation. + /// Constructs a [CompanionAdSlot] from a specific platform implementation. const CompanionAdSlot.fromPlatform(this.platform); /// Implementation of [PlatformCompanionAdSlot] for the current platform. diff --git a/packages/interactive_media_ads/lib/src/platform_interface/build_widget_creation_params.dart b/packages/interactive_media_ads/lib/src/platform_interface/build_widget_creation_params.dart index 48e6e2e8796..5c2a84371cc 100644 --- a/packages/interactive_media_ads/lib/src/platform_interface/build_widget_creation_params.dart +++ b/packages/interactive_media_ads/lib/src/platform_interface/build_widget_creation_params.dart @@ -5,6 +5,7 @@ import 'package:flutter/widgets.dart'; /// Object specifying creation parameters for creating a native view. +@immutable base class BuildWidgetCreationParams { /// Used by the platform implementation to create a new /// [BuildWidgetCreationParams].