From 846a41f9e5591679ad2a9c885d6376b38878cb41 Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Mon, 23 Sep 2024 12:44:29 -0400 Subject: [PATCH] [Messaging] Prep `FIRMessagingExtensionHelper` usage for refactored 1P target (#13691) --- FirebaseMessaging/Sources/FIRMessaging.m | 7 +++++++ .../Sources/Public/FirebaseMessaging/FIRMessaging.h | 4 ++++ .../Sources/Public/FirebaseMessaging/FirebaseMessaging.h | 2 ++ 3 files changed, 13 insertions(+) diff --git a/FirebaseMessaging/Sources/FIRMessaging.m b/FirebaseMessaging/Sources/FIRMessaging.m index af18ea77fea..6f160682e0a 100644 --- a/FirebaseMessaging/Sources/FIRMessaging.m +++ b/FirebaseMessaging/Sources/FIRMessaging.m @@ -40,7 +40,10 @@ #import "FirebaseMessaging/Sources/FIRMessagingUtilities.h" #import "FirebaseMessaging/Sources/FIRMessaging_Private.h" #import "FirebaseMessaging/Sources/NSError+FIRMessaging.h" +#if __has_include( \ + "FirebaseMessaging/Sources/Public/FirebaseMessaging/FIRMessagingExtensionHelper.h") #import "FirebaseMessaging/Sources/Public/FirebaseMessaging/FIRMessagingExtensionHelper.h" +#endif // __has_include("FirebaseMessaging/Sources/Public/FirebaseMessaging/FIRMessagingExtensionHelper.h") #import "FirebaseMessaging/Sources/Token/FIRMessagingAuthService.h" #import "FirebaseMessaging/Sources/Token/FIRMessagingTokenInfo.h" #import "FirebaseMessaging/Sources/Token/FIRMessagingTokenManager.h" @@ -131,6 +134,8 @@ + (FIRMessaging *)messaging { return (FIRMessaging *)instance; } +#if __has_include( \ + "FirebaseMessaging/Sources/Public/FirebaseMessaging/FIRMessagingExtensionHelper.h") + (FIRMessagingExtensionHelper *)extensionHelper { static dispatch_once_t once; static FIRMessagingExtensionHelper *extensionHelper; @@ -139,6 +144,8 @@ + (FIRMessagingExtensionHelper *)extensionHelper { }); return extensionHelper; } +#endif // __has_include("FirebaseMessaging/Sources/Public/FirebaseMessaging/FIRMessagingExtensionHelper.h") + - (instancetype)initWithAnalytics:(nullable id)analytics userDefaults:(GULUserDefaults *)defaults heartbeatLogger:(FIRHeartbeatLogger *)heartbeatLogger { diff --git a/FirebaseMessaging/Sources/Public/FirebaseMessaging/FIRMessaging.h b/FirebaseMessaging/Sources/Public/FirebaseMessaging/FIRMessaging.h index 4f5209bb935..5a7243cbacc 100644 --- a/FirebaseMessaging/Sources/Public/FirebaseMessaging/FIRMessaging.h +++ b/FirebaseMessaging/Sources/Public/FirebaseMessaging/FIRMessaging.h @@ -136,7 +136,9 @@ NS_SWIFT_NAME(MessagingMessageInfo) @end @class FIRMessaging; +#if __has_include("FIRMessagingExtensionHelper.h") @class FIRMessagingExtensionHelper; +#endif // __has_include("FIRMessagingExtensionHelper.h") /** * A protocol to handle token update or data message delivery from FCM. @@ -184,6 +186,7 @@ NS_SWIFT_NAME(Messaging) */ + (instancetype)messaging NS_SWIFT_NAME(messaging()); +#if __has_include("FIRMessagingExtensionHelper.h") /** * Use the MessagingExtensionHelper to populate rich UI content for your notifications. * For example, if an image URL is set in your notification payload or on the console, @@ -194,6 +197,7 @@ NS_SWIFT_NAME(Messaging) */ + (FIRMessagingExtensionHelper *)extensionHelper NS_SWIFT_NAME(serviceExtension()) NS_AVAILABLE(10.14, 10.0); +#endif // __has_include("FIRMessagingExtensionHelper.h") /** * Unavailable. Use +messaging instead. diff --git a/FirebaseMessaging/Sources/Public/FirebaseMessaging/FirebaseMessaging.h b/FirebaseMessaging/Sources/Public/FirebaseMessaging/FirebaseMessaging.h index c5d0bd05046..a46524b399c 100755 --- a/FirebaseMessaging/Sources/Public/FirebaseMessaging/FirebaseMessaging.h +++ b/FirebaseMessaging/Sources/Public/FirebaseMessaging/FirebaseMessaging.h @@ -15,4 +15,6 @@ */ #import "FIRMessaging.h" +#if __has_include("FIRMessagingExtensionHelper.h") #import "FIRMessagingExtensionHelper.h" +#endif // __has_include("FIRMessagingExtensionHelper.h")