Added boat ui

This commit is contained in:
Raimund Wege
2018-03-13 14:52:59 +01:00
parent 5d4d0578c7
commit 0f095571bb
8 changed files with 461 additions and 21 deletions
@@ -351,6 +351,11 @@
C891886E2057DB4A00E37CC3 /* BoatData.swift in Sources */ = {isa = PBXBuildFile; fileRef = C891886D2057DB4A00E37CC3 /* BoatData.swift */; };
C89188712057E7D700E37CC3 /* BoatCheckIn.swift in Sources */ = {isa = PBXBuildFile; fileRef = C891886F2057E7D700E37CC3 /* BoatCheckIn.swift */; };
C89188722057E7D700E37CC3 /* BoatCheckIn+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89188702057E7D700E37CC3 /* BoatCheckIn+CoreDataProperties.swift */; };
C89188742057F32300E37CC3 /* RegattaBoatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89188732057F32300E37CC3 /* RegattaBoatViewController.swift */; };
C89188762057F36300E37CC3 /* BoatSessionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89188752057F36300E37CC3 /* BoatSessionViewController.swift */; };
C89188782057F44200E37CC3 /* BoatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89188772057F44200E37CC3 /* BoatViewController.swift */; };
C891887A2057F55100E37CC3 /* BoatSessionController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89188792057F55100E37CC3 /* BoatSessionController.swift */; };
C891887C20580A4100E37CC3 /* TrainingBoatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C891887B20580A4100E37CC3 /* TrainingBoatViewController.swift */; };
C89C5FC51D06A289002AAAD2 /* GradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89C5FC41D06A289002AAAD2 /* GradientView.swift */; };
C89C5FCA1D06CECD002AAAD2 /* TrackingViewStatusCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89C5FC91D06CECD002AAAD2 /* TrackingViewStatusCell.swift */; };
C89C5FCC1D06CF0C002AAAD2 /* TrackingViewGPSAccuracyCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89C5FCB1D06CF0C002AAAD2 /* TrackingViewGPSAccuracyCell.swift */; };
@@ -768,6 +773,11 @@
C891886D2057DB4A00E37CC3 /* BoatData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoatData.swift; sourceTree = "<group>"; };
C891886F2057E7D700E37CC3 /* BoatCheckIn.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoatCheckIn.swift; sourceTree = "<group>"; };
C89188702057E7D700E37CC3 /* BoatCheckIn+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BoatCheckIn+CoreDataProperties.swift"; sourceTree = "<group>"; };
C89188732057F32300E37CC3 /* RegattaBoatViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegattaBoatViewController.swift; sourceTree = "<group>"; };
C89188752057F36300E37CC3 /* BoatSessionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoatSessionViewController.swift; sourceTree = "<group>"; };
C89188772057F44200E37CC3 /* BoatViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoatViewController.swift; sourceTree = "<group>"; };
C89188792057F55100E37CC3 /* BoatSessionController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoatSessionController.swift; sourceTree = "<group>"; };
C891887B20580A4100E37CC3 /* TrainingBoatViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrainingBoatViewController.swift; sourceTree = "<group>"; };
C89C5FC41D06A289002AAAD2 /* GradientView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GradientView.swift; sourceTree = "<group>"; };
C89C5FC91D06CECD002AAAD2 /* TrackingViewStatusCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TrackingViewStatusCell.swift; sourceTree = "<group>"; };
C89C5FCB1D06CF0C002AAAD2 /* TrackingViewGPSAccuracyCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TrackingViewGPSAccuracyCell.swift; sourceTree = "<group>"; };
@@ -1443,6 +1453,8 @@
C8CF22B11F669DA700A01E0A /* Regatta */,
C89C5FC61D06CE62002AAAD2 /* Tracking */,
C8CF22B21F669DB100A01E0A /* Training */,
C89188752057F36300E37CC3 /* BoatSessionViewController.swift */,
C89188772057F44200E37CC3 /* BoatViewController.swift */,
);
name = Session;
sourceTree = "<group>";
@@ -1471,6 +1483,7 @@
C843D4871EBCADDC00250F01 /* CompetitorSessionController.swift */,
C843D4891EBCADF500250F01 /* MarkSessionController.swift */,
C8739E0E1D2BEE7900A89F3C /* SessionController.swift */,
C89188792057F55100E37CC3 /* BoatSessionController.swift */,
);
name = Session;
sourceTree = "<group>";
@@ -1518,6 +1531,7 @@
children = (
7F99DE3B1A126554009B3619 /* RegattaCompetitorViewController.swift */,
C843D4851EBC927800250F01 /* RegattaMarkViewController.swift */,
C89188732057F32300E37CC3 /* RegattaBoatViewController.swift */,
);
name = Regatta;
sourceTree = "<group>";
@@ -1528,6 +1542,7 @@
C867BD081F4B0274007E78E0 /* TrainingCompetitorViewController.swift */,
C8CF22AC1F668BAB00A01E0A /* TrainingMarkViewController.swift */,
C8CF22C51F694EB900A01E0A /* TrainingViewController.swift */,
C891887B20580A4100E37CC3 /* TrainingBoatViewController.swift */,
);
name = Training;
sourceTree = "<group>";
@@ -2025,6 +2040,7 @@
C8739E121D2BF14F00A89F3C /* EventData.swift in Sources */,
C843D4881EBCADDC00250F01 /* CompetitorSessionController.swift in Sources */,
C8F71EDF1D8691F700826DE4 /* AFURLConnectionOperation.m in Sources */,
C891887A2057F55100E37CC3 /* BoatSessionController.swift in Sources */,
C8F71EE31D8691F700826DE4 /* SVIndefiniteAnimatedView.m in Sources */,
C8739E0F1D2BEE7900A89F3C /* SessionController.swift in Sources */,
C8739E1C1D2D5F1700A89F3C /* LocationData.swift in Sources */,
@@ -2036,7 +2052,9 @@
C8739E0C1D2AA2A500A89F3C /* Event+CoreDataProperties.swift in Sources */,
C8739E071D2AA2A500A89F3C /* GPSFix.swift in Sources */,
C8E0BD0D1F39ADAD002FCCA5 /* KeychainPasswordItem.swift in Sources */,
C891887C20580A4100E37CC3 /* TrainingBoatViewController.swift in Sources */,
C87A74E11F4EE570003DE396 /* TrainingRequestManager.swift in Sources */,
C89188762057F36300E37CC3 /* BoatSessionViewController.swift in Sources */,
C843D4811EBC54A300250F01 /* MarkCheckIn+CoreDataProperties.swift in Sources */,
C843D532201F3050003725F0 /* NewCheckInViewController.swift in Sources */,
C8F71EEE1D8691F700826DE4 /* UIProgressView+AFNetworking.m in Sources */,
@@ -2056,6 +2074,7 @@
C8BBAC791C52649E004CA551 /* LicenseViewController.swift in Sources */,
C8BFCCC41D51C53500FC1A27 /* TeamData.swift in Sources */,
C843D4911EC0A93600250F01 /* CoreData1-3.xcmappingmodel in Sources */,
C89188742057F32300E37CC3 /* RegattaBoatViewController.swift in Sources */,
C88F6D2B1FEAC4E800A616BE /* LeaderboardAutoCourseData.swift in Sources */,
7F23F0881A1A3DEF00F03F1C /* CheckInController.swift in Sources */,
C843D47F1EBC54A300250F01 /* CompetitorCheckIn+CoreDataProperties.swift in Sources */,
@@ -2087,6 +2106,7 @@
7F8B8D411A373B0200C34B88 /* SpeedViewController.swift in Sources */,
9E95C3D61C723AB30016632B /* Constants.swift in Sources */,
C8CF22A51F61965C00A01E0A /* TrainingCheckInController.swift in Sources */,
C89188782057F44200E37CC3 /* BoatViewController.swift in Sources */,
C8F71EF01D8691F700826DE4 /* UIWebView+AFNetworking.m in Sources */,
C87A74E81F504EBB003DE396 /* CreateEventData.swift in Sources */,
7FD9D3031A1236080058FEAD /* Extensions.swift in Sources */,
@@ -0,0 +1,13 @@
//
// BoatSessionController.swift
// SAPTracker
//
// Created by Raimund Wege on 13.03.18.
// Copyright © 2018 com.sap.sailing. All rights reserved.
//
import UIKit
class BoatSessionController: SessionController {
}
@@ -0,0 +1,41 @@
//
// BoatSessionViewController.swift
// SAPTracker
//
// Created by Raimund Wege on 13.03.18.
// Copyright © 2018 com.sap.sailing. All rights reserved.
//
import UIKit
class BoatSessionViewController: SessionViewController {
struct BoatSessionSegue {
static let EmbedBoat = "EmbedBoat"
}
weak var boatCheckIn: BoatCheckIn!
weak var boatCoreDataManager: CoreDataManager!
weak var boatViewController: BoatViewController?
// MARK: - Segues
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
super.prepare(for: segue, sender: sender)
if (segue.identifier == BoatSessionSegue.EmbedBoat) {
if let boatViewController = segue.destination as? BoatViewController {
boatViewController.boatCheckIn = boatCheckIn
boatViewController.boatSessionController = boatSessionController
boatViewController.boatCoreDataManager = boatCoreDataManager
self.boatViewController = boatViewController
}
}
}
// MARK: - Properties
lazy var boatSessionController: BoatSessionController = {
return BoatSessionController(checkIn: self.boatCheckIn, coreDataManager: self.boatCoreDataManager)
}()
}
@@ -0,0 +1,37 @@
//
// BoatViewController.swift
// SAPTracker
//
// Created by Raimund Wege on 13.03.18.
// Copyright © 2018 com.sap.sailing. All rights reserved.
//
import UIKit
class BoatViewController: UIViewController {
weak var boatCheckIn: BoatCheckIn!
weak var boatCoreDataManager: CoreDataManager!
weak var boatSessionController: BoatSessionController!
@IBOutlet weak var boatNameLabel: UILabel!
// MARK: - Refresh
func refresh(_ animated: Bool) {
refreshBoatNameLabel(animated)
}
fileprivate func refreshBoatNameLabel(_ animated: Bool) {
if (animated) {
UIView.animate(withDuration: 0.5) { self.refreshBoatNameLabel() }
} else {
refreshBoatNameLabel()
}
}
fileprivate func refreshBoatNameLabel() {
boatNameLabel.text = boatCheckIn.name
}
}
@@ -22,6 +22,7 @@ class CheckInTableViewController: UIViewController {
}
struct CheckInSegues {
static let boat = [CheckInSegue.RegattaBoat, CheckInSegue.TrainingBoat]
static let competitor = [CheckInSegue.RegattaCompetitor, CheckInSegue.TrainingCompetitor]
static let mark = [CheckInSegue.RegattaMark, CheckInSegue.TrainingMark]
}
@@ -329,7 +330,9 @@ class CheckInTableViewController: UIViewController {
}
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
if CheckInSegues.competitor.contains(identifier) {
if CheckInSegues.boat.contains(identifier) {
return segueCheckIn != nil && segueCheckIn is BoatCheckIn
} else if CheckInSegues.competitor.contains(identifier) {
return segueCheckIn != nil && segueCheckIn is CompetitorCheckIn
} else if CheckInSegues.mark.contains(identifier) {
return segueCheckIn != nil && segueCheckIn is MarkCheckIn
@@ -340,7 +343,17 @@ class CheckInTableViewController: UIViewController {
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
super.prepare(for: segue, sender: sender)
if let identifier = segue.identifier {
if CheckInSegues.competitor.contains(identifier) {
if CheckInSegues.boat.contains(identifier) {
if let boatCheckIn = segueCheckIn as? BoatCheckIn {
if let regattaBoatVC = segue.destination as? RegattaBoatViewController {
regattaBoatVC.boatCheckIn = boatCheckIn
regattaBoatVC.boatCoreDataManager = coreDataManager
} else if let trainingBoatVC = segue.destination as? TrainingBoatViewController {
trainingBoatVC.boatCheckIn = boatCheckIn
trainingBoatVC.boatCoreDataManager = coreDataManager
}
}
} else if CheckInSegues.competitor.contains(identifier) {
if let competitorCheckIn = segueCheckIn as? CompetitorCheckIn {
if let regattaCompetitorVC = segue.destination as? RegattaCompetitorViewController {
regattaCompetitorVC.competitorCheckIn = competitorCheckIn
@@ -609,7 +609,6 @@
<color key="titleColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="startTrackingButtonTapped:" destination="G3a-SV-Maf" eventType="touchUpInside" id="kU3-5M-fso"/>
<action selector="startTrackingButtonTapped:" destination="dMx-RA-QpG" eventType="touchUpInside" id="qcg-1Y-akf"/>
</connections>
</button>
@@ -1872,37 +1871,129 @@
</objects>
<point key="canvasLocation" x="4951" y="578"/>
</scene>
<!--View Controller-->
<!--Training Boat View Controller-->
<scene sceneID="KjJ-Gf-L6D">
<objects>
<viewController id="y7p-M3-tB3" sceneMemberID="viewController">
<viewController id="y7p-M3-tB3" customClass="TrainingBoatViewController" customModule="SAPTracker" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="ewO-N8-zLq"/>
<viewControllerLayoutGuide type="bottom" id="10B-q1-rjQ"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="0xp-SF-Pb4">
<view key="view" contentMode="scaleToFill" id="0xp-SF-Pb4" customClass="GradientView" customModule="SAPTracker" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="603"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lt3-7z-HgQ">
<rect key="frame" x="0.0" y="0.0" width="375" height="301.5"/>
<connections>
<segue destination="45p-eX-fmU" kind="embed" identifier="EmbedBoat" id="cVT-Os-RxU"/>
</connections>
</containerView>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="orh-Ip-L0o">
<rect key="frame" x="0.0" y="301.5" width="375" height="301.5"/>
<connections>
<segue destination="E6A-nT-WFd" kind="embed" identifier="EmbedTraining" id="Uh5-BJ-t8l"/>
</connections>
</containerView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="orh-Ip-L0o" firstAttribute="height" secondItem="lt3-7z-HgQ" secondAttribute="height" id="2jo-eq-C1Z"/>
<constraint firstItem="orh-Ip-L0o" firstAttribute="leading" secondItem="0xp-SF-Pb4" secondAttribute="leading" id="EO7-Wm-5kz"/>
<constraint firstAttribute="trailing" secondItem="lt3-7z-HgQ" secondAttribute="trailing" id="Oqz-WP-Pgp"/>
<constraint firstItem="orh-Ip-L0o" firstAttribute="top" secondItem="lt3-7z-HgQ" secondAttribute="bottom" id="TeD-cx-vYF"/>
<constraint firstAttribute="trailing" secondItem="orh-Ip-L0o" secondAttribute="trailing" id="fVF-aY-LOU"/>
<constraint firstItem="10B-q1-rjQ" firstAttribute="top" secondItem="orh-Ip-L0o" secondAttribute="bottom" id="gDr-5y-Dcu"/>
<constraint firstItem="lt3-7z-HgQ" firstAttribute="leading" secondItem="0xp-SF-Pb4" secondAttribute="leading" id="kg8-Xr-Yrc"/>
<constraint firstItem="lt3-7z-HgQ" firstAttribute="top" secondItem="ewO-N8-zLq" secondAttribute="bottom" id="pbu-aK-Uds"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="secondColor">
<color key="value" red="0.86274509803921573" green="0.8901960784313725" blue="0.92156862745098034" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="firstColor">
<color key="value" red="0.87058823529411766" green="0.94509803921568625" blue="0.94509803921568625" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<connections>
<segue destination="I54-NN-JAf" kind="presentation" identifier="Tracking" id="eex-WZ-awp"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="OX1-gW-3RO" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3172" y="-4354"/>
<point key="canvasLocation" x="3172" y="-4354.2728635682161"/>
</scene>
<!--View Controller-->
<!--Regatta Boat View Controller-->
<scene sceneID="3AO-vw-zZt">
<objects>
<viewController id="Y5o-Nm-utL" sceneMemberID="viewController">
<viewController id="Y5o-Nm-utL" customClass="RegattaBoatViewController" customModule="SAPTracker" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="SLG-lw-Y58"/>
<viewControllerLayoutGuide type="bottom" id="d7B-ph-XjQ"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="S5X-OF-4pC">
<view key="view" contentMode="scaleToFill" id="S5X-OF-4pC" customClass="GradientView" customModule="SAPTracker" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="603"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Llx-dw-jhM">
<rect key="frame" x="0.0" y="0.0" width="375" height="481"/>
<connections>
<segue destination="45p-eX-fmU" kind="embed" identifier="EmbedBoat" id="Wtz-5C-LB8"/>
</connections>
</containerView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dCN-yF-0OZ" userLabel="Event View">
<rect key="frame" x="0.0" y="481" width="375" height="122"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3VK-IG-R56">
<rect key="frame" x="20" y="20" width="335" height="82"/>
<constraints>
<constraint firstAttribute="height" constant="82" id="8Ro-TB-T3x">
<variation key="heightClass=compact" constant="62"/>
</constraint>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="21"/>
<state key="normal" title="Start Tracking Button">
<color key="titleColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="startTrackingButtonTapped:" destination="Y5o-Nm-utL" eventType="touchUpInside" id="XM4-hk-g8Q"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="3VK-IG-R56" secondAttribute="trailing" constant="20" id="Djg-rz-QHe"/>
<constraint firstAttribute="bottom" secondItem="3VK-IG-R56" secondAttribute="bottom" constant="20" id="NTn-TA-FIJ"/>
<constraint firstItem="3VK-IG-R56" firstAttribute="leading" secondItem="dCN-yF-0OZ" secondAttribute="leading" constant="20" id="kgf-iK-9qG"/>
<constraint firstItem="3VK-IG-R56" firstAttribute="top" secondItem="dCN-yF-0OZ" secondAttribute="top" constant="20" id="sdB-G7-xTl"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="dCN-yF-0OZ" firstAttribute="top" secondItem="Llx-dw-jhM" secondAttribute="bottom" id="EGB-QC-g4s"/>
<constraint firstItem="Llx-dw-jhM" firstAttribute="leading" secondItem="S5X-OF-4pC" secondAttribute="leading" id="Hpp-Nm-c0b"/>
<constraint firstAttribute="trailing" secondItem="Llx-dw-jhM" secondAttribute="trailing" id="Hux-AY-P8q"/>
<constraint firstItem="dCN-yF-0OZ" firstAttribute="top" secondItem="Llx-dw-jhM" secondAttribute="bottom" id="SG3-ZK-OY0"/>
<constraint firstItem="Llx-dw-jhM" firstAttribute="top" secondItem="SLG-lw-Y58" secondAttribute="bottom" id="gAF-un-WTL"/>
<constraint firstAttribute="trailing" secondItem="dCN-yF-0OZ" secondAttribute="trailing" id="gei-bU-GZJ"/>
<constraint firstItem="dCN-yF-0OZ" firstAttribute="leading" secondItem="S5X-OF-4pC" secondAttribute="leading" id="kpR-jP-H1h"/>
<constraint firstItem="d7B-ph-XjQ" firstAttribute="top" secondItem="dCN-yF-0OZ" secondAttribute="bottom" id="lgU-tu-wyT"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="firstColor">
<color key="value" red="0.87058823529411766" green="0.94509803921568625" blue="0.94509803921568625" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="secondColor">
<color key="value" red="0.86274509803921573" green="0.8901960784313725" blue="0.92156862745098034" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<connections>
<outlet property="startTrackingButton" destination="3VK-IG-R56" id="I3X-nt-Foh"/>
<segue destination="I54-NN-JAf" kind="presentation" identifier="Tracking" id="hpV-45-8J9"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="boI-kC-ANU" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
@@ -1983,6 +2074,7 @@
</navigationItem>
<connections>
<outlet property="optionButton" destination="MF0-Id-Lx7" id="NIO-Zv-lTa"/>
<segue destination="I54-NN-JAf" kind="presentation" identifier="Tracking" id="R4p-Rp-nUz"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="7zr-QD-wnW" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -2084,7 +2176,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3Oh-L0-8dT">
<rect key="frame" x="331" y="14.5" width="24" height="24"/>
<rect key="frame" x="331" y="15" width="24" height="24"/>
<state key="normal" image="refresh"/>
<connections>
<action selector="refreshButtonTapped:" destination="E6A-nT-WFd" eventType="touchUpInside" id="2Ee-rr-qgN"/>
@@ -2133,18 +2225,18 @@
<viewControllerLayoutGuide type="bottom" id="hrK-ty-jic"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="vV5-mZ-1WQ">
<rect key="frame" x="0.0" y="0.0" width="375" height="301.5"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="303.5"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" image="profile_placeholder" translatesAutoresizingMaskIntoConstraints="NO" id="KlN-FI-d4m">
<rect key="frame" x="0.0" y="0.0" width="375" height="301.5"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="303.5"/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="iwM-mY-oZT" userLabel="Button View">
<rect key="frame" x="0.0" y="0.0" width="375" height="263.5"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="265.5"/>
<subviews>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="NN8-QQ-TQB">
<rect key="frame" x="307" y="205.5" width="56" height="56"/>
<rect key="frame" x="307" y="207.5" width="56" height="56"/>
<state key="normal" image="edit"/>
<state key="highlighted" image="edit_pressed"/>
<connections>
@@ -2152,7 +2244,7 @@
</connections>
</button>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="1" verticalHuggingPriority="1" horizontalCompressionResistancePriority="999" verticalCompressionResistancePriority="999" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="clip" translatesAutoresizingMaskIntoConstraints="NO" id="bhL-2M-5XL">
<rect key="frame" x="41.5" y="112.5" width="293" height="40"/>
<rect key="frame" x="41.5" y="113.5" width="293" height="40"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<inset key="contentEdgeInsets" minX="8" minY="8" maxX="8" maxY="8"/>
<state key="normal" title="Team Image Upload Retry Button" image="refresh"/>
@@ -2161,7 +2253,7 @@
</connections>
</button>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="1" verticalHuggingPriority="1" horizontalCompressionResistancePriority="999" verticalCompressionResistancePriority="999" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="clip" translatesAutoresizingMaskIntoConstraints="NO" id="LGR-3t-JL4">
<rect key="frame" x="76" y="112.5" width="224" height="40"/>
<rect key="frame" x="76" y="113.5" width="224" height="40"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<inset key="contentEdgeInsets" minX="8" minY="8" maxX="8" maxY="8"/>
<state key="normal" title="Team Image Add Button" image="camera"/>
@@ -2184,7 +2276,7 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pAh-lZ-ZxJ" userLabel="Competitor View">
<rect key="frame" x="0.0" y="263.5" width="375" height="38"/>
<rect key="frame" x="0.0" y="265.5" width="375" height="38"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Sail ID Label" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="0.0" translatesAutoresizingMaskIntoConstraints="NO" id="k06-sH-apv">
<rect key="frame" x="257.5" y="9.5" width="97.5" height="20.5"/>
@@ -2263,6 +2355,38 @@
</objects>
<point key="canvasLocation" x="201" y="-313"/>
</scene>
<!--Boat View Controller-->
<scene sceneID="eu6-4J-Gmg">
<objects>
<viewController id="45p-eX-fmU" customClass="BoatViewController" customModule="SAPTracker" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="9T8-mk-vcr"/>
<viewControllerLayoutGuide type="bottom" id="hO6-PY-Dfm"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="jAl-lC-iGg">
<rect key="frame" x="0.0" y="0.0" width="375" height="301.5"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Boat Name Label" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsLetterSpacingToFitWidth="YES" preferredMaxLayoutWidth="0.0" translatesAutoresizingMaskIntoConstraints="NO" id="nSs-zx-Gsu">
<rect key="frame" x="122.5" y="140.5" width="130.5" height="20.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="nSs-zx-Gsu" firstAttribute="centerY" secondItem="jAl-lC-iGg" secondAttribute="centerY" id="PgM-WG-diS"/>
<constraint firstItem="nSs-zx-Gsu" firstAttribute="centerX" secondItem="jAl-lC-iGg" secondAttribute="centerX" id="xdT-BQ-UHe"/>
</constraints>
</view>
<connections>
<outlet property="boatNameLabel" destination="nSs-zx-Gsu" id="s73-4u-RU4"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="kII-W3-hIZ" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="5476" y="-3360"/>
</scene>
</scenes>
<resources>
<image name="DE.png" width="64" height="64"/>
@@ -2277,9 +2401,10 @@
<image name="settings" width="24" height="24"/>
</resources>
<inferredMetricsTieBreakers>
<segue reference="LhS-FE-OSU"/>
<segue reference="ipS-aD-UN6"/>
<segue reference="cVT-Os-RxU"/>
<segue reference="rUr-Ta-FZ1"/>
<segue reference="Uh5-BJ-t8l"/>
<segue reference="K7i-f6-Gr5"/>
<segue reference="gEw-ml-Ejg"/>
<segue reference="eex-WZ-awp"/>
</inferredMetricsTieBreakers>
</document>
@@ -0,0 +1,78 @@
//
// RegattaBoatViewController.swift
// SAPTracker
//
// Created by Raimund Wege on 13.03.18.
// Copyright © 2018 com.sap.sailing. All rights reserved.
//
import UIKit
class RegattaBoatViewController: BoatSessionViewController {
override func viewDidLoad() {
super.viewDidLoad()
delegate = self
setup()
updateOptimistic()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
refresh(false)
}
// MARK: - Setup
fileprivate func setup() {
setupButtons()
setupLocalization()
setupNavigationBar()
}
fileprivate func setupButtons() {
makeGreen(button: startTrackingButton)
}
fileprivate func setupLocalization() {
startTrackingButton.setTitle(Translation.RegattaView.StartTrackingButton.Title.String, for: .normal)
}
fileprivate func setupNavigationBar() {
navigationItem.titleView = TitleView(title: boatCheckIn.event.name, subtitle: boatCheckIn.leaderboard.name)
navigationController?.navigationBar.setNeedsLayout()
}
}
// MARK: SessionViewControllerDelegate
extension RegattaBoatViewController: SessionViewControllerDelegate {
var checkIn: CheckIn { get { return boatCheckIn } }
var checkOutActionTitle: String { get { return Translation.RegattaView.OptionSheet.CheckOutAction.Title.String } }
var checkOutAlertMessage: String { get { return Translation.RegattaView.CheckOutAlert.Message.String } }
var coreDataManager: CoreDataManager { get { return boatCoreDataManager } }
var sessionController: SessionController { get { return boatSessionController } }
func makeOptionSheet() -> UIAlertController {
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
if let popoverController = alertController.popoverPresentationController {
popoverController.barButtonItem = self.optionButton
}
alertController.addAction(self.makeActionCheckOut())
alertController.addAction(self.makeActionSettings())
alertController.addAction(self.makeActionInfo())
alertController.addAction(self.makeActionCancel())
return alertController
}
func refresh(_ animated: Bool) {
boatViewController?.refresh(animated)
}
}
@@ -0,0 +1,113 @@
//
// TrainingBoatViewController.swift
// SAPTracker
//
// Created by Raimund Wege on 13.03.18.
// Copyright © 2018 com.sap.sailing. All rights reserved.
//
import UIKit
class TrainingBoatViewController: BoatSessionViewController {
struct Segue {
static let EmbedTraining = "EmbedTraining"
}
weak var trainingViewController: TrainingViewController?
override func viewDidLoad() {
super.viewDidLoad()
delegate = self
setup()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
refresh(false)
}
// MARK: - Setup
fileprivate func setup() {
setupNavigationBar()
}
fileprivate func setupNavigationBar() {
navigationItem.title = boatCheckIn.event.name
}
// MARK: - Segues
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
super.prepare(for: segue, sender: sender)
if (segue.identifier == Segue.EmbedTraining) {
if let trainingViewController = segue.destination as? TrainingViewController {
trainingViewController.delegate = self
trainingViewController.trainingCheckIn = boatCheckIn
trainingViewController.trainingCoreDataManager = boatCoreDataManager
self.trainingViewController = trainingViewController
}
}
}
}
// MARK: - SessionViewControllerDelegate
extension TrainingBoatViewController: SessionViewControllerDelegate {
var checkIn: CheckIn { get { return boatCheckIn } }
var checkOutActionTitle: String { get { return Translation.TrainingView.OptionSheet.CheckOutAction.Title.String } }
var checkOutAlertMessage: String { get { return Translation.TrainingView.CheckOutAlert.Message.String } }
var coreDataManager: CoreDataManager { get { return boatCoreDataManager } }
var sessionController: SessionController { get { return boatSessionController } }
func makeOptionSheet() -> UIAlertController {
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
if let popoverController = alertController.popoverPresentationController {
popoverController.barButtonItem = self.optionButton
}
alertController.addAction(self.makeActionCheckOut())
alertController.addAction(self.makeActionSettings())
alertController.addAction(self.makeActionInfo())
alertController.addAction(self.makeActionCancel())
return alertController
}
func refresh(_ animated: Bool) {
boatViewController?.refresh(animated)
trainingViewController?.refresh(animated)
}
}
// MARK: - TrainingViewControllerDelegate
extension TrainingBoatViewController: TrainingViewControllerDelegate {
func trainingViewController(_ controller: TrainingViewController, refreshButtonTapped sender: Any) {
super.refreshButtonTapped(sender)
}
func trainingViewController(_ controller: TrainingViewController, startTrackingButtonTapped sender: Any) {
super.startTrackingButtonTapped(sender)
}
func trainingViewController(_ controller: TrainingViewController, leaderboardButtonTapped sender: Any) {
super.leaderboardButtonTapped(sender)
}
func trainingViewControllerDidFinishTraining(_ controller: TrainingViewController) {
updatePessimistic()
}
func trainingViewControllerDidReactivateTraining(_ controller: TrainingViewController) {
updatePessimistic()
}
}