Skip to content

Commit

Permalink
🐛 fix crashes when used with shuffle inset table
Browse files Browse the repository at this point in the history
  • Loading branch information
semvis123 committed Aug 15, 2021
1 parent 9fe0f93 commit 305b1c0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions Preferences/PackageNameHeaderCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,19 @@

@implementation PackageNameHeaderCell
- (void)setFrame:(CGRect)frame {
CGFloat contentOffset = ((UIScrollView *)[self.superview valueForKey:@"scrollView"]).contentOffset.y;
UINavigationBar *navigationBar = ((SPBRootListController *)[self.superview.superview valueForKey:@"viewDelegate"]).navigationController.navigationController.navigationBar;
frame.origin.y = 0;
frame.origin.x = 0;
CGFloat contentOffset;
UINavigationBar *navigationBar;
// fix for Shuffle inset Tables setting
if ([NSStringFromClass([self.superview class]) isEqualToString:@"UITableViewWrapperView"])
{
contentOffset = ((UIScrollView *)[self.superview.superview valueForKey:@"scrollView"]).contentOffset.y;
navigationBar = ((SPBRootListController *)[self.superview.superview.superview valueForKey:@"viewDelegate"]).navigationController.navigationController.navigationBar;
} else {
contentOffset = ((UIScrollView *)[self.superview valueForKey:@"scrollView"]).contentOffset.y;
navigationBar = ((SPBRootListController *)[self.superview.superview valueForKey:@"viewDelegate"]).navigationController.navigationController.navigationBar;
}
CGFloat navBarCompensation = navigationBar.frame.size.height + navigationBar.frame.origin.y;
CGFloat sum = navBarCompensation + contentOffset;
if (sum < 0) {
Expand Down
2 changes: 1 addition & 1 deletion control
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: com.semvis.sonitus
Name: Sonitus
Version: 1.0.0
Version: 1.0.1
Architecture: iphoneos-arm
Description: Sonitus, bring the noise cancellation control of your headphones to the built-in iOS menu.
Maintainer: Sem Visscher
Expand Down

0 comments on commit 305b1c0

Please sign in to comment.