Verified Commit 5427dd89 authored by Geoff Pado's avatar Geoff Pado

Display settings page when button is clicked

parent de9cd0f3
......@@ -36,6 +36,7 @@
043CD9D1226EB0F60012F5AE /* UIImageExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 043CD9D0226EB0F60012F5AE /* UIImageExtensions.swift */; };
043CD9D62275316E0012F5AE /* PhotoEditingScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 043CD9D52275316E0012F5AE /* PhotoEditingScrollView.swift */; };
043CD9D8227531DF0012F5AE /* PhotoEditingObservationVisualizationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 043CD9D7227531DF0012F5AE /* PhotoEditingObservationVisualizationView.swift */; };
043CD9DB22753D510012F5AE /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 043CD9DA22753D510012F5AE /* SettingsViewController.swift */; };
047072932268134500FF20B6 /* PhotoEditingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047072922268134500FF20B6 /* PhotoEditingView.swift */; };
047072952268137900FF20B6 /* PhotoEditingImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047072942268137900FF20B6 /* PhotoEditingImageView.swift */; };
048909F2226571AB0048E203 /* PhotoEditingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048909F1226571AB0048E203 /* PhotoEditingViewController.swift */; };
......@@ -92,6 +93,7 @@
043CD9D0226EB0F60012F5AE /* UIImageExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIImageExtensions.swift; sourceTree = "<group>"; };
043CD9D52275316E0012F5AE /* PhotoEditingScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoEditingScrollView.swift; sourceTree = "<group>"; };
043CD9D7227531DF0012F5AE /* PhotoEditingObservationVisualizationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoEditingObservationVisualizationView.swift; sourceTree = "<group>"; };
043CD9DA22753D510012F5AE /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = "<group>"; };
047072922268134500FF20B6 /* PhotoEditingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoEditingView.swift; sourceTree = "<group>"; };
047072942268137900FF20B6 /* PhotoEditingImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoEditingImageView.swift; sourceTree = "<group>"; };
048909F1226571AB0048E203 /* PhotoEditingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoEditingViewController.swift; sourceTree = "<group>"; };
......@@ -147,6 +149,7 @@
04D68BC3225EE2A500D09BBD /* Extensions */,
048909EF2265716B0048E203 /* Photo Editing */,
041EFF6C225C38600058D8EE /* Photo Selection */,
043CD9D922753D450012F5AE /* Settings */,
041EFF532255A0930058D8EE /* Style */,
048909F0226571830048E203 /* Supporting Files */,
);
......@@ -219,6 +222,14 @@
path = "Text Detection";
sourceTree = "<group>";
};
043CD9D922753D450012F5AE /* Settings */ = {
isa = PBXGroup;
children = (
043CD9DA22753D510012F5AE /* SettingsViewController.swift */,
);
path = Settings;
sourceTree = "<group>";
};
048909EF2265716B0048E203 /* Photo Editing */ = {
isa = PBXGroup;
children = (
......@@ -409,6 +420,7 @@
043CD9CF226EB0C70012F5AE /* DetectedTextObservation.swift in Sources */,
047072932268134500FF20B6 /* PhotoEditingView.swift in Sources */,
041EFF6B225C36350058D8EE /* PhotoLibraryViewController.swift in Sources */,
043CD9DB22753D510012F5AE /* SettingsViewController.swift in Sources */,
041EFF70225C3D830058D8EE /* PhotoLibraryView.swift in Sources */,
043CD9C9226EB0400012F5AE /* TextRectangleDetector.swift in Sources */,
048909F2226571AB0048E203 /* PhotoEditingViewController.swift in Sources */,
......
......@@ -8,12 +8,12 @@ class AppViewController: UIViewController, PhotoEditorPresenting {
init() {
super.init(nibName: nil, bundle: nil)
UIView.appearance().tintColor = .primary
let navigationController = NavigationController(rootViewController: PhotoSelectionViewController())
embed(navigationController)
}
// MARK: Photo Editing View Controller
func presentPhotoEditingViewController(for asset: PHAsset) {
let navigationController = NavigationController(rootViewController: PhotoEditingViewController(asset: asset))
present(navigationController, animated: true)
......@@ -27,6 +27,21 @@ class AppViewController: UIViewController, PhotoEditorPresenting {
}
}
// MARK: Settings View Controller
@objc func presentSettingsViewController() {
let navigationController = NavigationController(rootViewController: SettingsViewController())
present(navigationController, animated: true)
}
@objc func dismissSettingsViewController() {
if let presentedNavigationController = (presentedViewController as? NavigationController),
let rootViewController = presentedNavigationController.viewControllers.first,
rootViewController is SettingsViewController {
dismiss(animated: true)
}
}
// MARK: Status Bar
override var childForStatusBarStyle: UIViewController? { return children.first }
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "739-question-toolbar.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "739-question-toolbar@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "739-question-toolbar@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
\ No newline at end of file
......@@ -9,6 +9,7 @@ class PhotoSelectionViewController: UIViewController {
super.init(nibName: nil, bundle: nil)
navigationItem.title = PhotoSelectionViewController.navigationItemTitle
navigationItem.rightBarButtonItem = settingsBarButtonItem
embed(initialViewController)
}
......@@ -26,9 +27,16 @@ class PhotoSelectionViewController: UIViewController {
// MARK: Boilerplate
private static let navigationItemTitle = NSLocalizedString("PhotoSelectionViewController.navigationItemTitle", comment: "Navigation title for the photo selector")
private static let settingsButtonAccessibilityLabel = NSLocalizedString("PhotoSelectionViewController.settingsButtonAccessibilityLabel", comment: "Accessibility label for the button to get to settings")
private var permissionsRequester: PhotoPermissionsRequester
private lazy var settingsBarButtonItem: UIBarButtonItem = {
let barButtonItem = UIBarButtonItem(image: UIImage(named: "Help"), style: .plain, target: nil, action: #selector(AppViewController.presentSettingsViewController))
barButtonItem.accessibilityLabel = PhotoSelectionViewController.settingsButtonAccessibilityLabel
return barButtonItem
}()
@available(*, unavailable)
required init(coder: NSCoder) {
let className = String(describing: type(of: self))
......
// Created by Geoff Pado on 4/27/19.
// Copyright © 2019 Cocoatype, LLC. All rights reserved.
import UIKit
class SettingsViewController: UIViewController {
init() {
super.init(nibName: nil, bundle: nil)
}
override func loadView() {
view = SettingsTableView()
}
// MARK: Boilerplate
@available(*, unavailable)
required init(coder: NSCoder) {
let className = String(describing: type(of: self))
fatalError("\(className) does not implement init(coder:)")
}
}
class SettingsTableView: UITableView {
init() {
super.init(frame: .zero, style: .grouped)
register(SettingsTableViewCell.self, forCellReuseIdentifier: SettingsTableViewCell.identifier)
}
// MARK: Boilerplate
@available(*, unavailable)
required init(coder: NSCoder) {
let className = String(describing: type(of: self))
fatalError("\(className) does not implement init(coder:)")
}
}
class SettingsTableViewCell: UITableViewCell {
static let identifier = "SettingsTableViewCell.identifier"
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: .value1, reuseIdentifier: SettingsTableViewCell.identifier)
}
// MARK: Boilerplate
@available(*, unavailable)
required init(coder: NSCoder) {
let className = String(describing: type(of: self))
fatalError("\(className) does not implement init(coder:)")
}
}
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