Add warning when opening Local mode menu and Preferences the first time

This commit is contained in:
doregon committed 2021-08-06 21:18:07 -04:00
1 parent 85524e251c
commit 31b3bb2bff
3 files changed
+23 -8

No files matched your search

+2 -1
View File
@@ -21,7 +21,8 @@ void loadPreferences() {
prefDict[@"java_args"] = @"";
prefDict[@"java_home"] = @"";
prefDict[@"gl4es_libname"] = @"";
// prefDict[@"custom_envVars"] = @""; // TODO
prefDict[@"option_warn"] = @YES;
prefDict[@"local_warn"] = @YES;
[prefDict writeToFile:prefPath atomically:YES];
} else {
prefDict = [NSMutableDictionary dictionaryWithContentsOfFile:prefPath];
@@ -110,6 +110,14 @@ UITextField* versionTextField;
jhomeTextField.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
[scrollView addSubview:jhomeTextField];
if ([getPreference(@"option_warn") boolValue] == YES) {
UIAlertController *fullAlert = [UIAlertController alertControllerWithTitle:@"Restart required" message:@"Some options in this menu will require that you restart the launcher for them to take effect."preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil];
[self presentViewController:fullAlert animated:YES completion:nil];
[fullAlert addAction:cancel];
setPreference(@"option_warn", @NO);
}
scrollView.contentSize = CGSizeMake(scrollView.frame.size.width, scrollView.frame.size.height + 200);
}
+13 -7
View File
@@ -8,6 +8,7 @@
#import "LoginViewController.h"
#import "AboutLauncherViewController.h"
#import "LauncherFAQViewController.h"
#import "LauncherPreferences.h"
#include "ios_uikit_bridge.h"
#include "utils.h"
@@ -243,13 +244,18 @@ void loginAccountInput(UINavigationController *controller, int type, const char*
}
- (void)loginOffline:(UIButton *)sender {
UIAlertController *offlineAlert = [UIAlertController alertControllerWithTitle:@"Offline mode is now Local mode." message:@"You can continue to play installed versions, but you can no longer download Minecraft without a paid account. No support will be provided for issues with local accounts, or other means of acquiring Minecraft. See our website for more information."preferredStyle:UIAlertControllerStyleActionSheet];
[self setPopoverProperties:offlineAlert.popoverPresentationController sender:sender];
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {[self loginUsername:TYPE_OFFLINE];}];
UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {[self accountType:sender];}];
[self presentViewController:offlineAlert animated:YES completion:nil];
[offlineAlert addAction:ok];
[offlineAlert addAction:cancel];
if ([getPreference(@"local_warn") boolValue] == YES) {
UIAlertController *offlineAlert = [UIAlertController alertControllerWithTitle:@"Offline mode is now Local mode." message:@"You can continue to play installed versions, but you can no longer download Minecraft without a paid account. No support will be provided for issues with local accounts, or other means of acquiring Minecraft. See our website for more information."preferredStyle:UIAlertControllerStyleActionSheet];
[self setPopoverProperties:offlineAlert.popoverPresentationController sender:sender];
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {[self loginUsername:TYPE_OFFLINE];}];
UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {[self accountType:sender];}];
[self presentViewController:offlineAlert animated:YES completion:nil];
[offlineAlert addAction:ok];
[offlineAlert addAction:cancel];
setPreference(@"local_warn", @NO);
} else {
[self loginUsername:(TYPE_OFFLINE)];
}
}
- (void)loginDemo:(UIButton *)sender {