Skip to content

Commit

Permalink
replace the drawer drop shadows with a solid line as iOS 13 broke the…
Browse files Browse the repository at this point in the history
… layer shadows API on some devices
  • Loading branch information
c99koder committed Nov 19, 2019
1 parent c686601 commit 9230eb1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions IRCCloud/Classes/MainViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
BOOL _ignoreVisibilityChanges;
BOOL _ignoreInsetChanges;
NSString *_msgid;
UIView *_leftBorder, *_rightBorder;
}
@property (nonatomic) int cidToOpen;
@property (nonatomic) int bidToOpen;
Expand Down
23 changes: 17 additions & 6 deletions IRCCloud/Classes/MainViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ - (void)applyTheme {
self->_eventsView.topUnreadArrow.textColor = self->_eventsView.bottomUnreadArrow.textColor = [UIColor chatterBarTextColor];
[self->_eventsView clearRowCache];

self->_borders.backgroundColor = [UIColor iPadBordersColor];
self->_borders.backgroundColor = _leftBorder.backgroundColor = _rightBorder.backgroundColor = [UIColor iPadBordersColor];
[[self->_borders.subviews objectAtIndex:0] setBackgroundColor:[UIColor contentBackgroundColor]];

self->_eventActivity.activityIndicatorViewStyle = self->_headerActivity.activityIndicatorViewStyle = [UIColor activityIndicatorViewStyle];
Expand Down Expand Up @@ -453,10 +453,6 @@ - (void)viewDidLoad {
self.slidingViewController.underLeftWidthLayout = ECFixedRevealWidth;
self.slidingViewController.underRightWidthLayout = ECFixedRevealWidth;

self.navigationController.view.layer.shadowOpacity = 0.75f;
self.navigationController.view.layer.shadowRadius = 2.0f;
self.navigationController.view.layer.shadowColor = [UIColor blackColor].CGColor;

self->_menuBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[self->_menuBtn setImage:[[UIImage imageNamed:@"menu"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] forState:UIControlStateNormal];
[self->_menuBtn addTarget:self action:@selector(listButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
Expand Down Expand Up @@ -534,6 +530,14 @@ - (void)viewDidLoad {
if (@available(iOS 11, *)) {
[self.view addInteraction:[[UIDropInteraction alloc] initWithDelegate:self]];
}

_leftBorder = [[UIView alloc] init];
_leftBorder.backgroundColor = [UIColor iPadBordersColor];
[self.navigationController.view addSubview:_leftBorder];
_rightBorder = [[UIView alloc] init];
_rightBorder.backgroundColor = [UIColor iPadBordersColor];
[self.navigationController.view addSubview:_rightBorder];
self.navigationController.view.clipsToBounds = NO;
}

-(BOOL)dropInteraction:(UIDropInteraction *)interaction canHandleSession:(id<UIDropSession>)session __attribute__((availability(ios,introduced=11))) {
Expand Down Expand Up @@ -3369,7 +3373,10 @@ -(void)transitionToSize:(CGSize)size {
UIView *v = self.navigationItem.titleView;
self.navigationItem.titleView = nil;
self.navigationItem.titleView = v;
self.navigationController.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.slidingViewController.view.layer.bounds].CGPath;
self.navigationController.view.layer.shadowPath = nil;

_leftBorder.frame = CGRectMake(-1,0,1,size.height);
_rightBorder.frame = CGRectMake(size.width + 1,0,1,size.height);

_ignoreInsetChanges = NO;
[self _updateEventsInsets];
Expand Down Expand Up @@ -3558,6 +3565,10 @@ -(void)_updateUserListVisibility {
self->_eventsViewWidthConstraint.constant += self.slidingViewController.view.safeAreaInsets.right;
self->_eventsViewOffsetXConstraint.constant += self.slidingViewController.view.safeAreaInsets.right / 2;
}
if(self.slidingViewController.underRightViewController) {
self->_eventsViewWidthConstraint.constant++;
self->_eventsViewOffsetXConstraint.constant++;
}
}
} else {
if(self->_msgid) {
Expand Down

0 comments on commit 9230eb1

Please sign in to comment.