mirror of
https://github.com/ish-app/ish.git
synced 2026-02-01 14:32:26 +00:00
parent
bee09ce2ed
commit
e7d7f4616f
@ -12,6 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@interface AboutViewController : UITableViewController
|
||||
|
||||
@property BOOL includeDebugPanel;
|
||||
@property BOOL recoveryMode;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@ -36,6 +36,20 @@
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self _updatePreferenceUI];
|
||||
if (self.recoveryMode) {
|
||||
self.includeDebugPanel = YES;
|
||||
self.navigationItem.title = @"Recovery Mode";
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Exit"
|
||||
style:UIBarButtonItemStyleDone
|
||||
target:self
|
||||
action:@selector(exitRecovery:)];
|
||||
self.navigationItem.leftBarButtonItem = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)exitRecovery:(id)sender {
|
||||
[NSUserDefaults.standardUserDefaults setBool:NO forKey:@"recovery"];
|
||||
exit(0);
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#import <SystemConfiguration/SystemConfiguration.h>
|
||||
#import "AboutViewController.h"
|
||||
#import "AppDelegate.h"
|
||||
#import "AppGroup.h"
|
||||
#import "iOSFS.h"
|
||||
@ -208,7 +209,9 @@ static int bootError;
|
||||
[defaults removeObjectForKey:kPreferenceLaunchCommandKey];
|
||||
[defaults setBool:NO forKey:@"hail mary"];
|
||||
}
|
||||
|
||||
if ([NSUserDefaults.standardUserDefaults boolForKey:@"recovery"])
|
||||
return YES;
|
||||
|
||||
bootError = [self boot];
|
||||
return YES;
|
||||
}
|
||||
@ -243,6 +246,13 @@ void NetworkReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReach
|
||||
|
||||
if (self.window != nil) {
|
||||
// For iOS <13, where the app delegate owns the window instead of the scene
|
||||
if ([NSUserDefaults.standardUserDefaults boolForKey:@"recovery"]) {
|
||||
UINavigationController *vc = [[UIStoryboard storyboardWithName:@"About" bundle:nil] instantiateInitialViewController];
|
||||
AboutViewController *avc = vc.topViewController;
|
||||
avc.recoveryMode = YES;
|
||||
self.window.rootViewController = vc;
|
||||
return YES;
|
||||
}
|
||||
TerminalViewController *vc = (TerminalViewController *) self.window.rootViewController;
|
||||
currentTerminalViewController = vc;
|
||||
[vc startNewSession];
|
||||
|
||||
@ -42,9 +42,9 @@
|
||||
<key>UISceneDelegateClassName</key>
|
||||
<string>SceneDelegate</string>
|
||||
<key>UISceneConfigurationName</key>
|
||||
<string>Terminal</string>
|
||||
<string>Main App</string>
|
||||
<key>UISceneStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<string>Terminal</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
@ -60,7 +60,7 @@
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<string>Terminal</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
//
|
||||
|
||||
#import "SceneDelegate.h"
|
||||
#import "AboutViewController.h"
|
||||
|
||||
TerminalViewController *currentTerminalViewController = NULL;
|
||||
|
||||
@ -20,6 +21,14 @@ static NSString *const TerminalUUID = @"TerminalUUID";
|
||||
@implementation SceneDelegate
|
||||
|
||||
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
|
||||
if ([NSUserDefaults.standardUserDefaults boolForKey:@"recovery"]) {
|
||||
UINavigationController *vc = [[UIStoryboard storyboardWithName:@"About" bundle:nil] instantiateInitialViewController];
|
||||
AboutViewController *avc = vc.topViewController;
|
||||
avc.recoveryMode = YES;
|
||||
self.window.rootViewController = vc;
|
||||
return;
|
||||
}
|
||||
|
||||
TerminalViewController *vc = (TerminalViewController *) self.window.rootViewController;
|
||||
vc.sceneSession = session;
|
||||
if (session.stateRestorationActivity == nil) {
|
||||
|
||||
@ -8,15 +8,15 @@
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
<key>FooterText</key>
|
||||
<string>Danger zone: Only touch this if you know what you're doing but you messed up anyway</string>
|
||||
<string>Opens the app straight to the settings menu. Useful if you changed anything there and need to change it back but the app won't start.</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
<string>PSToggleSwitchSpecifier</string>
|
||||
<key>Title</key>
|
||||
<string>Reset launch and boot commands</string>
|
||||
<string>Recovery Mode</string>
|
||||
<key>Key</key>
|
||||
<string>hail mary</string>
|
||||
<string>recovery</string>
|
||||
<key>DefaultValue</key>
|
||||
<false/>
|
||||
</dict>
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
BB78AB2B1FAD22440013E782 /* TerminalView.m in Sources */ = {isa = PBXBuildFile; fileRef = BB78AB2A1FAD22440013E782 /* TerminalView.m */; };
|
||||
BB792B551F96D90D00FFB7A4 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = BB792B541F96D90D00FFB7A4 /* AppDelegate.m */; };
|
||||
BB792B581F96D90D00FFB7A4 /* TerminalViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BB792B571F96D90D00FFB7A4 /* TerminalViewController.m */; };
|
||||
BB792B5B1F96D90D00FFB7A4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BB792B591F96D90D00FFB7A4 /* Main.storyboard */; };
|
||||
BB792B5B1F96D90D00FFB7A4 /* Terminal.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BB792B591F96D90D00FFB7A4 /* Terminal.storyboard */; };
|
||||
BB792B5D1F96D90D00FFB7A4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BB792B5C1F96D90D00FFB7A4 /* Assets.xcassets */; };
|
||||
BB792B601F96D90D00FFB7A4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BB792B5E1F96D90D00FFB7A4 /* LaunchScreen.storyboard */; };
|
||||
BB792B631F96D90D00FFB7A4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BB792B621F96D90D00FFB7A4 /* main.m */; };
|
||||
@ -204,7 +204,7 @@
|
||||
BB792B541F96D90D00FFB7A4 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
||||
BB792B561F96D90D00FFB7A4 /* TerminalViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TerminalViewController.h; sourceTree = "<group>"; };
|
||||
BB792B571F96D90D00FFB7A4 /* TerminalViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TerminalViewController.m; sourceTree = "<group>"; };
|
||||
BB792B5A1F96D90D00FFB7A4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
BB792B5A1F96D90D00FFB7A4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Terminal.storyboard; sourceTree = "<group>"; };
|
||||
BB792B5C1F96D90D00FFB7A4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
BB792B5F1F96D90D00FFB7A4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
BB792B611F96D90D00FFB7A4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
@ -501,7 +501,7 @@
|
||||
BBCC9D952365430800424C83 /* SceneDelegate.m */,
|
||||
BB792B561F96D90D00FFB7A4 /* TerminalViewController.h */,
|
||||
BB792B571F96D90D00FFB7A4 /* TerminalViewController.m */,
|
||||
BB792B591F96D90D00FFB7A4 /* Main.storyboard */,
|
||||
BB792B591F96D90D00FFB7A4 /* Terminal.storyboard */,
|
||||
BBFB557D21587B2B00DFE6DE /* Bar */,
|
||||
BB78AB291FAD22440013E782 /* TerminalView.h */,
|
||||
BB78AB2A1FAD22440013E782 /* TerminalView.m */,
|
||||
@ -976,7 +976,7 @@
|
||||
BB792B601F96D90D00FFB7A4 /* LaunchScreen.storyboard in Resources */,
|
||||
BBBF7B5C2415CDBB00EC4C14 /* Settings.bundle in Resources */,
|
||||
BBBCE7E321D2F02200CA00B3 /* About.storyboard in Resources */,
|
||||
BB792B5B1F96D90D00FFB7A4 /* Main.storyboard in Resources */,
|
||||
BB792B5B1F96D90D00FFB7A4 /* Terminal.storyboard in Resources */,
|
||||
BB2B4DAF231D998300CB578B /* term.html in Resources */,
|
||||
BB10E5D0248DC21D009C7A74 /* Roots.storyboard in Resources */,
|
||||
BBCE66E2249A807700F45269 /* alpine.tar.gz in Resources */,
|
||||
@ -1122,12 +1122,12 @@
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
BB792B591F96D90D00FFB7A4 /* Main.storyboard */ = {
|
||||
BB792B591F96D90D00FFB7A4 /* Terminal.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
BB792B5A1F96D90D00FFB7A4 /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
name = Terminal.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BB792B5E1F96D90D00FFB7A4 /* LaunchScreen.storyboard */ = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user