-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDebugFlowController.swift
More file actions
56 lines (44 loc) · 1.9 KB
/
DebugFlowController.swift
File metadata and controls
56 lines (44 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// DebugFlowController.swift
// Pippin
//
// Created by Andrew McKnight on 4/5/17.
// Copyright © 2017 Two Ring Software. All rights reserved.
//
import Pippin
import UIKit
public enum DebugFlowError: Error {
case databaseExportError(message: String, underlyingError: Error)
case noAppsToImportDatabase
}
public class DebugFlowController: NSObject, DebugMenuPresenter {
private weak var presentingVC: UIViewController!
private var databaseFilename: String
private var debugWindow: DebugWindow?
public var environment: Environment?
private var assetBundle: Bundle?
private var buttonTintColor: UIColor
private var buttonStartLocation: CGPoint
var documentInteractionController: UIDocumentInteractionController!
public init(databaseFileName: String, assetBundle: Bundle? = nil, buttonTintColor: UIColor = .black, buttonStartLocation: CGPoint = .zero) {
self.databaseFilename = databaseFileName
self.assetBundle = assetBundle
self.buttonTintColor = buttonTintColor
self.buttonStartLocation = buttonStartLocation
super.init()
}
public func installViews(appControlPanel: UIView? = nil) {
debugWindow = DebugWindow(frame: UIScreen.main.bounds)
debugWindow?.windowLevel = WindowLevel.debugging.windowLevel()
debugWindow?.isHidden = false
debugWindow?.rootViewController = DebugViewController(delegate: self, environment: environment!, assetBundle: assetBundle, buttonTintColor: buttonTintColor, buttonStartLocation: buttonStartLocation, appControlPanel: appControlPanel)
}
}
extension DebugFlowController: DebugViewControllerDelegate {
func debugViewControllerDisplayedMenu(debugViewController: DebugViewController) {
debugWindow?.menuDisplayed = true
}
func debugViewControllerHidMenu(debugViewController: DebugViewController) {
debugWindow?.menuDisplayed = false
}
}