Fix: user interaction issue on iOS below 14
The following changes apply for iOS 13.7 and below. * Actually, a fake toolbar view is added on top of the real one, in order for subviews (the version picker and the play button) to receive user interaction properly * Tweaked Split behavior to fix another dead-locked sidebar issue * The toggle of hiding sidebar is now available
This commit is contained in:
1 parent
3ccd432412
commit
8577636a4e
4 files changed
+28
-23
No files matched your search
@@ -66,14 +66,25 @@
|
||||
self.versionTextField.inputAccessoryView = versionPickToolbar;
|
||||
self.versionTextField.inputView = self.versionPickerView;
|
||||
|
||||
[self.toolbar addSubview:self.versionTextField];
|
||||
UIView *targetToolbar;
|
||||
if (@available(iOS 14.0, *)) {
|
||||
// Use the real toolbar
|
||||
targetToolbar = self.toolbar;
|
||||
} else { // iOS 13.x and 12.x
|
||||
// Workaround user interaction issue by using a fake toolbar
|
||||
targetToolbar = [[UIView alloc] initWithFrame:self.toolbar.frame];
|
||||
targetToolbar.autoresizingMask = self.toolbar.autoresizingMask;
|
||||
[self.view addSubview:targetToolbar];
|
||||
}
|
||||
|
||||
[targetToolbar addSubview:self.versionTextField];
|
||||
|
||||
self.progressViewMain = [[UIProgressView alloc] initWithFrame:CGRectMake(0, 0, self.toolbar.frame.size.width, 4)];
|
||||
self.progressViewSub = [[UIProgressView alloc] initWithFrame:CGRectMake(0, self.toolbar.frame.size.height - 4, self.toolbar.frame.size.width, 4)];
|
||||
self.progressViewMain.autoresizingMask = self.progressViewSub.autoresizingMask = AUTORESIZE_MASKS;
|
||||
self.progressViewMain.hidden = self.progressViewSub.hidden = YES;
|
||||
[self.toolbar addSubview:self.progressViewMain];
|
||||
[self.toolbar addSubview:self.progressViewSub];
|
||||
[targetToolbar addSubview:self.progressViewMain];
|
||||
[targetToolbar addSubview:self.progressViewSub];
|
||||
|
||||
self.buttonInstall = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
setButtonPointerInteraction(self.buttonInstall);
|
||||
@@ -84,7 +95,7 @@
|
||||
self.buttonInstall.frame = CGRectMake(self.toolbar.frame.size.width * 0.8, 4, self.toolbar.frame.size.width * 0.2, self.toolbar.frame.size.height - 8);
|
||||
self.buttonInstall.tintColor = UIColor.whiteColor;
|
||||
[self.buttonInstall addTarget:self action:@selector(launchMinecraft:) forControlEvents:UIControlEventPrimaryActionTriggered];
|
||||
[self.toolbar addSubview:self.buttonInstall];
|
||||
[targetToolbar addSubview:self.buttonInstall];
|
||||
|
||||
self.progressText = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.toolbar.frame.size.width, self.toolbar.frame.size.height)];
|
||||
self.progressText.adjustsFontSizeToFitWidth = YES;
|
||||
@@ -92,7 +103,7 @@
|
||||
self.progressText.font = [self.progressText.font fontWithSize:16];
|
||||
self.progressText.textAlignment = NSTextAlignmentCenter;
|
||||
self.progressText.userInteractionEnabled = NO;
|
||||
[self.toolbar addSubview:self.progressText];
|
||||
[targetToolbar addSubview:self.progressText];
|
||||
|
||||
if ([BaseAuthenticator.current isKindOfClass:MicrosoftAuthenticator.class]) {
|
||||
// Perform token refreshment on startup
|
||||
|
||||
@@ -118,9 +118,7 @@ typedef void(^CreateView)(UITableViewCell *, NSString *, NSDictionary *);
|
||||
@"hasDetail": @YES,
|
||||
@"icon": @"sidebar.leading",
|
||||
@"type": self.typeSwitch,
|
||||
@"enableCondition": ^(BOOL enabled){
|
||||
return (UIDevice.currentDevice.systemVersion.floatValue >= 14) && whenNotInGame();
|
||||
}
|
||||
@"enableCondition": whenNotInGame
|
||||
},
|
||||
@{@"key": @"reset_warnings",
|
||||
@"icon": @"exclamationmark.triangle",
|
||||
|
||||
@@ -29,7 +29,7 @@ extern NSMutableDictionary *prefDict;
|
||||
}
|
||||
|
||||
- (void)splitViewController:(UISplitViewController *)svc willChangeToDisplayMode:(UISplitViewControllerDisplayMode)displayMode {
|
||||
if (self.preferredDisplayMode != displayMode) {
|
||||
if (self.preferredDisplayMode != displayMode && self.displayMode != UISplitViewControllerDisplayModeSecondaryOnly) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
self.preferredDisplayMode = UISplitViewControllerDisplayModeSecondaryOnly;
|
||||
});
|
||||
@@ -44,23 +44,19 @@ extern NSMutableDictionary *prefDict;
|
||||
|
||||
- (void)changeDisplayModeForSize:(CGSize)size {
|
||||
BOOL isPortrait = size.height > size.width;
|
||||
if (@available(iOS 14.0, tvOS 14.0, *)) {
|
||||
if (self.preferredDisplayMode == 0 || self.displayMode != UISplitViewControllerDisplayModeSecondaryOnly) {
|
||||
if([getPreference(@"hidden_sidebar") boolValue] == NO) {
|
||||
self.preferredDisplayMode = isPortrait ?
|
||||
if (self.preferredDisplayMode == 0 || self.displayMode != UISplitViewControllerDisplayModeSecondaryOnly) {
|
||||
if([getPreference(@"hidden_sidebar") boolValue] == NO) {
|
||||
self.preferredDisplayMode = isPortrait ?
|
||||
UISplitViewControllerDisplayModeOneOverSecondary :
|
||||
UISplitViewControllerDisplayModeOneBesideSecondary;
|
||||
} else {
|
||||
self.preferredDisplayMode = UISplitViewControllerDisplayModeSecondaryOnly;
|
||||
}
|
||||
} else {
|
||||
self.preferredDisplayMode = UISplitViewControllerDisplayModeSecondaryOnly;
|
||||
}
|
||||
}
|
||||
if (@available(iOS 14.0, tvOS 14.0, *)) {
|
||||
self.preferredSplitBehavior = isPortrait ?
|
||||
UISplitViewControllerSplitBehaviorOverlay :
|
||||
UISplitViewControllerSplitBehaviorTile;
|
||||
} else {
|
||||
if (self.preferredDisplayMode == 0 || self.displayMode != UISplitViewControllerDisplayModeSecondaryOnly) {
|
||||
self.preferredDisplayMode = UISplitViewControllerDisplayModeOneOverSecondary;
|
||||
}
|
||||
UISplitViewControllerSplitBehaviorOverlay :
|
||||
UISplitViewControllerSplitBehaviorTile;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
"preference.title.appicon-default" = "Familiar PojavLauncher light";
|
||||
"preference.title.appicon-dark" = "Familiar PojavLauncher dark";
|
||||
"preference.title.hidden_sidebar" = "Hide main menu sidebar by default";
|
||||
"preference.detail.hidden_sidebar" = "Allows you to hide the sidebar on the main menu by default and when rotating on iOS 14 and newer.";
|
||||
"preference.detail.hidden_sidebar" = "Allows you to hide the sidebar on the main menu by default and when rotating.";
|
||||
|
||||
"preference.title.reset_warnings" = "Reset all warnings";
|
||||
"preference.title.done.reset_warnings" = "All warnings have been reset.";
|
||||
|
||||
Reference in new issue
Block a user