feat(ios): main text view - dark theme support

This commit is contained in:
jahorton 2019-11-04 15:09:08 +07:00
parent 18450a4463
commit a935e4c8fa
5 changed files with 58 additions and 8 deletions

View file

@ -134,6 +134,7 @@
CE2B1E4C21B6112B007D092E /* DeviceKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE2B1E4B21B6112B007D092E /* DeviceKit.framework */; };
CE6138011FB99538009D0EF2 /* KeymanEngine.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = CE6137FF1FB99538009D0EF2 /* KeymanEngine.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
CE6138021FB999C8009D0EF2 /* KeymanEngine.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE6138031FB999C8009D0EF2 /* KeymanEngine.framework */; };
CE79CDB52370111200010C06 /* Themes+Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CE79CDB42370111200010C06 /* Themes+Colors.xcassets */; };
CE7C1AE2236925D800100C2C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CE7C1AE1236925D800100C2C /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
@ -297,6 +298,7 @@
CE2B1E4B21B6112B007D092E /* DeviceKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DeviceKit.framework; path = ../../Carthage/Build/iOS/DeviceKit.framework; sourceTree = "<group>"; };
CE6137FF1FB99538009D0EF2 /* KeymanEngine.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = KeymanEngine.framework; sourceTree = BUILT_PRODUCTS_DIR; };
CE6138031FB999C8009D0EF2 /* KeymanEngine.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = KeymanEngine.framework; sourceTree = BUILT_PRODUCTS_DIR; };
CE79CDB42370111200010C06 /* Themes+Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Themes+Colors.xcassets"; sourceTree = "<group>"; };
CE7C1AE1236925D800100C2C /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -511,6 +513,7 @@
162E2C9420926C8600F40769 /* Classes */,
9845A7BE1A439A9200544E2E /* GetStartedViewController */,
98C893F119F0811A000B9AC8 /* Images.xcassets */,
CE79CDB42370111200010C06 /* Themes+Colors.xcassets */,
9845A7C21A439A9200544E2E /* InfoViewController */,
984FA1E21974B06C0037EE5D /* Keyman.entitlements */,
9845A7B71A4398B200544E2E /* DropDownList */,
@ -825,6 +828,7 @@
9845A8D91A439F1000544E2E /* UIButtonBarStop@2x.png in Resources */,
9845A8D31A439F1000544E2E /* 786-browser@2x.png in Resources */,
981AFACF19EF44DE006706BF /* textsize_selected@2x.png in Resources */,
CE79CDB52370111200010C06 /* Themes+Colors.xcassets in Resources */,
CE1F5ECE23331DA400141F3E /* OfflineHelp.bundle in Resources */,
981AFAD319EF44DE006706BF /* navbar-Landscape-568h@2x.png in Resources */,
9845A8CC1A439F1000544E2E /* 715-globe-toolbar.png in Resources */,

View file

@ -143,8 +143,12 @@ class MainViewController: UIViewController, TextViewDelegate, UIActionSheetDeleg
Manager.shared.apiKeyboardRepository.fetch()
Manager.shared.apiLexicalModelRepository.fetch()
// TODO: For dark mode implementation, we'll need to change the color here.
let bgColor = UIColor(red: 1.0, green: 1.0, blue: 207.0 / 255.0, alpha: 1.0)
// Implement a default color...
var bgColor = UIColor(red: 1.0, green: 1.0, blue: 207.0 / 255.0, alpha: 1.0)
// And if the iOS version is current enough, override it from the palette.
if #available(iOS 11.0, *) {
bgColor = UIColor(named: "InputBackground")!
}
view?.backgroundColor = bgColor
// Check for configuration profiles/fonts to install
@ -198,7 +202,6 @@ class MainViewController: UIViewController, TextViewDelegate, UIActionSheetDeleg
textView.isScrollEnabled = true
textView.isUserInteractionEnabled = true
textView.font = textView.font?.withSize(textSize)
textView.textColor = UIColor.black // Dark mode will use white otherwise
view?.addSubview(textView!)
// Setup Info View

View file

@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15400" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13174"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15404"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@ -46,6 +44,7 @@
</constraints>
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="131" y="113"/>
</view>
</objects>
</document>

View file

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View file

@ -0,0 +1,38 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"colors" : [
{
"idiom" : "universal",
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "1.000",
"alpha" : "1.000",
"blue" : "0.812",
"green" : "1.000"
}
}
},
{
"idiom" : "universal",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0.000",
"alpha" : "1.000",
"blue" : "0.188",
"green" : "0.000"
}
}
}
]
}