Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@interface FIRIAMBannerViewController : FIRIAMBaseRenderingViewController
+ (FIRIAMBannerViewController *)
instantiateViewControllerWithResourceBundle:(NSBundle *)resourceBundle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@interface FIRIAMDefaultDisplayImpl : NSObject <FIRInAppMessagingDisplay>

/// Conforms to display delegate for rendering of in-app messages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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];
Expand All @@ -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];
Expand Down
10 changes: 4 additions & 6 deletions FirebaseInAppMessaging/Sources/Flows/FIRIAMActivityLogger.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
16 changes: 5 additions & 11 deletions FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayExecutor.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@interface FIRIAMDisplayCheckOnAnalyticEventsFlow : FIRIAMDisplayCheckTriggerFlow
@end
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@interface FIRIAMDisplayExecutor : NSObject

- (instancetype)initWithInAppMessaging:(FIRInAppMessaging *)inAppMessaging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@interface FIRIAMMessageClientCache : NSObject

// used to inform the analytics event display check flow about whether it should start/stop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@interface FIRIAMRuntimeManager : NSObject
@property(nonatomic, nonnull) FIRIAMSDKSettings *currentSetting;
@property(nonatomic, nonnull) FIRIAMActivityLogger *activityLogger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

NS_SWIFT_NAME(InAppMessaging)
@interface FIRInAppMessaging : NSObject
/** @fn inAppMessaging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import SwiftUI

// MARK: Image-only messages.

@available(iOS 13, tvOS 13, *)
@available(iOSApplicationExtension, unavailable)
@available(tvOSApplicationExtension, unavailable)
struct ImageOnlyInAppMessageDisplayViewModifier<DisplayMessage: View>: ViewModifier {
Expand All @@ -43,7 +42,6 @@ struct ImageOnlyInAppMessageDisplayViewModifier<DisplayMessage: View>: ViewModif
}
}

@available(iOS 13, tvOS 13, *)
@available(iOSApplicationExtension, unavailable)
@available(tvOSApplicationExtension, unavailable)
public extension View {
Expand All @@ -59,7 +57,6 @@ public extension View {

// MARK: Banner messages.

@available(iOS 13, tvOS 13, *)
@available(iOSApplicationExtension, unavailable)
@available(tvOSApplicationExtension, unavailable)
struct BannerInAppMessageDisplayViewModifier<DisplayMessage: View>: ViewModifier {
Expand All @@ -81,7 +78,6 @@ struct BannerInAppMessageDisplayViewModifier<DisplayMessage: View>: ViewModifier
}
}

@available(iOS 13, tvOS 13, *)
@available(iOSApplicationExtension, unavailable)
@available(tvOSApplicationExtension, unavailable)
public extension View {
Expand All @@ -96,7 +92,6 @@ public extension View {

// MARK: Modal messages.

@available(iOS 13, tvOS 13, *)
@available(iOSApplicationExtension, unavailable)
@available(tvOSApplicationExtension, unavailable)
struct ModalInAppMessageDisplayViewModifier<DisplayMessage: View>: ViewModifier {
Expand All @@ -118,7 +113,6 @@ struct ModalInAppMessageDisplayViewModifier<DisplayMessage: View>: ViewModifier
}
}

@available(iOS 13, tvOS 13, *)
@available(iOSApplicationExtension, unavailable)
@available(tvOSApplicationExtension, unavailable)
public extension View {
Expand All @@ -133,7 +127,6 @@ public extension View {

// MARK: Card messages.

@available(iOS 13, tvOS 13, *)
@available(iOSApplicationExtension, unavailable)
@available(tvOSApplicationExtension, unavailable)
struct CardInAppMessageDisplayViewModifier<DisplayMessage: View>: ViewModifier {
Expand All @@ -155,7 +148,6 @@ struct CardInAppMessageDisplayViewModifier<DisplayMessage: View>: ViewModifier {
}
}

@available(iOS 13, tvOS 13, *)
@available(iOSApplicationExtension, unavailable)
@available(tvOSApplicationExtension, unavailable)
public extension View {
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!")
Expand Down
Loading