diff --git a/CapCollector.xcodeproj/project.pbxproj b/CapCollector.xcodeproj/project.pbxproj
index e089aac..7361e2b 100644
--- a/CapCollector.xcodeproj/project.pbxproj
+++ b/CapCollector.xcodeproj/project.pbxproj
@@ -245,7 +245,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0940;
- LastUpgradeCheck = 0940;
+ LastUpgradeCheck = 1200;
ORGANIZATIONNAME = CH;
TargetAttributes = {
CE56CEC9209D81DD00932C01 = {
@@ -384,6 +384,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -409,7 +410,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 11.4;
+ IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -444,6 +445,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -463,7 +465,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 11.4;
+ IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
@@ -480,7 +482,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = H8WR4M6QQ4;
INFOPLIST_FILE = CapCollector/Info.plist;
- IPHONEOS_DEPLOYMENT_TARGET = 13.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@@ -503,7 +505,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = H8WR4M6QQ4;
INFOPLIST_FILE = CapCollector/Info.plist;
- IPHONEOS_DEPLOYMENT_TARGET = 13.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
diff --git a/CapCollector.xcodeproj/project.xcworkspace/xcuserdata/imac.xcuserdatad/UserInterfaceState.xcuserstate b/CapCollector.xcodeproj/project.xcworkspace/xcuserdata/imac.xcuserdatad/UserInterfaceState.xcuserstate
index 4385934..b15d0c8 100644
Binary files a/CapCollector.xcodeproj/project.xcworkspace/xcuserdata/imac.xcuserdatad/UserInterfaceState.xcuserstate and b/CapCollector.xcodeproj/project.xcworkspace/xcuserdata/imac.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/CapCollector.xcodeproj/xcuserdata/imac.xcuserdatad/xcschemes/xcschememanagement.plist b/CapCollector.xcodeproj/xcuserdata/imac.xcuserdatad/xcschemes/xcschememanagement.plist
index da0faea..30f9840 100644
--- a/CapCollector.xcodeproj/xcuserdata/imac.xcuserdatad/xcschemes/xcschememanagement.plist
+++ b/CapCollector.xcodeproj/xcuserdata/imac.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -9,6 +9,27 @@
orderHint
0
+ SQLite (Playground) 1.xcscheme
+
+ isShown
+
+ orderHint
+ 2
+
+ SQLite (Playground) 2.xcscheme
+
+ isShown
+
+ orderHint
+ 3
+
+ SQLite (Playground).xcscheme
+
+ isShown
+
+ orderHint
+ 1
+
diff --git a/CapCollector/AppDelegate.swift b/CapCollector/AppDelegate.swift
index a45792a..3750df9 100644
--- a/CapCollector/AppDelegate.swift
+++ b/CapCollector/AppDelegate.swift
@@ -60,7 +60,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}
}
- let serverUrl = URL(string: "https://cc.ssl443.org")!
+ let serverUrl = URL(string: "https://christophhagen.de")!
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
app = self
diff --git a/CapCollector/Base.lproj/Main.storyboard b/CapCollector/Base.lproj/Main.storyboard
index 9b4a01e..5f90789 100644
--- a/CapCollector/Base.lproj/Main.storyboard
+++ b/CapCollector/Base.lproj/Main.storyboard
@@ -1,9 +1,11 @@
-
+
-
+
+
+
@@ -21,7 +23,7 @@
-
+
@@ -60,6 +62,7 @@
+
@@ -73,7 +76,6 @@
-
@@ -97,7 +99,7 @@
-
+
@@ -114,7 +116,7 @@
-
+
@@ -124,7 +126,7 @@
-
+
@@ -231,62 +233,70 @@
-
+
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
+
-
+
+
+
+
-
+
+
-
-
-
+
+
+
+
+
+
+
+
+
-
-
@@ -309,14 +319,14 @@
-
+
+
-
@@ -341,7 +351,7 @@
-
+
@@ -359,7 +369,7 @@
-
+
@@ -397,7 +407,23 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CapCollector/Capture/CameraController.swift b/CapCollector/Capture/CameraController.swift
index a17d720..a7773f5 100644
--- a/CapCollector/Capture/CameraController.swift
+++ b/CapCollector/Capture/CameraController.swift
@@ -24,8 +24,6 @@ class CameraController: UIViewController {
@IBOutlet weak var cropView: CropView!
@IBOutlet weak var cancelButton: UIButton!
-
- @IBOutlet weak var bottomBar: UIView!
@IBOutlet weak var cameraView: CameraView! {
didSet {
@@ -67,9 +65,7 @@ class CameraController: UIViewController {
super.viewWillAppear(animated)
cameraView.delegate = self
- imageButton.imageView?.image = UIImage.templateImage(named: "camera")
- setTintColor()
-
+
cameraView.launch { success, error in
guard let err = error else {
return
@@ -88,27 +84,6 @@ class CameraController: UIViewController {
cameraView.complete()
}
- private func setTintColor() {
- let blur = UIBlurEffect(style: .systemThinMaterial)
- let a = UIVisualEffectView(effect: blur)
- a.translatesAutoresizingMaskIntoConstraints = false
- bottomBar.backgroundColor = nil
- bottomBar.insertSubview(a, at: 0)
- //bottomBar.addSubview(a)
- let t = bottomBar.topAnchor.constraint(equalTo: a.topAnchor)
- let b = bottomBar.bottomAnchor.constraint(equalTo: a.bottomAnchor)
- let l = bottomBar.leadingAnchor.constraint(equalTo: a.leadingAnchor)
- let r = bottomBar.trailingAnchor.constraint(equalTo: a.trailingAnchor)
- bottomBar.addConstraints([t,b,l,r])
- //let tint = AppDelegate.tintColor
- //cropView.lineColor = tint
- //imageButton.borderColor = tint
- imageButton.imageView?.tintColor = .systemBlue
-
- //cancelButton.borderColor = tint
- //cancelButton.set(template: "cancel", with: tint)
- }
-
private func giveFeedback(_ style: UIImpactFeedbackGenerator.FeedbackStyle) {
let generator = UIImpactFeedbackGenerator(style: style)
generator.impactOccurred()
diff --git a/CapCollector/Presentation/SearchAndDisplayAccessory.swift b/CapCollector/Presentation/SearchAndDisplayAccessory.swift
index e63b214..0e8917d 100644
--- a/CapCollector/Presentation/SearchAndDisplayAccessory.swift
+++ b/CapCollector/Presentation/SearchAndDisplayAccessory.swift
@@ -33,22 +33,24 @@ class SearchAndDisplayAccessory: PassthroughView {
// MARK: - Outlets
- @IBOutlet weak var newImageView: PassthroughView!
-
@IBOutlet weak var capImage: RoundedImageView!
@IBOutlet weak var saveButton: UIButton!
- @IBOutlet weak var deleteButton: UIButton!
-
@IBOutlet weak var cameraButton: UIButton!
@IBOutlet weak var searchBar: UISearchBar!
+ @IBOutlet weak var imageHeightContraint: NSLayoutConstraint!
+
// MARK: - Actions
@IBAction func cameraButtonPressed() {
- delegate?.capAccessoryCameraButtonPressed()
+ if isShowingCapImage {
+ discardImage()
+ } else {
+ delegate?.capAccessoryCameraButtonPressed()
+ }
}
@IBAction func saveButtonPressed() {
@@ -57,24 +59,20 @@ class SearchAndDisplayAccessory: PassthroughView {
}
}
- @IBAction func cancelButtonPressed() {
- discardImage()
- }
-
// MARK: - Variables
var view: UIView?
- weak var blurView: UIVisualEffectView?
-
- weak var currentBlurContraint: NSLayoutConstraint?
-
weak var delegate: CapAccessoryDelegate?
var currentImage: UIImage? {
capImage.image
}
+ var isShowingCapImage: Bool {
+ capImage.image != nil
+ }
+
// MARK: - Setup
convenience init(width: CGFloat) {
@@ -98,29 +96,11 @@ class SearchAndDisplayAccessory: PassthroughView {
//view!.autoresizingMask = .flexibleHeight
addSubview(view!)
- let blur = UIBlurEffect(style: .systemThinMaterial)
- let blurView = UIVisualEffectView(effect: blur)
- self.blurView = blurView
- blurView.translatesAutoresizingMaskIntoConstraints = false
- blurView.isUserInteractionEnabled = false
- insertSubview(blurView, at: 0)
-
- let t = searchBar.topAnchor.constraint(equalTo: blurView.topAnchor)
- let b = searchBar.bottomAnchor.constraint(equalTo: blurView.bottomAnchor)
- let l = leadingAnchor.constraint(equalTo: blurView.leadingAnchor)
- let r = trailingAnchor.constraint(equalTo: blurView.trailingAnchor)
- addConstraints([t, b, l, r])
-
- currentBlurContraint = t
-
- self.newImageView.alpha = 0
- self.newImageView.isHidden = true
+ hideImageView()
searchBar.text = nil
searchBar.setShowsCancelButton(false, animated: false)
searchBar.delegate = self
-
- cameraButton.setImage(UIImage.templateImage(named: "camera_square"), for: .normal)
}
// MARK: Search bar
@@ -132,15 +112,14 @@ class SearchAndDisplayAccessory: PassthroughView {
// MARK: Cap image
- func showImageView(with image: UIImage, isUnlocked: Bool) {
+ func showImageView(with image: UIImage) {
capImage.image = image
+ cameraButton.setImage(UIImage(systemName: "xmark"), for: .normal)
- saveButton.isHidden = !isUnlocked
- saveButton.isEnabled = isUnlocked
- let text = isUnlocked ? "Delete" : "Clear image"
- deleteButton.setTitle(text, for: .normal)
-
- showImageView()
+ imageHeightContraint.constant = 90
+ capImage.alpha = 1
+ capImage.isHidden = false
+ saveButton.isHidden = false
}
func discardImage() {
@@ -152,24 +131,13 @@ class SearchAndDisplayAccessory: PassthroughView {
}
func hideImageView() {
- currentBlurContraint?.isActive = false
- let t = searchBar.topAnchor.constraint(equalTo: blurView!.topAnchor)
- addConstraint(t)
- currentBlurContraint = t
+ capImage.image = nil
+ cameraButton.setImage(UIImage(systemName: "camera"), for: .normal)
- self.newImageView.alpha = 0
- self.newImageView.isHidden = true
- self.capImage.image = nil
- }
-
- private func showImageView() {
- currentBlurContraint?.isActive = false
- let t = blurView!.topAnchor.constraint(equalTo: saveButton.topAnchor, constant: -8)
- addConstraint(t)
- currentBlurContraint = t
-
- self.newImageView.isHidden = false
- self.newImageView.alpha = 1
+ //imageHeightContraint.constant = 0
+ capImage.alpha = 0
+ capImage.isHidden = true
+ saveButton.isHidden = true
}
}
diff --git a/CapCollector/Presentation/SearchAndDisplayAccessory.xib b/CapCollector/Presentation/SearchAndDisplayAccessory.xib
index 464ef77..60b535f 100644
--- a/CapCollector/Presentation/SearchAndDisplayAccessory.xib
+++ b/CapCollector/Presentation/SearchAndDisplayAccessory.xib
@@ -1,9 +1,11 @@
-
+
-
+
+
+
@@ -11,8 +13,7 @@
-
-
+
@@ -22,96 +23,90 @@
+
+
+
+
+
+
+
+
-
-
+
+
Title
Title
-
+
+
+
+
+
+
-
+
+
+
+
+
-
-
+
-
+
-
-
+
-
+
+
+
+
diff --git a/CapCollector/TableView.swift b/CapCollector/TableView.swift
index 91c59e5..fd7f2b6 100644
--- a/CapCollector/TableView.swift
+++ b/CapCollector/TableView.swift
@@ -198,8 +198,8 @@ class TableView: UITableViewController {
private func updateNavigationItemTitleView() {
DispatchQueue.main.async {
- self.titleLabel.text = self.titleText
- self.subtitleLabel.text = self.subtitleText
+ self.titleLabel?.text = self.titleText
+ self.subtitleLabel?.text = self.subtitleText
}
}
@@ -249,7 +249,7 @@ class TableView: UITableViewController {
return
}
let thumbnail = Cap.thumbnail(for: image)
- app.storage.save(thumbnail: thumbnail, for: id)
+ _ = app.storage.save(thumbnail: thumbnail, for: id)
}
if group.wait(timeout: .now() + .seconds(30)) != .success {
self.log("Timed out waiting for thumbnails to be generated")
@@ -302,7 +302,7 @@ class TableView: UITableViewController {
guard let color = image.averageColor(context: context) else {
return
}
- app.database.set(color: color, for: id)
+ _ = app.database.set(color: color, for: id)
}
if group.wait(timeout: .now() + .seconds(30)) != .success {
self.log("Timed out waiting for colors to be generated")
@@ -812,7 +812,7 @@ extension TableView: CameraControllerDelegate {
func didCapture(image: UIImage) {
guard let cap = capToAddImageTo else {
- accessory!.showImageView(with: image, isUnlocked: isUnlocked)
+ accessory!.showImageView(with: image)
classify(image: image)
return
}
@@ -1063,6 +1063,9 @@ extension TableView: CapAccessoryDelegate {
}
func capAccessory(shouldSave image: UIImage) {
+ guard isUnlocked else {
+ return
+ }
saveNewCap(for: image)
}