Verified Commit 465cf68e authored by Geoff Pado's avatar Geoff Pado

Style permissions prompt page

parent d8a52752
......@@ -19,6 +19,11 @@
041EFF4E225302CC0058D8EE /* IntroView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041EFF4D225302CC0058D8EE /* IntroView.swift */; };
041EFF50225303120058D8EE /* PromptLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041EFF4F225303120058D8EE /* PromptLabel.swift */; };
041EFF52225303430058D8EE /* PromptButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041EFF51225303430058D8EE /* PromptButton.swift */; };
041EFF552255A0B00058D8EE /* Colors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041EFF542255A0B00058D8EE /* Colors.swift */; };
041EFF582255A2FB0058D8EE /* Aleo-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 041EFF562255A2ED0058D8EE /* Aleo-Bold.otf */; };
041EFF592255A2FB0058D8EE /* Aleo-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = 041EFF572255A2EE0058D8EE /* Aleo-Regular.otf */; };
041EFF5B2255A39D0058D8EE /* Fonts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041EFF5A2255A39D0058D8EE /* Fonts.swift */; };
041EFF5D2255A85F0058D8EE /* NavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041EFF5C2255A85F0058D8EE /* NavigationController.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
......@@ -48,6 +53,11 @@
041EFF4D225302CC0058D8EE /* IntroView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IntroView.swift; sourceTree = "<group>"; };
041EFF4F225303120058D8EE /* PromptLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromptLabel.swift; sourceTree = "<group>"; };
041EFF51225303430058D8EE /* PromptButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromptButton.swift; sourceTree = "<group>"; };
041EFF542255A0B00058D8EE /* Colors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Colors.swift; sourceTree = "<group>"; };
041EFF562255A2ED0058D8EE /* Aleo-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Aleo-Bold.otf"; sourceTree = "<group>"; };
041EFF572255A2EE0058D8EE /* Aleo-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Aleo-Regular.otf"; sourceTree = "<group>"; };
041EFF5A2255A39D0058D8EE /* Fonts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Fonts.swift; sourceTree = "<group>"; };
041EFF5C2255A85F0058D8EE /* NavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -89,6 +99,7 @@
041EFEF72251A9F30058D8EE /* Highlighter */ = {
isa = PBXGroup;
children = (
041EFF532255A0930058D8EE /* Style */,
041EFF4C225302B90058D8EE /* Intro View */,
041EFEF82251A9F30058D8EE /* AppDelegate.swift */,
041EFEFA2251A9F30058D8EE /* AppViewController.swift */,
......@@ -98,6 +109,7 @@
041EFF182251AAFE0058D8EE /* UIViewControllerExtensions.swift */,
041EFF1A2251AB8D0058D8EE /* AppWindow.swift */,
041EFF4A225300030058D8EE /* Localizable.strings */,
041EFF5C2255A85F0058D8EE /* NavigationController.swift */,
);
path = Highlighter;
sourceTree = "<group>";
......@@ -122,6 +134,17 @@
path = "Intro View";
sourceTree = "<group>";
};
041EFF532255A0930058D8EE /* Style */ = {
isa = PBXGroup;
children = (
041EFF562255A2ED0058D8EE /* Aleo-Bold.otf */,
041EFF572255A2EE0058D8EE /* Aleo-Regular.otf */,
041EFF542255A0B00058D8EE /* Colors.swift */,
041EFF5A2255A39D0058D8EE /* Fonts.swift */,
);
path = Style;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
......@@ -203,6 +226,8 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
041EFF582255A2FB0058D8EE /* Aleo-Bold.otf in Resources */,
041EFF592255A2FB0058D8EE /* Aleo-Regular.otf in Resources */,
041EFF032251A9F50058D8EE /* LaunchScreen.storyboard in Resources */,
041EFF4B225300030058D8EE /* Localizable.strings in Resources */,
041EFF002251A9F50058D8EE /* Assets.xcassets in Resources */,
......@@ -223,11 +248,14 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
041EFF5D2255A85F0058D8EE /* NavigationController.swift in Sources */,
041EFF492252FAF50058D8EE /* IntroViewController.swift in Sources */,
041EFF552255A0B00058D8EE /* Colors.swift in Sources */,
041EFEFB2251A9F30058D8EE /* AppViewController.swift in Sources */,
041EFF192251AAFE0058D8EE /* UIViewControllerExtensions.swift in Sources */,
041EFF52225303430058D8EE /* PromptButton.swift in Sources */,
041EFEF92251A9F30058D8EE /* AppDelegate.swift in Sources */,
041EFF5B2255A39D0058D8EE /* Fonts.swift in Sources */,
041EFF50225303120058D8EE /* PromptLabel.swift in Sources */,
041EFF1B2251AB8D0058D8EE /* AppWindow.swift in Sources */,
041EFF4E225302CC0058D8EE /* IntroView.swift in Sources */,
......
......@@ -6,9 +6,18 @@ import UIKit
class AppViewController: UIViewController {
init() {
super.init(nibName: nil, bundle: nil)
embed(IntroViewController())
let navigationController = NavigationController(rootViewController: IntroViewController())
embed(navigationController)
}
// MARK: Status Bar
override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent }
override var childForStatusBarStyle: UIViewController? { return nil }
// MARK: Boilerplate
@available(*, unavailable)
required init(coder: NSCoder) {
let className = String(describing: type(of: self))
......
......@@ -20,10 +20,15 @@
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Black Highlighter accesses your photo library to open photos for redaction and to save redacted photos.</string>
<key>UIAppFonts</key>
<array>
<string>Aleo-Bold.otf</string>
<string>Aleo-Regular.otf</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
......
......@@ -11,7 +11,7 @@ class IntroView: UIView {
super.init(frame: .zero)
backgroundColor = .white
backgroundColor = .primary
addSubview(promptLabel)
addSubview(promptButton)
......
......@@ -7,6 +7,7 @@ import UIKit
class IntroViewController: UIViewController {
init() {
super.init(nibName: nil, bundle: nil)
navigationItem.title = IntroViewController.navigationItemTitle
}
override func loadView() {
......@@ -21,6 +22,10 @@ class IntroViewController: UIViewController {
print("permission requested")
}
// MARK: Boilerplate
private static let navigationItemTitle = NSLocalizedString("IntroViewController.navigationItemTitle", comment: "Navigation title for the intro view")
@available(*, unavailable)
required init(coder: NSCoder) {
let className = String(describing: type(of: self))
......
......@@ -6,7 +6,11 @@ import UIKit
class PromptButton: UIButton {
init(title string: String) {
super.init(frame: .zero)
setTitleColor(tintColor, for: .normal)
titleLabel?.font = .appFont(forTextStyle: .headline)
titleLabel?.adjustsFontForContentSizeCategory = true
setTitleColor(.white, for: .normal)
setTitle(string, for: .normal)
translatesAutoresizingMaskIntoConstraints = false
}
......
......@@ -7,8 +7,11 @@ class PromptLabel: UILabel {
init(text string: String) {
super.init(frame: .zero)
adjustsFontForContentSizeCategory = true
font = .appFont(forTextStyle: .body)
numberOfLines = 0
text = string
textColor = .primaryExtraLight
translatesAutoresizingMaskIntoConstraints = false
}
......
......@@ -6,5 +6,6 @@
Copyright © 2019 Cocoatype, LLC. All rights reserved.
*/
"IntroViewController.navigationItemTitle" = "Welcome";
"IntroView.promptLabelText" = "Black Highlighter needs permission to edit your photos.";
"IntroView.promptButtonTitle" = "Grant Access";
// Created by Geoff Pado on 4/3/19.
// Copyright © 2019 Cocoatype, LLC. All rights reserved.
import UIKit
class NavigationController: UINavigationController {
override init(rootViewController: UIViewController) {
super.init(rootViewController: rootViewController)
navigationBar.barTintColor = .primaryDark
navigationBar.isTranslucent = false
navigationBar.tintColor = .white
navigationBar.titleTextAttributes = [
.font: UIFont.appFont(forTextStyle: .headline),
.foregroundColor: UIColor.white
]
}
// MARK: Boilerplate
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nil, bundle: nil)
}
@available(*, unavailable)
required init(coder: NSCoder) {
let className = String(describing: type(of: self))
fatalError("\(className) does not implement init(coder:)")
}
}
// Created by Geoff Pado on 4/3/19.
// Copyright © 2019 Cocoatype, LLC. All rights reserved.
import UIKit
extension UIColor {
static let primaryExtraLight = UIColor(hexLiteral: 0x878787)
static let primaryLight = UIColor(hexLiteral: 0x484848)
static let primary = UIColor(hexLiteral: 0x212121)
static let primaryDark = UIColor(hexLiteral: 0x1b1b1b)
convenience init(hexLiteral hex: Int) {
let red = CGFloat((hex & 0xFF0000) >> 16)
let green = CGFloat((hex & 0x00FF00) >> 8)
let blue = CGFloat((hex & 0x0000FF) >> 0)
self.init(red: red / 255,
green: green / 255,
blue: blue / 255,
alpha: 1.0)
}
}
// Created by Geoff Pado on 4/3/19.
// Copyright © 2019 Cocoatype, LLC. All rights reserved.
import UIKit
extension UIFont {
class func appFont(forTextStyle textStyle: UIFont.TextStyle) -> UIFont {
let fontMetrics = UIFontMetrics(forTextStyle: textStyle)
guard textStyle != .headline else { return fontMetrics.scaledFont(for: boldFont) }
return fontMetrics.scaledFont(for: regularFont)
}
// MARK: Boilerplate
private static let boldFontName = "Aleo-Bold"
private static let regularFontName = "Aleo-Regular"
private static var boldFont: UIFont {
guard let appFont = UIFont(name: UIFont.boldFontName, size: 17.0) else {
fatalError("Couldn't get bold font")
}
return appFont
}
private static var regularFont: UIFont {
guard let appFont = UIFont(name: UIFont.regularFontName, size: 17.0) else {
fatalError("Couldn't get regular font")
}
return appFont
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment