From f80cab42d5b40ea2fcdd270790d5b946ffd8955d Mon Sep 17 00:00:00 2001
From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com>
Date: Tue, 25 Jun 2024 13:14:38 -0400
Subject: [PATCH] [interactive_media_ads] Adds initial Android implementation
(#6733)
Android implementation for https://github.com/flutter/flutter/issues/134228
---
packages/interactive_media_ads/CHANGELOG.md | 4 +
.../android/build.gradle | 6 +
.../AdDisplayContainerProxyApi.kt | 14 +
.../AdErrorEventProxyApi.kt | 21 +
.../AdErrorListenerProxyApi.kt | 27 +
.../interactive_media_ads/AdErrorProxyApi.kt | 61 +
.../AdEventListenerProxyApi.kt | 26 +
.../interactive_media_ads/AdEventProxyApi.kt | 49 +
.../AdMediaInfoProxyApi.kt | 20 +
.../AdPodInfoProxyApi.kt | 40 +
.../AdsLoadedListenerProxyApi.kt | 28 +
.../AdsLoaderProxyApi.kt | 36 +
.../AdsManagerLoadedEventProxyApi.kt | 21 +
.../AdsManagerProxyApi.kt | 28 +
.../AdsRequestProxyApi.kt | 37 +
.../BaseDisplayContainerProxyApi.kt | 14 +
.../BaseManagerProxyApi.kt | 40 +
.../ContentProgressProviderProxyApi.kt | 15 +
.../FrameLayoutProxyApi.kt | 20 +
.../ImaSdkFactoryProxyApi.kt | 49 +
.../ImaSdkSettingsProxyApi.kt | 14 +
.../InteractiveMediaAdsLibrary.g.kt | 3625 +++++++++++++
.../InteractiveMediaAdsPlugin.kt | 79 +-
.../MediaPlayerProxyApi.kt | 36 +
.../ProxyApiRegistrar.kt | 128 +
.../VideoAdPlayerCallbackProxyApi.kt | 87 +
.../VideoAdPlayerProxyApi.kt | 80 +
.../VideoProgressUpdateProxyApi.kt | 27 +
.../VideoViewProxyApi.kt | 38 +
.../ViewGroupProxyApi.kt | 21 +
.../interactive_media_ads/ViewProxyApi.kt | 14 +
.../src/test/kotlin/android/net/Uri.kt | 22 +
.../AdErrorEventProxyApiTest.kt | 25 +
.../AdErrorListenerProxyApiTest.kt | 35 +
.../AdErrorProxyApiTest.kt | 53 +
.../AdEventListenerProxyApiTest.kt | 34 +
.../AdEventProxyApiTest.kt | 23 +
.../AdMediaInfoProxyApiTest.kt | 23 +
.../AdPodInfoProxyApiTest.kt | 73 +
.../AdsLoadedListenerProxyApiTest.kt | 34 +
.../AdsLoaderProxyApiTest.kt | 47 +
.../AdsManagerLoadedEventProxyApiTest.kt | 25 +
.../AdsManagerProxyApiTest.kt | 42 +
.../AdsRequestProxyApiTest.kt | 35 +
.../BaseManagerProxyApiTest.kt | 56 +
.../ImaSdkFactoryProxyApiTest.kt | 54 +
.../InteractiveMediaAdsPluginTest.kt | 31 -
.../MediaPlayerProxyApiTest.kt | 64 +
.../TestProxyApiRegistrar.kt | 17 +
.../VideoAdPlayerCallbackProxyApiTest.kt | 124 +
.../VideoAdPlayerProxyApiTest.kt | 132 +
.../VideoViewProxyApiTest.kt | 38 +
.../ViewGroupProxyApiTest.kt | 24 +
.../android/app/src/main/AndroidManifest.xml | 4 +
.../example/lib/main.dart | 169 +-
.../example/pubspec.yaml | 1 +
.../lib/interactive_media_ads.dart | 15 +-
.../android/android_ad_display_container.dart | 279 +
.../lib/src/android/android_ads_loader.dart | 143 +
.../lib/src/android/android_ads_manager.dart | 88 +
.../android/android_ads_manager_delegate.dart | 11 +
.../android_interactive_media_ads.dart | 40 +
.../lib/src/android/android_view_widget.dart | 103 +
.../android/enum_converter_extensions.dart | 85 +
.../src/android/interactive_media_ads.g.dart | 4726 +++++++++++++++++
.../android/interactive_media_ads_proxy.dart | 90 +
.../android/platform_views_service_proxy.dart | 53 +
.../platform_ads_manager.dart | 2 +-
.../pigeons/copyright.txt | 3 +
.../interactive_media_ads_android.dart | 723 +++
packages/interactive_media_ads/pubspec.yaml | 4 +-
.../android/ad_display_container_test.dart | 518 ++
.../ad_display_container_test.mocks.dart | 1266 +++++
.../test/android/ads_loader_test.dart | 322 ++
.../test/android/ads_loader_test.mocks.dart | 1771 ++++++
.../test/android/ads_manager_tests.dart | 136 +
.../test/android/ads_manager_tests.mocks.dart | 501 ++
.../test/version_test.dart | 27 +
78 files changed, 16725 insertions(+), 71 deletions(-)
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdDisplayContainerProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdErrorEventProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdErrorListenerProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdErrorProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdEventListenerProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdEventProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdMediaInfoProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdPodInfoProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsLoadedListenerProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsLoaderProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsManagerLoadedEventProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsManagerProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/BaseManagerProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ContentProgressProviderProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/FrameLayoutProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ImaSdkFactoryProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ImaSdkSettingsProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/MediaPlayerProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ProxyApiRegistrar.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/VideoAdPlayerCallbackProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/VideoAdPlayerProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/VideoProgressUpdateProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/VideoViewProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ViewGroupProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ViewProxyApi.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/android/net/Uri.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/AdErrorEventProxyApiTest.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/AdErrorListenerProxyApiTest.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/AdErrorProxyApiTest.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/AdEventListenerProxyApiTest.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/AdEventProxyApiTest.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/AdMediaInfoProxyApiTest.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/AdPodInfoProxyApiTest.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/AdsLoadedListenerProxyApiTest.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/AdsLoaderProxyApiTest.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/AdsManagerLoadedEventProxyApiTest.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/AdsManagerProxyApiTest.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApiTest.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/BaseManagerProxyApiTest.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/ImaSdkFactoryProxyApiTest.kt
delete mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsPluginTest.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/MediaPlayerProxyApiTest.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/TestProxyApiRegistrar.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/VideoAdPlayerCallbackProxyApiTest.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/VideoAdPlayerProxyApiTest.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/VideoViewProxyApiTest.kt
create mode 100644 packages/interactive_media_ads/android/src/test/kotlin/dev/flutter/packages/interactive_media_ads/ViewGroupProxyApiTest.kt
create mode 100644 packages/interactive_media_ads/lib/src/android/android_ad_display_container.dart
create mode 100644 packages/interactive_media_ads/lib/src/android/android_ads_loader.dart
create mode 100644 packages/interactive_media_ads/lib/src/android/android_ads_manager.dart
create mode 100644 packages/interactive_media_ads/lib/src/android/android_ads_manager_delegate.dart
create mode 100644 packages/interactive_media_ads/lib/src/android/android_interactive_media_ads.dart
create mode 100644 packages/interactive_media_ads/lib/src/android/android_view_widget.dart
create mode 100644 packages/interactive_media_ads/lib/src/android/enum_converter_extensions.dart
create mode 100644 packages/interactive_media_ads/lib/src/android/interactive_media_ads.g.dart
create mode 100644 packages/interactive_media_ads/lib/src/android/interactive_media_ads_proxy.dart
create mode 100644 packages/interactive_media_ads/lib/src/android/platform_views_service_proxy.dart
create mode 100644 packages/interactive_media_ads/pigeons/copyright.txt
create mode 100644 packages/interactive_media_ads/pigeons/interactive_media_ads_android.dart
create mode 100644 packages/interactive_media_ads/test/android/ad_display_container_test.dart
create mode 100644 packages/interactive_media_ads/test/android/ad_display_container_test.mocks.dart
create mode 100644 packages/interactive_media_ads/test/android/ads_loader_test.dart
create mode 100644 packages/interactive_media_ads/test/android/ads_loader_test.mocks.dart
create mode 100644 packages/interactive_media_ads/test/android/ads_manager_tests.dart
create mode 100644 packages/interactive_media_ads/test/android/ads_manager_tests.mocks.dart
create mode 100644 packages/interactive_media_ads/test/version_test.dart
diff --git a/packages/interactive_media_ads/CHANGELOG.md b/packages/interactive_media_ads/CHANGELOG.md
index 838b76b7d944..68c213c1c792 100644
--- a/packages/interactive_media_ads/CHANGELOG.md
+++ b/packages/interactive_media_ads/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.0.2
+
+* Adds Android implementation.
+
## 0.0.1+3
* Fixes the pub badge source.
diff --git a/packages/interactive_media_ads/android/build.gradle b/packages/interactive_media_ads/android/build.gradle
index eab18ff2d763..282ddf2c7f41 100644
--- a/packages/interactive_media_ads/android/build.gradle
+++ b/packages/interactive_media_ads/android/build.gradle
@@ -51,10 +51,16 @@ android {
dependencies {
implementation 'androidx.annotation:annotation:1.8.0'
+ implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.33.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.jetbrains.kotlin:kotlin-test'
+ testImplementation "org.mockito.kotlin:mockito-kotlin:4.1.0"
testImplementation 'org.mockito:mockito-inline:5.1.0'
testImplementation 'androidx.test:core:1.3.0'
+
+ // org.jetbrains.kotlin:kotlin-bom artifact purpose is to align kotlin stdlib and related code versions.
+ // See: https://youtrack.jetbrains.com/issue/KT-55297/kotlin-stdlib-should-declare-constraints-on-kotlin-stdlib-jdk8-and-kotlin-stdlib-jdk7
+ implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.10"))
}
lintOptions {
diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdDisplayContainerProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdDisplayContainerProxyApi.kt
new file mode 100644
index 000000000000..225abe612669
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdDisplayContainerProxyApi.kt
@@ -0,0 +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.
+
+package dev.flutter.packages.interactive_media_ads
+
+/**
+ * ProxyApi implementation for [com.google.ads.interactivemedia.v3.api.AdDisplayContainer].
+ *
+ *
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 AdDisplayContainerProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
+ PigeonApiAdDisplayContainer(pigeonRegistrar)
diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdErrorEventProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdErrorEventProxyApi.kt
new file mode 100644
index 000000000000..63e52492cd8c
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdErrorEventProxyApi.kt
@@ -0,0 +1,21 @@
+// 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.AdError
+import com.google.ads.interactivemedia.v3.api.AdErrorEvent
+
+/**
+ * ProxyApi implementation for [AdErrorEvent].
+ *
+ *
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 AdErrorEventProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
+ PigeonApiAdErrorEvent(pigeonRegistrar) {
+ override fun error(pigeon_instance: AdErrorEvent): AdError {
+ return pigeon_instance.error
+ }
+}
diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdErrorListenerProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdErrorListenerProxyApi.kt
new file mode 100644
index 000000000000..0fc8ee253333
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdErrorListenerProxyApi.kt
@@ -0,0 +1,27 @@
+// 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.AdErrorEvent
+
+/**
+ * ProxyApi implementation for [AdErrorEvent.AdErrorListener].
+ *
+ *
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 AdErrorListenerProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
+ PigeonApiAdErrorListener(pigeonRegistrar) {
+ internal class AdErrorListenerImpl(val api: AdErrorListenerProxyApi) :
+ AdErrorEvent.AdErrorListener {
+ override fun onAdError(event: AdErrorEvent) {
+ api.pigeonRegistrar.runOnMainThread { api.onAdError(this, event) {} }
+ }
+ }
+
+ override fun pigeon_defaultConstructor(): AdErrorEvent.AdErrorListener {
+ return AdErrorListenerImpl(this)
+ }
+}
diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdErrorProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdErrorProxyApi.kt
new file mode 100644
index 000000000000..5e06fe2c3b70
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdErrorProxyApi.kt
@@ -0,0 +1,61 @@
+// 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.AdError
+
+/**
+ * ProxyApi implementation for [AdError].
+ *
+ *
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 AdErrorProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
+ PigeonApiAdError(pigeonRegistrar) {
+ override fun errorCode(pigeon_instance: AdError): AdErrorCode {
+ return when (pigeon_instance.errorCode) {
+ AdError.AdErrorCode.ADS_PLAYER_NOT_PROVIDED -> AdErrorCode.ADS_PLAYER_WAS_NOT_PROVIDED
+ AdError.AdErrorCode.INTERNAL_ERROR -> AdErrorCode.INTERNAL_ERROR
+ AdError.AdErrorCode.VAST_MALFORMED_RESPONSE -> AdErrorCode.VAST_MALFORMED_RESPONSE
+ AdError.AdErrorCode.UNKNOWN_AD_RESPONSE -> AdErrorCode.UNKNOWN_AD_RESPONSE
+ AdError.AdErrorCode.VAST_TRAFFICKING_ERROR -> AdErrorCode.VAST_TRAFFICKING_ERROR
+ AdError.AdErrorCode.VAST_LOAD_TIMEOUT -> AdErrorCode.VAST_LOAD_TIMEOUT
+ AdError.AdErrorCode.VAST_TOO_MANY_REDIRECTS -> AdErrorCode.VAST_TOO_MANY_REDIRECTS
+ AdError.AdErrorCode.VAST_NO_ADS_AFTER_WRAPPER -> AdErrorCode.VAST_NO_ADS_AFTER_WRAPPER
+ AdError.AdErrorCode.VIDEO_PLAY_ERROR -> AdErrorCode.VIDEO_PLAY_ERROR
+ AdError.AdErrorCode.VAST_MEDIA_LOAD_TIMEOUT -> AdErrorCode.VAST_MEDIA_LOAD_TIMEOUT
+ AdError.AdErrorCode.VAST_LINEAR_ASSET_MISMATCH -> AdErrorCode.VAST_LINEAR_ASSET_MISMATCH
+ AdError.AdErrorCode.OVERLAY_AD_PLAYING_FAILED -> AdErrorCode.OVERLAY_AD_PLAYING_FAILED
+ AdError.AdErrorCode.OVERLAY_AD_LOADING_FAILED -> AdErrorCode.OVERLAY_AD_LOADING_FAILED
+ AdError.AdErrorCode.VAST_NONLINEAR_ASSET_MISMATCH -> AdErrorCode.VAST_NONLINEAR_ASSET_MISMATCH
+ AdError.AdErrorCode.COMPANION_AD_LOADING_FAILED -> AdErrorCode.COMPANION_AD_LOADING_FAILED
+ AdError.AdErrorCode.UNKNOWN_ERROR -> AdErrorCode.UNKNOWN_ERROR
+ AdError.AdErrorCode.VAST_EMPTY_RESPONSE -> AdErrorCode.VAST_EMPTY_RESPONSE
+ AdError.AdErrorCode.FAILED_TO_REQUEST_ADS -> AdErrorCode.FAILED_TO_REQUEST_ADS
+ AdError.AdErrorCode.VAST_ASSET_NOT_FOUND -> AdErrorCode.VAST_ASSET_NOT_FOUND
+ AdError.AdErrorCode.ADS_REQUEST_NETWORK_ERROR -> AdErrorCode.ADS_REQUEST_NETWORK_ERROR
+ AdError.AdErrorCode.INVALID_ARGUMENTS -> AdErrorCode.INVALID_ARGUMENTS
+ AdError.AdErrorCode.PLAYLIST_NO_CONTENT_TRACKING -> AdErrorCode.PLAYLIST_NO_CONTENT_TRACKING
+ AdError.AdErrorCode.UNEXPECTED_ADS_LOADED_EVENT -> AdErrorCode.UNEXPECTED_ADS_LOADED_EVENT
+ else -> AdErrorCode.UNKNOWN
+ }
+ }
+
+ override fun errorCodeNumber(pigeon_instance: AdError): Long {
+ return pigeon_instance.errorCodeNumber.toLong()
+ }
+
+ override fun errorType(pigeon_instance: AdError): AdErrorType {
+ return when (pigeon_instance.errorType) {
+ AdError.AdErrorType.LOAD -> AdErrorType.LOAD
+ AdError.AdErrorType.PLAY -> AdErrorType.PLAY
+ else -> AdErrorType.UNKNOWN
+ }
+ }
+
+ override fun message(pigeon_instance: AdError): String {
+ return pigeon_instance.message
+ }
+}
diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdEventListenerProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdEventListenerProxyApi.kt
new file mode 100644
index 000000000000..9037799d1a89
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdEventListenerProxyApi.kt
@@ -0,0 +1,26 @@
+// 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.AdEvent
+
+/**
+ * ProxyApi implementation for [AdEvent.AdEventListener].
+ *
+ *
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 AdEventListenerProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
+ PigeonApiAdEventListener(pigeonRegistrar) {
+ internal class AdEventListenerImpl(val api: AdEventListenerProxyApi) : AdEvent.AdEventListener {
+ override fun onAdEvent(event: AdEvent) {
+ api.pigeonRegistrar.runOnMainThread { api.onAdEvent(this, event) {} }
+ }
+ }
+
+ override fun pigeon_defaultConstructor(): AdEvent.AdEventListener {
+ return AdEventListenerImpl(this)
+ }
+}
diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdEventProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdEventProxyApi.kt
new file mode 100644
index 000000000000..c490a1643c9a
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdEventProxyApi.kt
@@ -0,0 +1,49 @@
+// 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.AdEvent
+
+/**
+ * ProxyApi implementation for [AdEvent].
+ *
+ *
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 AdEventProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
+ PigeonApiAdEvent(pigeonRegistrar) {
+ override fun type(pigeon_instance: AdEvent): AdEventType {
+ return when (pigeon_instance.type) {
+ AdEvent.AdEventType.ALL_ADS_COMPLETED -> AdEventType.ALL_ADS_COMPLETED
+ AdEvent.AdEventType.AD_BREAK_FETCH_ERROR -> AdEventType.AD_BREAK_FETCH_ERROR
+ AdEvent.AdEventType.CLICKED -> AdEventType.CLICKED
+ AdEvent.AdEventType.COMPLETED -> AdEventType.COMPLETED
+ AdEvent.AdEventType.CUEPOINTS_CHANGED -> AdEventType.CUEPOINTS_CHANGED
+ AdEvent.AdEventType.CONTENT_PAUSE_REQUESTED -> AdEventType.CONTENT_PAUSE_REQUESTED
+ AdEvent.AdEventType.CONTENT_RESUME_REQUESTED -> AdEventType.CONTENT_RESUME_REQUESTED
+ AdEvent.AdEventType.FIRST_QUARTILE -> AdEventType.FIRST_QUARTILE
+ AdEvent.AdEventType.LOG -> AdEventType.LOG
+ AdEvent.AdEventType.AD_BREAK_READY -> AdEventType.AD_BREAK_READY
+ AdEvent.AdEventType.MIDPOINT -> AdEventType.MIDPOINT
+ AdEvent.AdEventType.PAUSED -> AdEventType.PAUSED
+ AdEvent.AdEventType.RESUMED -> AdEventType.RESUMED
+ AdEvent.AdEventType.SKIPPABLE_STATE_CHANGED -> AdEventType.SKIPPABLE_STATE_CHANGED
+ AdEvent.AdEventType.SKIPPED -> AdEventType.SKIPPED
+ AdEvent.AdEventType.STARTED -> AdEventType.STARTED
+ AdEvent.AdEventType.TAPPED -> AdEventType.TAPPED
+ AdEvent.AdEventType.ICON_TAPPED -> AdEventType.ICON_TAPPED
+ AdEvent.AdEventType.ICON_FALLBACK_IMAGE_CLOSED -> AdEventType.ICON_FALLBACK_IMAGE_CLOSED
+ AdEvent.AdEventType.THIRD_QUARTILE -> AdEventType.THIRD_QUARTILE
+ AdEvent.AdEventType.LOADED -> AdEventType.LOADED
+ AdEvent.AdEventType.AD_PROGRESS -> AdEventType.AD_PROGRESS
+ AdEvent.AdEventType.AD_BUFFERING -> AdEventType.AD_BUFFERING
+ AdEvent.AdEventType.AD_BREAK_STARTED -> AdEventType.AD_BREAK_STARTED
+ AdEvent.AdEventType.AD_BREAK_ENDED -> AdEventType.AD_BREAK_ENDED
+ AdEvent.AdEventType.AD_PERIOD_STARTED -> AdEventType.AD_PERIOD_STARTED
+ AdEvent.AdEventType.AD_PERIOD_ENDED -> AdEventType.AD_PERIOD_ENDED
+ else -> AdEventType.UNKNOWN
+ }
+ }
+}
diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdMediaInfoProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdMediaInfoProxyApi.kt
new file mode 100644
index 000000000000..cb1e03500b12
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdMediaInfoProxyApi.kt
@@ -0,0 +1,20 @@
+// 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.player.AdMediaInfo
+
+/**
+ * ProxyApi implementation for [AdMediaInfo].
+ *
+ *
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 AdMediaInfoProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
+ PigeonApiAdMediaInfo(pigeonRegistrar) {
+ override fun url(pigeon_instance: AdMediaInfo): String {
+ return pigeon_instance.url
+ }
+}
diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdPodInfoProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdPodInfoProxyApi.kt
new file mode 100644
index 000000000000..367d5f5416a2
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdPodInfoProxyApi.kt
@@ -0,0 +1,40 @@
+// 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.AdPodInfo
+
+/**
+ * ProxyApi implementation for [AdPodInfo].
+ *
+ *
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 AdPodInfoProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
+ PigeonApiAdPodInfo(pigeonRegistrar) {
+ override fun adPosition(pigeon_instance: AdPodInfo): Long {
+ return pigeon_instance.adPosition.toLong()
+ }
+
+ override fun maxDuration(pigeon_instance: AdPodInfo): Double {
+ return pigeon_instance.maxDuration
+ }
+
+ override fun podIndex(pigeon_instance: AdPodInfo): Long {
+ return pigeon_instance.podIndex.toLong()
+ }
+
+ override fun timeOffset(pigeon_instance: AdPodInfo): Double {
+ return pigeon_instance.timeOffset
+ }
+
+ override fun totalAds(pigeon_instance: AdPodInfo): Long {
+ return pigeon_instance.totalAds.toLong()
+ }
+
+ override fun isBumper(pigeon_instance: AdPodInfo): Boolean {
+ return pigeon_instance.isBumper
+ }
+}
diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsLoadedListenerProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsLoadedListenerProxyApi.kt
new file mode 100644
index 000000000000..2054e84dac34
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsLoadedListenerProxyApi.kt
@@ -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.
+
+package dev.flutter.packages.interactive_media_ads
+
+import com.google.ads.interactivemedia.v3.api.AdsLoader
+import com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent
+
+/**
+ * ProxyApi implementation for [AdsLoader.AdsLoadedListener].
+ *
+ *
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 AdsLoadedListenerProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
+ PigeonApiAdsLoadedListener(pigeonRegistrar) {
+ internal class AdsLoadedListenerImpl(val api: AdsLoadedListenerProxyApi) :
+ AdsLoader.AdsLoadedListener {
+ override fun onAdsManagerLoaded(event: AdsManagerLoadedEvent) {
+ api.pigeonRegistrar.runOnMainThread { api.onAdsManagerLoaded(this, event) {} }
+ }
+ }
+
+ override fun pigeon_defaultConstructor(): AdsLoader.AdsLoadedListener {
+ return AdsLoadedListenerImpl(this)
+ }
+}
diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsLoaderProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsLoaderProxyApi.kt
new file mode 100644
index 000000000000..5b5d1d7721e8
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsLoaderProxyApi.kt
@@ -0,0 +1,36 @@
+// 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.AdErrorEvent
+import com.google.ads.interactivemedia.v3.api.AdsLoader
+import com.google.ads.interactivemedia.v3.api.AdsRequest
+
+/**
+ * ProxyApi implementation for [AdsLoader].
+ *
+ *
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 AdsLoaderProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
+ PigeonApiAdsLoader(pigeonRegistrar) {
+ override fun addAdErrorListener(
+ pigeon_instance: AdsLoader,
+ listener: AdErrorEvent.AdErrorListener
+ ) {
+ pigeon_instance.addAdErrorListener(listener)
+ }
+
+ override fun addAdsLoadedListener(
+ pigeon_instance: AdsLoader,
+ listener: AdsLoader.AdsLoadedListener
+ ) {
+ pigeon_instance.addAdsLoadedListener(listener)
+ }
+
+ override fun requestAds(pigeon_instance: AdsLoader, request: AdsRequest) {
+ pigeon_instance.requestAds(request)
+ }
+}
diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsManagerLoadedEventProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsManagerLoadedEventProxyApi.kt
new file mode 100644
index 000000000000..1374ecde4a12
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsManagerLoadedEventProxyApi.kt
@@ -0,0 +1,21 @@
+// 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.AdsManager
+import com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent
+
+/**
+ * ProxyApi implementation for [AdsManagerLoadedEvent].
+ *
+ *
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 AdsManagerLoadedEventProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
+ PigeonApiAdsManagerLoadedEvent(pigeonRegistrar) {
+ override fun manager(pigeon_instance: AdsManagerLoadedEvent): AdsManager {
+ return pigeon_instance.adsManager
+ }
+}
diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsManagerProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsManagerProxyApi.kt
new file mode 100644
index 000000000000..022a81417e2a
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsManagerProxyApi.kt
@@ -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.
+
+package dev.flutter.packages.interactive_media_ads
+
+import com.google.ads.interactivemedia.v3.api.AdsManager
+
+/**
+ * ProxyApi implementation for [AdsManager].
+ *
+ *
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 AdsManagerProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
+ PigeonApiAdsManager(pigeonRegistrar) {
+ override fun discardAdBreak(pigeon_instance: AdsManager) {
+ pigeon_instance.discardAdBreak()
+ }
+
+ override fun pause(pigeon_instance: AdsManager) {
+ pigeon_instance.pause()
+ }
+
+ override fun start(pigeon_instance: AdsManager) {
+ pigeon_instance.start()
+ }
+}
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
new file mode 100644
index 000000000000..9222ea80d40b
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt
@@ -0,0 +1,37 @@
+// 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.AdsRequest
+import com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider
+
+/**
+ * ProxyApi implementation for [AdsRequest].
+ *
+ *
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 AdsRequestProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
+ PigeonApiAdsRequest(pigeonRegistrar) {
+ companion object {
+ /**
+ * The current version of the `interactive_media_ads` plugin.
+ *
+ * This must match the version in pubspec.yaml.
+ */
+ const val pluginVersion = "0.0.2"
+ }
+
+ override fun setAdTagUrl(pigeon_instance: AdsRequest, adTagUrl: String) {
+ pigeon_instance.adTagUrl = "$adTagUrl&request_agent=Flutter-IMA-$pluginVersion"
+ }
+
+ override fun setContentProgressProvider(
+ pigeon_instance: AdsRequest,
+ provider: ContentProgressProvider
+ ) {
+ pigeon_instance.contentProgressProvider = provider
+ }
+}
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
new file mode 100644
index 000000000000..6499138ad9cf
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/BaseDisplayContainerProxyApi.kt
@@ -0,0 +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.
+
+package dev.flutter.packages.interactive_media_ads
+
+/**
+ * ProxyApi implementation for [com.google.ads.interactivemedia.v3.api.BaseDisplayContainer].
+ *
+ *
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 BaseDisplayContainerProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
+ PigeonApiBaseDisplayContainer(pigeonRegistrar)
diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/BaseManagerProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/BaseManagerProxyApi.kt
new file mode 100644
index 000000000000..92d7558fa7cc
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/BaseManagerProxyApi.kt
@@ -0,0 +1,40 @@
+// 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.AdErrorEvent
+import com.google.ads.interactivemedia.v3.api.AdEvent
+import com.google.ads.interactivemedia.v3.api.BaseManager
+
+/**
+ * ProxyApi implementation for [BaseManager].
+ *
+ *
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 BaseManagerProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
+ PigeonApiBaseManager(pigeonRegistrar) {
+ override fun addAdErrorListener(
+ pigeon_instance: BaseManager,
+ errorListener: AdErrorEvent.AdErrorListener
+ ) {
+ pigeon_instance.addAdErrorListener(errorListener)
+ }
+
+ override fun addAdEventListener(
+ pigeon_instance: BaseManager,
+ adEventListener: AdEvent.AdEventListener
+ ) {
+ pigeon_instance.addAdEventListener(adEventListener)
+ }
+
+ override fun destroy(pigeon_instance: BaseManager) {
+ pigeon_instance.destroy()
+ }
+
+ override fun init(pigeon_instance: BaseManager) {
+ pigeon_instance.init()
+ }
+}
diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ContentProgressProviderProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ContentProgressProviderProxyApi.kt
new file mode 100644
index 000000000000..0fa1308d1383
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ContentProgressProviderProxyApi.kt
@@ -0,0 +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.
+
+package dev.flutter.packages.interactive_media_ads
+
+/**
+ * ProxyApi implementation for
+ * [com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider].
+ *
+ *
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 ContentProgressProviderProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
+ PigeonApiContentProgressProvider(pigeonRegistrar)
diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/FrameLayoutProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/FrameLayoutProxyApi.kt
new file mode 100644
index 000000000000..c2d6ee342787
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/FrameLayoutProxyApi.kt
@@ -0,0 +1,20 @@
+// 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 android.widget.FrameLayout
+
+/**
+ * ProxyApi implementation for [FrameLayout].
+ *
+ *
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 FrameLayoutProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
+ PigeonApiFrameLayout(pigeonRegistrar) {
+ override fun pigeon_defaultConstructor(): FrameLayout {
+ return FrameLayout(pigeonRegistrar.context)
+ }
+}
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
new file mode 100644
index 000000000000..eaed1baabe25
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ImaSdkFactoryProxyApi.kt
@@ -0,0 +1,49 @@
+// 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 android.view.ViewGroup
+import com.google.ads.interactivemedia.v3.api.AdDisplayContainer
+import com.google.ads.interactivemedia.v3.api.AdsLoader
+import com.google.ads.interactivemedia.v3.api.AdsRequest
+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
+
+/**
+ * ProxyApi implementation for [ImaSdkFactory].
+ *
+ *
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 ImaSdkFactoryProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
+ PigeonApiImaSdkFactory(pigeonRegistrar) {
+ override fun instance(): ImaSdkFactory {
+ return ImaSdkFactory.getInstance()
+ }
+
+ override fun createAdDisplayContainer(
+ container: ViewGroup,
+ player: VideoAdPlayer
+ ): AdDisplayContainer {
+ return ImaSdkFactory.createAdDisplayContainer(container, player)
+ }
+
+ override fun createImaSdkSettings(pigeon_instance: ImaSdkFactory): ImaSdkSettings {
+ return pigeon_instance.createImaSdkSettings()
+ }
+
+ override fun createAdsLoader(
+ pigeon_instance: ImaSdkFactory,
+ settings: ImaSdkSettings,
+ container: AdDisplayContainer
+ ): AdsLoader {
+ return pigeon_instance.createAdsLoader(pigeonRegistrar.context, settings, container)
+ }
+
+ override fun createAdsRequest(pigeon_instance: ImaSdkFactory): AdsRequest {
+ return pigeon_instance.createAdsRequest()
+ }
+}
diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ImaSdkSettingsProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ImaSdkSettingsProxyApi.kt
new file mode 100644
index 000000000000..c95fd1d71e02
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/ImaSdkSettingsProxyApi.kt
@@ -0,0 +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.
+
+package dev.flutter.packages.interactive_media_ads
+
+/**
+ * ProxyApi implementation for [com.google.ads.interactivemedia.v3.api.ImaSdkSettings].
+ *
+ *
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 ImaSdkSettingsProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
+ PigeonApiImaSdkSettings(pigeonRegistrar)
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
new file mode 100644
index 000000000000..49d21f7b51eb
--- /dev/null
+++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/InteractiveMediaAdsLibrary.g.kt
@@ -0,0 +1,3625 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+// Autogenerated from Pigeon (v19.1.0), do not edit directly.
+// See also: https://pub.dev/packages/pigeon
+@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass", "SyntheticAccessor")
+
+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.MessageCodec
+import io.flutter.plugin.common.StandardMessageCodec
+import java.io.ByteArrayOutputStream
+import java.nio.ByteBuffer
+
+private fun wrapResult(result: Any?): List {
+ return listOf(result)
+}
+
+private fun wrapError(exception: Throwable): List {
+ return if (exception is FlutterError) {
+ listOf(exception.code, exception.message, exception.details)
+ } else {
+ listOf(
+ exception.javaClass.simpleName,
+ exception.toString(),
+ "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception))
+ }
+}
+
+private fun createConnectionError(channelName: String): FlutterError {
+ return FlutterError(
+ "channel-error", "Unable to establish connection on channel: '$channelName'.", "")
+}
+
+/**
+ * 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
+) : 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.
+ *
+ *
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` is made with the instance's identifier. However, if the strong reference
+ * is removed and then the identifier is retrieved with the intention to pass the identifier to Dart
+ * (e.g. calling [getIdentifierForStrongReference]), the strong reference to the instance is
+ * recreated. The strong reference will then need to be removed manually again.
+ */
+@Suppress("UNCHECKED_CAST", "MemberVisibilityCanBePrivate", "unused")
+class PigeonInstanceManager(private val finalizationListener: PigeonFinalizationListener) {
+ /** Interface for listening when a weak reference of an instance is removed from the manager. */
+ interface PigeonFinalizationListener {
+ fun onFinalize(identifier: Long)
+ }
+
+ private val identifiers = java.util.WeakHashMap()
+ private val weakInstances = HashMap>()
+ private val strongInstances = HashMap()
+ private val referenceQueue = java.lang.ref.ReferenceQueue()
+ private val weakReferencesToIdentifiers = HashMap, Long>()
+ private val handler = android.os.Handler(android.os.Looper.getMainLooper())
+ private var nextIdentifier: Long = minHostCreatedIdentifier
+ private var hasFinalizationListenerStopped = false
+
+ /**
+ * Modifies the time interval used to define how often this instance removes garbage collected
+ * weak references to native Android objects that this instance was managing.
+ */
+ var clearFinalizedWeakReferencesInterval: Long = 3000
+ set(value) {
+ handler.removeCallbacks { this.releaseAllFinalizedInstances() }
+ field = value
+ releaseAllFinalizedInstances()
+ }
+
+ init {
+ handler.postDelayed({ releaseAllFinalizedInstances() }, clearFinalizedWeakReferencesInterval)
+ }
+
+ companion object {
+ // Identifiers are locked to a specific range to avoid collisions with objects
+ // created simultaneously from Dart.
+ // Host uses identifiers >= 2^16 and Dart is expected to use values n where,
+ // 0 <= n < 2^16.
+ private const val minHostCreatedIdentifier: Long = 65536
+ private const val tag = "PigeonInstanceManager"
+
+ /**
+ * Instantiate a new manager.
+ *
+ * When the manager is no longer needed, [stopFinalizationListener] must be called.
+ *
+ * @param finalizationListener the listener for garbage collected weak references.
+ * @return a new `PigeonInstanceManager`.
+ */
+ fun create(finalizationListener: PigeonFinalizationListener): PigeonInstanceManager {
+ return PigeonInstanceManager(finalizationListener)
+ }
+ }
+
+ /**
+ * Removes `identifier` and its associated strongly referenced instance, if present, from the
+ * manager.
+ *
+ * @param identifier the identifier paired to an instance.
+ * @param the expected return type.
+ * @return the removed instance if the manager contains the given identifier, otherwise `null` if
+ * the manager doesn't contain the value.
+ */
+ fun remove(identifier: Long): T? {
+ logWarningIfFinalizationListenerHasStopped()
+ return strongInstances.remove(identifier) as T?
+ }
+
+ /**
+ * Retrieves the identifier paired with an instance.
+ *
+ * If the manager contains a strong reference to `instance`, it will return the identifier
+ * associated with `instance`. If the manager contains only a weak reference to `instance`, a new
+ * strong reference to `instance` will be added and will need to be removed again with [remove].
+ *
+ * If this method returns a nonnull identifier, this method also expects the Dart
+ * `PigeonInstanceManager` to have, or recreate, a weak reference to the Dart instance the
+ * identifier is associated with.
+ *
+ * @param instance an instance that may be stored in the manager.
+ * @return the identifier associated with `instance` if the manager contains the value, otherwise
+ * `null` if the manager doesn't contain the value.
+ */
+ fun getIdentifierForStrongReference(instance: Any?): Long? {
+ logWarningIfFinalizationListenerHasStopped()
+ val identifier = identifiers[instance]
+ if (identifier != null) {
+ strongInstances[identifier] = instance!!
+ }
+ return identifier
+ }
+
+ /**
+ * 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.
+ *
+ * @param instance the instance to be stored.
+ * @param identifier the identifier to be paired with instance. This value must be >= 0 and
+ * unique.
+ */
+ fun addDartCreatedInstance(instance: Any, identifier: Long) {
+ logWarningIfFinalizationListenerHasStopped()
+ addInstance(instance, identifier)
+ }
+
+ /**
+ * Adds a new instance that was instantiated from the host platform.
+ *
+ * @param instance the instance to be stored. This must be unique to all other added instances.
+ * @return the unique identifier (>= 0) stored with instance.
+ */
+ fun addHostCreatedInstance(instance: Any): Long {
+ logWarningIfFinalizationListenerHasStopped()
+ require(!containsInstance(instance)) {
+ "Instance of ${instance.javaClass} has already been added."
+ }
+ val identifier = nextIdentifier++
+ addInstance(instance, identifier)
+ return identifier
+ }
+
+ /**
+ * Retrieves the instance associated with identifier.
+ *
+ * @param identifier the identifier associated with an instance.
+ * @param the expected return type.
+ * @return the instance associated with `identifier` if the manager contains the value, otherwise
+ * `null` if the manager doesn't contain the value.
+ */
+ fun getInstance(identifier: Long): T? {
+ logWarningIfFinalizationListenerHasStopped()
+ val instance = weakInstances[identifier] as java.lang.ref.WeakReference?
+ return instance?.get()
+ }
+
+ /**
+ * Returns whether this manager contains the given `instance`.
+ *
+ * @param instance the instance whose presence in this manager is to be tested.
+ * @return whether this manager contains the given `instance`.
+ */
+ fun containsInstance(instance: Any?): Boolean {
+ logWarningIfFinalizationListenerHasStopped()
+ return identifiers.containsKey(instance)
+ }
+
+ /**
+ * Stop the periodic run of the [PigeonFinalizationListener] for instances that have been garbage
+ * collected.
+ *
+ * The InstanceManager can continue to be used, but the [PigeonFinalizationListener] will no
+ * longer be called and methods will log a warning.
+ */
+ fun stopFinalizationListener() {
+ handler.removeCallbacks { this.releaseAllFinalizedInstances() }
+ hasFinalizationListenerStopped = true
+ }
+
+ /**
+ * Removes all of the instances from this manager.
+ *
+ * The manager will be empty after this call returns.
+ */
+ fun clear() {
+ identifiers.clear()
+ weakInstances.clear()
+ strongInstances.clear()
+ weakReferencesToIdentifiers.clear()
+ }
+
+ /**
+ * Whether the [PigeonFinalizationListener] is still being called for instances that are garbage
+ * collected.
+ *
+ * See [stopFinalizationListener].
+ */
+ fun hasFinalizationListenerStopped(): Boolean {
+ return hasFinalizationListenerStopped
+ }
+
+ private fun releaseAllFinalizedInstances() {
+ if (hasFinalizationListenerStopped()) {
+ return
+ }
+ var reference: java.lang.ref.WeakReference?
+ while ((referenceQueue.poll() as java.lang.ref.WeakReference?).also { reference = it } !=
+ null) {
+ val identifier = weakReferencesToIdentifiers.remove(reference)
+ if (identifier != null) {
+ weakInstances.remove(identifier)
+ strongInstances.remove(identifier)
+ finalizationListener.onFinalize(identifier)
+ }
+ }
+ handler.postDelayed({ releaseAllFinalizedInstances() }, clearFinalizedWeakReferencesInterval)
+ }
+
+ private fun addInstance(instance: Any, identifier: Long) {
+ require(identifier >= 0) { "Identifier must be >= 0: $identifier" }
+ require(!weakInstances.containsKey(identifier)) {
+ "Identifier has already been added: $identifier"
+ }
+ val weakReference = java.lang.ref.WeakReference(instance, referenceQueue)
+ identifiers[instance] = identifier
+ weakInstances[identifier] = weakReference
+ weakReferencesToIdentifiers[weakReference] = identifier
+ strongInstances[identifier] = instance
+ }
+
+ private fun logWarningIfFinalizationListenerHasStopped() {
+ if (hasFinalizationListenerStopped()) {
+ Log.w(
+ tag,
+ "The manager was used after calls to the PigeonFinalizationListener has been stopped.")
+ }
+ }
+}
+
+/** Generated API for managing the Dart and native `PigeonInstanceManager`s. */
+private class PigeonInstanceManagerApi(val binaryMessenger: BinaryMessenger) {
+ companion object {
+ /** The codec used by PigeonInstanceManagerApi. */
+ val codec: MessageCodec by lazy { StandardMessageCodec() }
+
+ /**
+ * Sets up an instance of `PigeonInstanceManagerApi` to handle messages from the
+ * `binaryMessenger`.
+ */
+ fun setUpMessageHandlers(
+ binaryMessenger: BinaryMessenger,
+ instanceManager: PigeonInstanceManager?
+ ) {
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.removeStrongReference",
+ codec)
+ if (instanceManager != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val identifierArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long }
+ val wrapped: List =
+ try {
+ instanceManager.remove(identifierArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.clear",
+ codec)
+ if (instanceManager != null) {
+ channel.setMessageHandler { _, reply ->
+ val wrapped: List =
+ try {
+ instanceManager.clear()
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ }
+ }
+
+ fun removeStrongReference(identifierArg: Long, callback: (Result) -> Unit) {
+ val channelName =
+ "dev.flutter.pigeon.interactive_media_ads.PigeonInstanceManagerApi.removeStrongReference"
+ val channel = BasicMessageChannel(binaryMessenger, channelName, codec)
+ channel.send(listOf(identifierArg)) {
+ if (it is List<*>) {
+ if (it.size > 1) {
+ callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+}
+/**
+ * Provides implementations for each ProxyApi implementation and provides access to resources needed
+ * by any implementation.
+ */
+abstract class PigeonProxyApiRegistrar(val binaryMessenger: BinaryMessenger) {
+ val instanceManager: PigeonInstanceManager
+ private var _codec: StandardMessageCodec? = null
+ val codec: StandardMessageCodec
+ get() {
+ if (_codec == null) {
+ _codec = PigeonProxyApiBaseCodec(this)
+ }
+ return _codec!!
+ }
+
+ init {
+ val api = PigeonInstanceManagerApi(binaryMessenger)
+ instanceManager =
+ PigeonInstanceManager.create(
+ object : PigeonInstanceManager.PigeonFinalizationListener {
+ override fun onFinalize(identifier: Long) {
+ api.removeStrongReference(identifier) {
+ if (it.isFailure) {
+ Log.e(
+ "PigeonProxyApiRegistrar",
+ "Failed to remove Dart strong reference with identifier: $identifier")
+ }
+ }
+ }
+ })
+ }
+
+ /**
+ * An implementation of [PigeonApiBaseDisplayContainer] used to add a new Dart instance of
+ * `BaseDisplayContainer` to the Dart `InstanceManager`.
+ */
+ open fun getPigeonApiBaseDisplayContainer(): PigeonApiBaseDisplayContainer {
+ return PigeonApiBaseDisplayContainer(this)
+ }
+
+ /**
+ * An implementation of [PigeonApiAdDisplayContainer] used to add a new Dart instance of
+ * `AdDisplayContainer` to the Dart `InstanceManager`.
+ */
+ open fun getPigeonApiAdDisplayContainer(): PigeonApiAdDisplayContainer {
+ return PigeonApiAdDisplayContainer(this)
+ }
+
+ /**
+ * An implementation of [PigeonApiAdsLoader] used to add a new Dart instance of `AdsLoader` to the
+ * Dart `InstanceManager`.
+ */
+ abstract fun getPigeonApiAdsLoader(): PigeonApiAdsLoader
+
+ /**
+ * An implementation of [PigeonApiAdsManagerLoadedEvent] used to add a new Dart instance of
+ * `AdsManagerLoadedEvent` to the Dart `InstanceManager`.
+ */
+ abstract fun getPigeonApiAdsManagerLoadedEvent(): PigeonApiAdsManagerLoadedEvent
+
+ /**
+ * 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`.
+ */
+ abstract fun getPigeonApiAdError(): PigeonApiAdError
+
+ /**
+ * An implementation of [PigeonApiAdsRequest] used to add a new Dart instance of `AdsRequest` to
+ * the Dart `InstanceManager`.
+ */
+ abstract fun getPigeonApiAdsRequest(): PigeonApiAdsRequest
+
+ /**
+ * An implementation of [PigeonApiContentProgressProvider] used to add a new Dart instance of
+ * `ContentProgressProvider` to the Dart `InstanceManager`.
+ */
+ open fun getPigeonApiContentProgressProvider(): PigeonApiContentProgressProvider {
+ return PigeonApiContentProgressProvider(this)
+ }
+
+ /**
+ * 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`.
+ */
+ abstract fun getPigeonApiBaseManager(): PigeonApiBaseManager
+
+ /**
+ * An implementation of [PigeonApiAdEvent] used to add a new Dart instance of `AdEvent` to the
+ * Dart `InstanceManager`.
+ */
+ abstract fun getPigeonApiAdEvent(): PigeonApiAdEvent
+
+ /**
+ * An implementation of [PigeonApiImaSdkFactory] used to add a new Dart instance of
+ * `ImaSdkFactory` to the Dart `InstanceManager`.
+ */
+ abstract fun getPigeonApiImaSdkFactory(): PigeonApiImaSdkFactory
+
+ /**
+ * An implementation of [PigeonApiImaSdkSettings] used to add a new Dart instance of
+ * `ImaSdkSettings` to the Dart `InstanceManager`.
+ */
+ open fun getPigeonApiImaSdkSettings(): PigeonApiImaSdkSettings {
+ return PigeonApiImaSdkSettings(this)
+ }
+
+ /**
+ * An implementation of [PigeonApiVideoProgressUpdate] used to add a new Dart instance of
+ * `VideoProgressUpdate` to the Dart `InstanceManager`.
+ */
+ abstract fun getPigeonApiVideoProgressUpdate(): PigeonApiVideoProgressUpdate
+
+ /**
+ * 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`.
+ */
+ abstract fun getPigeonApiAdPodInfo(): PigeonApiAdPodInfo
+
+ /**
+ * 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`.
+ */
+ abstract fun getPigeonApiViewGroup(): PigeonApiViewGroup
+
+ /**
+ * 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`.
+ */
+ open fun getPigeonApiView(): PigeonApiView {
+ return PigeonApiView(this)
+ }
+
+ /**
+ * An implementation of [PigeonApiMediaPlayer] used to add a new Dart instance of `MediaPlayer` to
+ * the Dart `InstanceManager`.
+ */
+ abstract fun getPigeonApiMediaPlayer(): PigeonApiMediaPlayer
+
+ /**
+ * An implementation of [PigeonApiVideoAdPlayerCallback] used to add a new Dart instance of
+ * `VideoAdPlayerCallback` to the Dart `InstanceManager`.
+ */
+ abstract fun getPigeonApiVideoAdPlayerCallback(): PigeonApiVideoAdPlayerCallback
+
+ /**
+ * An implementation of [PigeonApiVideoAdPlayer] used to add a new Dart instance of
+ * `VideoAdPlayer` to the Dart `InstanceManager`.
+ */
+ abstract fun getPigeonApiVideoAdPlayer(): PigeonApiVideoAdPlayer
+
+ /**
+ * An implementation of [PigeonApiAdsLoadedListener] used to add a new Dart instance of
+ * `AdsLoadedListener` to the Dart `InstanceManager`.
+ */
+ abstract fun getPigeonApiAdsLoadedListener(): PigeonApiAdsLoadedListener
+
+ /**
+ * An implementation of [PigeonApiAdErrorListener] used to add a new Dart instance of
+ * `AdErrorListener` to the Dart `InstanceManager`.
+ */
+ abstract fun getPigeonApiAdErrorListener(): PigeonApiAdErrorListener
+
+ /**
+ * An implementation of [PigeonApiAdEventListener] used to add a new Dart instance of
+ * `AdEventListener` to the Dart `InstanceManager`.
+ */
+ abstract fun getPigeonApiAdEventListener(): PigeonApiAdEventListener
+
+ fun setUp() {
+ PigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger, instanceManager)
+ PigeonApiAdsLoader.setUpMessageHandlers(binaryMessenger, getPigeonApiAdsLoader())
+ PigeonApiAdsRequest.setUpMessageHandlers(binaryMessenger, getPigeonApiAdsRequest())
+ PigeonApiAdsManager.setUpMessageHandlers(binaryMessenger, getPigeonApiAdsManager())
+ PigeonApiBaseManager.setUpMessageHandlers(binaryMessenger, getPigeonApiBaseManager())
+ PigeonApiImaSdkFactory.setUpMessageHandlers(binaryMessenger, getPigeonApiImaSdkFactory())
+ PigeonApiVideoProgressUpdate.setUpMessageHandlers(
+ binaryMessenger, getPigeonApiVideoProgressUpdate())
+ PigeonApiFrameLayout.setUpMessageHandlers(binaryMessenger, getPigeonApiFrameLayout())
+ PigeonApiViewGroup.setUpMessageHandlers(binaryMessenger, getPigeonApiViewGroup())
+ PigeonApiVideoView.setUpMessageHandlers(binaryMessenger, getPigeonApiVideoView())
+ PigeonApiMediaPlayer.setUpMessageHandlers(binaryMessenger, getPigeonApiMediaPlayer())
+ PigeonApiVideoAdPlayerCallback.setUpMessageHandlers(
+ binaryMessenger, getPigeonApiVideoAdPlayerCallback())
+ PigeonApiVideoAdPlayer.setUpMessageHandlers(binaryMessenger, getPigeonApiVideoAdPlayer())
+ PigeonApiAdsLoadedListener.setUpMessageHandlers(
+ binaryMessenger, getPigeonApiAdsLoadedListener())
+ PigeonApiAdErrorListener.setUpMessageHandlers(binaryMessenger, getPigeonApiAdErrorListener())
+ PigeonApiAdEventListener.setUpMessageHandlers(binaryMessenger, getPigeonApiAdEventListener())
+ }
+
+ fun tearDown() {
+ PigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger, null)
+ PigeonApiAdsLoader.setUpMessageHandlers(binaryMessenger, null)
+ PigeonApiAdsRequest.setUpMessageHandlers(binaryMessenger, null)
+ PigeonApiAdsManager.setUpMessageHandlers(binaryMessenger, null)
+ PigeonApiBaseManager.setUpMessageHandlers(binaryMessenger, null)
+ PigeonApiImaSdkFactory.setUpMessageHandlers(binaryMessenger, null)
+ PigeonApiVideoProgressUpdate.setUpMessageHandlers(binaryMessenger, null)
+ PigeonApiFrameLayout.setUpMessageHandlers(binaryMessenger, null)
+ PigeonApiViewGroup.setUpMessageHandlers(binaryMessenger, null)
+ PigeonApiVideoView.setUpMessageHandlers(binaryMessenger, null)
+ PigeonApiMediaPlayer.setUpMessageHandlers(binaryMessenger, null)
+ PigeonApiVideoAdPlayerCallback.setUpMessageHandlers(binaryMessenger, null)
+ PigeonApiVideoAdPlayer.setUpMessageHandlers(binaryMessenger, null)
+ PigeonApiAdsLoadedListener.setUpMessageHandlers(binaryMessenger, null)
+ PigeonApiAdErrorListener.setUpMessageHandlers(binaryMessenger, null)
+ PigeonApiAdEventListener.setUpMessageHandlers(binaryMessenger, null)
+ }
+}
+
+private class PigeonProxyApiBaseCodec(val registrar: PigeonProxyApiRegistrar) :
+ StandardMessageCodec() {
+ override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? {
+ return when (type) {
+ 128.toByte() -> {
+ return registrar.instanceManager.getInstance(
+ readValue(buffer).let { if (it is Int) it.toLong() else it as Long })
+ }
+ else -> super.readValueOfType(type, buffer)
+ }
+ }
+
+ override fun writeValue(stream: ByteArrayOutputStream, value: Any?) {
+ 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) {}
+ }
+
+ when {
+ registrar.instanceManager.containsInstance(value) -> {
+ stream.write(128)
+ writeValue(stream, registrar.instanceManager.getIdentifierForStrongReference(value))
+ }
+ else -> super.writeValue(stream, value)
+ }
+ }
+}
+
+/**
+ * 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 class AdErrorCode(val raw: Int) {
+ /** Ads player was not provided. */
+ ADS_PLAYER_WAS_NOT_PROVIDED(0),
+ /** There was a problem requesting ads from the server. */
+ ADS_REQUEST_NETWORK_ERROR(1),
+ /** A companion ad failed to load or render. */
+ COMPANION_AD_LOADING_FAILED(2),
+ /** There was a problem requesting ads from the server. */
+ FAILED_TO_REQUEST_ADS(3),
+ /** An error internal to the SDK occurred. */
+ INTERNAL_ERROR(4),
+ /** Invalid arguments were provided to SDK methods. */
+ INVALID_ARGUMENTS(5),
+ /** An overlay ad failed to load. */
+ OVERLAY_AD_LOADING_FAILED(6),
+ /** An overlay ad failed to render. */
+ OVERLAY_AD_PLAYING_FAILED(7),
+ /** Ads list was returned but ContentProgressProvider was not configured. */
+ PLAYLIST_NO_CONTENT_TRACKING(8),
+ /** Ads loader sent ads loaded event when it was not expected. */
+ UNEXPECTED_ADS_LOADED_EVENT(9),
+ /** The ad response was not understood and cannot be parsed. */
+ UNKNOWN_AD_RESPONSE(10),
+ /** An unexpected error occurred and the cause is not known. */
+ UNKNOWN_ERROR(11),
+ /** No assets were found in the VAST ad response. */
+ VAST_ASSET_NOT_FOUND(12),
+ /** 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.
+ */
+ VAST_LINEAR_ASSET_MISMATCH(14),
+ /**
+ * 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. */
+ VAST_MALFORMED_RESPONSE(16),
+ /** 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.
+ */
+ VAST_NONLINEAR_ASSET_MISMATCH(18),
+ /** No Ads VAST response after one or more wrappers. */
+ VAST_NO_ADS_AFTER_WRAPPER(19),
+ /** The maximum number of VAST wrapper redirects has been reached. */
+ VAST_TOO_MANY_REDIRECTS(20),
+ /**
+ * Trafficking error.
+ *
+ * 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. */
+ VIDEO_PLAY_ERROR(22),
+ /** The error code is not recognized by this wrapper. */
+ UNKNOWN(23);
+
+ companion object {
+ fun ofRaw(raw: Int): AdErrorCode? {
+ return values().firstOrNull { it.raw == raw }
+ }
+ }
+}
+
+/**
+ * Specifies when the error was encountered, during either ad loading or playback.
+ *
+ * See
+ * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.AdErrorType.html.
+ */
+enum class AdErrorType(val raw: Int) {
+ /** Indicates that the error was encountered when the ad was being loaded. */
+ LOAD(0),
+ /** Indicates that the error was encountered after the ad loaded, during ad play. */
+ PLAY(1),
+ /** The error is not recognized by this wrapper. */
+ UNKNOWN(2);
+
+ companion object {
+ fun ofRaw(raw: Int): AdErrorType? {
+ return values().firstOrNull { it.raw == raw }
+ }
+ }
+}
+
+/**
+ * Types of events that can occur during ad playback.
+ *
+ * See
+ * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventType.html.
+ */
+enum class AdEventType(val raw: Int) {
+ /** Fired when an ad break in a stream ends. */
+ AD_BREAK_ENDED(0),
+ /** Fired when an ad break will not play back any ads. */
+ AD_BREAK_FETCH_ERROR(1),
+ /** Fired when an ad break is ready from VMAP or ad rule ads. */
+ AD_BREAK_READY(2),
+ /** Fired when an ad break in a stream starts. */
+ AD_BREAK_STARTED(3),
+ /** Fired when playback stalls while the ad buffers. */
+ AD_BUFFERING(4),
+ /** Fired when an ad period in a stream ends. */
+ 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. */
+ 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.
+ */
+ ALL_ADS_COMPLETED(8),
+ /** Fired when an ad is clicked. */
+ CLICKED(9),
+ /** Fired when an ad completes playing. */
+ COMPLETED(10),
+ /** Fired when content should be paused. */
+ CONTENT_PAUSE_REQUESTED(11),
+ /** Fired when content should be resumed. */
+ CONTENT_RESUME_REQUESTED(12),
+ /** Fired when VOD stream cuepoints have changed. */
+ CUEPOINTS_CHANGED(13),
+ /** Fired when the ad playhead crosses first quartile. */
+ FIRST_QUARTILE(14),
+ /** The user has closed the icon fallback image dialog. */
+ ICON_FALLBACK_IMAGE_CLOSED(15),
+ /** The user has tapped an ad icon. */
+ 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. */
+ LOG(18),
+ /** Fired when the ad playhead crosses midpoint. */
+ MIDPOINT(19),
+ /** Fired when an ad is paused. */
+ PAUSED(20),
+ /** Fired when an ad is resumed. */
+ RESUMED(21),
+ /** Fired when an ad changes its skippable state. */
+ SKIPPABLE_STATE_CHANGED(22),
+ /** Fired when an ad was skipped. */
+ SKIPPED(23),
+ /** Fired when an ad starts playing. */
+ STARTED(24),
+ /** Fired when a non-clickthrough portion of a video ad is clicked. */
+ TAPPED(25),
+ /** Fired when the ad playhead crosses third quartile. */
+ THIRD_QUARTILE(26),
+ /** The event type is not recognized by this wrapper. */
+ UNKNOWN(27);
+
+ companion object {
+ fun ofRaw(raw: Int): AdEventType? {
+ return values().firstOrNull { it.raw == raw }
+ }
+ }
+}
+/**
+ * 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.
+ */
+@Suppress("UNCHECKED_CAST")
+open class PigeonApiBaseDisplayContainer(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ @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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ 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 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?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+}
+/**
+ * A container in which to display the ads.
+ *
+ * See
+ * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdDisplayContainer.
+ */
+@Suppress("UNCHECKED_CAST")
+open class PigeonApiAdDisplayContainer(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ @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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ 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 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?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+
+ @Suppress("FunctionName")
+ /** An implementation of [PigeonApiBaseDisplayContainer] used to access callback methods */
+ fun pigeon_getPigeonApiBaseDisplayContainer(): PigeonApiBaseDisplayContainer {
+ return pigeonRegistrar.getPigeonApiBaseDisplayContainer()
+ }
+}
+/**
+ * An object which allows publishers to request ads from ad servers or a dynamic ad insertion
+ * stream.
+ *
+ * See
+ * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader.
+ */
+@Suppress("UNCHECKED_CAST")
+abstract class PigeonApiAdsLoader(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ /** 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
+ )
+
+ /** 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
+ )
+
+ /** 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
+ )
+
+ companion object {
+ @Suppress("LocalVariableName")
+ fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAdsLoader?) {
+ val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec()
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.AdsLoader.addAdErrorListener",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsLoader
+ val listenerArg =
+ args[1] as com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener
+ val wrapped: List =
+ try {
+ api.addAdErrorListener(pigeon_instanceArg, listenerArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.AdsLoader.addAdsLoadedListener",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsLoader
+ val listenerArg =
+ args[1] as com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener
+ val wrapped: List =
+ try {
+ api.addAdsLoadedListener(pigeon_instanceArg, listenerArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.AdsLoader.requestAds",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsLoader
+ val requestArg = args[1] as com.google.ads.interactivemedia.v3.api.AdsRequest
+ val wrapped: List =
+ try {
+ api.requestAds(pigeon_instanceArg, requestArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ }
+ }
+
+ @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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ 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"
+ 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?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+}
+/**
+ * An event raised when ads are successfully loaded from the ad server through an AdsLoader.
+ *
+ * See
+ * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsManagerLoadedEvent.html.
+ */
+@Suppress("UNCHECKED_CAST")
+abstract class PigeonApiAdsManagerLoadedEvent(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ /**
+ * 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
+
+ @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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ 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 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?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+}
+/**
+ * An event raised when there is an error loading or playing ads.
+ *
+ * See
+ * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdErrorEvent.html.
+ */
+@Suppress("UNCHECKED_CAST")
+abstract class PigeonApiAdErrorEvent(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ /** 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
+
+ @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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ val pigeon_identifierArg =
+ pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg)
+ val errorArg = error(pigeon_instanceArg)
+ val binaryMessenger = pigeonRegistrar.binaryMessenger
+ val codec = pigeonRegistrar.codec
+ val channelName = "dev.flutter.pigeon.interactive_media_ads.AdErrorEvent.pigeon_newInstance"
+ val channel = BasicMessageChannel(binaryMessenger, channelName, codec)
+ 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?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+}
+/**
+ * An error that occurred in the SDK.
+ *
+ * See
+ * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdError.html.
+ */
+@Suppress("UNCHECKED_CAST")
+abstract class PigeonApiAdError(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ /** The error's code. */
+ 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
+
+ /** The error's type. */
+ 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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ val pigeon_identifierArg =
+ pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg)
+ val errorCodeArg = errorCode(pigeon_instanceArg)
+ val errorCodeNumberArg = errorCodeNumber(pigeon_instanceArg)
+ val errorTypeArg = errorType(pigeon_instanceArg)
+ val messageArg = message(pigeon_instanceArg)
+ val binaryMessenger = pigeonRegistrar.binaryMessenger
+ val codec = pigeonRegistrar.codec
+ val channelName = "dev.flutter.pigeon.interactive_media_ads.AdError.pigeon_newInstance"
+ val channel = BasicMessageChannel(binaryMessenger, channelName, codec)
+ channel.send(
+ listOf(
+ pigeon_identifierArg,
+ errorCodeArg.raw,
+ errorCodeNumberArg,
+ errorTypeArg.raw,
+ messageArg)) {
+ if (it is List<*>) {
+ if (it.size > 1) {
+ callback(
+ Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+}
+/**
+ * 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.
+ */
+@Suppress("UNCHECKED_CAST")
+abstract class PigeonApiAdsRequest(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ /** Sets the URL from which ads will be requested. */
+ 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).
+ */
+ abstract fun setContentProgressProvider(
+ pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsRequest,
+ provider: com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider
+ )
+
+ companion object {
+ @Suppress("LocalVariableName")
+ fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAdsRequest?) {
+ val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec()
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.AdsRequest.setAdTagUrl",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsRequest
+ val adTagUrlArg = args[1] as String
+ val wrapped: List =
+ try {
+ api.setAdTagUrl(pigeon_instanceArg, adTagUrlArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.AdsRequest.setContentProgressProvider",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsRequest
+ val providerArg =
+ args[1] as com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider
+ val wrapped: List =
+ try {
+ api.setContentProgressProvider(pigeon_instanceArg, providerArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ }
+ }
+
+ @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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ 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"
+ 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?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+}
+/**
+ * Defines an interface to allow SDK to track progress of the content video.
+ *
+ * See
+ * https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/android/api/reference/com/google/ads/interactivemedia/v3/api/player/ContentProgressProvider.html.
+ */
+@Suppress("UNCHECKED_CAST")
+open class PigeonApiContentProgressProvider(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ @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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ 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 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?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+}
+/**
+ * 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.
+ */
+@Suppress("UNCHECKED_CAST")
+abstract class PigeonApiAdsManager(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ /** Discards current ad break and resumes content. */
+ abstract fun discardAdBreak(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsManager)
+
+ /** Pauses the current ad. */
+ abstract fun pause(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsManager)
+
+ /** Starts playing the ads. */
+ abstract fun start(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdsManager)
+
+ companion object {
+ @Suppress("LocalVariableName")
+ fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAdsManager?) {
+ val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec()
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.AdsManager.discardAdBreak",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsManager
+ val wrapped: List =
+ try {
+ api.discardAdBreak(pigeon_instanceArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.pause", codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsManager
+ val wrapped: List =
+ try {
+ api.pause(pigeon_instanceArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.AdsManager.start", codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.AdsManager
+ val wrapped: List =
+ try {
+ api.start(pigeon_instanceArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ }
+ }
+
+ @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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ 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"
+ 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?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+
+ @Suppress("FunctionName")
+ /** An implementation of [PigeonApiBaseManager] used to access callback methods */
+ fun pigeon_getPigeonApiBaseManager(): PigeonApiBaseManager {
+ return pigeonRegistrar.getPigeonApiBaseManager()
+ }
+}
+/**
+ * Base interface for managing ads..
+ *
+ * See
+ * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseManager.html.
+ */
+@Suppress("UNCHECKED_CAST")
+abstract class PigeonApiBaseManager(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ /**
+ * 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
+ )
+
+ /**
+ * 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
+ )
+
+ /** Stops the ad and all tracking, then releases all assets that were loaded to play the ad. */
+ abstract fun destroy(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager)
+
+ /** Initializes the ad experience using default rendering settings */
+ abstract fun init(pigeon_instance: com.google.ads.interactivemedia.v3.api.BaseManager)
+
+ companion object {
+ @Suppress("LocalVariableName")
+ fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiBaseManager?) {
+ val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec()
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.BaseManager.addAdErrorListener",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.BaseManager
+ val errorListenerArg =
+ args[1] as com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener
+ val wrapped: List =
+ try {
+ api.addAdErrorListener(pigeon_instanceArg, errorListenerArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.BaseManager.addAdEventListener",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.BaseManager
+ val adEventListenerArg =
+ args[1] as com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener
+ val wrapped: List =
+ try {
+ api.addAdEventListener(pigeon_instanceArg, adEventListenerArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.BaseManager.destroy",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.BaseManager
+ val wrapped: List =
+ try {
+ api.destroy(pigeon_instanceArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.BaseManager.init", codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.BaseManager
+ val wrapped: List =
+ try {
+ api.init(pigeon_instanceArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ }
+ }
+
+ @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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ 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"
+ 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?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+}
+/**
+ * Event to notify publisher that an event occurred with an Ad.
+ *
+ * See
+ * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.html.
+ */
+@Suppress("UNCHECKED_CAST")
+abstract class PigeonApiAdEvent(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ /** The type of event that occurred. */
+ abstract fun type(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdEvent): AdEventType
+
+ @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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ val pigeon_identifierArg =
+ pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg)
+ val typeArg = type(pigeon_instanceArg)
+ val binaryMessenger = pigeonRegistrar.binaryMessenger
+ val codec = pigeonRegistrar.codec
+ val channelName = "dev.flutter.pigeon.interactive_media_ads.AdEvent.pigeon_newInstance"
+ val channel = BasicMessageChannel(binaryMessenger, channelName, codec)
+ channel.send(listOf(pigeon_identifierArg, typeArg.raw)) {
+ if (it is List<*>) {
+ if (it.size > 1) {
+ callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+}
+/**
+ * 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.
+ */
+@Suppress("UNCHECKED_CAST")
+abstract class PigeonApiImaSdkFactory(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ 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
+
+ /** 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
+
+ /** 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
+
+ companion object {
+ @Suppress("LocalVariableName")
+ fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiImaSdkFactory?) {
+ val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec()
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.instance",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_identifierArg =
+ args[0].let { num -> if (num is Int) num.toLong() else num as Long }
+ val wrapped: List =
+ try {
+ api.pigeonRegistrar.instanceManager.addDartCreatedInstance(
+ api.instance(), pigeon_identifierArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createAdDisplayContainer",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val containerArg = args[0] as android.view.ViewGroup
+ val playerArg = args[1] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer
+ val wrapped: List =
+ try {
+ listOf(api.createAdDisplayContainer(containerArg, playerArg))
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createImaSdkSettings",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.ImaSdkFactory
+ val wrapped: List =
+ try {
+ listOf(api.createImaSdkSettings(pigeon_instanceArg))
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ 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) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.ImaSdkFactory.createAdsRequest",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as com.google.ads.interactivemedia.v3.api.ImaSdkFactory
+ val wrapped: List =
+ try {
+ listOf(api.createAdsRequest(pigeon_instanceArg))
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ }
+ }
+
+ @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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ 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"
+ 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?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+}
+/**
+ * Defines general SDK settings that are used when creating an `AdsLoader`.
+ *
+ * See
+ * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkSettings.html.
+ */
+@Suppress("UNCHECKED_CAST")
+open class PigeonApiImaSdkSettings(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ @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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ 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"
+ 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?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+}
+/**
+ * Defines an update to the video's progress.
+ *
+ * See
+ * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoProgressUpdate.html.
+ */
+@Suppress("UNCHECKED_CAST")
+abstract class PigeonApiVideoProgressUpdate(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ abstract fun pigeon_defaultConstructor(
+ currentTimeMs: Long,
+ durationMs: Long
+ ): com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate
+
+ /** Value to use for cases when progress is not yet defined, such as video initialization. */
+ abstract fun videoTimeNotReady():
+ com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate
+
+ companion object {
+ @Suppress("LocalVariableName")
+ fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiVideoProgressUpdate?) {
+ val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec()
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.VideoProgressUpdate.pigeon_defaultConstructor",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_identifierArg =
+ args[0].let { num -> if (num is Int) num.toLong() else num as Long }
+ val currentTimeMsArg =
+ args[1].let { num -> if (num is Int) num.toLong() else num as Long }
+ val durationMsArg = args[2].let { num -> if (num is Int) num.toLong() else num as Long }
+ val wrapped: List =
+ try {
+ api.pigeonRegistrar.instanceManager.addDartCreatedInstance(
+ api.pigeon_defaultConstructor(currentTimeMsArg, durationMsArg),
+ pigeon_identifierArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.VideoProgressUpdate.videoTimeNotReady",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_identifierArg =
+ args[0].let { num -> if (num is Int) num.toLong() else num as Long }
+ val wrapped: List =
+ try {
+ api.pigeonRegistrar.instanceManager.addDartCreatedInstance(
+ api.videoTimeNotReady(), pigeon_identifierArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ }
+ }
+
+ @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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ 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 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?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+}
+/**
+ * The minimal information required to play an ad.
+ *
+ * See
+ * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/AdMediaInfo.html.
+ */
+@Suppress("UNCHECKED_CAST")
+abstract class PigeonApiAdMediaInfo(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ 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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ val pigeon_identifierArg =
+ pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg)
+ val urlArg = url(pigeon_instanceArg)
+ val binaryMessenger = pigeonRegistrar.binaryMessenger
+ val codec = pigeonRegistrar.codec
+ val channelName = "dev.flutter.pigeon.interactive_media_ads.AdMediaInfo.pigeon_newInstance"
+ val channel = BasicMessageChannel(binaryMessenger, channelName, codec)
+ 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?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+}
+/**
+ * An ad may be part of a pod of ads.
+ *
+ * See
+ * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdPodInfo.html.
+ */
+@Suppress("UNCHECKED_CAST")
+abstract class PigeonApiAdPodInfo(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ /**
+ * 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.
+ */
+ abstract fun adPosition(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdPodInfo): Long
+
+ /**
+ * The maximum duration of the pod in seconds.
+ *
+ * For unknown duration, -1 is returned.
+ */
+ 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
+
+ /**
+ * 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.
+ */
+ abstract fun timeOffset(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdPodInfo): Double
+
+ /** The total number of ads contained within this pod, including bumpers. */
+ abstract fun totalAds(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdPodInfo): Long
+
+ /** Returns true if the ad is a bumper ad. */
+ abstract fun isBumper(pigeon_instance: com.google.ads.interactivemedia.v3.api.AdPodInfo): Boolean
+
+ @Suppress("LocalVariableName", "FunctionName")
+ /** Creates a Dart instance of AdPodInfo and attaches it to [pigeon_instanceArg]. */
+ fun pigeon_newInstance(
+ pigeon_instanceArg: com.google.ads.interactivemedia.v3.api.AdPodInfo,
+ callback: (Result) -> Unit
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ val pigeon_identifierArg =
+ pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg)
+ val adPositionArg = adPosition(pigeon_instanceArg)
+ val maxDurationArg = maxDuration(pigeon_instanceArg)
+ val podIndexArg = podIndex(pigeon_instanceArg)
+ val timeOffsetArg = timeOffset(pigeon_instanceArg)
+ val totalAdsArg = totalAds(pigeon_instanceArg)
+ val isBumperArg = isBumper(pigeon_instanceArg)
+ val binaryMessenger = pigeonRegistrar.binaryMessenger
+ val codec = pigeonRegistrar.codec
+ val channelName = "dev.flutter.pigeon.interactive_media_ads.AdPodInfo.pigeon_newInstance"
+ val channel = BasicMessageChannel(binaryMessenger, channelName, codec)
+ channel.send(
+ listOf(
+ pigeon_identifierArg,
+ adPositionArg,
+ maxDurationArg,
+ podIndexArg,
+ timeOffsetArg,
+ totalAdsArg,
+ isBumperArg)) {
+ if (it is List<*>) {
+ if (it.size > 1) {
+ callback(
+ Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+}
+/**
+ * FrameLayout is designed to block out an area on the screen to display a single item.
+ *
+ * See https://developer.android.com/reference/android/widget/FrameLayout.
+ */
+@Suppress("UNCHECKED_CAST")
+abstract class PigeonApiFrameLayout(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ abstract fun pigeon_defaultConstructor(): android.widget.FrameLayout
+
+ companion object {
+ @Suppress("LocalVariableName")
+ fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiFrameLayout?) {
+ val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec()
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.FrameLayout.pigeon_defaultConstructor",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_identifierArg =
+ args[0].let { num -> if (num is Int) num.toLong() else num as Long }
+ val wrapped: List =
+ try {
+ api.pigeonRegistrar.instanceManager.addDartCreatedInstance(
+ api.pigeon_defaultConstructor(), pigeon_identifierArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ }
+ }
+
+ @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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ 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"
+ 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?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+
+ @Suppress("FunctionName")
+ /** An implementation of [PigeonApiViewGroup] used to access callback methods */
+ fun pigeon_getPigeonApiViewGroup(): PigeonApiViewGroup {
+ return pigeonRegistrar.getPigeonApiViewGroup()
+ }
+}
+/**
+ * A special view that can contain other views (called children.)
+ *
+ * See https://developer.android.com/reference/android/view/ViewGroup.
+ */
+@Suppress("UNCHECKED_CAST")
+abstract class PigeonApiViewGroup(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ abstract fun addView(pigeon_instance: android.view.ViewGroup, view: android.view.View)
+
+ companion object {
+ @Suppress("LocalVariableName")
+ fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiViewGroup?) {
+ val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec()
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.ViewGroup.addView",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as android.view.ViewGroup
+ val viewArg = args[1] as android.view.View
+ val wrapped: List =
+ try {
+ api.addView(pigeon_instanceArg, viewArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ }
+ }
+
+ @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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ 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"
+ 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?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+
+ @Suppress("FunctionName")
+ /** An implementation of [PigeonApiView] used to access callback methods */
+ fun pigeon_getPigeonApiView(): PigeonApiView {
+ return pigeonRegistrar.getPigeonApiView()
+ }
+}
+/**
+ * Displays a video file.
+ *
+ * See https://developer.android.com/reference/android/widget/VideoView.
+ */
+@Suppress("UNCHECKED_CAST")
+abstract class PigeonApiVideoView(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ abstract fun pigeon_defaultConstructor(): android.widget.VideoView
+
+ /** Sets the URI of the video. */
+ abstract fun setVideoUri(pigeon_instance: android.widget.VideoView, uri: String)
+
+ /**
+ * The current position of the playing video.
+ *
+ * In milliseconds.
+ */
+ abstract fun getCurrentPosition(pigeon_instance: android.widget.VideoView): Long
+
+ companion object {
+ @Suppress("LocalVariableName")
+ fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiVideoView?) {
+ val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec()
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.VideoView.pigeon_defaultConstructor",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_identifierArg =
+ args[0].let { num -> if (num is Int) num.toLong() else num as Long }
+ val wrapped: List =
+ try {
+ api.pigeonRegistrar.instanceManager.addDartCreatedInstance(
+ api.pigeon_defaultConstructor(), pigeon_identifierArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.VideoView.setVideoUri",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as android.widget.VideoView
+ val uriArg = args[1] as String
+ val wrapped: List =
+ try {
+ api.setVideoUri(pigeon_instanceArg, uriArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.VideoView.getCurrentPosition",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as android.widget.VideoView
+ val wrapped: List =
+ try {
+ listOf(api.getCurrentPosition(pigeon_instanceArg))
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ }
+ }
+
+ @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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ throw IllegalStateException(
+ "Attempting to create a new Dart instance of VideoView, but the class has a nonnull callback method.")
+ }
+
+ /** 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
+ ) {
+ val binaryMessenger = pigeonRegistrar.binaryMessenger
+ val codec = pigeonRegistrar.codec
+ val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoView.onPrepared"
+ val channel = BasicMessageChannel(binaryMessenger, channelName, codec)
+ channel.send(listOf(pigeon_instanceArg, playerArg)) {
+ if (it is List<*>) {
+ if (it.size > 1) {
+ callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+
+ /** 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
+ ) {
+ val binaryMessenger = pigeonRegistrar.binaryMessenger
+ val codec = pigeonRegistrar.codec
+ val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoView.onCompletion"
+ val channel = BasicMessageChannel(binaryMessenger, channelName, codec)
+ channel.send(listOf(pigeon_instanceArg, playerArg)) {
+ if (it is List<*>) {
+ if (it.size > 1) {
+ callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+
+ /** 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
+ ) {
+ val binaryMessenger = pigeonRegistrar.binaryMessenger
+ val codec = pigeonRegistrar.codec
+ val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoView.onError"
+ val channel = BasicMessageChannel(binaryMessenger, channelName, codec)
+ channel.send(listOf(pigeon_instanceArg, playerArg, whatArg, extraArg)) {
+ if (it is List<*>) {
+ if (it.size > 1) {
+ callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+
+ @Suppress("FunctionName")
+ /** An implementation of [PigeonApiView] used to access callback methods */
+ fun pigeon_getPigeonApiView(): PigeonApiView {
+ return pigeonRegistrar.getPigeonApiView()
+ }
+}
+/**
+ * This class represents the basic building block for user interface components.
+ *
+ * See https://developer.android.com/reference/android/view/View.
+ */
+@Suppress("UNCHECKED_CAST")
+open class PigeonApiView(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ @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) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ 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"
+ 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?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+}
+/**
+ * MediaPlayer class can be used to control playback of audio/video files and streams.
+ *
+ * See https://developer.android.com/reference/android/media/MediaPlayer.
+ */
+@Suppress("UNCHECKED_CAST")
+abstract class PigeonApiMediaPlayer(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ /** Gets the duration of the file. */
+ abstract fun getDuration(pigeon_instance: android.media.MediaPlayer): Long
+
+ /** Seeks to specified time position. */
+ abstract fun seekTo(pigeon_instance: android.media.MediaPlayer, mSec: Long)
+
+ /** Starts or resumes playback. */
+ abstract fun start(pigeon_instance: android.media.MediaPlayer)
+
+ /** Pauses playback. */
+ abstract fun pause(pigeon_instance: android.media.MediaPlayer)
+
+ /** Stops playback after playback has been started or paused. */
+ abstract fun stop(pigeon_instance: android.media.MediaPlayer)
+
+ companion object {
+ @Suppress("LocalVariableName")
+ fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiMediaPlayer?) {
+ val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec()
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.getDuration",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as android.media.MediaPlayer
+ val wrapped: List =
+ try {
+ listOf(api.getDuration(pigeon_instanceArg))
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.seekTo",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as android.media.MediaPlayer
+ val mSecArg = args[1].let { num -> if (num is Int) num.toLong() else num as Long }
+ val wrapped: List =
+ try {
+ api.seekTo(pigeon_instanceArg, mSecArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.start",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as android.media.MediaPlayer
+ val wrapped: List =
+ try {
+ api.start(pigeon_instanceArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.pause",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as android.media.MediaPlayer
+ val wrapped: List =
+ try {
+ api.pause(pigeon_instanceArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger, "dev.flutter.pigeon.interactive_media_ads.MediaPlayer.stop", codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg = args[0] as android.media.MediaPlayer
+ val wrapped: List =
+ try {
+ api.stop(pigeon_instanceArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ }
+ }
+
+ @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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ 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"
+ 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?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+}
+/**
+ * Callbacks that the player must fire.
+ *
+ * See
+ * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.VideoAdPlayerCallback.html
+ */
+@Suppress("UNCHECKED_CAST")
+abstract class PigeonApiVideoAdPlayerCallback(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ /** 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
+ )
+
+ /** 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
+ )
+
+ /** Fire this callback when all content has finished playing. */
+ 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
+ )
+
+ /** 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
+ )
+
+ /** 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
+ )
+
+ /** 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
+ )
+
+ /** 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
+ )
+
+ /** 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
+ )
+
+ /** 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
+ )
+
+ companion object {
+ @Suppress("LocalVariableName")
+ fun setUpMessageHandlers(
+ binaryMessenger: BinaryMessenger,
+ api: PigeonApiVideoAdPlayerCallback?
+ ) {
+ val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec()
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onAdProgress",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg =
+ args[0]
+ as
+ com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback
+ val adMediaInfoArg =
+ args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo
+ val videoProgressUpdateArg =
+ args[2] as com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate
+ val wrapped: List =
+ try {
+ api.onAdProgress(pigeon_instanceArg, adMediaInfoArg, videoProgressUpdateArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onBuffering",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg =
+ args[0]
+ as
+ com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback
+ val adMediaInfoArg =
+ args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo
+ val wrapped: List =
+ try {
+ api.onBuffering(pigeon_instanceArg, adMediaInfoArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onContentComplete",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg =
+ args[0]
+ as
+ com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback
+ val wrapped: List =
+ try {
+ api.onContentComplete(pigeon_instanceArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onEnded",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg =
+ args[0]
+ as
+ com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback
+ val adMediaInfoArg =
+ args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo
+ val wrapped: List =
+ try {
+ api.onEnded(pigeon_instanceArg, adMediaInfoArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onError",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg =
+ args[0]
+ as
+ com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback
+ val adMediaInfoArg =
+ args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo
+ val wrapped: List =
+ try {
+ api.onError(pigeon_instanceArg, adMediaInfoArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onLoaded",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg =
+ args[0]
+ as
+ com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback
+ val adMediaInfoArg =
+ args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo
+ val wrapped: List =
+ try {
+ api.onLoaded(pigeon_instanceArg, adMediaInfoArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onPause",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg =
+ args[0]
+ as
+ com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback
+ val adMediaInfoArg =
+ args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo
+ val wrapped: List =
+ try {
+ api.onPause(pigeon_instanceArg, adMediaInfoArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onPlay",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg =
+ args[0]
+ as
+ com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback
+ val adMediaInfoArg =
+ args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo
+ val wrapped: List =
+ try {
+ api.onPlay(pigeon_instanceArg, adMediaInfoArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayerCallback.onResume",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg =
+ args[0]
+ as
+ com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback
+ val adMediaInfoArg =
+ args[1] as com.google.ads.interactivemedia.v3.api.player.AdMediaInfo
+ val wrapped: List =
+ try {
+ api.onResume(pigeon_instanceArg, adMediaInfoArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ 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 percentageArg = args[2].let { num -> if (num is Int) num.toLong() else num as Long }
+ val wrapped: List =
+ try {
+ api.onVolumeChanged(pigeon_instanceArg, adMediaInfoArg, percentageArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ }
+ }
+
+ @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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ 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 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?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+}
+/**
+ * Defines the set of methods that a video player must implement to be used by the IMA SDK, as well
+ * as a set of callbacks that it must fire.
+ *
+ * See
+ * https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/player/VideoAdPlayer.html.
+ */
+@Suppress("UNCHECKED_CAST")
+abstract class PigeonApiVideoAdPlayer(open val pigeonRegistrar: PigeonProxyApiRegistrar) {
+ abstract fun pigeon_defaultConstructor():
+ com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer
+
+ /** 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
+ )
+
+ /** The `VideoProgressUpdate` describing playback progress of the current video. */
+ abstract fun setAdProgress(
+ pigeon_instance: com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer,
+ progress: com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate
+ )
+
+ companion object {
+ @Suppress("LocalVariableName")
+ fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiVideoAdPlayer?) {
+ val codec = api?.pigeonRegistrar?.codec ?: StandardMessageCodec()
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.pigeon_defaultConstructor",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_identifierArg =
+ args[0].let { num -> if (num is Int) num.toLong() else num as Long }
+ val wrapped: List =
+ try {
+ api.pigeonRegistrar.instanceManager.addDartCreatedInstance(
+ api.pigeon_defaultConstructor(), pigeon_identifierArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ 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 valueArg = args[1].let { num -> if (num is Int) num.toLong() else num as Long }
+ val wrapped: List =
+ try {
+ api.setVolume(pigeon_instanceArg, valueArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ run {
+ val channel =
+ BasicMessageChannel(
+ binaryMessenger,
+ "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.setAdProgress",
+ codec)
+ if (api != null) {
+ channel.setMessageHandler { message, reply ->
+ val args = message as List
+ val pigeon_instanceArg =
+ args[0] as com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer
+ val progressArg =
+ args[1] as com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate
+ val wrapped: List =
+ try {
+ api.setAdProgress(pigeon_instanceArg, progressArg)
+ listOf(null)
+ } catch (exception: Throwable) {
+ wrapError(exception)
+ }
+ reply.reply(wrapped)
+ }
+ } else {
+ channel.setMessageHandler(null)
+ }
+ }
+ }
+ }
+
+ @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
+ ) {
+ if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) {
+ Result.success(Unit)
+ return
+ }
+ throw IllegalStateException(
+ "Attempting to create a new Dart instance of VideoAdPlayer, but the class has a nonnull callback method.")
+ }
+
+ /** 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
+ ) {
+ val binaryMessenger = pigeonRegistrar.binaryMessenger
+ val codec = pigeonRegistrar.codec
+ val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.addCallback"
+ val channel = BasicMessageChannel(binaryMessenger, channelName, codec)
+ channel.send(listOf(pigeon_instanceArg, callbackArg)) {
+ if (it is List<*>) {
+ if (it.size > 1) {
+ callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+
+ /** 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
+ ) {
+ val binaryMessenger = pigeonRegistrar.binaryMessenger
+ val codec = pigeonRegistrar.codec
+ val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.loadAd"
+ val channel = BasicMessageChannel(binaryMessenger, channelName, codec)
+ channel.send(listOf(pigeon_instanceArg, adMediaInfoArg, adPodInfoArg)) {
+ if (it is List<*>) {
+ if (it.size > 1) {
+ callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+
+ /** 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
+ ) {
+ val binaryMessenger = pigeonRegistrar.binaryMessenger
+ val codec = pigeonRegistrar.codec
+ val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.pauseAd"
+ val channel = BasicMessageChannel(binaryMessenger, channelName, codec)
+ channel.send(listOf(pigeon_instanceArg, adMediaInfoArg)) {
+ if (it is List<*>) {
+ if (it.size > 1) {
+ callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+
+ /**
+ * 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
+ ) {
+ val binaryMessenger = pigeonRegistrar.binaryMessenger
+ val codec = pigeonRegistrar.codec
+ val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.playAd"
+ val channel = BasicMessageChannel(binaryMessenger, channelName, codec)
+ channel.send(listOf(pigeon_instanceArg, adMediaInfoArg)) {
+ if (it is List<*>) {
+ if (it.size > 1) {
+ callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?)))
+ } else {
+ callback(Result.success(Unit))
+ }
+ } else {
+ callback(Result.failure(createConnectionError(channelName)))
+ }
+ }
+ }
+
+ /** 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
+ ) {
+ val binaryMessenger = pigeonRegistrar.binaryMessenger
+ val codec = pigeonRegistrar.codec
+ val channelName = "dev.flutter.pigeon.interactive_media_ads.VideoAdPlayer.release"
+ val channel = BasicMessageChannel