Skip to content

Commit

Permalink
Swift 6 support for App Open examples
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 709832864
  • Loading branch information
Justin Malandruccolo authored and copybara-github committed Dec 30, 2024
1 parent be67518 commit e162328
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.google.ads.AdManagerAppOpenExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down Expand Up @@ -360,7 +360,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.google.ads.AdManagerAppOpenExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
// limitations under the License.
//

import GoogleMobileAds
@preconcurrency import GoogleMobileAds

@MainActor
protocol AppOpenAdManagerDelegate: AnyObject {
/// Method to be invoked when an app open ad life cycle is complete (i.e. dismissed or fails to
/// show).
func appOpenAdManagerAdDidComplete(_ appOpenAdManager: AppOpenAdManager)
}

@MainActor
class AppOpenAdManager: NSObject {
/// Ad references in the app open beta will time out after four hours,
/// but this time limit may change in future beta versions. For details, see:
Expand Down Expand Up @@ -108,7 +110,7 @@ class AppOpenAdManager: NSObject {
}
}

extension AppOpenAdManager: GADFullScreenContentDelegate {
extension AppOpenAdManager: @preconcurrency GADFullScreenContentDelegate {
func adWillPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
print("App open ad is will be presented.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import UserMessagingPlatform
/// consent for users in GDPR impacted countries. This is an example and
/// you can choose another consent management platform to capture consent.

@MainActor
class GoogleMobileAdsConsentManager: NSObject {
static let shared = GoogleMobileAdsConsentManager()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.google.ads.AppOpenExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down Expand Up @@ -358,7 +358,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.google.ads.AppOpenExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
// limitations under the License.
//

import GoogleMobileAds
@preconcurrency import GoogleMobileAds

@MainActor
protocol AppOpenAdManagerDelegate: AnyObject {
/// Method to be invoked when an app open ad life cycle is complete (i.e. dismissed or fails to
/// show).
func appOpenAdManagerAdDidComplete(_ appOpenAdManager: AppOpenAdManager)
}

@MainActor
class AppOpenAdManager: NSObject {
/// Ad references in the app open beta will time out after four hours,
/// but this time limit may change in future beta versions. For details, see:
Expand Down Expand Up @@ -108,7 +110,7 @@ class AppOpenAdManager: NSObject {
}
}

extension AppOpenAdManager: GADFullScreenContentDelegate {
extension AppOpenAdManager: @preconcurrency GADFullScreenContentDelegate {
func adWillPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
print("App open ad is will be presented.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import UserMessagingPlatform
/// consent for users in GDPR impacted countries. This is an example and
/// you can choose another consent management platform to capture consent.

@MainActor
class GoogleMobileAdsConsentManager: NSObject {
static let shared = GoogleMobileAdsConsentManager()

Expand Down

0 comments on commit e162328

Please sign in to comment.