diff --git a/android/src/main/kotlin/setupad/plugin/setupad_prebid_flutter/SetupadPrebidFlutterPlugin.kt b/android/src/main/kotlin/setupad/plugin/setupad_prebid_flutter/SetupadPrebidFlutterPlugin.kt index f427557..21c66a8 100644 --- a/android/src/main/kotlin/setupad/plugin/setupad_prebid_flutter/SetupadPrebidFlutterPlugin.kt +++ b/android/src/main/kotlin/setupad/plugin/setupad_prebid_flutter/SetupadPrebidFlutterPlugin.kt @@ -32,9 +32,10 @@ class SetupadPrebidFlutterPlugin : FlutterPlugin, ActivityAware { if (call.method == "startPrebid") { val arguments = call.arguments as? Map<*, *> val prebidAccountID = arguments?.get("accountID") as? String ?: "" + val urlServer = arguments?.get("urlServer") as? String ?: "" val timeoutMillis = arguments?.get("timeoutMillis") as? Int ?: 0 val pbsDebug = arguments?.get("pbsDebug") as? Boolean ?: false - initializePrebidMobile(prebidAccountID, timeoutMillis, pbsDebug) + initializePrebidMobile(urlServer,prebidAccountID, timeoutMillis, pbsDebug) } else { result.notImplemented() } @@ -81,12 +82,12 @@ class SetupadPrebidFlutterPlugin : FlutterPlugin, ActivityAware { /** * Prebid Mobile SDK initialization method */ - private fun initializePrebidMobile(prebidAccountID: String, timeout: Int, pbs: Boolean) { + private fun initializePrebidMobile(urlServer: String,prebidAccountID: String, timeout: Int, pbs: Boolean) { activityFuture.thenAccept { activity -> PrebidMobile.setPrebidServerAccountId(prebidAccountID) PrebidMobile.setPrebidServerHost( Host.createCustomHost( - "https://prebid.setupad.io/openrtb2/auction" + urlServer ) ) diff --git a/example/ios/Flutter/Flutter.podspec b/example/ios/Flutter/Flutter.podspec index 98e1633..3aed58d 100644 --- a/example/ios/Flutter/Flutter.podspec +++ b/example/ios/Flutter/Flutter.podspec @@ -11,7 +11,7 @@ Pod::Spec.new do |s| s.license = { :type => 'BSD' } s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s } - s.ios.deployment_target = '12.0' + s.ios.deployment_target = '13.0' # Framework linking is handled by Flutter tooling, not CocoaPods. # Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs. s.vendored_frameworks = 'path/to/nothing' diff --git a/example/ios/ios/Runner/AppDelegate.swift b/example/ios/ios/Runner/AppDelegate.swift index 6266644..c30b367 100644 --- a/example/ios/ios/Runner/AppDelegate.swift +++ b/example/ios/ios/Runner/AppDelegate.swift @@ -2,12 +2,15 @@ import Flutter import UIKit @main -@objc class AppDelegate: FlutterAppDelegate { +@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } + + func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) { + GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry) + } } diff --git a/example/ios/lib/main.dart b/example/ios/lib/main.dart index 7b7f5b6..873f4b2 100644 --- a/example/ios/lib/main.dart +++ b/example/ios/lib/main.dart @@ -5,7 +5,7 @@ void main() { } class MyApp extends StatelessWidget { - const MyApp({super.key}); + const MyApp(); // This widget is the root of your application. @override @@ -36,7 +36,7 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - const MyHomePage({super.key, required this.title}); + const MyHomePage({required this.title}); // This widget is the home page of your application. It is stateful, meaning // that it has a State object (defined below) that contains fields that affect diff --git a/example/lib/main.dart b/example/lib/main.dart index 4125fdf..436a665 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -5,9 +5,10 @@ import 'package:setupad_prebid_flutter/prebid_ads.dart'; import 'package:app_tracking_transparency/app_tracking_transparency.dart'; -void main() { +void main() async { WidgetsFlutterBinding.ensureInitialized(); - const PrebidMobile().initializeSDK("apptest", 3000, true); + const PrebidMobile().initializeSDK( + "https://prebid.setupad.io/openrtb2/auction", "apptest", 3000, true); runApp(const MyApp()); } @@ -95,7 +96,7 @@ class _MyAppState extends State { children: [ PrebidAd( adType: 'banner', - configId: '6143', + configId: '6143', //you could add zones here adUnitId: '/147246189/app_test', width: 300, height: 250, diff --git a/ios/Classes/SetupadPrebidFlutterPlugin.swift b/ios/Classes/SetupadPrebidFlutterPlugin.swift index 6c80d18..c016249 100644 --- a/ios/Classes/SetupadPrebidFlutterPlugin.swift +++ b/ios/Classes/SetupadPrebidFlutterPlugin.swift @@ -19,16 +19,15 @@ public class SetupadPrebidFlutterPlugin: NSObject, FlutterPlugin { case "startPrebid": let argument = call.arguments as! Dictionary let accountId = argument["accountID"] as? String ?? "" + let urlServer = argument["urlServer"] as? String ?? "" let timeoutMillis = argument["timeoutMillis"] as? Int ?? 3000 let pbs = argument["pbsDebug"] as? Bool ?? false if (accountId != ""){ Prebid.shared.prebidServerAccountId = accountId Prebid.shared.pbsDebug = pbs Prebid.shared.shareGeoLocation = true - - try! Prebid.initializeSDK( - serverURL: "https://prebid.setupad.io/openrtb2/auction", + serverURL: urlServer, gadMobileAdsVersion: string(for: MobileAds.shared.versionNumber) ) { status, error in switch status { @@ -46,28 +45,6 @@ public class SetupadPrebidFlutterPlugin: NSObject, FlutterPlugin { break } } - -// Prebid.initializeSDK() { status, error in -// switch status { -// case .succeeded: -// os_log("Prebid Mobile SDK initialized successfully!", log: customLog, type: .info) -// -// case .failed: -// os_log("%{error} Prebid Mobile SDK initialization error: %@", -// log: customLog, -// type: .error, -// error!.localizedDescription) -// -// case .serverStatusWarning: -// os_log("%{error} Prebid Server status checking failed: %@", -// log: customLog, -// type: .error, -// error!.localizedDescription) -// -// default: -// break -// } -// } Prebid.shared.timeoutMillis = timeoutMillis } diff --git a/lib/prebid_mobile.dart b/lib/prebid_mobile.dart index 48fc11c..acc76d3 100644 --- a/lib/prebid_mobile.dart +++ b/lib/prebid_mobile.dart @@ -5,14 +5,15 @@ class PrebidMobile { const PrebidMobile(); ///initializeSDK() passes to the native side Prebid account ID - Future initializeSDK( - String prebidAccountID, int timeoutMillis, bool pbsDebug) { + Future initializeSDK(String urlServer, String prebidAccountID, + int timeoutMillis, bool pbsDebug) { const MethodChannel channel = MethodChannel('setupad.plugin.setupad_prebid_flutter/myChannel_0'); return channel.invokeMethod('startPrebid', { + "urlServer": urlServer, "accountID": prebidAccountID, "timeoutMillis": timeoutMillis, - "pbsDebug": pbsDebug + "pbsDebug": pbsDebug, }); } } diff --git a/pubspec.lock b/pubspec.lock index d7590dd..56b0a16 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -71,26 +71,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" url: "https://pub.dev" source: hosted - version: "10.0.9" + version: "11.0.2" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" url: "https://pub.dev" source: hosted - version: "3.0.9" + version: "3.0.10" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" lints: dependency: transitive description: @@ -103,26 +103,26 @@ packages: dependency: transitive description: name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6" url: "https://pub.dev" source: hosted - version: "0.12.17" + version: "0.12.18" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.13.0" meta: dependency: transitive description: name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.17.0" path: dependency: transitive description: @@ -188,18 +188,18 @@ packages: dependency: transitive description: name: test_api - sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + sha256: "19a78f63e83d3a61f00826d09bc2f60e191bf3504183c001262be6ac75589fb8" url: "https://pub.dev" source: hosted - version: "0.7.4" + version: "0.7.8" vector_math: dependency: transitive description: name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.2.0" vm_service: dependency: transitive description: @@ -209,5 +209,5 @@ packages: source: hosted version: "15.0.0" sdks: - dart: ">=3.7.0-0 <4.0.0" + dart: ">=3.9.0-0 <4.0.0" flutter: ">=3.18.0-18.0.pre.54"