Skip to content

Commit

Permalink
Port hidden sidebar stuffs from 2.1.1 branch
Browse files Browse the repository at this point in the history
As well as add a new preference to enable hiding by default and when rotating for iOS 14 and newer.
  • Loading branch information
crystall1nedev committed Dec 18, 2022
1 parent 849c1a2 commit fe38eac
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 11 deletions.
3 changes: 2 additions & 1 deletion Natives/LauncherPreferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ void loadPreferences(BOOL reset) {
setDefaultValueForPref(prefDict, @"check_sha", @YES);
setDefaultValueForPref(prefDict, @"auto_ram", @(!getEntitlementValue(@"com.apple.private.memorystatus")));
setDefaultValueForPref(prefDict, @"unsupported_warn_counter", @(0));

setDefaultValueForPref(prefDict, @"hidden_siderbar", @NO);

// Debug settings
setDefaultValueForPref(debugPrefDict, @"debug_skip_wait_jit", @NO);
setDefaultValueForPref(debugPrefDict, @"debug_hide_home_indicator", @NO);
Expand Down
12 changes: 10 additions & 2 deletions Natives/LauncherPreferencesViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,18 @@ - (void)viewDidLoad
@"AppIcon-Dark"
],
@"pickList": @[
localize(@"preference.title.appicon-default", nil),
localize(@"preference.title.appicon-dark", nil)
localize(@"preference.title.appicon-default", nil),
localize(@"preference.title.appicon-dark", nil)
]
},
@{@"key": @"hidden_sidebar",
@"hasDetail": @YES,
@"icon": @"sidebar.leading",
@"type": self.typeSwitch,
@"enableCondition": ^(BOOL enabled){
return (UIDevice.currentDevice.systemVersion.floatValue >= 14) && whenNotInGame();
}
},
@{@"key": @"reset_warnings",
@"icon": @"exclamationmark.triangle",
@"type": self.typeButton,
Expand Down
22 changes: 15 additions & 7 deletions Natives/LauncherSplitViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,23 @@ - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIVi

- (void)changeDisplayModeForSize:(CGSize)size {
BOOL isPortrait = size.height > size.width;
if (self.preferredDisplayMode == 0 || self.displayMode != UISplitViewControllerDisplayModeSecondaryOnly) {
self.preferredDisplayMode = isPortrait ?
UISplitViewControllerDisplayModeOneOverSecondary :
UISplitViewControllerDisplayModeOneBesideSecondary;
}
if (@available(iOS 14.0, tvOS 14.0, *)) {
if (self.preferredDisplayMode == 0 || self.displayMode != UISplitViewControllerDisplayModeSecondaryOnly) {
if([getPreference(@"hidden_sidebar") boolValue]) {
self.preferredDisplayMode = isPortrait ?
UISplitViewControllerDisplayModeOneOverSecondary :
UISplitViewControllerDisplayModeOneBesideSecondary;
} else {
self.preferredDisplayMode = UISplitViewControllerDisplayModeOneOverSecondary;
}
}
self.preferredSplitBehavior = isPortrait ?
UISplitViewControllerSplitBehaviorOverlay :
UISplitViewControllerSplitBehaviorTile;
UISplitViewControllerSplitBehaviorOverlay :
UISplitViewControllerSplitBehaviorTile;
} else {
if (self.preferredDisplayMode == 0 || self.displayMode != UISplitViewControllerDisplayModeSecondaryOnly) {
self.preferredDisplayMode = UISplitViewControllerDisplayModeOneOverSecondary;
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion Natives/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,12 @@
"preference.detail.debug_logging" = "Logs internal settings and actions to latestlog.txt. This helps the developers find issues easier, but Minecraft may run slower as the logs will be written to more often.";
"preference.title.jitstreamer_server" = "JitStreamer server IP";
"preference.detail.jitstreamer_server" = "Allows you to change to a custom JitStreamer server IP, such as for self-hosted instances. This option can be left alone if you use the default JitStreamer servers.";

"preference.title.appicon" = "Set app icon";
"preference.detail.appicon" = "Allows you to choose between different Home Screen icons for PojavLauncher.";
"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.title.reset_warnings" = "Reset all warnings";
"preference.title.done.reset_warnings" = "All warnings have been reset.";
Expand Down
Binary file modified Natives/resources/Assets.car
Binary file not shown.

0 comments on commit fe38eac

Please sign in to comment.