Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/UID2GMAPlugin.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "UID2GMAPluginTests"
BuildableName = "UID2GMAPluginTests"
BlueprintName = "UID2GMAPluginTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Override point for customization after application launch.

// Initialize Google Mobile Ads SDK
GADMobileAds.sharedInstance().start()
MobileAds.shared.start()

return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import UID2
import UIKit

class GameViewController: UIViewController, GADFullScreenContentDelegate {
class GameViewController: UIViewController, FullScreenContentDelegate {

private enum GameState: Int {
case notStarted
Expand All @@ -40,7 +40,7 @@
private static let adIntroLength = 3.0

/// The rewarded interstitial ad.
private var rewardedInterstitialAd: GADRewardedInterstitialAd?
private var rewardedInterstitialAd: RewardedInterstitialAd?

/// The countdown timer.
private var timer: Timer?
Expand Down Expand Up @@ -77,7 +77,7 @@

Task {
await loadUID2Identity()
let versionNumber = GADMobileAds.sharedInstance().versionNumber
let versionNumber = MobileAds.shared.versionNumber
print("Google Mobile Ads SDK version: \(versionNumber.majorVersion).\(versionNumber.minorVersion).\(versionNumber.patchVersion)")
}

Expand Down Expand Up @@ -145,10 +145,10 @@
}

private func loadRewardedInterstitialAd() {
let request = GAMRequest()
GADRewardedInterstitialAd.load(
withAdUnitID: "/21775744923/example/rewarded_interstitial", request: request
let request = AdManagerRequest()
RewardedInterstitialAd.load(
with: "/21775744923/example/rewarded_interstitial", request: request
) { (ad, error) in

Check warning on line 151 in Development/UID2GoogleGMADevelopmentApp/UID2GoogleGMADevelopmentApp/GameViewController.swift

View workflow job for this annotation

GitHub Actions / Code Tests

Variable name 'ad' should be between 3 and 40 characters long (identifier_name)
if let error = error {
print("Failed to load rewarded interstitial ad with error: \(error.localizedDescription)")
self.playAgainButton.isHidden = false
Expand Down Expand Up @@ -219,7 +219,7 @@
let alertAction = UIAlertAction(
title: "No, thanks",
style: .cancel
) { action in

Check warning on line 222 in Development/UID2GoogleGMADevelopmentApp/UID2GoogleGMADevelopmentApp/GameViewController.swift

View workflow job for this annotation

GitHub Actions / Code Tests

Unused parameter in a closure should be replaced with _ (unused_closure_parameter)
adCanceled = true
self.playAgainButton.isHidden = false
}
Expand All @@ -236,11 +236,11 @@
}

private func showRewardedInterstitialAd() {
guard let ad = self.rewardedInterstitialAd else {

Check warning on line 239 in Development/UID2GoogleGMADevelopmentApp/UID2GoogleGMADevelopmentApp/GameViewController.swift

View workflow job for this annotation

GitHub Actions / Code Tests

Variable name 'ad' should be between 3 and 40 characters long (identifier_name)
print("Ad wasn't ready")
return
}
ad.present(fromRootViewController: self) {
ad.present(from: self) {
let reward = ad.adReward
print(
"Reward received with currency \(reward.amount), amount \(reward.amount.doubleValue)"
Expand All @@ -255,20 +255,19 @@
startNewGame()
}

// MARK: - GADFullScreenContentDelegate
func adWillPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
// MARK: - FullScreenContentDelegate

func adWillPresentFullScreenContent(_ ad: any FullScreenPresentingAd) {

Check warning on line 260 in Development/UID2GoogleGMADevelopmentApp/UID2GoogleGMADevelopmentApp/GameViewController.swift

View workflow job for this annotation

GitHub Actions / Code Tests

Variable name 'ad' should be between 3 and 40 characters long (identifier_name)
print("Ad did present full screen content.")
}

func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error)
{
func ad(_ ad: any FullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {

Check warning on line 264 in Development/UID2GoogleGMADevelopmentApp/UID2GoogleGMADevelopmentApp/GameViewController.swift

View workflow job for this annotation

GitHub Actions / Code Tests

Variable name 'ad' should be between 3 and 40 characters long (identifier_name)
print("Ad failed to present full screen content with error \(error.localizedDescription).")
self.rewardedInterstitialAd = nil
self.playAgainButton.isHidden = false
}

func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) {
func adDidDismissFullScreenContent(_ ad: any FullScreenPresentingAd) {

Check warning on line 270 in Development/UID2GoogleGMADevelopmentApp/UID2GoogleGMADevelopmentApp/GameViewController.swift

View workflow job for this annotation

GitHub Actions / Code Tests

Variable name 'ad' should be between 3 and 40 characters long (identifier_name)
print("Ad did dismiss full screen content.")
self.rewardedInterstitialAd = nil
self.playAgainButton.isHidden = false
Expand Down
4 changes: 2 additions & 2 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/IABTechLab/uid2-ios-sdk.git", "1.7.0" ..< "2.0.0"),
.package(url: "https://github.com/googleads/swift-package-manager-google-mobile-ads.git", "10.7.0" ..< "12.0.0")
.package(url: "https://github.com/googleads/swift-package-manager-google-mobile-ads.git", .upToNextMajor(from: "12.0.0"))
],
targets: [
.target(
Expand Down
20 changes: 10 additions & 10 deletions Sources/UID2GMAPlugin/EUIDGMAMediationAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class EUIDGMAMediationAdapter: NSObject {
}

@available(iOS 13, *)
extension EUIDGMAMediationAdapter: GADRTBAdapter {
extension EUIDGMAMediationAdapter: RTBAdapter {

static func setUpWith(_ configuration: GADMediationServerConfiguration, completionHandler: @escaping GADMediationAdapterSetUpCompletionBlock) {
static func setUp(with configuration: MediationServerConfiguration, completionHandler: @escaping GADMediationAdapterSetUpCompletionBlock) {
guard isOperatingSystemSupported else {
completionHandler(OperatingSystemUnsupportedError())
return
Expand All @@ -30,7 +30,7 @@ extension EUIDGMAMediationAdapter: GADRTBAdapter {
completionHandler(nil)
}

func collectSignals(for params: GADRTBRequestParameters, completionHandler: @escaping GADRTBSignalCompletionHandler) {
func collectSignals(for params: RTBRequestParameters, completionHandler: @escaping GADRTBSignalCompletionHandler) {
guard isOperatingSystemSupported else {
completionHandler(nil, OperatingSystemUnsupportedError())
return
Expand All @@ -44,24 +44,24 @@ extension EUIDGMAMediationAdapter: GADRTBAdapter {
}
}

static func adapterVersion() -> GADVersionNumber {
var version = GADVersionNumber()
version.majorVersion = 1
static func adapterVersion() -> VersionNumber {
var version = VersionNumber()
version.majorVersion = 2
version.minorVersion = 0
version.patchVersion = 1
version.patchVersion = 0
return version
}

static func adSDKVersion() -> GADVersionNumber {
static func adSDKVersion() -> VersionNumber {
let uid2Version = UID2SDKProperties.getUID2SDKVersion()
var version = GADVersionNumber()
var version = VersionNumber()
version.majorVersion = uid2Version.major
version.minorVersion = uid2Version.minor
version.patchVersion = uid2Version.patch
return version
}

static func networkExtrasClass() -> GADAdNetworkExtras.Type? {
static func networkExtrasClass() -> AdNetworkExtras.Type? {
return nil
}

Expand Down
20 changes: 10 additions & 10 deletions Sources/UID2GMAPlugin/UID2GMAMediationAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class UID2GMAMediationAdapter: NSObject {
}

@available(iOS 13, *)
extension UID2GMAMediationAdapter: GADRTBAdapter {
extension UID2GMAMediationAdapter: RTBAdapter {

static func setUpWith(_ configuration: GADMediationServerConfiguration, completionHandler: @escaping GADMediationAdapterSetUpCompletionBlock) {
static func setUp(with configuration: MediationServerConfiguration, completionHandler: @escaping GADMediationAdapterSetUpCompletionBlock) {
guard isOperatingSystemSupported else {
completionHandler(OperatingSystemUnsupportedError())
return
Expand All @@ -33,7 +33,7 @@ extension UID2GMAMediationAdapter: GADRTBAdapter {
completionHandler(nil)
}

func collectSignals(for params: GADRTBRequestParameters, completionHandler: @escaping GADRTBSignalCompletionHandler) {
func collectSignals(for params: RTBRequestParameters, completionHandler: @escaping GADRTBSignalCompletionHandler) {
guard isOperatingSystemSupported else {
completionHandler(nil, OperatingSystemUnsupportedError())
return
Expand All @@ -47,24 +47,24 @@ extension UID2GMAMediationAdapter: GADRTBAdapter {
}
}

static func adapterVersion() -> GADVersionNumber {
var version = GADVersionNumber()
version.majorVersion = 1
static func adapterVersion() -> VersionNumber {
var version = VersionNumber()
version.majorVersion = 2
version.minorVersion = 0
version.patchVersion = 1
version.patchVersion = 0
return version
}

static func adSDKVersion() -> GADVersionNumber {
static func adSDKVersion() -> VersionNumber {
let uid2Version = UID2SDKProperties.getUID2SDKVersion()
var version = GADVersionNumber()
var version = VersionNumber()
version.majorVersion = uid2Version.major
version.minorVersion = uid2Version.minor
version.patchVersion = uid2Version.patch
return version
}

static func networkExtrasClass() -> GADAdNetworkExtras.Type? {
static func networkExtrasClass() -> AdNetworkExtras.Type? {
return nil
}

Expand Down
6 changes: 3 additions & 3 deletions Tests/UID2GMAPluginTests/EUIDGMAMediationAdapterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class EUIDGMAMediationAdapterTests: XCTestCase {
)
)

let signal = try await EUIDGMAMediationAdapter().collectSignals(for: GADRTBRequestParameters())
let signal = try await EUIDGMAMediationAdapter().collectSignals(for: RTBRequestParameters())

// Confirm that Adapter returns expected data
XCTAssertEqual("euid-test-token", signal)
Expand All @@ -36,7 +36,7 @@ final class EUIDGMAMediationAdapterTests: XCTestCase {
await EUIDManager.shared.resetIdentity()

let result = await Task<String?, Error> {
try await EUIDGMAMediationAdapter().collectSignals(for: GADRTBRequestParameters())
try await EUIDGMAMediationAdapter().collectSignals(for: RTBRequestParameters())
}.result
XCTAssertThrowsError(try result.get()) { error in
let adapterError = error as? AdvertisingTokenNotFoundError
Expand All @@ -60,7 +60,7 @@ final class EUIDGMAMediationAdapterTests: XCTestCase {
)

let result = await Task<String?, Error> {
try await EUIDGMAMediationAdapter().collectSignals(for: GADRTBRequestParameters())
try await EUIDGMAMediationAdapter().collectSignals(for: RTBRequestParameters())
}.result
XCTAssertThrowsError(try result.get()) { error in
let adapterError = error as? AdvertisingTokenNotFoundError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import GoogleMobileAds

/// Adds an async wrapper interface to simplify testing
extension GADRTBAdapter {
func collectSignals(for params: GADRTBRequestParameters) async throws -> String? {
extension RTBAdapter {
func collectSignals(for params: RTBRequestParameters) async throws -> String? {
try await withCheckedThrowingContinuation { continuation in
collectSignals(for: params, completionHandler: { signal, error in
guard error == nil else {
Expand Down

This file was deleted.

6 changes: 3 additions & 3 deletions Tests/UID2GMAPluginTests/UID2GMAMediationAdapterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class UID2GMAMediationAdapterTests: XCTestCase {
)
)

let signal = try await UID2GMAMediationAdapter().collectSignals(for: GADRTBRequestParameters())
let signal = try await UID2GMAMediationAdapter().collectSignals(for: RTBRequestParameters())

// Confirm that Adapter returns expected data
XCTAssertEqual("uid2-test-token", signal)
Expand All @@ -38,7 +38,7 @@ final class UID2GMAMediationAdapterTests: XCTestCase {
await UID2Manager.shared.resetIdentity()

let result = await Task<String?, Error> {
try await UID2GMAMediationAdapter().collectSignals(for: GADRTBRequestParameters())
try await UID2GMAMediationAdapter().collectSignals(for: RTBRequestParameters())
}.result
XCTAssertThrowsError(try result.get()) { error in
let adapterError = error as? AdvertisingTokenNotFoundError
Expand All @@ -62,7 +62,7 @@ final class UID2GMAMediationAdapterTests: XCTestCase {
)

let result = await Task<String?, Error> {
try await UID2GMAMediationAdapter().collectSignals(for: GADRTBRequestParameters())
try await UID2GMAMediationAdapter().collectSignals(for: RTBRequestParameters())
}.result
XCTAssertThrowsError(try result.get()) { error in
let adapterError = error as? AdvertisingTokenNotFoundError
Expand Down
7 changes: 3 additions & 4 deletions UID2GMAPlugin.podspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"summary": "A plugin for integrating UID2 and Google GMA into iOS applications.",
"homepage": "https://unifiedid.com/",
"license": "Apache License, Version 2.0",
"version": "1.0.1",
"version": "2.0.0",
"authors": {
"David Snabel-Caunt": "[email protected]"
},
"source": {
"git": "https://github.com/IABTechLab/uid2-ios-plugin-google-gma.git",
"tag": "v1.0.1"
"tag": "v2.0.0"
},
"platforms": {
"ios": "12.0"
Expand All @@ -27,8 +27,7 @@
],
"dependencies": {
"Google-Mobile-Ads-SDK": [
">= 10.7",
"< 12.0"
"~> 12.0"
],
"UID2": [
">= 1.7.0",
Expand Down