Make the about screen dark if the terminal is dark

Fixes #493
This commit is contained in:
Theodore Dubois
2019-10-06 14:29:05 -07:00
parent 3d11d053e2
commit eb628d2fc3
4 changed files with 63 additions and 2 deletions
+16
View File
@@ -0,0 +1,16 @@
//
// AboutNavigationController.h
// iSH
//
// Created by Theodore Dubois on 10/6/19.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface AboutNavigationController : UINavigationController
@end
NS_ASSUME_NONNULL_END
+39
View File
@@ -0,0 +1,39 @@
//
// AboutNavigationController.m
// iSH
//
// Created by Theodore Dubois on 10/6/19.
//
#import "AboutNavigationController.h"
#import "UserPreferences.h"
@interface AboutNavigationController ()
@end
@implementation AboutNavigationController
- (void)viewDidLoad {
[super viewDidLoad];
[[UserPreferences shared] addObserver:self forKeyPath:@"theme" options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionInitial context:nil];
}
- (void)dealloc {
[[UserPreferences shared] removeObserver:self forKeyPath:@"theme"];
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
if (@available(iOS 13, *)) {
if ([keyPath isEqualToString:@"theme"]) {
UIKeyboardAppearance appearance = UserPreferences.shared.theme.keyboardAppearance;
if (appearance == UIKeyboardAppearanceDark) {
self.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;
} else {
self.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
}
}
}
}
@end
+2 -2
View File
@@ -499,10 +499,10 @@
</objects>
<point key="canvasLocation" x="1058" y="725"/>
</scene>
<!--Navigation Controller-->
<!--About Navigation Controller-->
<scene sceneID="Vga-Xh-1SC">
<objects>
<navigationController modalPresentationStyle="formSheet" id="0yy-Uo-cZb" sceneMemberID="viewController">
<navigationController modalPresentationStyle="formSheet" id="0yy-Uo-cZb" customClass="AboutNavigationController" sceneMemberID="viewController">
<modalFormSheetSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="q93-rv-TwM">
<rect key="frame" x="0.0" y="0.0" width="320" height="56"/>
+6
View File
@@ -12,6 +12,7 @@
9A28E4EA219A8B670073D200 /* AboutAppearanceViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A28E4E9219A8B670073D200 /* AboutAppearanceViewController.m */; };
BB0FC5921F980A6C00803272 /* Terminal.m in Sources */ = {isa = PBXBuildFile; fileRef = BB0FC5911F980A6B00803272 /* Terminal.m */; };
BB13F7EA200ADCED003D1C4D /* libish.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BB13F7DC200AD81D003D1C4D /* libish.a */; };
BB1D9D93234A8FE100F364E8 /* AboutNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = BB1D9D92234A8FE100F364E8 /* AboutNavigationController.m */; };
BB23F58D231E1D1400585522 /* ScrollbarView.m in Sources */ = {isa = PBXBuildFile; fileRef = BB23F58C231E1D1400585522 /* ScrollbarView.m */; };
BB2B4DAC231D94C300CB578B /* hterm_all.js in Resources */ = {isa = PBXBuildFile; fileRef = BB2B4DAB231D94C300CB578B /* hterm_all.js */; };
BB2B4DAD231D998300CB578B /* term.js in Resources */ = {isa = PBXBuildFile; fileRef = BB4A539C1FAA490C00A72ACE /* term.js */; };
@@ -112,6 +113,8 @@
BB13F4DD21C5770000343E17 /* NSError+ISHErrno.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSError+ISHErrno.m"; sourceTree = "<group>"; };
BB13F7C8200ACC24003D1C4D /* xcode-meson.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "xcode-meson.sh"; sourceTree = "<group>"; };
BB13F7DC200AD81D003D1C4D /* libish.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libish.a; sourceTree = BUILT_PRODUCTS_DIR; };
BB1D9D91234A8FE100F364E8 /* AboutNavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AboutNavigationController.h; sourceTree = "<group>"; };
BB1D9D92234A8FE100F364E8 /* AboutNavigationController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AboutNavigationController.m; sourceTree = "<group>"; };
BB23F58B231E1D1400585522 /* ScrollbarView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScrollbarView.h; sourceTree = "<group>"; };
BB23F58C231E1D1400585522 /* ScrollbarView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScrollbarView.m; sourceTree = "<group>"; };
BB2B4DAB231D94C300CB578B /* hterm_all.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = hterm_all.js; path = libapps/hterm/dist/js/hterm_all.js; sourceTree = "<group>"; };
@@ -648,6 +651,8 @@
isa = PBXGroup;
children = (
BBBCE7E521D2F02200CA00B3 /* About.storyboard */,
BB1D9D91234A8FE100F364E8 /* AboutNavigationController.h */,
BB1D9D92234A8FE100F364E8 /* AboutNavigationController.m */,
BBFB5577215876CD00DFE6DE /* AboutViewController.h */,
BBFB5578215876CD00DFE6DE /* AboutViewController.m */,
8632A7BD219A59FB00F02325 /* UserPreferences.h */,
@@ -929,6 +934,7 @@
buildActionMask = 2147483647;
files = (
9A28E4EA219A8B670073D200 /* AboutAppearanceViewController.m in Sources */,
BB1D9D93234A8FE100F364E8 /* AboutNavigationController.m in Sources */,
BB792B581F96D90D00FFB7A4 /* TerminalViewController.m in Sources */,
BB78AB2B1FAD22440013E782 /* TerminalView.m in Sources */,
BB23F58D231E1D1400585522 /* ScrollbarView.m in Sources */,