Feature/3124 release preparation

This commit is contained in:
Frank Rotermund
2022-06-08 13:04:21 +00:00
parent 2a2b0cd134
commit 00fb1d0f01
15 changed files with 184 additions and 22 deletions
@@ -22,6 +22,7 @@
TopBannerViewController *topBannerViewController;
bool bannersInitialized;
bool isBannerVisible;
bool shouldHideBanner;
}
- (void)setTopBannerViewConstraints;
- (void)showTopBanner;
@@ -44,6 +45,7 @@
[super viewDidLoad];
bannersInitialized = FALSE;
isBannerVisible = FALSE;
shouldHideBanner = FALSE;
}
- (void)onMatrixSessionChange
@@ -70,6 +72,11 @@
- (void)setTopBannerViewConstraints
{
// get the offset in the y-coordiante so that the banner appears below the navigation bar
UIWindow *window = UIApplication.sharedApplication.windows.firstObject;
CGFloat statusBarHeight = window.safeAreaInsets.top;
CGFloat navigationBarHeight = self.navigationController.navigationBar.frame.size.height;
NSLayoutConstraint *alignTopConstraint = [NSLayoutConstraint
constraintWithItem:topBannerViewController.view
attribute:NSLayoutAttributeTop
@@ -77,7 +84,7 @@
toItem:self.view
attribute:NSLayoutAttributeTop
multiplier:1.0
constant:0];
constant:statusBarHeight + navigationBarHeight];
[[self view] addConstraint:alignTopConstraint];
NSLayoutConstraint *alignLeadingConstraint = [NSLayoutConstraint
@@ -134,6 +141,11 @@
[self->topBannerViewController removeAdvertiseViewControllers];
}];
// this notification will be called either if the user clicked on the banner or wants to hide it using a swipe gesture
[[NSNotificationCenter defaultCenter] addObserverForName:@"de.bwi.messenger.mark_top_banner_as_read" object:NULL queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) {
shouldHideBanner = TRUE;
}];
self->bannersInitialized = TRUE;
if( [BuildSettings showTopBanner] ) {
@@ -146,7 +158,7 @@
- (void)showTopBanner
{
if( isBannerVisible ) {
if( isBannerVisible || shouldHideBanner) {
return; // nothing to do because the banner is already visible for the user
}