Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIAM] Cleanup compilation guards for building on older SDKs #12937

Merged
merged 2 commits into from
May 10, 2024
Merged
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 @@ -95,14 +95,12 @@ - (instancetype)initWithExpireAfterInSeconds:(NSInteger)expireInSeconds
selector:@selector(appWillBecomeInactive:)
name:UIApplicationWillResignActiveNotification
object:nil];
#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
if (@available(iOS 13.0, tvOS 13.0, *)) {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(appWillBecomeInactive:)
name:UISceneWillDeactivateNotification
object:nil];
}
#endif // defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000

@try {
[self loadFromCachePath:cachePath];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,12 @@ - (instancetype)initWithRequestSender:(FIRIAMClearcutHttpRequestSender *)request
selector:@selector(scheduleNextSendFromForeground:)
name:UIApplicationWillEnterForegroundNotification
object:nil];
#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
if (@available(iOS 13.0, tvOS 13.0, *)) {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(scheduleNextSendFromForeground:)
name:UISceneWillEnterForegroundNotification
object:nil];
}
#endif // defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
_userDefaults = userDefaults ? userDefaults : [GULUserDefaults standardUserDefaults];
// it would be 0 if it does not exist, which is equvilent to saying that
// you can send now
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,14 @@ - (void)viewDidLoad {

// Calculate status bar height.
CGFloat statusBarHeight = 0;
#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
if (@available(iOS 13.0, tvOS 13.0, *)) {
UIStatusBarManager *manager =
[UIApplication sharedApplication].keyWindow.windowScene.statusBarManager;

statusBarHeight = manager.statusBarFrame.size.height;
} else {
#endif
statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height;
#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
}
#endif

// Pin title label below status bar with cushion.
[[self.titleLabel.topAnchor constraintEqualToAnchor:self.view.topAnchor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ - (void)viewDidLoad {
selector:@selector(appDidBecomeActive:)
name:UIApplicationDidBecomeActiveNotification
object:nil];
#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
if (@available(iOS 13.0, tvOS 13.0, *)) {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(appWillBecomeInactive:)
Expand All @@ -67,7 +66,6 @@ - (void)viewDidLoad {
name:UISceneDidActivateNotification
object:nil];
}
#endif // defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
self.aggregateImpressionTimeInSeconds = 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,11 @@ + (UIWindow *)windowForBlockingView {
static dispatch_once_t onceToken;

dispatch_once(&onceToken, ^{
#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
if (@available(iOS 13.0, tvOS 13.0, *)) {
UIWindowForModal = [[self class] iOS13PlusWindow];
} else {
#endif // defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
UIWindowForModal = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
}
#endif // defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
UIWindowForModal.windowLevel = UIWindowLevelNormal;
});
return UIWindowForModal;
Expand All @@ -47,23 +43,18 @@ + (UIWindow *)windowForNonBlockingView {
static dispatch_once_t onceToken;

dispatch_once(&onceToken, ^{
#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
if (@available(iOS 13.0, tvOS 13.0, *)) {
UIWindowForBanner = [[self class] iOS13PlusBannerWindow];
} else {
#endif // defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
UIWindowForBanner =
[[FIRIAMBannerViewUIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
}
#endif
UIWindowForBanner.windowLevel = UIWindowLevelNormal;
});

return UIWindowForBanner;
}

#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
+ (UIWindow *)iOS13PlusWindow API_AVAILABLE(ios(13.0)) {
UIWindowScene *foregroundedScene = [[UIApplication sharedApplication] fir_foregroundWindowScene];
if (foregroundedScene.delegate) {
Expand All @@ -82,7 +73,6 @@ + (FIRIAMBannerViewUIWindow *)iOS13PlusBannerWindow API_AVAILABLE(ios(13.0)) {
}
}

#endif
@end

#endif // TARGET_OS_IOS
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,7 @@ - (void)viewDidLayoutSubviews {
CGFloat maxImageViewHeight = self.view.window.frame.size.height - minimalMargine * 2;

// Factor in space for the top notch on iPhone X*.
#if defined(__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
if (@available(iOS 11.0, *)) {
maxImageViewHeight -= self.view.safeAreaInsets.top;
}
#endif // defined(__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
maxImageViewHeight -= self.view.safeAreaInsets.top;

CGFloat adjustedImageViewHeight = self.imageOriginalSize.height;
CGFloat adjustedImageViewWidth = self.imageOriginalSize.width;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,7 @@ - (void)layoutFineTuneInPortraitMode {
TopBottomPaddingAroundMsgCard * 2;

// Factor in space for the top notch on iPhone X*.
#if defined(__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
if (@available(iOS 11.0, *)) {
heightCalcReference -= self.view.safeAreaInsets.top;
}
#endif // defined(__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
heightCalcReference -= self.view.safeAreaInsets.top;
}

FIRLogDebug(kFIRLoggerInAppMessagingDisplay, @"I-FID300004",
Expand Down
2 changes: 0 additions & 2 deletions FirebaseInAppMessaging/Sources/Flows/FIRIAMActivityLogger.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,12 @@ - (instancetype)initWithMaxCountBeforeReduce:(NSInteger)maxBeforeReduce
selector:@selector(appWillBecomeInactive:)
name:UIApplicationWillResignActiveNotification
object:nil];
#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
if (@available(iOS 13.0, tvOS 13.0, *)) {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(appWillBecomeInactive:)
name:UISceneWillDeactivateNotification
object:nil];
}
#endif // defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
if (loadFromCache) {
@try {
[self loadFromCachePath:nil];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@ - (void)start {
selector:@selector(checkAndDisplayNextAppForegroundMessageFromForeground:)
name:UIApplicationWillEnterForegroundNotification
object:nil];
#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
if (@available(iOS 13.0, tvOS 13.0, *)) {
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(checkAndDisplayNextAppForegroundMessageFromForeground:)
name:UISceneWillEnterForegroundNotification
object:nil];
}
#endif // defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
}

- (void)checkAndDisplayNextAppForegroundMessageFromForeground:(NSNotification *)notification {
Expand Down
6 changes: 2 additions & 4 deletions FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayExecutor.m
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@ - (void)displayMessageLoadError:(NSError *)error {
[alert addAction:defaultAction];

dispatch_async(dispatch_get_main_queue(), ^{
#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
if (@available(iOS 13.0, tvOS 13.0, *)) {
UIWindowScene *foregroundedScene =
[[UIApplication sharedApplication] fir_foregroundWindowScene];
Expand All @@ -364,10 +363,9 @@ - (void)displayMessageLoadError:(NSError *)error {
return;
}
self.alertWindow = [[UIWindow alloc] initWithWindowScene:foregroundedScene];
} else {
self.alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
ncooke3 marked this conversation as resolved.
Show resolved Hide resolved
}
#else // defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
self.alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
#endif
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,14 +29,12 @@ - (void)start {
selector:@selector(appWillEnterForeground:)
name:UIApplicationWillEnterForegroundNotification
object:nil];
#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
if (@available(iOS 13.0, tvOS 13.0, *)) {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(appWillEnterForeground:)
name:UISceneWillEnterForegroundNotification
object:nil];
}
#endif // defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
}

- (void)appWillEnterForeground:(NSNotification *)notification {
Expand Down
Loading