diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b52caf8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ + +/build/* +/Pods/* +Podfile.lock diff --git a/CapCollector.xcodeproj/project.pbxproj b/CapCollector.xcodeproj/project.pbxproj index 0ce0b2e..7d91419 100644 --- a/CapCollector.xcodeproj/project.pbxproj +++ b/CapCollector.xcodeproj/project.pbxproj @@ -8,6 +8,14 @@ /* Begin PBXBuildFile section */ 043EC7C35065DD26F6BB496F /* Pods_CapCollector.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86546C4DAB5E47A540F6E8DD /* Pods_CapCollector.framework */; }; + 5904C33A2199C9FA0046A573 /* SortController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5904C3392199C9FA0046A573 /* SortController.swift */; }; + 5904C33C2199D0260046A573 /* AlwaysShowPopup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5904C33B2199D0260046A573 /* AlwaysShowPopup.swift */; }; + 591252EE21A837FB005B1179 /* Squeezenet.mlmodel in Sources */ = {isa = PBXBuildFile; fileRef = 591252EB21A837FB005B1179 /* Squeezenet.mlmodel */; }; + 591252F021A837FB005B1179 /* Resnet.mlmodel in Sources */ = {isa = PBXBuildFile; fileRef = 591252ED21A837FB005B1179 /* Resnet.mlmodel */; }; + 59158B1621E37B0200D90CB0 /* GridViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59158B1521E37B0200D90CB0 /* GridViewController.swift */; }; + 59158B1821E4C9AC00D90CB0 /* NavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59158B1721E4C9AC00D90CB0 /* NavigationController.swift */; }; + 591832CE21A2A97E00E5987D /* Cap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 591832CD21A2A97E00E5987D /* Cap.swift */; }; + 598D60E221B6B4D200C7473E /* ImageClassifier.mlmodel in Sources */ = {isa = PBXBuildFile; fileRef = 598D60E121B6B4D200C7473E /* ImageClassifier.mlmodel */; }; 59C1BBA92174CBB800EC84BB /* SettingsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59C1BBA82174CBB800EC84BB /* SettingsController.swift */; }; 59C1BBAB21762D9600EC84BB /* UserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59C1BBAA21762D9600EC84BB /* UserDefaults.swift */; }; CE56CECE209D81DE00932C01 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE56CECD209D81DE00932C01 /* AppDelegate.swift */; }; @@ -15,9 +23,6 @@ CE56CED5209D81E000932C01 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CE56CED4209D81E000932C01 /* Assets.xcassets */; }; CE56CED8209D81E000932C01 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CE56CED6209D81E000932C01 /* LaunchScreen.storyboard */; }; CE56CEF8209D83B800932C01 /* CapCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE56CEE0209D83B200932C01 /* CapCell.swift */; }; - CE56CEF9209D83B800932C01 /* CapImages.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE56CEE1209D83B200932C01 /* CapImages.swift */; }; - CE56CEFA209D83B800932C01 /* CapNames.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE56CEE2209D83B200932C01 /* CapNames.swift */; }; - CE56CEFC209D83B800932C01 /* DropboxUpload.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE56CEE4209D83B300932C01 /* DropboxUpload.swift */; }; CE56CEFD209D83B800932C01 /* NameFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE56CEE5209D83B300932C01 /* NameFile.swift */; }; CE56CEFE209D83B800932C01 /* RoundedButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE56CEE6209D83B300932C01 /* RoundedButton.swift */; }; CE56CEFF209D83B800932C01 /* CameraController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE56CEE7209D83B300932C01 /* CameraController.swift */; }; @@ -33,16 +38,21 @@ CE56CF09209D83B800932C01 /* Classifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE56CEF1209D83B500932C01 /* Classifier.swift */; }; CE56CF0A209D83B800932C01 /* CropView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE56CEF2209D83B600932C01 /* CropView.swift */; }; CE56CF0B209D83B800932C01 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE56CEF3209D83B600932C01 /* Logger.swift */; }; - CE56CF0C209D83B800932C01 /* DropboxDownload.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE56CEF4209D83B600932C01 /* DropboxDownload.swift */; }; CE56CF0D209D83B800932C01 /* ImageSelector.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE56CEF5209D83B600932C01 /* ImageSelector.swift */; }; CE56CF0E209D83B800932C01 /* PhotoCaptureHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE56CEF6209D83B700932C01 /* PhotoCaptureHandler.swift */; }; CE56CF0F209D83B800932C01 /* UIImageExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE56CEF7209D83B700932C01 /* UIImageExtensions.swift */; }; - CEF38744209D8476001C8D3C /* Resnet.mlmodel in Sources */ = {isa = PBXBuildFile; fileRef = CEF38742209D8476001C8D3C /* Resnet.mlmodel */; }; - CEF38745209D8476001C8D3C /* Squeezenet.mlmodel in Sources */ = {isa = PBXBuildFile; fileRef = CEF38743209D8476001C8D3C /* Squeezenet.mlmodel */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 342A23CD7996DA1E7039C097 /* Pods-CapCollector.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CapCollector.release.xcconfig"; path = "Pods/Target Support Files/Pods-CapCollector/Pods-CapCollector.release.xcconfig"; sourceTree = ""; }; + 5904C3392199C9FA0046A573 /* SortController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SortController.swift; sourceTree = ""; }; + 5904C33B2199D0260046A573 /* AlwaysShowPopup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlwaysShowPopup.swift; sourceTree = ""; }; + 591252EB21A837FB005B1179 /* Squeezenet.mlmodel */ = {isa = PBXFileReference; lastKnownFileType = file.mlmodel; name = Squeezenet.mlmodel; path = ../../../../Dropbox/Models/Squeezenet.mlmodel; sourceTree = ""; }; + 591252ED21A837FB005B1179 /* Resnet.mlmodel */ = {isa = PBXFileReference; lastKnownFileType = file.mlmodel; name = Resnet.mlmodel; path = ../../../../Dropbox/Models/Resnet.mlmodel; sourceTree = ""; }; + 59158B1521E37B0200D90CB0 /* GridViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GridViewController.swift; sourceTree = ""; }; + 59158B1721E4C9AC00D90CB0 /* NavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationController.swift; sourceTree = ""; }; + 591832CD21A2A97E00E5987D /* Cap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Cap.swift; sourceTree = ""; }; + 598D60E121B6B4D200C7473E /* ImageClassifier.mlmodel */ = {isa = PBXFileReference; lastKnownFileType = file.mlmodel; name = ImageClassifier.mlmodel; path = ../../../../Dropbox/Models/ImageClassifier.mlmodel; sourceTree = ""; }; 59C1BBA82174CBB800EC84BB /* SettingsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsController.swift; sourceTree = ""; }; 59C1BBAA21762D9600EC84BB /* UserDefaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaults.swift; sourceTree = ""; }; 86546C4DAB5E47A540F6E8DD /* Pods_CapCollector.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CapCollector.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -53,9 +63,6 @@ CE56CED7209D81E000932C01 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; CE56CED9209D81E000932C01 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; CE56CEE0209D83B200932C01 /* CapCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CapCell.swift; sourceTree = ""; }; - CE56CEE1209D83B200932C01 /* CapImages.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CapImages.swift; sourceTree = ""; }; - CE56CEE2209D83B200932C01 /* CapNames.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CapNames.swift; sourceTree = ""; }; - CE56CEE4209D83B300932C01 /* DropboxUpload.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DropboxUpload.swift; sourceTree = ""; }; CE56CEE5209D83B300932C01 /* NameFile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NameFile.swift; sourceTree = ""; }; CE56CEE6209D83B300932C01 /* RoundedButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RoundedButton.swift; sourceTree = ""; }; CE56CEE7209D83B300932C01 /* CameraController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CameraController.swift; sourceTree = ""; }; @@ -71,13 +78,9 @@ CE56CEF1209D83B500932C01 /* Classifier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Classifier.swift; sourceTree = ""; }; CE56CEF2209D83B600932C01 /* CropView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CropView.swift; sourceTree = ""; }; CE56CEF3209D83B600932C01 /* Logger.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = ""; }; - CE56CEF4209D83B600932C01 /* DropboxDownload.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DropboxDownload.swift; sourceTree = ""; }; CE56CEF5209D83B600932C01 /* ImageSelector.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageSelector.swift; sourceTree = ""; }; CE56CEF6209D83B700932C01 /* PhotoCaptureHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoCaptureHandler.swift; sourceTree = ""; }; CE56CEF7209D83B700932C01 /* UIImageExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIImageExtensions.swift; sourceTree = ""; }; - CE92CA6120CAD38600D5DAA4 /* Xcode.mlmodel */ = {isa = PBXFileReference; lastKnownFileType = file.mlmodel; path = Xcode.mlmodel; sourceTree = ""; }; - CEF38742209D8476001C8D3C /* Resnet.mlmodel */ = {isa = PBXFileReference; lastKnownFileType = file.mlmodel; name = Resnet.mlmodel; path = ../../../../Dropbox/Models/Resnet.mlmodel; sourceTree = ""; }; - CEF38743209D8476001C8D3C /* Squeezenet.mlmodel */ = {isa = PBXFileReference; lastKnownFileType = file.mlmodel; name = Squeezenet.mlmodel; path = ../../../../Dropbox/Models/Squeezenet.mlmodel; sourceTree = ""; }; DBD72193E502C23E06DA913D /* Pods-CapCollector.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CapCollector.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CapCollector/Pods-CapCollector.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -102,6 +105,16 @@ name = Pods; sourceTree = ""; }; + 591252E921A837B4005B1179 /* Models */ = { + isa = PBXGroup; + children = ( + 591252ED21A837FB005B1179 /* Resnet.mlmodel */, + 591252EB21A837FB005B1179 /* Squeezenet.mlmodel */, + 598D60E121B6B4D200C7473E /* ImageClassifier.mlmodel */, + ); + name = Models; + sourceTree = ""; + }; 9EAE4B3CEE704AF443897B44 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -132,10 +145,9 @@ isa = PBXGroup; children = ( CE56CECD209D81DE00932C01 /* AppDelegate.swift */, - CEF38742209D8476001C8D3C /* Resnet.mlmodel */, - CEF38743209D8476001C8D3C /* Squeezenet.mlmodel */, - CE92CA6120CAD38600D5DAA4 /* Xcode.mlmodel */, + CE56CED1209D81DE00932C01 /* Main.storyboard */, CE56CEF1209D83B500932C01 /* Classifier.swift */, + 591252E921A837B4005B1179 /* Models */, CEF3874D209D9378001C8D3C /* Capture */, CEF3874E209D9390001C8D3C /* Sync */, CEF38750209D93D1001C8D3C /* Data */, @@ -143,8 +155,6 @@ CEF3874F209D93A6001C8D3C /* Presentation */, CEF3874C209D935E001C8D3C /* Extensions */, CE56CEF3209D83B600932C01 /* Logger.swift */, - CE56CED1209D81DE00932C01 /* Main.storyboard */, - 59C1BBA82174CBB800EC84BB /* SettingsController.swift */, CE56CEDF209D81FD00932C01 /* Support */, ); path = CapCollector; @@ -163,6 +173,7 @@ CEF3874B209D932E001C8D3C /* View Components */ = { isa = PBXGroup; children = ( + 5904C33B2199D0260046A573 /* AlwaysShowPopup.swift */, CE56CEF2209D83B600932C01 /* CropView.swift */, CE56CEEA209D83B400932C01 /* RoundedImageView.swift */, CE56CEE6209D83B300932C01 /* RoundedButton.swift */, @@ -195,8 +206,6 @@ isa = PBXGroup; children = ( CE56CEE9209D83B400932C01 /* DropBoxController.swift */, - CE56CEF4209D83B600932C01 /* DropboxDownload.swift */, - CE56CEE4209D83B300932C01 /* DropboxUpload.swift */, ); path = Sync; sourceTree = ""; @@ -205,9 +214,13 @@ isa = PBXGroup; children = ( CE56CEEB209D83B400932C01 /* TableView.swift */, + 59158B1721E4C9AC00D90CB0 /* NavigationController.swift */, CE56CEE0209D83B200932C01 /* CapCell.swift */, CE56CEF5209D83B600932C01 /* ImageSelector.swift */, CE56CEEF209D83B500932C01 /* ImageCell.swift */, + 59C1BBA82174CBB800EC84BB /* SettingsController.swift */, + 5904C3392199C9FA0046A573 /* SortController.swift */, + 59158B1521E37B0200D90CB0 /* GridViewController.swift */, ); path = Presentation; sourceTree = ""; @@ -215,9 +228,8 @@ CEF38750209D93D1001C8D3C /* Data */ = { isa = PBXGroup; children = ( - CE56CEE1209D83B200932C01 /* CapImages.swift */, 59C1BBAA21762D9600EC84BB /* UserDefaults.swift */, - CE56CEE2209D83B200932C01 /* CapNames.swift */, + 591832CD21A2A97E00E5987D /* Cap.swift */, CE56CEF0209D83B500932C01 /* DiskManager.swift */, CE56CEE5209D83B300932C01 /* NameFile.swift */, ); @@ -258,7 +270,12 @@ TargetAttributes = { CE56CEC9209D81DD00932C01 = { CreatedOnToolsVersion = 9.4; - LastSwiftMigration = 1000; + LastSwiftMigration = 1020; + SystemCapabilities = { + com.apple.BackgroundModes = { + enabled = 0; + }; + }; }; }; }; @@ -340,33 +357,35 @@ buildActionMask = 2147483647; files = ( 59C1BBA92174CBB800EC84BB /* SettingsController.swift in Sources */, + 591252EE21A837FB005B1179 /* Squeezenet.mlmodel in Sources */, CE56CF09209D83B800932C01 /* Classifier.swift in Sources */, + 5904C33A2199C9FA0046A573 /* SortController.swift in Sources */, CE56CF0B209D83B800932C01 /* Logger.swift in Sources */, CE56CF01209D83B800932C01 /* DropBoxController.swift in Sources */, CE56CF04209D83B800932C01 /* UIViewExtensions.swift in Sources */, + 59158B1821E4C9AC00D90CB0 /* NavigationController.swift in Sources */, + 591832CE21A2A97E00E5987D /* Cap.swift in Sources */, CE56CF08209D83B800932C01 /* DiskManager.swift in Sources */, CE56CF0F209D83B800932C01 /* UIImageExtensions.swift in Sources */, - CE56CEF9209D83B800932C01 /* CapImages.swift in Sources */, - CEF38745209D8476001C8D3C /* Squeezenet.mlmodel in Sources */, - CEF38744209D8476001C8D3C /* Resnet.mlmodel in Sources */, CE56CF03209D83B800932C01 /* TableView.swift in Sources */, + 59158B1621E37B0200D90CB0 /* GridViewController.swift in Sources */, CE56CEFD209D83B800932C01 /* NameFile.swift in Sources */, 59C1BBAB21762D9600EC84BB /* UserDefaults.swift in Sources */, CE56CECE209D81DE00932C01 /* AppDelegate.swift in Sources */, CE56CF0D209D83B800932C01 /* ImageSelector.swift in Sources */, + 598D60E221B6B4D200C7473E /* ImageClassifier.mlmodel in Sources */, CE56CEFF209D83B800932C01 /* CameraController.swift in Sources */, CE56CF05209D83B800932C01 /* ViewControllerExtensions.swift in Sources */, CE56CF0E209D83B800932C01 /* PhotoCaptureHandler.swift in Sources */, CE56CEFE209D83B800932C01 /* RoundedButton.swift in Sources */, - CE56CEFA209D83B800932C01 /* CapNames.swift in Sources */, CE56CF07209D83B800932C01 /* ImageCell.swift in Sources */, CE56CF00209D83B800932C01 /* UIAlertControllerExtensions.swift in Sources */, CE56CF06209D83B800932C01 /* CameraView.swift in Sources */, CE56CF0A209D83B800932C01 /* CropView.swift in Sources */, - CE56CF0C209D83B800932C01 /* DropboxDownload.swift in Sources */, + 5904C33C2199D0260046A573 /* AlwaysShowPopup.swift in Sources */, CE56CF02209D83B800932C01 /* RoundedImageView.swift in Sources */, - CE56CEFC209D83B800932C01 /* DropboxUpload.swift in Sources */, CE56CEF8209D83B800932C01 /* CapCell.swift in Sources */, + 591252F021A837FB005B1179 /* Resnet.mlmodel in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/CapCollector.xcodeproj/xcuserdata/christoph.xcuserdatad/xcschemes/xcschememanagement.plist b/CapCollector.xcodeproj/xcuserdata/christoph.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..6938457 --- /dev/null +++ b/CapCollector.xcodeproj/xcuserdata/christoph.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,19 @@ + + + + + SchemeUserState + + CapCollector.xcscheme + + orderHint + 3 + + CapCollector.xcscheme_^#shared#^_ + + orderHint + 3 + + + + diff --git a/CapCollector.xcworkspace/contents.xcworkspacedata b/CapCollector.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..2407818 --- /dev/null +++ b/CapCollector.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/CapCollector.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/CapCollector.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/CapCollector.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/CapCollector.xcworkspace/xcuserdata/christoph.xcuserdatad/IDEFindNavigatorScopes.plist b/CapCollector.xcworkspace/xcuserdata/christoph.xcuserdatad/IDEFindNavigatorScopes.plist new file mode 100644 index 0000000..5dd5da8 --- /dev/null +++ b/CapCollector.xcworkspace/xcuserdata/christoph.xcuserdatad/IDEFindNavigatorScopes.plist @@ -0,0 +1,5 @@ + + + + + diff --git a/CapCollector.xcworkspace/xcuserdata/christoph.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/CapCollector.xcworkspace/xcuserdata/christoph.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..ed9a9b4 --- /dev/null +++ b/CapCollector.xcworkspace/xcuserdata/christoph.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/CapCollector/AppDelegate.swift b/CapCollector/AppDelegate.swift index e4b0ebc..06b3acf 100644 --- a/CapCollector/AppDelegate.swift +++ b/CapCollector/AppDelegate.swift @@ -10,9 +10,29 @@ import UIKit import CoreData import SwiftyDropbox +var shouldLaunchCamera = false + @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { + + enum ShortcutIdentifier: String { + case first + // MARK: - Initializers + + init?(fullType: String) { + guard let last = fullType.components(separatedBy: ".").last else { return nil } + self.init(rawValue: last) + } + + // MARK: - Properties + + var type: String { + return Bundle.main.bundleIdentifier! + ".\(self.rawValue)" + } + } + + // MARK: - Static Properties /// Main tint color of the app static let tintColor = UIColor(red: 122/255, green: 155/255, blue: 41/255, alpha: 1) @@ -25,6 +45,37 @@ class AppDelegate: UIResponder, UIApplicationDelegate { DiskManager.setupOnFirstLaunch() return true } + + func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { + DropboxController.shared.handle(url: url) + return true + } + + private func handleShortCutItem(_ shortcutItem: UIApplicationShortcutItem) -> Bool { + event("Shortcut pressed") + shouldLaunchCamera = true + return true + } + + func applicationDidBecomeActive(_ application: UIApplication) { + Cap.uploadRemainingImages() + guard shouldLaunchCamera else { return } + shouldLaunchCamera = false + if let c = (frontmostViewController as? UINavigationController)?.topViewController as? TableView { + c.performSegue(withIdentifier: "showCamera", sender: nil) + } + } + + /* + Called when the user activates your application by selecting a shortcut on the home screen, except when + application(_:,willFinishLaunchingWithOptions:) or application(_:didFinishLaunchingWithOptions) returns `false`. + You should handle the shortcut in those callbacks and return `false` if possible. In that case, this + callback is used if your application is already launched in the background. + */ + func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) { + let handledShortCutItem = handleShortCutItem(shortcutItem) + completionHandler(handledShortCutItem) + } var frontmostViewController: UIViewController? { var controller = window?.rootViewController @@ -34,9 +85,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate { return controller } - func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { - DropboxController.shared.handle(url: url) - return true - } + } +extension AppDelegate: Logger { + static let logToken = "[AppDelegate]" + +} diff --git a/CapCollector/Base.lproj/Main.storyboard b/CapCollector/Base.lproj/Main.storyboard index 11b3307..9215c89 100644 --- a/CapCollector/Base.lproj/Main.storyboard +++ b/CapCollector/Base.lproj/Main.storyboard @@ -1,11 +1,11 @@ - + - + @@ -20,17 +20,42 @@ + + + + + + + + + + + + + + + + + + + - + - - - - - + + + + + + + + + + + + + - + @@ -78,10 +124,68 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -98,12 +202,30 @@ + + + + + + + + + + + + - + @@ -129,10 +251,13 @@ + + + @@ -221,7 +346,7 @@ - + @@ -352,6 +477,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -360,37 +636,47 @@ - + + - + - + + + + + + + + + + - - - + - + + + - - - - + + @@ -451,6 +736,14 @@ + + + + + + + +