Skip to content

Commit

Permalink
Remove boot enabled option
Browse files Browse the repository at this point in the history
It's been a number of months and I haven't told anyone that it exists.
No need to keep it.
  • Loading branch information
tbodt committed Sep 23, 2019
1 parent 31a3ad3 commit 7c992b7
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 64 deletions.
8 changes: 0 additions & 8 deletions app/AboutViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ @interface AboutViewController ()
@property (weak, nonatomic) IBOutlet UISwitch *disableDimmingSwitch;
@property (weak, nonatomic) IBOutlet UITextField *launchCommandField;
@property (weak, nonatomic) IBOutlet UITextField *bootCommandField;
@property (weak, nonatomic) IBOutlet UISwitch *bootEnabledSwitch;

@property (weak, nonatomic) IBOutlet UITableViewCell *sendFeedback;
@property (weak, nonatomic) IBOutlet UITableViewCell *openGithub;
Expand Down Expand Up @@ -46,7 +45,6 @@ - (void)_addObservers {
[prefs addObserver:self forKeyPath:@"fontSize" options:opts context:nil];
[prefs addObserver:self forKeyPath:@"launchCommand" options:opts context:nil];
[prefs addObserver:self forKeyPath:@"bootCommand" options:opts context:nil];
[prefs addObserver:self forKeyPath:@"bootEnabled" options:opts context:nil];
}

- (void)_removeObservers {
Expand All @@ -56,7 +54,6 @@ - (void)_removeObservers {
[prefs removeObserver:self forKeyPath:@"fontSize"];
[prefs removeObserver:self forKeyPath:@"launchCommand"];
[prefs removeObserver:self forKeyPath:@"bootCommand"];
[prefs removeObserver:self forKeyPath:@"bootEnabled"];
} @catch (NSException * __unused exception) {}
}

Expand All @@ -74,7 +71,6 @@ - (void)_updatePreferenceUI {
self.disableDimmingSwitch.on = UserPreferences.shared.shouldDisableDimming;
self.launchCommandField.text = [UserPreferences.shared.launchCommand componentsJoinedByString:@" "];
self.bootCommandField.text = [UserPreferences.shared.bootCommand componentsJoinedByString:@" "];
self.bootEnabledSwitch.on = UserPreferences.shared.bootEnabled;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
Expand Down Expand Up @@ -122,8 +118,4 @@ - (IBAction)bootCommandChanged:(id)sender {
UserPreferences.shared.bootCommand = [self.bootCommandField.text componentsSeparatedByString:@" "];
}

- (IBAction)bootEnabledChanged:(id)sender {
UserPreferences.shared.bootEnabled = self.bootEnabledSwitch.on;
}

@end
14 changes: 4 additions & 10 deletions app/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,7 @@ - (int)startThings {
return err;

NSArray<NSString *> *command;
if (UserPreferences.shared.bootEnabled) {
command = UserPreferences.shared.bootCommand;
} else {
command = UserPreferences.shared.launchCommand;
}
command = UserPreferences.shared.bootCommand;
NSLog(@"%@", command);
char argv[4096];
[self convertCommand:command toArgs:argv limitSize:sizeof(argv)];
Expand All @@ -173,11 +169,9 @@ - (int)startThings {
return err;
task_start(current);

if (UserPreferences.shared.bootEnabled) {
err = [self startSession];
if (err < 0)
return err;
}
err = [self startSession];
if (err < 0)
return err;

return 0;
}
Expand Down
33 changes: 2 additions & 31 deletions app/Base.lproj/About.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -226,43 +226,15 @@
</constraints>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="GpH-bG-hOP" userLabel="Boot enabled">
<rect key="frame" x="0.0" y="555" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="GpH-bG-hOP" id="i8u-Ts-DqN">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Use boot command" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zKE-s4-Csc">
<rect key="frame" x="8" y="11.5" width="151" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="BWY-qW-iul">
<rect key="frame" x="263" y="6.5" width="51" height="31"/>
<connections>
<action selector="bootEnabledChanged:" destination="yJz-O7-jlW" eventType="valueChanged" id="nCx-Dp-Eq9"/>
</connections>
</switch>
</subviews>
<constraints>
<constraint firstItem="BWY-qW-iul" firstAttribute="centerY" secondItem="i8u-Ts-DqN" secondAttribute="centerY" id="9Sf-ri-BeM"/>
<constraint firstItem="zKE-s4-Csc" firstAttribute="centerY" secondItem="i8u-Ts-DqN" secondAttribute="centerY" id="Ycc-hI-V4E"/>
<constraint firstAttribute="trailingMargin" secondItem="BWY-qW-iul" secondAttribute="trailing" id="ZxU-cq-oNi"/>
<constraint firstItem="zKE-s4-Csc" firstAttribute="leading" secondItem="i8u-Ts-DqN" secondAttribute="leadingMargin" id="wZz-M3-Bli"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="blue" indentationWidth="10" textLabel="83j-2z-XRR" style="IBUITableViewCellStyleDefault" id="OIE-9g-Btx" userLabel="Export">
<rect key="frame" x="0.0" y="599" width="320" height="44"/>
<rect key="frame" x="0.0" y="555" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="OIE-9g-Btx" id="uY3-tT-dwz">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Export container" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="83j-2z-XRR">
<rect key="frame" x="15" y="0.0" width="297" height="44"/>
<rect key="frame" x="16" y="0.0" width="288" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
Expand Down Expand Up @@ -291,7 +263,6 @@
</navigationItem>
<connections>
<outlet property="bootCommandField" destination="bKw-tV-nX1" id="MVz-gk-QE7"/>
<outlet property="bootEnabledSwitch" destination="BWY-qW-iul" id="vMW-zz-Ryk"/>
<outlet property="capsLockMappingCell" destination="31N-0g-RhF" id="UjF-21-3df"/>
<outlet property="disableDimmingSwitch" destination="cPj-sQ-qsh" id="Kjp-xA-A0Y"/>
<outlet property="exportContainerCell" destination="OIE-9g-Btx" id="qxo-l5-0Mq"/>
Expand Down
6 changes: 1 addition & 5 deletions app/TerminalViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ @implementation TerminalViewController

- (void)viewDidLoad {
[super viewDidLoad];
if (UserPreferences.shared.bootEnabled) {
self.terminal = [Terminal terminalWithType:TTY_CONSOLE_MAJOR number:7];
} else {
self.terminal = [Terminal terminalWithType:TTY_CONSOLE_MAJOR number:1];
}
self.terminal = [Terminal terminalWithType:TTY_CONSOLE_MAJOR number:7];
[self.termView becomeFirstResponder];

NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
Expand Down
1 change: 0 additions & 1 deletion app/UserPreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ extern NSString *const kThemeBackgroundColor;
@property NSNumber *fontSize;
@property NSArray<NSString *> *launchCommand;
@property NSArray<NSString *> *bootCommand;
@property BOOL bootEnabled;

+ (instancetype)shared;

Expand Down
9 changes: 0 additions & 9 deletions app/UserPreferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
static NSString *const kPreferenceDisableDimmingKey = @"Disable Dimming";
static NSString *const kPreferenceLaunchCommandKey = @"Init Command";
static NSString *const kPreferenceBootCommandKey = @"Boot Command";
static NSString *const kPreferenceBootEnabledKey = @"Boot Enabled";

@implementation UserPreferences {
NSUserDefaults *_defaults;
Expand Down Expand Up @@ -45,7 +44,6 @@ - (instancetype)init {
kPreferenceDisableDimmingKey: @(NO),
kPreferenceLaunchCommandKey: @[@"/bin/login", @"-f", @"root"],
kPreferenceBootCommandKey: @[@"/sbin/init"],
kPreferenceBootEnabledKey: @(YES),
}];
_theme = [[Theme alloc] initWithProperties:[_defaults objectForKey:kPreferenceThemeKey]];
}
Expand Down Expand Up @@ -117,13 +115,6 @@ - (void)setBootCommand:(NSArray<NSString *> *)bootCommand {
[_defaults setObject:bootCommand forKey:kPreferenceBootCommandKey];
}

- (BOOL)bootEnabled {
return [_defaults boolForKey:kPreferenceBootEnabledKey];
}
- (void)setBootEnabled:(BOOL)bootEnabled {
[_defaults setBool:bootEnabled forKey:kPreferenceBootEnabledKey];
}

@end

static id ArchiveColor(UIColor *color) {
Expand Down

0 comments on commit 7c992b7

Please sign in to comment.