diff --git a/FirebaseInAppMessaging/Sources/DefaultUI/Banner/FIRIAMBannerViewController.h b/FirebaseInAppMessaging/Sources/DefaultUI/Banner/FIRIAMBannerViewController.h index ed830039b26..29d273c6d63 100644 --- a/FirebaseInAppMessaging/Sources/DefaultUI/Banner/FIRIAMBannerViewController.h +++ b/FirebaseInAppMessaging/Sources/DefaultUI/Banner/FIRIAMBannerViewController.h @@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN NS_EXTENSION_UNAVAILABLE("Firebase In App Messaging is not supported for iOS extensions.") -API_AVAILABLE(ios(13.0), tvos(13.0)) + @interface FIRIAMBannerViewController : FIRIAMBaseRenderingViewController + (FIRIAMBannerViewController *) instantiateViewControllerWithResourceBundle:(NSBundle *)resourceBundle diff --git a/FirebaseInAppMessaging/Sources/DefaultUI/FIRIAMBaseRenderingViewController.m b/FirebaseInAppMessaging/Sources/DefaultUI/FIRIAMBaseRenderingViewController.m index 460fe9f60a2..9691fc8f392 100644 --- a/FirebaseInAppMessaging/Sources/DefaultUI/FIRIAMBaseRenderingViewController.m +++ b/FirebaseInAppMessaging/Sources/DefaultUI/FIRIAMBaseRenderingViewController.m @@ -55,17 +55,15 @@ - (void)viewDidLoad { selector:@selector(appDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil]; - if (@available(iOS 13.0, tvOS 13.0, *)) { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(appWillBecomeInactive:) - name:UISceneWillDeactivateNotification - object:nil]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(appDidBecomeActive:) - name:UISceneDidActivateNotification - object:nil]; - } + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(appWillBecomeInactive:) + name:UISceneWillDeactivateNotification + object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(appDidBecomeActive:) + name:UISceneDidActivateNotification + object:nil]; self.aggregateImpressionTimeInSeconds = 0; } diff --git a/FirebaseInAppMessaging/Sources/DefaultUI/FIRIAMDefaultDisplayImpl.h b/FirebaseInAppMessaging/Sources/DefaultUI/FIRIAMDefaultDisplayImpl.h index 9e67121d13e..6cc5f3b4d10 100644 --- a/FirebaseInAppMessaging/Sources/DefaultUI/FIRIAMDefaultDisplayImpl.h +++ b/FirebaseInAppMessaging/Sources/DefaultUI/FIRIAMDefaultDisplayImpl.h @@ -26,7 +26,7 @@ NS_SWIFT_NAME(InAppMessagingDefaultDisplayImpl) * to help UI Testing app access the UI layer directly. */ NS_EXTENSION_UNAVAILABLE("Firebase In App Messaging is not supported for iOS extensions.") -API_AVAILABLE(ios(13.0), tvos(13.0)) + @interface FIRIAMDefaultDisplayImpl : NSObject /// Conforms to display delegate for rendering of in-app messages. diff --git a/FirebaseInAppMessaging/Sources/DefaultUI/FIRIAMRenderingWindowHelper.m b/FirebaseInAppMessaging/Sources/DefaultUI/FIRIAMRenderingWindowHelper.m index 2d42847474b..8a2d9ed1e71 100644 --- a/FirebaseInAppMessaging/Sources/DefaultUI/FIRIAMRenderingWindowHelper.m +++ b/FirebaseInAppMessaging/Sources/DefaultUI/FIRIAMRenderingWindowHelper.m @@ -28,11 +28,7 @@ + (UIWindow *)windowForBlockingView { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - if (@available(iOS 13.0, tvOS 13.0, *)) { - UIWindowForModal = [[self class] iOS13PlusWindow]; - } else { - UIWindowForModal = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - } + UIWindowForModal = [[self class] iOS13PlusWindow]; UIWindowForModal.windowLevel = UIWindowLevelNormal; }); return UIWindowForModal; @@ -43,19 +39,14 @@ + (UIWindow *)windowForNonBlockingView { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - if (@available(iOS 13.0, tvOS 13.0, *)) { - UIWindowForBanner = [[self class] iOS13PlusBannerWindow]; - } else { - UIWindowForBanner = - [[FIRIAMBannerViewUIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - } + UIWindowForBanner = [[self class] iOS13PlusBannerWindow]; UIWindowForBanner.windowLevel = UIWindowLevelNormal; }); return UIWindowForBanner; } -+ (UIWindow *)iOS13PlusWindow API_AVAILABLE(ios(13.0)) { ++ (UIWindow *)iOS13PlusWindow { UIWindowScene *foregroundedScene = [[UIApplication sharedApplication] fir_foregroundWindowScene]; if (foregroundedScene.delegate) { return [[UIWindow alloc] initWithWindowScene:foregroundedScene]; @@ -64,7 +55,7 @@ + (UIWindow *)iOS13PlusWindow API_AVAILABLE(ios(13.0)) { } } -+ (FIRIAMBannerViewUIWindow *)iOS13PlusBannerWindow API_AVAILABLE(ios(13.0)) { ++ (FIRIAMBannerViewUIWindow *)iOS13PlusBannerWindow { UIWindowScene *foregroundedScene = [[UIApplication sharedApplication] fir_foregroundWindowScene]; if (foregroundedScene.delegate) { return [[FIRIAMBannerViewUIWindow alloc] initWithWindowScene:foregroundedScene]; diff --git a/FirebaseInAppMessaging/Sources/Flows/FIRIAMActivityLogger.m b/FirebaseInAppMessaging/Sources/Flows/FIRIAMActivityLogger.m index a89c03ba911..98448e01e5b 100644 --- a/FirebaseInAppMessaging/Sources/Flows/FIRIAMActivityLogger.m +++ b/FirebaseInAppMessaging/Sources/Flows/FIRIAMActivityLogger.m @@ -113,12 +113,10 @@ - (instancetype)initWithMaxCountBeforeReduce:(NSInteger)maxBeforeReduce selector:@selector(appWillBecomeInactive:) name:UIApplicationWillResignActiveNotification object:nil]; - if (@available(iOS 13.0, tvOS 13.0, *)) { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(appWillBecomeInactive:) - name:UISceneWillDeactivateNotification - object:nil]; - } + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(appWillBecomeInactive:) + name:UISceneWillDeactivateNotification + object:nil]; if (loadFromCache) { @try { [self loadFromCachePath:nil]; diff --git a/FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayCheckOnAppForegroundFlow.m b/FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayCheckOnAppForegroundFlow.m index 27fc9492ba1..94baa3ef64a 100644 --- a/FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayCheckOnAppForegroundFlow.m +++ b/FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayCheckOnAppForegroundFlow.m @@ -33,13 +33,11 @@ - (void)start { selector:@selector(checkAndDisplayNextAppForegroundMessageFromForeground:) name:UIApplicationWillEnterForegroundNotification object:nil]; - if (@available(iOS 13.0, tvOS 13.0, *)) { - [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(checkAndDisplayNextAppForegroundMessageFromForeground:) - name:UISceneWillEnterForegroundNotification - object:nil]; - } + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector(checkAndDisplayNextAppForegroundMessageFromForeground:) + name:UISceneWillEnterForegroundNotification + object:nil]; } - (void)checkAndDisplayNextAppForegroundMessageFromForeground:(NSNotification *)notification { diff --git a/FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayExecutor.m b/FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayExecutor.m index c7b10afe459..2fd5c5fcef7 100644 --- a/FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayExecutor.m +++ b/FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayExecutor.m @@ -355,19 +355,13 @@ - (void)displayMessageLoadError:(NSError *)error { [alert addAction:defaultAction]; dispatch_async(dispatch_get_main_queue(), ^{ - if (@available(iOS 13.0, tvOS 13.0, *)) { - UIWindowScene *foregroundedScene = - [[UIApplication sharedApplication] fir_foregroundWindowScene]; + UIWindowScene *foregroundedScene = + [[UIApplication sharedApplication] fir_foregroundWindowScene]; - if (foregroundedScene == nil) { - return; - } - self.alertWindow = [[UIWindow alloc] initWithWindowScene:foregroundedScene]; -#if TARGET_OS_IOS || TARGET_OS_TV - } else { - self.alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; -#endif + if (foregroundedScene == nil) { + return; } + self.alertWindow = [[UIWindow alloc] initWithWindowScene:foregroundedScene]; UIViewController *alertViewController = [[UIViewController alloc] init]; self.alertWindow.rootViewController = alertViewController; self.alertWindow.hidden = NO; diff --git a/FirebaseInAppMessaging/Sources/Flows/FIRIAMFetchOnAppForegroundFlow.m b/FirebaseInAppMessaging/Sources/Flows/FIRIAMFetchOnAppForegroundFlow.m index 946a9ec56b2..4dde68b383f 100644 --- a/FirebaseInAppMessaging/Sources/Flows/FIRIAMFetchOnAppForegroundFlow.m +++ b/FirebaseInAppMessaging/Sources/Flows/FIRIAMFetchOnAppForegroundFlow.m @@ -29,12 +29,10 @@ - (void)start { selector:@selector(appWillEnterForeground:) name:UIApplicationWillEnterForegroundNotification object:nil]; - if (@available(iOS 13.0, tvOS 13.0, *)) { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(appWillEnterForeground:) - name:UISceneWillEnterForegroundNotification - object:nil]; - } + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(appWillEnterForeground:) + name:UISceneWillEnterForegroundNotification + object:nil]; } - (void)appWillEnterForeground:(NSNotification *)notification { diff --git a/FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMDisplayCheckOnAnalyticEventsFlow.h b/FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMDisplayCheckOnAnalyticEventsFlow.h index bf47dcf1821..b2857bf8dcc 100644 --- a/FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMDisplayCheckOnAnalyticEventsFlow.h +++ b/FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMDisplayCheckOnAnalyticEventsFlow.h @@ -20,6 +20,6 @@ // a Firebase Analytics event is fired. NS_EXTENSION_UNAVAILABLE("Firebase In App Messaging is not supported for iOS extensions.") -API_AVAILABLE(ios(13.0), tvos(13.0)) + @interface FIRIAMDisplayCheckOnAnalyticEventsFlow : FIRIAMDisplayCheckTriggerFlow @end diff --git a/FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMDisplayExecutor.h b/FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMDisplayExecutor.h index 28eedb51b56..4e08fdd05b3 100644 --- a/FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMDisplayExecutor.h +++ b/FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMDisplayExecutor.h @@ -39,7 +39,7 @@ NS_ASSUME_NONNULL_BEGIN // 1 No current in-app message is being displayed // 2 For non-contextual messages, the display interval in display setting is met. NS_EXTENSION_UNAVAILABLE("Firebase In App Messaging is not supported for iOS extensions.") -API_AVAILABLE(ios(13.0), tvos(13.0)) + @interface FIRIAMDisplayExecutor : NSObject - (instancetype)initWithInAppMessaging:(FIRInAppMessaging *)inAppMessaging diff --git a/FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMFetchOnAppForegroundFlow.h b/FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMFetchOnAppForegroundFlow.h index 61f2e926222..4e159156779 100644 --- a/FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMFetchOnAppForegroundFlow.h +++ b/FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMFetchOnAppForegroundFlow.h @@ -17,7 +17,7 @@ // an implementation of FIRIAMDisplayExecutor by triggering the display when app is foregrounded NS_EXTENSION_UNAVAILABLE("Firebase In App Messaging is not supported for iOS extensions.") -API_AVAILABLE(ios(13.0), tvos(13.0)) + @interface FIRIAMFetchOnAppForegroundFlow : FIRIAMFetchFlow - (void)start; - (void)stop; diff --git a/FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMMessageClientCache.h b/FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMMessageClientCache.h index c9ed28d92fa..824e86640ad 100644 --- a/FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMMessageClientCache.h +++ b/FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMMessageClientCache.h @@ -50,7 +50,7 @@ NS_ASSUME_NONNULL_BEGIN // This class exists so that we can do message match more efficiently (in-memory search vs search // in local persistent storage) by using appropriate in-memory data structure. NS_EXTENSION_UNAVAILABLE("Firebase In App Messaging is not supported for iOS extensions.") -API_AVAILABLE(ios(13.0), tvos(13.0)) + @interface FIRIAMMessageClientCache : NSObject // used to inform the analytics event display check flow about whether it should start/stop diff --git a/FirebaseInAppMessaging/Sources/Private/Runtime/FIRIAMFetchFlow.h b/FirebaseInAppMessaging/Sources/Private/Runtime/FIRIAMFetchFlow.h index 1a0dd105b24..601103dd122 100644 --- a/FirebaseInAppMessaging/Sources/Private/Runtime/FIRIAMFetchFlow.h +++ b/FirebaseInAppMessaging/Sources/Private/Runtime/FIRIAMFetchFlow.h @@ -44,7 +44,7 @@ typedef void (^FIRIAMFetchMessageCompletionHandler)( // Parent class for supporting different fetching flows. Subclass is supposed to trigger // checkAndFetch at appropriate moments based on its fetch strategy NS_EXTENSION_UNAVAILABLE("Firebase In App Messaging is not supported for iOS extensions.") -API_AVAILABLE(ios(13.0), tvos(13.0)) + @interface FIRIAMFetchFlow : NSObject - (instancetype)initWithSetting:(FIRIAMFetchSetting *)setting messageCache:(FIRIAMMessageClientCache *)cache diff --git a/FirebaseInAppMessaging/Sources/Private/Runtime/FIRIAMRuntimeManager.h b/FirebaseInAppMessaging/Sources/Private/Runtime/FIRIAMRuntimeManager.h index a72b595852f..53d2e0a2ff6 100644 --- a/FirebaseInAppMessaging/Sources/Private/Runtime/FIRIAMRuntimeManager.h +++ b/FirebaseInAppMessaging/Sources/Private/Runtime/FIRIAMRuntimeManager.h @@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN // A class for managing the objects/dependencies for supporting different fiam flows at runtime NS_EXTENSION_UNAVAILABLE("Firebase In App Messaging is not supported for iOS extensions.") -API_AVAILABLE(ios(13.0), tvos(13.0)) + @interface FIRIAMRuntimeManager : NSObject @property(nonatomic, nonnull) FIRIAMSDKSettings *currentSetting; @property(nonatomic, nonnull) FIRIAMActivityLogger *activityLogger; diff --git a/FirebaseInAppMessaging/Sources/Private/Util/UIApplication+FIRForegroundWindowScene.h b/FirebaseInAppMessaging/Sources/Private/Util/UIApplication+FIRForegroundWindowScene.h index 142dbdb4b44..095d2a79648 100644 --- a/FirebaseInAppMessaging/Sources/Private/Util/UIApplication+FIRForegroundWindowScene.h +++ b/FirebaseInAppMessaging/Sources/Private/Util/UIApplication+FIRForegroundWindowScene.h @@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN // Extension on UIApplication to get the first foreground connected scene @interface UIApplication (FIRForegroundWindowScene) -- (nullable UIWindowScene *)fir_foregroundWindowScene API_AVAILABLE(ios(13.0)); +- (nullable UIWindowScene *)fir_foregroundWindowScene; @end diff --git a/FirebaseInAppMessaging/Sources/Public/FirebaseInAppMessaging/FIRInAppMessaging.h b/FirebaseInAppMessaging/Sources/Public/FirebaseInAppMessaging/FIRInAppMessaging.h index b83ab6cb66f..474c1b36dd5 100644 --- a/FirebaseInAppMessaging/Sources/Public/FirebaseInAppMessaging/FIRInAppMessaging.h +++ b/FirebaseInAppMessaging/Sources/Public/FirebaseInAppMessaging/FIRInAppMessaging.h @@ -44,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN NS_EXTENSION_UNAVAILABLE("Firebase In App Messaging is not supported for iOS extensions.") API_UNAVAILABLE(macos, watchos) -API_AVAILABLE(ios(13.0), tvos(13.0)) + NS_SWIFT_NAME(InAppMessaging) @interface FIRInAppMessaging : NSObject /** @fn inAppMessaging diff --git a/FirebaseInAppMessaging/Swift/Source/CustomInAppMessageDisplayViewModifier.swift b/FirebaseInAppMessaging/Swift/Source/CustomInAppMessageDisplayViewModifier.swift index 82811a2b27c..ab666f2daec 100644 --- a/FirebaseInAppMessaging/Swift/Source/CustomInAppMessageDisplayViewModifier.swift +++ b/FirebaseInAppMessaging/Swift/Source/CustomInAppMessageDisplayViewModifier.swift @@ -20,7 +20,6 @@ import SwiftUI // MARK: Image-only messages. -@available(iOS 13, tvOS 13, *) @available(iOSApplicationExtension, unavailable) @available(tvOSApplicationExtension, unavailable) struct ImageOnlyInAppMessageDisplayViewModifier: ViewModifier { @@ -43,7 +42,6 @@ struct ImageOnlyInAppMessageDisplayViewModifier: ViewModif } } -@available(iOS 13, tvOS 13, *) @available(iOSApplicationExtension, unavailable) @available(tvOSApplicationExtension, unavailable) public extension View { @@ -59,7 +57,6 @@ public extension View { // MARK: Banner messages. -@available(iOS 13, tvOS 13, *) @available(iOSApplicationExtension, unavailable) @available(tvOSApplicationExtension, unavailable) struct BannerInAppMessageDisplayViewModifier: ViewModifier { @@ -81,7 +78,6 @@ struct BannerInAppMessageDisplayViewModifier: ViewModifier } } -@available(iOS 13, tvOS 13, *) @available(iOSApplicationExtension, unavailable) @available(tvOSApplicationExtension, unavailable) public extension View { @@ -96,7 +92,6 @@ public extension View { // MARK: Modal messages. -@available(iOS 13, tvOS 13, *) @available(iOSApplicationExtension, unavailable) @available(tvOSApplicationExtension, unavailable) struct ModalInAppMessageDisplayViewModifier: ViewModifier { @@ -118,7 +113,6 @@ struct ModalInAppMessageDisplayViewModifier: ViewModifier } } -@available(iOS 13, tvOS 13, *) @available(iOSApplicationExtension, unavailable) @available(tvOSApplicationExtension, unavailable) public extension View { @@ -133,7 +127,6 @@ public extension View { // MARK: Card messages. -@available(iOS 13, tvOS 13, *) @available(iOSApplicationExtension, unavailable) @available(tvOSApplicationExtension, unavailable) struct CardInAppMessageDisplayViewModifier: ViewModifier { @@ -155,7 +148,6 @@ struct CardInAppMessageDisplayViewModifier: ViewModifier { } } -@available(iOS 13, tvOS 13, *) @available(iOSApplicationExtension, unavailable) @available(tvOSApplicationExtension, unavailable) public extension View { @@ -174,7 +166,6 @@ public extension View { * A singleton that acts as the bridge between view modifiers for displaying custom in-app messages and the * in-app message fetch/display/interaction flow. */ -@available(iOS 13, tvOS 13, *) @available(iOSApplicationExtension, unavailable) @available(tvOSApplicationExtension, unavailable) class DelegateBridge: NSObject, InAppMessagingDisplay, InAppMessagingDisplayDelegate, diff --git a/FirebaseInAppMessaging/Swift/Source/SwiftUIPreviewHelpers.swift b/FirebaseInAppMessaging/Swift/Source/SwiftUIPreviewHelpers.swift index 9b64490fb47..29aee60a24f 100644 --- a/FirebaseInAppMessaging/Swift/Source/SwiftUIPreviewHelpers.swift +++ b/FirebaseInAppMessaging/Swift/Source/SwiftUIPreviewHelpers.swift @@ -18,7 +18,6 @@ import UIKit @_exported import FirebaseInAppMessagingInternal #endif // SWIFT_PACKAGE -@available(iOS 13.0, tvOS 13.0, *) @available(iOSApplicationExtension, unavailable) @available(tvOSApplicationExtension, unavailable) public enum InAppMessagingPreviewHelpers { diff --git a/FirebaseInAppMessaging/Swift/Tests/Unit/FirebaseInAppMessaging_APIBuildTests.swift b/FirebaseInAppMessaging/Swift/Tests/Unit/FirebaseInAppMessaging_APIBuildTests.swift index db7393d2b44..a1b903caa44 100644 --- a/FirebaseInAppMessaging/Swift/Tests/Unit/FirebaseInAppMessaging_APIBuildTests.swift +++ b/FirebaseInAppMessaging/Swift/Tests/Unit/FirebaseInAppMessaging_APIBuildTests.swift @@ -266,7 +266,6 @@ final class FirebaseInAppMessaging_APIBuildTests: XCTestCase { _ = swiftDelegate as InAppMessagingDisplayDelegate } - @available(iOS 13, tvOS 13, *) struct MyView: View { var body: some View { Text("Hello, world!")