mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-22 01:22:46 +02:00
Merge pull request #3603 from vector-im/reduce_warnings
Reduce Xcode warnings
This commit is contained in:
@@ -146,51 +146,9 @@
|
||||
|
||||
memberTitleView = [RoomMemberTitleView roomMemberTitleView];
|
||||
memberTitleView.delegate = self;
|
||||
|
||||
if (@available(iOS 11.0, *))
|
||||
{
|
||||
// Define directly the navigation titleView with the custom title view instance. Do not use anymore a container.
|
||||
self.navigationItem.titleView = memberTitleView;
|
||||
}
|
||||
else
|
||||
{
|
||||
self.navigationItem.titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 600, 40)];
|
||||
|
||||
// Add the title view and define edge constraints
|
||||
memberTitleView.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
[self.navigationItem.titleView addSubview:memberTitleView];
|
||||
|
||||
NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:memberTitleView
|
||||
attribute:NSLayoutAttributeTop
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.navigationItem.titleView
|
||||
attribute:NSLayoutAttributeTop
|
||||
multiplier:1.0f
|
||||
constant:0.0f];
|
||||
NSLayoutConstraint *bottomConstraint = [NSLayoutConstraint constraintWithItem:memberTitleView
|
||||
attribute:NSLayoutAttributeBottom
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.navigationItem.titleView
|
||||
attribute:NSLayoutAttributeBottom
|
||||
multiplier:1.0f
|
||||
constant:0.0f];
|
||||
NSLayoutConstraint *leadingConstraint = [NSLayoutConstraint constraintWithItem:memberTitleView
|
||||
attribute:NSLayoutAttributeLeading
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.navigationItem.titleView
|
||||
attribute:NSLayoutAttributeLeading
|
||||
multiplier:1.0f
|
||||
constant:0.0f];
|
||||
NSLayoutConstraint *trailingConstraint = [NSLayoutConstraint constraintWithItem:memberTitleView
|
||||
attribute:NSLayoutAttributeTrailing
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.navigationItem.titleView
|
||||
attribute:NSLayoutAttributeTrailing
|
||||
multiplier:1.0f
|
||||
constant:0.0f];
|
||||
|
||||
[NSLayoutConstraint activateConstraints:@[topConstraint, bottomConstraint, leadingConstraint, trailingConstraint]];
|
||||
}
|
||||
// Define directly the navigation titleView with the custom title view instance. Do not use anymore a container.
|
||||
self.navigationItem.titleView = memberTitleView;
|
||||
|
||||
// Add tap gesture on member's name
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)];
|
||||
|
||||
@@ -40,54 +40,26 @@
|
||||
|
||||
if (self.superview)
|
||||
{
|
||||
if (@available(iOS 11.0, *))
|
||||
{
|
||||
// Force the title view layout by adding 2 new constraints on the UINavigationBarContentView instance.
|
||||
NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:self
|
||||
attribute:NSLayoutAttributeTop
|
||||
// Force the title view layout by adding 2 new constraints on the UINavigationBarContentView instance.
|
||||
NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:self
|
||||
attribute:NSLayoutAttributeTop
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.superview
|
||||
attribute:NSLayoutAttributeTop
|
||||
multiplier:1.0f
|
||||
constant:0.0f];
|
||||
NSLayoutConstraint *centerXConstraint = [NSLayoutConstraint constraintWithItem:self
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.superview
|
||||
attribute:NSLayoutAttributeTop
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
multiplier:1.0f
|
||||
constant:0.0f];
|
||||
NSLayoutConstraint *centerXConstraint = [NSLayoutConstraint constraintWithItem:self
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.superview
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
multiplier:1.0f
|
||||
constant:0.0f];
|
||||
|
||||
[NSLayoutConstraint activateConstraints:@[topConstraint, centerXConstraint]];
|
||||
|
||||
// Do not crop the avatar
|
||||
self.superview.clipsToBounds = NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Center horizontally the avatar into the navigation bar
|
||||
CGRect frame = self.superview.frame;
|
||||
UINavigationBar *navigationBar;
|
||||
UIView *superView = self;
|
||||
while (superView.superview)
|
||||
{
|
||||
if ([superView.superview isKindOfClass:[UINavigationBar class]])
|
||||
{
|
||||
navigationBar = (UINavigationBar*)superView.superview;
|
||||
break;
|
||||
}
|
||||
|
||||
superView = superView.superview;
|
||||
}
|
||||
|
||||
if (navigationBar)
|
||||
{
|
||||
CGSize navBarSize = navigationBar.frame.size;
|
||||
CGFloat superviewCenterX = frame.origin.x + (frame.size.width / 2);
|
||||
|
||||
self.memberAvatarMaskCenterXConstraint.constant = (navBarSize.width / 2) - superviewCenterX;
|
||||
}
|
||||
}
|
||||
|
||||
[NSLayoutConstraint activateConstraints:@[topConstraint, centerXConstraint]];
|
||||
|
||||
// Do not crop the avatar
|
||||
self.superview.clipsToBounds = NO;
|
||||
}
|
||||
|
||||
if (_delegate && [_delegate respondsToSelector:@selector(roomMemberTitleViewDidLayoutSubview:)])
|
||||
|
||||
@@ -4438,15 +4438,13 @@
|
||||
|
||||
if ([self.roomDataSource.mxSession.syncError.errcode isEqualToString:kMXErrCodeStringResourceLimitExceeded])
|
||||
{
|
||||
[roomActivitiesView showResourceLimitExceededError:self.roomDataSource.mxSession.syncError.userInfo onAdminContactTapped:^(NSURL *adminContact) {
|
||||
if ([[UIApplication sharedApplication] canOpenURL:adminContact])
|
||||
{
|
||||
[[UIApplication sharedApplication] openURL:adminContact];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"[RoomVC] refreshActivitiesViewDisplay: adminContact(%@) cannot be opened", adminContact);
|
||||
}
|
||||
[roomActivitiesView showResourceLimitExceededError:self.roomDataSource.mxSession.syncError.userInfo onAdminContactTapped:^(NSURL *adminContactURL) {
|
||||
[[UIApplication sharedApplication] vc_open:adminContactURL completionHandler:^(BOOL success) {
|
||||
if (!success)
|
||||
{
|
||||
NSLog(@"[RoomVC] refreshActivitiesViewDisplay: adminContact(%@) cannot be opened", adminContactURL);
|
||||
}
|
||||
}];
|
||||
}];
|
||||
}
|
||||
else if ([AppDelegate theDelegate].isOffline)
|
||||
@@ -4613,16 +4611,13 @@
|
||||
}
|
||||
else if (serverNotices.usageLimit && serverNotices.usageLimit.isServerNoticeUsageLimit)
|
||||
{
|
||||
[roomActivitiesView showResourceUsageLimitNotice:serverNotices.usageLimit onAdminContactTapped:^(NSURL *adminContact) {
|
||||
|
||||
if ([[UIApplication sharedApplication] canOpenURL:adminContact])
|
||||
{
|
||||
[[UIApplication sharedApplication] openURL:adminContact];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"[RoomVC] refreshActivitiesViewDisplay: adminContact(%@) cannot be opened", adminContact);
|
||||
}
|
||||
[roomActivitiesView showResourceUsageLimitNotice:serverNotices.usageLimit onAdminContactTapped:^(NSURL *adminContactURL) {
|
||||
[[UIApplication sharedApplication] vc_open:adminContactURL completionHandler:^(BOOL success) {
|
||||
if (!success)
|
||||
{
|
||||
NSLog(@"[RoomVC] refreshActivitiesViewDisplay: adminContact(%@) cannot be opened", adminContactURL);
|
||||
}
|
||||
}];
|
||||
}];
|
||||
}
|
||||
else
|
||||
|
||||
@@ -40,54 +40,26 @@
|
||||
|
||||
if (self.superview)
|
||||
{
|
||||
if (@available(iOS 11.0, *))
|
||||
{
|
||||
// Force the title view layout by adding 2 new constraints on the UINavigationBarContentView instance.
|
||||
NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:self
|
||||
attribute:NSLayoutAttributeTop
|
||||
// Force the title view layout by adding 2 new constraints on the UINavigationBarContentView instance.
|
||||
NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:self
|
||||
attribute:NSLayoutAttributeTop
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.superview
|
||||
attribute:NSLayoutAttributeTop
|
||||
multiplier:1.0f
|
||||
constant:0.0f];
|
||||
NSLayoutConstraint *centerXConstraint = [NSLayoutConstraint constraintWithItem:self
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.superview
|
||||
attribute:NSLayoutAttributeTop
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
multiplier:1.0f
|
||||
constant:0.0f];
|
||||
NSLayoutConstraint *centerXConstraint = [NSLayoutConstraint constraintWithItem:self
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.superview
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
multiplier:1.0f
|
||||
constant:0.0f];
|
||||
|
||||
[NSLayoutConstraint activateConstraints:@[topConstraint, centerXConstraint]];
|
||||
|
||||
// Do not crop the avatar
|
||||
self.superview.clipsToBounds = NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Center horizontally the avatar into the navigation bar
|
||||
CGRect frame = self.superview.frame;
|
||||
UINavigationBar *navigationBar;
|
||||
UIView *superView = self;
|
||||
while (superView.superview)
|
||||
{
|
||||
if ([superView.superview isKindOfClass:[UINavigationBar class]])
|
||||
{
|
||||
navigationBar = (UINavigationBar*)superView.superview;
|
||||
break;
|
||||
}
|
||||
|
||||
superView = superView.superview;
|
||||
}
|
||||
|
||||
if (navigationBar)
|
||||
{
|
||||
CGSize navBarSize = navigationBar.frame.size;
|
||||
CGFloat superviewCenterX = frame.origin.x + (frame.size.width / 2);
|
||||
|
||||
self.roomAvatarMaskCenterXConstraint.constant = (navBarSize.width / 2) - superviewCenterX;
|
||||
}
|
||||
}
|
||||
|
||||
[NSLayoutConstraint activateConstraints:@[topConstraint, centerXConstraint]];
|
||||
|
||||
// Do not crop the avatar
|
||||
self.superview.clipsToBounds = NO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,59 +78,23 @@
|
||||
|
||||
if (self.superview)
|
||||
{
|
||||
if (@available(iOS 11.0, *))
|
||||
{
|
||||
// Force the title view layout by adding 2 new constraints on the UINavigationBarContentView instance.
|
||||
NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:self
|
||||
attribute:NSLayoutAttributeTop
|
||||
// Force the title view layout by adding 2 new constraints on the UINavigationBarContentView instance.
|
||||
NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:self
|
||||
attribute:NSLayoutAttributeTop
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.superview
|
||||
attribute:NSLayoutAttributeTop
|
||||
multiplier:1.0f
|
||||
constant:0.0f];
|
||||
NSLayoutConstraint *centerXConstraint = [NSLayoutConstraint constraintWithItem:self
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.superview
|
||||
attribute:NSLayoutAttributeTop
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
multiplier:1.0f
|
||||
constant:0.0f];
|
||||
NSLayoutConstraint *centerXConstraint = [NSLayoutConstraint constraintWithItem:self
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.superview
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
multiplier:1.0f
|
||||
constant:0.0f];
|
||||
|
||||
[NSLayoutConstraint activateConstraints:@[topConstraint, centerXConstraint]];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Center horizontally the display name into the navigation bar
|
||||
CGRect frame = self.superview.frame;
|
||||
|
||||
// Look for the navigation bar.
|
||||
UINavigationBar *navigationBar;
|
||||
UIView *superView = self;
|
||||
while (superView.superview)
|
||||
{
|
||||
if ([superView.superview isKindOfClass:[UINavigationBar class]])
|
||||
{
|
||||
navigationBar = (UINavigationBar*)superView.superview;
|
||||
break;
|
||||
}
|
||||
|
||||
superView = superView.superview;
|
||||
}
|
||||
|
||||
if (navigationBar)
|
||||
{
|
||||
CGSize navBarSize = navigationBar.frame.size;
|
||||
CGFloat superviewCenterX = frame.origin.x + (frame.size.width / 2);
|
||||
|
||||
// Check whether the view is not moving away (see navigation between view controllers).
|
||||
if (superviewCenterX < navBarSize.width)
|
||||
{
|
||||
// Center the display name
|
||||
self.displayNameCenterXConstraint.constant = (navBarSize.width / 2) - superviewCenterX;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[NSLayoutConstraint activateConstraints:@[topConstraint, centerXConstraint]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,52 +38,23 @@
|
||||
|
||||
if (self.superview)
|
||||
{
|
||||
if (@available(iOS 11.0, *))
|
||||
{
|
||||
// Force the title view layout by adding 2 new constraints on the UINavigationBarContentView instance.
|
||||
NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:self
|
||||
attribute:NSLayoutAttributeTop
|
||||
// Force the title view layout by adding 2 new constraints on the UINavigationBarContentView instance.
|
||||
NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:self
|
||||
attribute:NSLayoutAttributeTop
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.superview
|
||||
attribute:NSLayoutAttributeTop
|
||||
multiplier:1.0f
|
||||
constant:0.0f];
|
||||
NSLayoutConstraint *centerXConstraint = [NSLayoutConstraint constraintWithItem:self
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.superview
|
||||
attribute:NSLayoutAttributeTop
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
multiplier:1.0f
|
||||
constant:0.0f];
|
||||
NSLayoutConstraint *centerXConstraint = [NSLayoutConstraint constraintWithItem:self
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.superview
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
multiplier:1.0f
|
||||
constant:0.0f];
|
||||
|
||||
[NSLayoutConstraint activateConstraints:@[topConstraint, centerXConstraint]];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Center horizontally the display name into the navigation bar
|
||||
CGRect frame = self.superview.frame;
|
||||
UINavigationBar *navigationBar;
|
||||
UIView *superView = self;
|
||||
while (superView.superview)
|
||||
{
|
||||
if ([superView.superview isKindOfClass:[UINavigationBar class]])
|
||||
{
|
||||
navigationBar = (UINavigationBar*)superView.superview;
|
||||
break;
|
||||
}
|
||||
|
||||
superView = superView.superview;
|
||||
}
|
||||
|
||||
if (navigationBar)
|
||||
{
|
||||
CGSize navBarSize = navigationBar.frame.size;
|
||||
CGFloat superviewCenterX = frame.origin.x + (frame.size.width / 2);
|
||||
|
||||
// Center the display name
|
||||
self.displayNameCenterXConstraint.constant = (navBarSize.width / 2) - superviewCenterX;
|
||||
}
|
||||
}
|
||||
|
||||
[NSLayoutConstraint activateConstraints:@[topConstraint, centerXConstraint]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user