Settings menu, manual changes upload

This commit is contained in:
Christoph Hagen 2018-10-17 11:46:16 +02:00
parent 8ed9a6046d
commit bd63eb38e2
10 changed files with 401 additions and 139 deletions

View File

@ -8,6 +8,8 @@
/* Begin PBXBuildFile section */
043EC7C35065DD26F6BB496F /* Pods_CapCollector.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86546C4DAB5E47A540F6E8DD /* Pods_CapCollector.framework */; };
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 */; };
CE56CED3209D81DE00932C01 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CE56CED1209D81DE00932C01 /* Main.storyboard */; };
CE56CED5209D81E000932C01 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CE56CED4209D81E000932C01 /* Assets.xcassets */; };
@ -41,6 +43,8 @@
/* 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 = "<group>"; };
59C1BBA82174CBB800EC84BB /* SettingsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsController.swift; sourceTree = "<group>"; };
59C1BBAA21762D9600EC84BB /* UserDefaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaults.swift; sourceTree = "<group>"; };
86546C4DAB5E47A540F6E8DD /* Pods_CapCollector.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CapCollector.framework; sourceTree = BUILT_PRODUCTS_DIR; };
CE56CECA209D81DD00932C01 /* CapCollector.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CapCollector.app; sourceTree = BUILT_PRODUCTS_DIR; };
CE56CECD209D81DE00932C01 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@ -140,6 +144,7 @@
CEF3874C209D935E001C8D3C /* Extensions */,
CE56CEF3209D83B600932C01 /* Logger.swift */,
CE56CED1209D81DE00932C01 /* Main.storyboard */,
59C1BBA82174CBB800EC84BB /* SettingsController.swift */,
CE56CEDF209D81FD00932C01 /* Support */,
);
path = CapCollector;
@ -211,6 +216,7 @@
isa = PBXGroup;
children = (
CE56CEE1209D83B200932C01 /* CapImages.swift */,
59C1BBAA21762D9600EC84BB /* UserDefaults.swift */,
CE56CEE2209D83B200932C01 /* CapNames.swift */,
CE56CEF0209D83B500932C01 /* DiskManager.swift */,
CE56CEE5209D83B300932C01 /* NameFile.swift */,
@ -333,6 +339,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
59C1BBA92174CBB800EC84BB /* SettingsController.swift in Sources */,
CE56CF09209D83B800932C01 /* Classifier.swift in Sources */,
CE56CF0B209D83B800932C01 /* Logger.swift in Sources */,
CE56CF01209D83B800932C01 /* DropBoxController.swift in Sources */,
@ -344,6 +351,7 @@
CEF38744209D8476001C8D3C /* Resnet.mlmodel in Sources */,
CE56CF03209D83B800932C01 /* TableView.swift in Sources */,
CE56CEFD209D83B800932C01 /* NameFile.swift in Sources */,
59C1BBAB21762D9600EC84BB /* UserDefaults.swift in Sources */,
CE56CECE209D81DE00932C01 /* AppDelegate.swift in Sources */,
CE56CF0D209D83B800932C01 /* ImageSelector.swift in Sources */,
CE56CEFF209D83B800932C01 /* CameraController.swift in Sources */,

View File

@ -38,77 +38,5 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
DropboxController.shared.handle(url: url)
return true
}
/**
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
// Saves changes in the application's managed object context before the application terminates.
self.saveContext()
}
*/
// MARK: - Core Data stack
lazy var persistentContainer: NSPersistentContainer = {
/*
The persistent container for the application. This implementation
creates and returns a container, having loaded the store for the
application to it. This property is optional since there are legitimate
error conditions that could cause the creation of the store to fail.
*/
let container = NSPersistentContainer(name: "CapFinder")
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
/*
Typical reasons for an error here include:
* The parent directory does not exist, cannot be created, or disallows writing.
* The persistent store is not accessible, due to permissions or data protection when the device is locked.
* The device is out of space.
* The store could not be migrated to the current model version.
Check the error message to determine what the actual problem was.
*/
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
return container
}()
// MARK: - Core Data Saving support
func saveContext () {
let context = persistentContainer.viewContext
if context.hasChanges {
do {
try context.save()
} catch {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
}
}
}

View File

@ -1,29 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14269.12" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="VSb-c5-JF6">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.30.1" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="qlf-I7-aOI">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14252.5"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.19.1"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Caps-->
<!--Settings-->
<scene sceneID="shc-cx-eOe">
<objects>
<tableViewController title="Settings" id="x62-XO-Rsu" customClass="SettingsController" customModule="CapCollector" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="KlQ-aK-UAl">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="0.14168914909999999" green="0.14168914909999999" blue="0.14168914909999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="separatorColor" red="0.4408732927524982" green="0.4408732927524982" blue="0.4408732927524982" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
<sections>
<tableViewSection headerTitle="Database" footerTitle="New caps can't be found through matching. Update the app to the newest version to receive new matching models." id="t1t-6Z-uZp">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" textLabel="xVf-9U-8dt" detailTextLabel="cwp-eR-aXo" style="IBUITableViewCellStyleSubtitle" id="pQw-5h-loP">
<rect key="frame" x="0.0" y="55.5" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="pQw-5h-loP" id="Hkl-nU-jPG">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="1167 caps, 5600 images" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="xVf-9U-8dt">
<rect key="frame" x="16" y="5" width="185.5" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="1157 recognized, 10 new" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="cwp-eR-aXo">
<rect key="frame" x="16" y="25.5" width="138.5" height="14.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<color key="backgroundColor" red="0.20027729420000001" green="0.19907802899999999" blue="0.2014765594" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
</tableViewCell>
</cells>
</tableViewSection>
<tableViewSection headerTitle="NAMES" footerTitle="Updates names and image counts of the index" id="fnu-vJ-6gE">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" textLabel="NLm-th-Ww3" detailTextLabel="Zdl-lL-KYt" style="IBUITableViewCellStyleSubtitle" id="M1J-fv-ztL">
<rect key="frame" x="0.0" y="207" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="M1J-fv-ztL" id="r9E-Qt-wSx">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Upload name list" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="NLm-th-Ww3">
<rect key="frame" x="16" y="5" width="128" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="3 new caps and 10 new images" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Zdl-lL-KYt">
<rect key="frame" x="16" y="25.5" width="176" height="14.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<color key="backgroundColor" red="0.20027729419427479" green="0.19907802895957852" blue="0.20147655942897102" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
</tableViewCell>
</cells>
</tableViewSection>
<tableViewSection headerTitle="Refresh" footerTitle="Refreshes the image count of all caps. This will take a while." id="3rn-AC-q60">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" textLabel="tgU-ma-Xhz" style="IBUITableViewCellStyleDefault" id="GoI-GJ-dx1">
<rect key="frame" x="0.0" y="326.5" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="GoI-GJ-dx1" id="AOV-5g-KkH">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Refresh image counts" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="tgU-ma-Xhz">
<rect key="frame" x="16" y="0.0" width="343" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<color key="backgroundColor" red="0.20027729420000001" green="0.19907802899999999" blue="0.2014765594" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
</tableViewCell>
</cells>
</tableViewSection>
<tableViewSection headerTitle="Dropbox" footerTitle="Sign in to dropbox to access the cap database." id="Nw5-uf-OcQ">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" textLabel="dW2-Yd-L4J" style="IBUITableViewCellStyleDefault" id="Hie-e3-jja">
<rect key="frame" x="0.0" y="462" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Hie-e3-jja" id="z9u-9f-fqP">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Sign in" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="dW2-Yd-L4J">
<rect key="frame" x="16" y="0.0" width="343" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<color key="backgroundColor" red="0.20027729420000001" green="0.19907802899999999" blue="0.2014765594" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
</tableViewCell>
</cells>
</tableViewSection>
</sections>
<connections>
<outlet property="dataSource" destination="x62-XO-Rsu" id="vJB-Oo-TFT"/>
<outlet property="delegate" destination="x62-XO-Rsu" id="jSg-gK-Dqw"/>
</connections>
</tableView>
<connections>
<outlet property="databaseUpdatesLabel" destination="Zdl-lL-KYt" id="akt-Mb-Aqe"/>
<outlet property="dropboxAccountLabel" destination="dW2-Yd-L4J" id="lIc-yn-YxK"/>
<outlet property="recognizedCapsLabel" destination="cwp-eR-aXo" id="Nvh-8s-sRU"/>
<outlet property="totalCapsLabel" destination="xVf-9U-8dt" id="LeK-Xt-loM"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="rhf-CV-Ipz" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3408.8000000000002" y="2261.9190404797605"/>
</scene>
<!--Main Image-->
<scene sceneID="FO1-cz-6Q6">
<objects>
<viewController storyboardIdentifier="ImageSelector" id="xXN-Zh-iCd" customClass="ImageSelector" customModule="CapCollector" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="7RW-nN-0XQ">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="603"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Vx1-tM-8mD" userLabel="Status Bar View">
<rect key="frame" x="0.0" y="0.0" width="375" height="20"/>
<rect key="frame" x="0.0" y="-20" width="375" height="20"/>
<color key="backgroundColor" red="0.14168914909999999" green="0.14168914909999999" blue="0.14168914909999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="KLt-lS-0bs">
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="603"/>
<color key="backgroundColor" red="0.14168914910710662" green="0.14168914910710662" blue="0.14168914910710662" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="0.0" id="m0z-hV-bp1">
<size key="itemSize" width="125" height="125"/>
@ -57,33 +186,14 @@
</cells>
</collectionView>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pHE-7r-I7l" userLabel="Search View">
<rect key="frame" x="-1" y="668" width="377" height="49"/>
<rect key="frame" x="-1" y="604" width="377" height="49"/>
<constraints>
<constraint firstAttribute="height" constant="49" id="75Y-Pa-gf4"/>
</constraints>
</containerView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="uBv-Ka-a6u" customClass="RoundedButton" customModule="CapCollector" customModuleProvider="target">
<rect key="frame" x="20" y="607" width="335" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="I11-YD-mhs"/>
</constraints>
<state key="normal" title="Cancel"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
<color key="value" red="0.83921568629999999" green="0.9379758883" blue="0.54901960780000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
<real key="value" value="1"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="didCancel" destination="xXN-Zh-iCd" eventType="touchUpInside" id="7bg-Y2-nV1"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="lmc-ZJ-cgu" firstAttribute="bottom" secondItem="uBv-Ka-a6u" secondAttribute="bottom" constant="20" id="0bT-Jh-qzm"/>
<constraint firstItem="lmc-ZJ-cgu" firstAttribute="top" secondItem="Vx1-tM-8mD" secondAttribute="top" constant="20" id="9Ai-nd-gYO"/>
<constraint firstItem="KLt-lS-0bs" firstAttribute="top" secondItem="Vx1-tM-8mD" secondAttribute="bottom" id="DdH-ID-K5R"/>
<constraint firstItem="lmc-ZJ-cgu" firstAttribute="bottom" secondItem="KLt-lS-0bs" secondAttribute="bottom" id="LgP-eI-hGc"/>
@ -91,10 +201,8 @@
<constraint firstItem="KLt-lS-0bs" firstAttribute="leading" secondItem="lmc-ZJ-cgu" secondAttribute="leading" id="MNg-7M-R1B"/>
<constraint firstItem="KLt-lS-0bs" firstAttribute="top" secondItem="lmc-ZJ-cgu" secondAttribute="top" id="MgU-8N-zWy"/>
<constraint firstItem="lmc-ZJ-cgu" firstAttribute="trailing" secondItem="Vx1-tM-8mD" secondAttribute="trailing" id="PqZ-Gb-7Le"/>
<constraint firstItem="uBv-Ka-a6u" firstAttribute="leading" secondItem="lmc-ZJ-cgu" secondAttribute="leading" constant="20" id="VLy-Qd-LzF"/>
<constraint firstItem="Vx1-tM-8mD" firstAttribute="leading" secondItem="lmc-ZJ-cgu" secondAttribute="leading" id="WgW-hG-WpI"/>
<constraint firstItem="pHE-7r-I7l" firstAttribute="centerX" secondItem="lmc-ZJ-cgu" secondAttribute="centerX" id="fdQ-KZ-Nj4"/>
<constraint firstItem="uBv-Ka-a6u" firstAttribute="centerX" secondItem="lmc-ZJ-cgu" secondAttribute="centerX" id="jcu-4d-ddV"/>
<constraint firstItem="lmc-ZJ-cgu" firstAttribute="bottom" secondItem="pHE-7r-I7l" secondAttribute="bottom" constant="-50" id="n33-vy-jhn"/>
<constraint firstItem="lmc-ZJ-cgu" firstAttribute="trailing" secondItem="pHE-7r-I7l" secondAttribute="trailing" constant="-1" id="sGP-rj-Nsr"/>
</constraints>
@ -103,25 +211,22 @@
<tabBarItem key="tabBarItem" systemItem="history" id="Cxk-kX-pY9">
<color key="badgeColor" white="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tabBarItem>
<navigationItem key="navigationItem" title="Caps" id="Pt2-ad-tUu">
<navigationItem key="navigationItem" title="Main Image" id="Pt2-ad-tUu">
<barButtonItem key="backBarButtonItem" title="Back" id="e2a-wC-2Uv"/>
<barButtonItem key="leftBarButtonItem" systemItem="camera" id="qPt-0g-cjq"/>
<barButtonItem key="rightBarButtonItem" title="Clear" id="hmj-Lo-iYP"/>
</navigationItem>
<nil key="simulatedTopBarMetrics"/>
<nil key="simulatedBottomBarMetrics"/>
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" barStyle="black" translucent="NO" prompted="NO"/>
<connections>
<outlet property="collection" destination="KLt-lS-0bs" id="Jfu-ZQ-v2b"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="xnW-hF-IOj" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1804" y="1558"/>
<point key="canvasLocation" x="4097" y="2262"/>
</scene>
<!--Camera Controller-->
<!--New image-->
<scene sceneID="5iQ-Nr-LFc">
<objects>
<viewController id="oDF-NZ-j9r" customClass="CameraController" customModule="CapCollector" customModuleProvider="target" sceneMemberID="viewController">
<viewController title="New image" id="oDF-NZ-j9r" customClass="CameraController" customModule="CapCollector" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Y3e-A9-cGq">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@ -245,9 +350,9 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="u9k-DO-1HN" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3159" y="1558"/>
<point key="canvasLocation" x="4096.8000000000002" y="1557.5712143928038"/>
</scene>
<!--Table View-->
<!--Caps-->
<scene sceneID="3Dy-nA-zIw">
<objects>
<viewController id="VSb-c5-JF6" customClass="TableView" customModule="CapCollector" customModuleProvider="target" sceneMemberID="viewController">
@ -256,7 +361,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsVerticalScrollIndicator="NO" keyboardDismissMode="onDrag" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="Djy-MM-jNn">
<rect key="frame" x="0.0" y="110" width="375" height="501"/>
<rect key="frame" x="0.0" y="154" width="375" height="457"/>
<color key="backgroundColor" red="0.14168914909999999" green="0.14168914909999999" blue="0.14168914909999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="cap" rowHeight="100" id="ubX-SO-ltt" customClass="CapCell" customModule="CapCollector" customModuleProvider="target">
@ -335,11 +440,11 @@
<state key="normal" title="Button" image="camera_square"/>
<connections>
<action selector="imageClearButtonPressed" destination="VSb-c5-JF6" eventType="touchUpInside" id="zGe-MT-RR1"/>
<segue destination="oDF-NZ-j9r" kind="show" identifier="showCamera" id="CZp-Jx-hhr"/>
<segue destination="oDF-NZ-j9r" kind="presentation" identifier="showCamera" id="CZp-Jx-hhr"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="m5W-zE-D1T">
<rect key="frame" x="0.0" y="20" width="375" height="90"/>
<rect key="frame" x="0.0" y="64" width="375" height="90"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="TLY-ak-c4W" customClass="RoundedImageView" customModule="CapCollector" customModuleProvider="target">
<rect key="frame" x="2" y="2" width="86" height="86"/>
@ -418,7 +523,13 @@
</constraints>
<viewLayoutGuide key="safeArea" id="ubM-g6-UCF"/>
</view>
<nil key="simulatedTopBarMetrics"/>
<navigationItem key="navigationItem" title="Caps" id="ck0-ra-23a">
<barButtonItem key="leftBarButtonItem" systemItem="organize" id="SDv-mW-eqq">
<connections>
<segue destination="x62-XO-Rsu" kind="show" identifier="showSettings" id="TWW-Vh-GTa"/>
</connections>
</barButtonItem>
</navigationItem>
<nil key="simulatedBottomBarMetrics"/>
<connections>
<outlet property="deleteButton" destination="wMe-pc-3Zj" id="c9L-bH-9gt"/>
@ -435,7 +546,28 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="yym-Ts-ne2" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2469.5999999999999" y="1557.5712143928038"/>
<point key="canvasLocation" x="3408.8000000000002" y="1557.5712143928038"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="cDZ-9F-oGg">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="qlf-I7-aOI" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" barStyle="black" id="tO3-6d-IEo">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<textAttributes key="titleTextAttributes">
<color key="textColor" red="0.83921568629999999" green="0.9379758883" blue="0.54901960780000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</textAttributes>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="VSb-c5-JF6" kind="relationship" relationship="rootViewController" id="qHI-dC-d0K"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ar3-Vx-90J" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2740" y="1558"/>
</scene>
</scenes>
<resources>

View File

@ -0,0 +1,48 @@
//
// UserDefaults.swift
// CapCollector
//
// Created by Christoph on 16.10.18.
// Copyright © 2018 CH. All rights reserved.
//
import Foundation
final class Persistence {
static var recognizedCapCount: Int {
get {
return UserDefaults.standard.integer(forKey: "recognizedCaps")
}
set {
UserDefaults.standard.set(newValue, forKey: "recognizedCaps")
}
}
static var newImageCount: Int {
get {
return UserDefaults.standard.integer(forKey: "newImages")
}
set {
UserDefaults.standard.set(newValue, forKey: "newImages")
}
}
static var notUploadedCapCount: Int {
get {
return UserDefaults.standard.integer(forKey: "notUploadedCaps")
}
set {
UserDefaults.standard.set(newValue, forKey: "notUploadedCaps")
}
}
static var notUploadedImageCount: Int {
get {
return UserDefaults.standard.integer(forKey: "notUploadedImages")
}
set {
UserDefaults.standard.set(newValue, forKey: "notUploadedImages")
}
}
}

View File

@ -2,22 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>dbapi-8-emm</string>
<string>dbapi-2</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>db-n81tx2g638wuffl</string>
</array>
<key>CFBundleURLName</key>
<string></string>
</dict>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
@ -33,11 +17,29 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.2.6</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string></string>
<key>CFBundleURLSchemes</key>
<array>
<string>db-n81tx2g638wuffl</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>dbapi-8-emm</string>
<string>dbapi-2</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>Take images to identify matching caps and register new ones</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
@ -52,10 +54,6 @@
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>NSCameraUsageDescription</key>
<string>Take images to identify matching caps and register new ones</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
@ -63,5 +61,7 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>

View File

@ -0,0 +1,144 @@
//
// SettingsController.swift
// CapCollector
//
// Created by Christoph on 15.10.18.
// Copyright © 2018 CH. All rights reserved.
//
import UIKit
class SettingsController: UITableViewController {
@IBOutlet weak var totalCapsLabel: UILabel!
@IBOutlet weak var recognizedCapsLabel: UILabel!
@IBOutlet weak var databaseUpdatesLabel: UILabel!
@IBOutlet weak var dropboxAccountLabel: UILabel!
private var nameFileChanges = false
private var isUpdatingCounts = false
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(_ animated: Bool) {
updateDropboxStatus()
updateNameFileStats()
updateDatabaseStats()
}
private func updateDatabaseStats() {
let totalCaps = CapNames.shared.count
totalCapsLabel.text = "\(totalCaps) caps, \(CapNames.shared.imageCount) images"
let recognizedCaps = Persistence.recognizedCapCount
let newCapCount = totalCaps - recognizedCaps
recognizedCapsLabel.text = "\(recognizedCaps) recognized, \(newCapCount) new"
}
private func updateNameFileStats() {
let capCount = Persistence.notUploadedCapCount
let imageCount = Persistence.notUploadedImageCount
nameFileChanges = capCount > 0 || imageCount > 0
databaseUpdatesLabel.text = "\(capCount) new caps and \(imageCount) new images"
}
private func updateDropboxStatus() {
print("Dropbox enabled: \(DropboxController.shared.isEnabled)")
dropboxAccountLabel.text = DropboxController.shared.isEnabled ? "Sign out" : "Sign in"
}
override func tableView(_ tableView: UITableView, shouldHighlightRowAt indexPath: IndexPath) -> Bool {
switch indexPath.section {
case 0: // Database
return false
case 1: // Upload
return nameFileChanges
case 2: // Refresh count
return !isUpdatingCounts
case 3: // Dropbox account
return true
default: return false
}
}
override func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? {
switch indexPath.section {
case 0: // Database
return nil
case 1: // Upload
return nameFileChanges ? indexPath : nil
case 2: // Refresh count
return isUpdatingCounts ? nil : indexPath
case 3: // Dropbox account
return indexPath
default: return nil
}
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
switch indexPath.section {
case 0:
break
case 1: // Upload
if nameFileChanges {
uploadNameFile()
}
case 2: // Refresh count
updateCounts()
case 3: // Dropbox account
break
default: break
}
}
private func updateCounts() {
isUpdatingCounts = true
CapImages.shared.updateCounts() {
self.isUpdatingCounts = false
self.updateDatabaseStats()
}
}
private func uploadNameFile() {
CapNames.shared.saveAndUpload()
updateNameFileStats()
}
private func toggleDropbox() {
guard !DropboxController.shared.isEnabled else {
DropboxController.shared.signOut()
updateDropboxStatus()
return
}
DropboxController.shared.setup(in: self)
updateDropboxStatus()
}
}
extension SettingsController: DropboxControllerDelegate {
func dropboxControllerDidFinishLoadingCaps() {
}
func dropboxControllerDidLoadNames() {
}
func dropboxController(didLoad caps: [Int]) {
}
func dropboxController(didLoad cap: Int) {
}
}

View File

@ -1,3 +1,4 @@
/Users/christoph/Documents/GitHub/CapCollector/build/CapCollector/Build/Intermediates.noindex/CapCollector.build/Debug-iphoneos/CapCollector.build/Objects-normal/arm64/SettingsController.o
/Users/christoph/Documents/GitHub/CapCollector/build/CapCollector/Build/Intermediates.noindex/CapCollector.build/Debug-iphoneos/CapCollector.build/Objects-normal/arm64/Classifier.o
/Users/christoph/Documents/GitHub/CapCollector/build/CapCollector/Build/Intermediates.noindex/CapCollector.build/Debug-iphoneos/CapCollector.build/Objects-normal/arm64/Logger.o
/Users/christoph/Documents/GitHub/CapCollector/build/CapCollector/Build/Intermediates.noindex/CapCollector.build/Debug-iphoneos/CapCollector.build/Objects-normal/arm64/DropBoxController.o
@ -7,6 +8,7 @@
/Users/christoph/Documents/GitHub/CapCollector/build/CapCollector/Build/Intermediates.noindex/CapCollector.build/Debug-iphoneos/CapCollector.build/Objects-normal/arm64/CapImages.o
/Users/christoph/Documents/GitHub/CapCollector/build/CapCollector/Build/Intermediates.noindex/CapCollector.build/Debug-iphoneos/CapCollector.build/Objects-normal/arm64/TableView.o
/Users/christoph/Documents/GitHub/CapCollector/build/CapCollector/Build/Intermediates.noindex/CapCollector.build/Debug-iphoneos/CapCollector.build/Objects-normal/arm64/NameFile.o
/Users/christoph/Documents/GitHub/CapCollector/build/CapCollector/Build/Intermediates.noindex/CapCollector.build/Debug-iphoneos/CapCollector.build/Objects-normal/arm64/UserDefaults.o
/Users/christoph/Documents/GitHub/CapCollector/build/CapCollector/Build/Intermediates.noindex/CapCollector.build/Debug-iphoneos/CapCollector.build/Objects-normal/arm64/AppDelegate.o
/Users/christoph/Documents/GitHub/CapCollector/build/CapCollector/Build/Intermediates.noindex/CapCollector.build/Debug-iphoneos/CapCollector.build/Objects-normal/arm64/ImageSelector.o
/Users/christoph/Documents/GitHub/CapCollector/build/CapCollector/Build/Intermediates.noindex/CapCollector.build/Debug-iphoneos/CapCollector.build/Objects-normal/arm64/CameraController.o

View File

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>LastAccessedDate</key>
<date>2018-08-16T09:18:02Z</date>
<date>2018-10-17T09:43:52Z</date>
<key>WorkspacePath</key>
<string>/Users/christoph/Documents/GitHub/CapCollector/CapCollector.xcworkspace</string>
</dict>

View File

@ -1 +1 @@
1534411083.265933: Module build session file for module cache at Path(str: "/Users/christoph/Documents/GitHub/CapCollector/build/ModuleCache.noindex")
1539769432.274418: Module build session file for module cache at Path(str: "/Users/christoph/Documents/GitHub/CapCollector/build/ModuleCache.noindex")