Skip to content

Commit

Permalink
Feat: notify TS user to enable URL Scheme for JIT
Browse files Browse the repository at this point in the history
  • Loading branch information
khanhduytran0 committed Apr 9, 2024
1 parent f7163ce commit 73e35f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Natives/LauncherNavigationController.m
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,15 @@ - (void)receiveNotification:(NSNotification *)notification {

- (void)invokeAfterJITEnabled:(void(^)(void))handler {
localVersionList = remoteVersionList = nil;
BOOL hasTrollStoreJIT = getEntitlementValue(@"com.apple.private.local.sandboxed-jit");

if (isJITEnabled(false)) {
dispatch_async(dispatch_get_main_queue(), ^{
[ALTServerManager.sharedManager stopDiscovering];
handler();
});
return;
} else if (getEntitlementValue(@"com.apple.private.local.sandboxed-jit")) {
} else if (hasTrollStoreJIT) {
NSURL *jitURL = [NSURL URLWithString:[NSString stringWithFormat:@"apple-magnifier://enable-jit?bundle-id=%@", NSBundle.mainBundle.bundleIdentifier]];
[UIApplication.sharedApplication openURL:jitURL options:@{} completionHandler:nil];
// Do not return, wait for TrollStore to enable JIT and jump back
Expand All @@ -368,7 +369,7 @@ - (void)invokeAfterJITEnabled:(void(^)(void))handler {
//CADisplayLink *displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(tickJIT)];

UIAlertController* alert = [UIAlertController alertControllerWithTitle:localize(@"launcher.wait_jit.title", nil)
message:localize(@"launcher.wait_jit.message", nil)
message:hasTrollStoreJIT ? localize(@"launcher.wait_jit_trollstore.message", nil) : localize(@"launcher.wait_jit.message", nil)
preferredStyle:UIAlertControllerStyleAlert];
/* TODO:
UIAlertAction *cancel = [UIAlertAction actionWithTitle:localize(@"Cancel", nil) style:UIAlertActionStyleCancel handler:^{
Expand Down
1 change: 1 addition & 0 deletions Natives/resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@

"launcher.wait_jit.title" = "Waiting for JIT";
"launcher.wait_jit.message" = "PojavLauncher relies on Just-in-time compilation for Java to work at maximum performance.";
"launcher.wait_jit_trollstore.message" = "If you still see this message, please enable URL Scheme in TrollStore.";

"login.error.username.outOfRange" = "Username must be at least 3 characters and a maximum of 16 characters";

Expand Down

0 comments on commit 73e35f5

Please sign in to comment.