diff --git a/Makefile b/Makefile index ba29b101..0a80a650 100644 --- a/Makefile +++ b/Makefile @@ -212,14 +212,14 @@ deploy: Natives/build/PojavLauncher.app/PojavLauncher \ JavaApp/local_out/launcher.jar \ root@$(DEVICE_IP):/var/tmp; \ - ssh root@$(DEVICE_IP) -p $(DEVICE_PORT) -t "mv /var/tmp/libawt_xawt.dylib /Applications/PojavLauncher.app/Frameworks/libawt_xawt.dylib && mv /var/tmp/libpojavexec.dylib /Applications/PojavLauncher.app/Frameworks/libpojavexec.dylib && mv /var/tmp/PojavLauncher /Applications/PojavLauncher.app/PojavLauncher && mv /var/tmp/launcher.jar /Applications/PojavLauncher.app/libs/launcher.jar && cd /Application/PojavLauncher.app/Frameworks && ln -sf libawt_xawt.dylib libawt_headless.dylib && killall PojavLauncher"; \ + ssh root@$(DEVICE_IP) -p $(DEVICE_PORT) -t "mv /var/tmp/libawt_xawt.dylib /Applications/PojavLauncher.app/Frameworks/libawt_xawt.dylib && mv /var/tmp/libpojavexec.dylib /Applications/PojavLauncher.app/Frameworks/libpojavexec.dylib && mv /var/tmp/PojavLauncher /Applications/PojavLauncher.app/PojavLauncher && mv /var/tmp/launcher.jar /Applications/PojavLauncher.app/libs/launcher.jar && cd /Applications/PojavLauncher.app/Frameworks && ln -sf libawt_xawt.dylib libawt_headless.dylib && killall PojavLauncher"; \ else \ scp -o "StrictHostKeyChecking no" -o "UserKnownHostsFile=/dev/null" Natives/build/libpojavexec.dylib \ Natives/build/libawt_xawt.dylib \ Natives/build/PojavLauncher.app/PojavLauncher \ JavaApp/local_out/launcher.jar \ root@$(DEVICE_IP):/var/tmp; \ - ssh root@$(DEVICE_IP) -t "mv /var/tmp/libawt_xawt.dylib /Applications/PojavLauncher.app/Frameworks/libawt_xawt.dylib && mv /var/tmp/libpojavexec.dylib /Applications/PojavLauncher.app/Frameworks/libpojavexec.dylib && mv /var/tmp/PojavLauncher /Applications/PojavLauncher.app/PojavLauncher && mv /var/tmp/launcher.jar /Applications/PojavLauncher.app/libs/launcher.jar && cd /Application/PojavLauncher.app/Frameworks && ln -sf libawt_xawt.dylib libawt_headless.dylib && killall PojavLauncher"; \ + ssh root@$(DEVICE_IP) -t "mv /var/tmp/libawt_xawt.dylib /Applications/PojavLauncher.app/Frameworks/libawt_xawt.dylib && mv /var/tmp/libpojavexec.dylib /Applications/PojavLauncher.app/Frameworks/libpojavexec.dylib && mv /var/tmp/PojavLauncher /Applications/PojavLauncher.app/PojavLauncher && mv /var/tmp/launcher.jar /Applications/PojavLauncher.app/libs/launcher.jar && cd /Applications/PojavLauncher.app/Frameworks && ln -sf libawt_xawt.dylib libawt_headless.dylib && killall PojavLauncher"; \ fi; \ else \ echo 'You need to run '\''export DEVICE_IP='\'' to use make deploy.'; \ diff --git a/Natives/AboutLauncherViewController.m b/Natives/AboutLauncherViewController.m index 9762b34c..b672366a 100644 --- a/Natives/AboutLauncherViewController.m +++ b/Natives/AboutLauncherViewController.m @@ -60,14 +60,22 @@ [scrollView addSubview:logoVerView]; [logoVerView setFont:[UIFont boldSystemFontOfSize:20]]; - UIButton *updateHistoryButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; - [updateHistoryButton setTitle:@"See the recent changelog." forState:UIControlStateNormal]; - updateHistoryButton.frame = CGRectMake(4, logoVerView.frame.origin.y + logoVerView.frame.size.height + 5, width - 8, 25.0); - updateHistoryButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; - [updateHistoryButton addTarget:self action:@selector(updateHistory) forControlEvents:UIControlEventTouchUpInside]; - [scrollView addSubview:updateHistoryButton]; + CGFloat logoNoteViewOriginY; + if(@available (iOS 14.0, *)) { + // UIMenu on the main screen + logoNoteViewOriginY = logoVerView.frame.origin.y + logoVerView.frame.size.height + 5; + } else { + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Send your logs" style:UIBarButtonItemStyleDone target:self action:@selector(latestLogShare)]; + UIButton *updateHistoryButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; + [updateHistoryButton setTitle:@"See the recent changelog." forState:UIControlStateNormal]; + updateHistoryButton.frame = CGRectMake(4, logoVerView.frame.origin.y + logoVerView.frame.size.height + 5, width - 8, 25.0); + updateHistoryButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; + [updateHistoryButton addTarget:self action:@selector(updateHistory) forControlEvents:UIControlEventTouchUpInside]; + [scrollView addSubview:updateHistoryButton]; + logoNoteViewOriginY = logoVerView.frame.origin.y + logoVerView.frame.size.height + updateHistoryButton.frame.origin.y + updateHistoryButton.frame.size.height + 9; + } - UILabel *logoNoteView = [[UILabel alloc] initWithFrame:CGRectMake(4.0, updateHistoryButton.frame.origin.y + updateHistoryButton.frame.size.height + 9.0, width - 8, 700)]; + UILabel *logoNoteView = [[UILabel alloc] initWithFrame:CGRectMake(4.0, logoNoteViewOriginY, width - 8, 700)]; logoNoteView.text = @"Created by PojavLauncherTeam in 2021. We do not exist on TikTok. No one from the dev team makes TikTok videos.\n\nDuyKhanhTran - lead iOS port developer\nDoregon - iOS port developer\nSpecial thanks to Hayden Seay, for porting OpenJDK 16, making this possible, and hosting on Procursus."; logoNoteView.lineBreakMode = NSLineBreakByWordWrapping; logoNoteView.numberOfLines = 0; @@ -88,8 +96,6 @@ [safetyNoteView sizeToFit]; [scrollView addSubview:safetyNoteView]; - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Send your logs" style:UIBarButtonItemStyleDone target:self action:@selector(latestLogShare)]; - scrollView.contentSize = CGSizeMake(scrollView.frame.size.width, safetyNoteView.frame.origin.y + safetyNoteView.frame.size.height + 0); } diff --git a/Natives/LauncherPreferencesViewController.m b/Natives/LauncherPreferencesViewController.m index 8ef27439..90f3b7e1 100644 --- a/Natives/LauncherPreferencesViewController.m +++ b/Natives/LauncherPreferencesViewController.m @@ -21,7 +21,6 @@ UITextField* rendTextField; UITextField* jargsTextField; UITextField* jhomeTextField; -UITextField* versionTextField; - (void)viewDidLoad { @@ -73,7 +72,7 @@ UITextField* versionTextField; [scrollView addSubview:jargsTextView]; jargsTextField = [[UITextField alloc] initWithFrame:CGRectMake(buttonSizeSlider.frame.origin.x + 3, 54.0, width - jargsTextView.bounds.size.width - 8.0, 30)]; - [jargsTextField addTarget:versionTextField action:@selector(resignFirstResponder) forControlEvents:UIControlEventEditingDidEndOnExit]; + [jargsTextField addTarget:self action:@selector(resignFirstResponder) forControlEvents:UIControlEventEditingDidEndOnExit]; jargsTextField.tag = 100; jargsTextField.delegate = self; jargsTextField.placeholder = @"Specify arguments..."; @@ -89,7 +88,7 @@ UITextField* versionTextField; [scrollView addSubview:rendTextView]; rendTextField = [[UITextField alloc] initWithFrame:CGRectMake(buttonSizeSlider.frame.origin.x + 3, 94.0, width - jargsTextView.bounds.size.width - 8.0, 30)]; - [rendTextField addTarget:versionTextField action:@selector(resignFirstResponder) forControlEvents:UIControlEventEditingDidEndOnExit]; + [rendTextField addTarget:self action:@selector(resignFirstResponder) forControlEvents:UIControlEventEditingDidEndOnExit]; rendTextField.tag = 101; rendTextField.delegate = self; rendTextField.placeholder = @"Override renderer..."; @@ -105,7 +104,7 @@ UITextField* versionTextField; [scrollView addSubview:jhomeTextView]; jhomeTextField = [[UITextField alloc] initWithFrame:CGRectMake(buttonSizeSlider.frame.origin.x + 3, 134.0, width - jargsTextView.bounds.size.width - 8.0, 30)]; - [jhomeTextField addTarget:versionTextField action:@selector(resignFirstResponder) forControlEvents:UIControlEventEditingDidEndOnExit]; + [jhomeTextField addTarget:self action:@selector(resignFirstResponder) forControlEvents:UIControlEventEditingDidEndOnExit]; jhomeTextField.tag = 102; jhomeTextField.delegate = self; jhomeTextField.placeholder = @"Override Java path..."; diff --git a/Natives/LoginViewController.m b/Natives/LoginViewController.m index 0e55877d..eba0efa3 100644 --- a/Natives/LoginViewController.m +++ b/Natives/LoginViewController.m @@ -9,6 +9,7 @@ #import "AboutLauncherViewController.h" #import "LauncherFAQViewController.h" #import "LauncherPreferences.h" +#import "UpdateHistoryViewController.h" #include "ios_uikit_bridge.h" #include "utils.h" @@ -51,10 +52,12 @@ void loginAccountInput(UINavigationController *controller, int type, const char* @interface LoginViewController () { } @property (nonatomic, strong) ASWebAuthenticationSession *authVC; +@property (nonatomic, strong) UIActivityViewController *activityViewController; @end @implementation LoginViewController @synthesize authVC; +@synthesize activityViewController; - (void)viewDidLoad { [super viewDidLoad]; @@ -97,33 +100,63 @@ void loginAccountInput(UINavigationController *controller, int type, const char* [self.view addSubview:logoWaterView]; [logoWaterView setFont:[UIFont boldSystemFontOfSize:(logoView.frame.size.width / 2.0)]]; + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"About" style:UIBarButtonItemStyleDone target:self action:@selector(aboutLauncher)]; + if(@available (iOS 14.0, *)) { + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"More" style:UIBarButtonItemStyleDone target:self action:@selector(aboutLauncher)]; + UIAction *option1 = [UIAction actionWithTitle:@"About PojavLauncher" image:nil identifier:nil + handler:^(__kindof UIAction * _Nonnull action) {[self aboutLauncher];}]; + UIAction *option2 = [UIAction actionWithTitle:@"Send your logs" image:nil identifier:nil + handler:^(__kindof UIAction * _Nonnull action) {[self latestLogShare];}]; + UIAction *option3 = [UIAction actionWithTitle:@"Recent updates" image:nil identifier:nil + handler:^(__kindof UIAction * _Nonnull action) {[self updateHistory];}]; + UIMenu *menu = [UIMenu menuWithTitle:@"" image:nil identifier:nil + options:UIMenuOptionsDisplayInline children:@[option1, option2, option3]]; + self.navigationItem.rightBarButtonItem.action = nil; + self.navigationItem.rightBarButtonItem.primaryAction = nil; + self.navigationItem.rightBarButtonItem.menu = menu; + } UIButton *button_faq = [UIButton buttonWithType:UIButtonTypeRoundedRect]; - [button_faq setTitle:@"FAQ" forState:UIControlStateNormal]; + [button_faq setTitle:@" FAQ" forState:UIControlStateNormal]; button_faq.frame = CGRectMake(widthSplit2 - (((width - widthSplit * 2.0) / 2) / 2), (height - 80.0), (width - widthSplit * 2.0) / 2, 40.0); button_faq.backgroundColor = [UIColor colorWithRed:54/255.0 green:176/255.0 blue:48/255.0 alpha:1.0]; button_faq.layer.cornerRadius = 5; [button_faq setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [button_faq addTarget:self action:@selector(showFAQ) forControlEvents:UIControlEventTouchUpInside]; + if(@available (iOS 13.0, *)) { + button_faq.imageView.image = [[UIImage systemImageNamed:@"doc.text.fill"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + [button_faq setTintColor:[UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0]]; + [button_faq setImage:button_faq.imageView.image forState:UIControlStateNormal]; + } [scrollView addSubview:button_faq]; UIButton *button_login = [UIButton buttonWithType:UIButtonTypeRoundedRect]; - [button_login setTitle:@"Sign In" forState:UIControlStateNormal]; + [button_login setTitle:@" Sign In" forState:UIControlStateNormal]; button_login.frame = CGRectMake(button_faq.frame.origin.x - button_faq.frame.size.width - 20, (height - 80.0), (width - widthSplit * 2.0) / 2, 40.0); button_login.backgroundColor = [UIColor colorWithRed:54/255.0 green:176/255.0 blue:48/255.0 alpha:1.0]; button_login.layer.cornerRadius = 5; [button_login setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [button_login addTarget:self action:@selector(accountType:) forControlEvents:UIControlEventTouchUpInside]; + if(@available (iOS 13.0, *)) { + button_login.imageView.image = [[UIImage systemImageNamed:@"person.crop.circle.fill.badge.plus"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + [button_login setTintColor:[UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0]]; + [button_login setImage:button_login.imageView.image forState:UIControlStateNormal]; + } [scrollView addSubview:button_login]; UIButton *button_accounts = [UIButton buttonWithType:UIButtonTypeRoundedRect]; - [button_accounts setTitle:@"Accounts" forState:UIControlStateNormal]; + [button_accounts setTitle:@" Accounts" forState:UIControlStateNormal]; button_accounts.frame = CGRectMake(button_faq.frame.origin.x + button_faq.frame.size.width + 20, (height - 80.0), (width - widthSplit * 2.0) / 2, 40.0); button_accounts.backgroundColor = [UIColor colorWithRed:54/255.0 green:176/255.0 blue:48/255.0 alpha:1.0]; button_accounts.layer.cornerRadius = 5; [button_accounts setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [button_accounts addTarget:self action:@selector(loginAccount:) forControlEvents:UIControlEventTouchUpInside]; + if(@available (iOS 13.0, *)) { + button_accounts.imageView.image = [[UIImage systemImageNamed:@"person.crop.circle.fill"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + [button_accounts setTintColor:[UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0]]; + [button_accounts setImage:button_accounts.imageView.image forState:UIControlStateNormal]; + } [scrollView addSubview:button_accounts]; } @@ -336,8 +369,8 @@ void loginAccountInput(UINavigationController *controller, int type, const char* - (void)aboutLauncher { - AboutLauncherViewController *vc = [[AboutLauncherViewController alloc] init]; - [self.navigationController pushViewController:vc animated:YES]; + AboutLauncherViewController *vc = [[AboutLauncherViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; } - (void)showFAQ @@ -346,6 +379,19 @@ void loginAccountInput(UINavigationController *controller, int type, const char* [self.navigationController pushViewController:vc animated:YES]; } +-(void)latestLogShare +{ + NSString *latestlogPath = [NSString stringWithFormat:@"file://%s/Documents/.pojavlauncher/latestlog.old.txt", getenv("HOME")]; + activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[@"latestlog.txt", [NSURL URLWithString:latestlogPath]] applicationActivities:nil]; + + [self presentViewController:activityViewController animated:YES completion:nil]; +} + +- (void)updateHistory { + UpdateHistoryViewController *vc = [[UpdateHistoryViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; +} + - (void)setPopoverProperties:(UIPopoverPresentationController *)controller sender:(UIButton *)sender { if (controller != nil) { controller.sourceView = sender;