mirror of
https://github.com/RevenueCat/purchases-ios
synced 2026-11-11 22:55:55 +05:45
* ci: test AdMob adapter deploy with hardcoded version 5.66.0 Temporarily hardcode version and simplify deploy-tag workflow to test the deploy-to-purchases-ios-admob job from the release-admob-adapter branch. * Revert "ci: test AdMob adapter deploy with hardcoded version 5.66.0" This reverts commit 104542f0ab0a0dbb590b19187f8e598ca8ece96c. * feat: add AdMobIntegrationSample example app xcodeproj and config Add the Xcode project, Info.plist, gitignore, and Package.resolved for the AdMob example app. Clean up duplicate RevenueCatAdMob package dependencies and fix project-level deployment target. * fix: allow example app Package.resolved through gitignore The root Package.resolved pattern matched at any depth, silently excluding the example app's Package.resolved from the deployed repo. Add a negation so the example app keeps reproducible builds. * fix: gitignore Package.resolved in example app instead of committing it * feat: add VanillaAdTrackingSample example app for manual ad tracking Adds a companion example to AdMobIntegrationSample that demonstrates manual ad event tracking via Purchases.shared.adTracker without the RevenueCatAdMob adapter library. Covers all ad formats (banner, interstitial, app open, rewarded, rewarded interstitial, native) with manual delegate callbacks and paidEventHandler wiring. * feat: add VanillaAdTrackingSample to Tuist workspace Adds Tuist project definition and workspace entry for the vanilla ad tracking example. Introduces vanillaAdTrackingPackages helper that provides RevenueCat (local) + GoogleMobileAds (remote) without the adapter dependency. * Fixup * docs: remove adapter comparison from VanillaAdTrackingSample README * fix: use dynamic placement in banner impression and click callbacks * fix: update Google Mobile Ads version constraint to allow v13 * fix: use configuration-based styling for CTA button in native ad view * fix: remove unused placement parameter from loadNativeAd * fix: inline Google Mobile Ads package in Project.swift Move the Google Mobile Ads package declaration directly into the VanillaAdTrackingSample Project.swift instead of using a shared helper, since it's only used by this one project. * fix: remove unused VanillaAdTrackingSample-Info.plist The info.plist values are already declared in Project.swift via infoPlist: .extendingDefault, making this file redundant. * fix: add didFailToPresentFullScreenContent delegate method Handle the case where a loaded full-screen ad fails to present by cleaning up metadata, resetting the ad reference and status. This prevents leaked metadata entries and stuck "Ready" states. * fix: mark AdMobManager as @MainActor for thread safety AdMob callbacks may fire off the main thread, but @Published properties are observed by SwiftUI and must be mutated on main. * docs: update build instructions to use tuist generate The project uses Tuist for workspace generation, not a standalone .xcodeproj file. * fix: move native ad delegate assignment before availability guard The delegate assignment is not iOS 15-dependent and should be set before the guard so impression/click callbacks work regardless of the consumer's deployment target. * refactor: extract shared full-screen ad cleanup into helper method Deduplicate the identical cleanup logic between adDidDismissFullScreenContent and ad(_:didFailToPresentFullScreenContentWithError:) into a single cleanUpFullScreenAd helper. * fix(ads): save adLoader before setting delegate * chore(ads): cleanup vanilla example and project file * fix(ads): remove hardcoded development team * fix(ads): move from local to remote package dep * fix(ads): revert tuist and fix project file * fix(ads): revert tuist and fix project file --------- Co-authored-by: Peter Porfy <peter.porfy@revenuecat.com>
72 lines
3.5 KiB
Swift
72 lines
3.5 KiB
Swift
import Foundation
|
|
|
|
/// Constants for the Vanilla Ad Tracking Sample app.
|
|
///
|
|
/// IMPORTANT: These are test ad unit IDs provided by Google AdMob for development and testing.
|
|
/// Replace these with your actual production ad unit IDs before publishing your app.
|
|
enum Constants {
|
|
/// RevenueCat API Key
|
|
/// Get your API key from https://app.revenuecat.com/
|
|
///
|
|
/// NOTE: For this sample app, you can use any valid RevenueCat API key.
|
|
/// The sample demonstrates ad event tracking, not subscription functionality.
|
|
#error("Modify this property to reflect your app's API key, then comment this line out.")
|
|
static let revenueCatAPIKey = "YOUR_REVENUECAT_API_KEY"
|
|
|
|
/// AdMob Test Ad Unit IDs
|
|
/// These are official test IDs provided by Google that always serve test ads.
|
|
/// Source: https://developers.google.com/admob/ios/test-ads
|
|
enum AdMob {
|
|
/// Banner Ad Test Unit ID
|
|
/// Always successfully loads and displays a test banner ad.
|
|
static let bannerAdUnitID = "ca-app-pub-3940256099942544/2435281174"
|
|
|
|
/// Interstitial Ad Test Unit ID
|
|
/// Always successfully loads and displays a test interstitial ad.
|
|
static let interstitialAdUnitID = "ca-app-pub-3940256099942544/4411468910"
|
|
|
|
/// Rewarded Ad Test Unit ID
|
|
/// Always successfully loads and displays a test rewarded ad.
|
|
static let rewardedAdUnitID = "ca-app-pub-3940256099942544/1712485313"
|
|
|
|
/// Rewarded Interstitial Ad Test Unit ID
|
|
/// Always successfully loads and displays a test rewarded interstitial ad.
|
|
static let rewardedInterstitialAdUnitID = "ca-app-pub-3940256099942544/6978759866"
|
|
|
|
/// App Open Ad Test Unit ID
|
|
/// Always successfully loads and displays a test app open ad.
|
|
/// App open ads are full-screen ads shown when users open or switch back to your app.
|
|
static let appOpenAdUnitID = "ca-app-pub-3940256099942544/5575463023"
|
|
|
|
/// Native Ad Test Unit ID
|
|
/// Test ID for native ads (text + images).
|
|
/// Official Google test ID for Native Advanced ads.
|
|
///
|
|
/// ⚠️ IMPORTANT: This test ID does not work reliably for native ads.
|
|
/// Google's test IDs for native ads often fail to load or behave inconsistently.
|
|
/// For reliable testing:
|
|
/// 1. Use a production ad unit ID from your AdMob account
|
|
/// 2. Configure your device as a test device
|
|
static let nativeAdUnitID = "ca-app-pub-3940256099942544/2247696110"
|
|
|
|
/// Native Video Ad Test Unit ID
|
|
/// Test ID for native ads with video content.
|
|
/// Official Google test ID for Native Advanced Video ads.
|
|
///
|
|
/// ⚠️ IMPORTANT: This test ID does not work reliably for native video ads.
|
|
/// Google's test IDs for native ads often fail to load or behave inconsistently.
|
|
/// For reliable testing:
|
|
/// 1. Use a production ad unit ID from your AdMob account
|
|
/// 2. Configure your device as a test device
|
|
static let nativeVideoAdUnitID = "ca-app-pub-3940256099942544/1044960115"
|
|
|
|
/// Invalid Ad Unit ID - Used for Error Handling
|
|
/// This intentionally invalid ID triggers load failures to demonstrate
|
|
/// how to handle and track ad load errors with RevenueCat.
|
|
///
|
|
/// NOTE: AdMob does not provide an official "error test ID", so we use
|
|
/// an invalid ID to simulate load failures for testing purposes.
|
|
static let invalidAdUnitID = "invalid-ad-unit-id"
|
|
}
|
|
}
|