diff --git a/RNGoogleMobileAds.podspec b/RNGoogleMobileAds.podspec index a6f0e267..4fd3214b 100644 --- a/RNGoogleMobileAds.podspec +++ b/RNGoogleMobileAds.podspec @@ -30,7 +30,9 @@ Pod::Spec.new do |s| google_ump_sdk_version = $RNGoogleUmpSDKVersion end + if !ENV['MAC_CATALYST'] s.dependency 'GoogleUserMessagingPlatform', google_ump_sdk_version + end if defined?($RNGoogleMobileAdsSDKVersion) Pod::UI.puts "#{s.name}: Using user specified Google Mobile-Ads SDK version '#{$RNGoogleMobileAdsSDKVersion}'" @@ -38,7 +40,9 @@ Pod::Spec.new do |s| end # AdMob dependencies + if !ENV['MAC_CATALYST'] s.dependency 'Google-Mobile-Ads-SDK', google_mobile_ads_sdk_version + end if defined?($RNGoogleMobileAdsAsStaticFramework) Pod::UI.puts "#{s.name}: Using overridden static_framework value of '#{$RNGoogleMobileAdsAsStaticFramework}'" diff --git a/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.m b/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.m index 7af5fb72..2ee8f82d 100644 --- a/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.m +++ b/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.m @@ -15,6 +15,8 @@ * */ +#if !TARGET_OS_MACCATALYST + #import @interface RCT_EXTERN_MODULE (RNGoogleMobileAdsAppOpenModule, NSObject) @@ -40,3 +42,5 @@ + (BOOL)requiresMainQueueSetup { : (RCTPromiseRejectBlock)reject) @end + +#endif diff --git a/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.swift b/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.swift index 38e8356b..a121b105 100644 --- a/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.swift +++ b/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.swift @@ -15,6 +15,8 @@ * */ +#if !targetEnvironment(macCatalyst) + import Foundation import GoogleMobileAds @@ -79,3 +81,5 @@ class RNGoogleMobileAdsAppOpenModule: NSObject { } } } + +#endif diff --git a/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.h b/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.h index b7afd089..60a369b7 100644 --- a/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.h +++ b/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.h @@ -15,6 +15,8 @@ * */ +#if !TARGET_OS_MACCATALYST + #import #import #import @@ -37,3 +39,5 @@ - (void)recordManualImpression; @end + +#endif diff --git a/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.m b/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.m index 59d8f3fe..60a029be 100644 --- a/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.m +++ b/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.m @@ -15,6 +15,8 @@ * */ +#if !TARGET_OS_MACCATALYST + #import "RNGoogleMobileAdsBannerComponent.h" #import #import "RNGoogleMobileAdsCommon.h" @@ -154,3 +156,5 @@ - (void)recordManualImpression { } @end + +#endif diff --git a/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerViewManager.m b/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerViewManager.m index 0a489dd3..bbaf8921 100644 --- a/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerViewManager.m +++ b/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerViewManager.m @@ -35,6 +35,7 @@ @implementation RNGoogleMobileAdsBannerViewManager RCT_EXPORT_VIEW_PROPERTY(onNativeEvent, RCTBubblingEventBlock); RCT_EXPORT_METHOD(recordManualImpression : (nonnull NSNumber *)reactTag) { +#if !TARGET_OS_MACCATALYST [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { RNGoogleMobileAdsBannerComponent *banner = viewRegistry[reactTag]; @@ -44,13 +45,18 @@ @implementation RNGoogleMobileAdsBannerViewManager } [banner recordManualImpression]; }]; +#endif } @synthesize bridge = _bridge; - (UIView *)view { +#if TARGET_OS_MACCATALYST + return nil; +#else RNGoogleMobileAdsBannerComponent *banner = [RNGoogleMobileAdsBannerComponent new]; return banner; +#endif } - (dispatch_queue_t)methodQueue { diff --git a/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.h b/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.h index 571aac58..5c47ca34 100644 --- a/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.h +++ b/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.h @@ -16,6 +16,8 @@ * */ +#if !TARGET_OS_MACCATALYST + #import @import GoogleMobileAds; @@ -64,3 +66,5 @@ extern NSString *const GOOGLE_MOBILE_ADS_EVENT_APP_EVENT; extern NSString *const GOOGLE_MOBILE_ADS_EVENT_REWARDED_LOADED; extern NSString *const GOOGLE_MOBILE_ADS_EVENT_REWARDED_EARNED_REWARD; + +#endif diff --git a/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.m b/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.m index e025270f..4d5d6b7c 100644 --- a/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.m +++ b/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.m @@ -16,6 +16,8 @@ * */ +#if !TARGET_OS_MACCATALYST + #import "RNGoogleMobileAdsCommon.h" #import "common/RNRCTEventEmitter.h" @@ -231,3 +233,5 @@ + (UIViewController *)currentViewController { } @end + +#endif diff --git a/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.m b/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.m index c20259e0..80288a85 100644 --- a/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.m +++ b/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.m @@ -19,7 +19,9 @@ #import #import +#if !TARGET_OS_MACCATALYST #include +#endif #import "RCTBridgeModule.h" #import "RNGoogleMobileAdsConsentModule.h" #import "common/RNSharedUtils.h" @@ -37,6 +39,7 @@ - (dispatch_queue_t)methodQueue { #pragma mark - #pragma mark Google Mobile Ads Methods +#if !TARGET_OS_MACCATALYST - (NSString *)getConsentStatusString:(UMPConsentStatus)consentStatus { switch (consentStatus) { case UMPConsentStatusRequired: @@ -50,11 +53,13 @@ - (NSString *)getConsentStatusString:(UMPConsentStatus)consentStatus { return @"UNKNOWN"; } } +#endif RCT_EXPORT_METHOD(requestInfoUpdate : (NSDictionary *)options : (RCTPromiseResolveBlock)resolve : (RCTPromiseRejectBlock)reject) { +#if !TARGET_OS_MACCATALYST UMPRequestParameters *parameters = [[UMPRequestParameters alloc] init]; UMPDebugSettings *debugSettings = [[UMPDebugSettings alloc] init]; @@ -86,9 +91,11 @@ - (NSString *)getConsentStatusString:(UMPConsentStatus)consentStatus { }); } }]; +#endif } RCT_EXPORT_METHOD(showForm : (RCTPromiseResolveBlock)resolve : (RCTPromiseRejectBlock)reject) { +#if !TARGET_OS_MACCATALYST [UMPConsentForm loadWithCompletionHandler:^(UMPConsentForm *form, NSError *loadError) { if (loadError) { [RNSharedUtils rejectPromiseWithUserInfo:reject @@ -117,9 +124,14 @@ - (NSString *)getConsentStatusString:(UMPConsentStatus)consentStatus { }]; } }]; +#endif } -RCT_EXPORT_METHOD(reset) { [UMPConsentInformation.sharedInstance reset]; } +RCT_EXPORT_METHOD(reset) { +#if !TARGET_OS_MACCATALYST + [UMPConsentInformation.sharedInstance reset]; +#endif +} RCT_EXPORT_METHOD(getTCString : (RCTPromiseResolveBlock)resolve : (RCTPromiseRejectBlock)reject) { @try { diff --git a/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenAd.swift b/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenAd.swift index 011f580a..55ad012b 100644 --- a/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenAd.swift +++ b/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenAd.swift @@ -15,6 +15,8 @@ * */ +#if !targetEnvironment(macCatalyst) + import Foundation import GoogleMobileAds @@ -206,3 +208,5 @@ class RNGoogleMobileAdsFullScreenAd: NSObject where T : GADFullScreenPresenti resolve!(nil) } } + +#endif diff --git a/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenContentDelegate.swift b/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenContentDelegate.swift index 6caf6b03..e5f9ac3a 100644 --- a/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenContentDelegate.swift +++ b/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenContentDelegate.swift @@ -1,3 +1,5 @@ +#if !targetEnvironment(macCatalyst) + import Foundation import GoogleMobileAds @@ -70,3 +72,5 @@ class RNGoogleMobileAdsFullScreenContentDelegate: NSObject, GADFullScreenContent ) } } + +#endif diff --git a/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.m b/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.m index 5c0f0c2c..0382d160 100644 --- a/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.m +++ b/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.m @@ -15,6 +15,8 @@ * */ +#if !TARGET_OS_MACCATALYST + #import @interface RCT_EXTERN_MODULE (RNGoogleMobileAdsInterstitialModule, NSObject) @@ -40,3 +42,5 @@ + (BOOL)requiresMainQueueSetup { : (RCTPromiseRejectBlock)reject) @end + +#endif diff --git a/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.swift b/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.swift index f4788e15..f6d1f156 100644 --- a/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.swift +++ b/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.swift @@ -15,6 +15,8 @@ * */ +#if !targetEnvironment(macCatalyst) + import Foundation import GoogleMobileAds @@ -117,3 +119,5 @@ class RNGoogleMobileAdsInterstitialModule: NSObject { } } } + +#endif diff --git a/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.m b/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.m index 7e9a95ea..d4941d15 100644 --- a/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.m +++ b/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.m @@ -15,7 +15,9 @@ * */ +#if !TARGET_OS_MACCATALYST #import +#endif #import #import "RNGoogleMobileAdsModule.h" @@ -35,6 +37,7 @@ - (dispatch_queue_t)methodQueue { #pragma mark Google Mobile Ads Methods RCT_EXPORT_METHOD(initialize : (RCTPromiseResolveBlock)resolve : (RCTPromiseRejectBlock)reject) { +#if !TARGET_OS_MACCATALYST [[GADMobileAds sharedInstance] startWithCompletionHandler:^(GADInitializationStatus *_Nonnull status) { NSDictionary *adapterStatuses = [status adapterStatusesByClassName]; @@ -50,6 +53,7 @@ - (dispatch_queue_t)methodQueue { } resolve(result); }]; +#endif } RCT_EXPORT_METHOD(setRequestConfiguration @@ -61,6 +65,7 @@ - (dispatch_queue_t)methodQueue { } - (void)setRequestConfiguration:(NSDictionary *)requestConfiguration { +#if !TARGET_OS_MACCATALYST if (requestConfiguration[@"maxAdContentRating"]) { NSString *rating = requestConfiguration[@"maxAdContentRating"]; if ([rating isEqualToString:@"G"]) { @@ -99,11 +104,13 @@ - (void)setRequestConfiguration:(NSDictionary *)requestConfiguration { } GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers = devices; } +#endif } RCT_EXPORT_METHOD(openAdInspector : (RCTPromiseResolveBlock)resolve : (RCTPromiseRejectBlock)reject) { +#if !TARGET_OS_MACCATALYST [GADMobileAds.sharedInstance presentAdInspectorFromViewController:RCTSharedApplication().delegate.window.rootViewController completionHandler:^(NSError *_Nullable error) { @@ -119,15 +126,18 @@ - (void)setRequestConfiguration:(NSDictionary *)requestConfiguration { resolve(nil); } }]; +#endif } RCT_EXPORT_METHOD(openDebugMenu : (NSString *)adUnit) { +#if !TARGET_OS_MACCATALYST GADDebugOptionsViewController *debugOptionsViewController = [GADDebugOptionsViewController debugOptionsViewControllerWithAdUnitID:adUnit]; [RCTSharedApplication().delegate.window.rootViewController presentViewController:debugOptionsViewController animated:YES completion:nil]; +#endif } @end diff --git a/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.m b/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.m index 5818c81b..42e93763 100644 --- a/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.m +++ b/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.m @@ -15,6 +15,8 @@ * */ +#if !TARGET_OS_MACCATALYST + #import @interface RCT_EXTERN_MODULE (RNGoogleMobileAdsRewardedInterstitialModule, NSObject) @@ -40,3 +42,5 @@ + (BOOL)requiresMainQueueSetup { : (RCTPromiseRejectBlock)reject) @end + +#endif diff --git a/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.swift b/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.swift index 3e008e3a..df9938e6 100644 --- a/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.swift +++ b/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.swift @@ -15,6 +15,8 @@ * */ +#if !targetEnvironment(macCatalyst) + import Foundation import GoogleMobileAds @@ -79,3 +81,5 @@ class RNGoogleMobileAdsRewardedInterstitialModule: NSObject { } } } + +#endif diff --git a/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.m b/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.m index a7af7c29..7920e773 100644 --- a/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.m +++ b/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.m @@ -15,6 +15,8 @@ * */ +#if !TARGET_OS_MACCATALYST + #import @interface RCT_EXTERN_MODULE (RNGoogleMobileAdsRewardedModule, NSObject) @@ -40,3 +42,5 @@ + (BOOL)requiresMainQueueSetup { : (RCTPromiseRejectBlock)reject) @end + +#endif diff --git a/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.swift b/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.swift index d7c09fb6..4bb061c0 100644 --- a/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.swift +++ b/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.swift @@ -15,6 +15,8 @@ * */ +#if !targetEnvironment(macCatalyst) + import Foundation import GoogleMobileAds @@ -79,3 +81,5 @@ class RNGoogleMobileAdsRewardedModule: NSObject { } } } + +#endif