mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-25 19:10:49 +02:00
Feature/3124 release preparation
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user