mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-19 20:25:31 +00:00
Navigate into training after successful check-in
This commit is contained in:
@@ -8,8 +8,16 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
protocol CreateTrainingViewControllerDelegate: class {
|
||||
|
||||
func createTrainingViewController(_ controller: CreateTrainingViewController, didCheckIn checkIn: CheckIn)
|
||||
|
||||
}
|
||||
|
||||
class CreateTrainingViewController: UIViewController {
|
||||
|
||||
weak var delegate: CreateTrainingViewControllerDelegate?
|
||||
|
||||
weak var trainingController: TrainingController!
|
||||
weak var trainingCoreDataManager: TrainingCoreDataManager!
|
||||
|
||||
@@ -57,13 +65,19 @@ class CreateTrainingViewController: UIViewController {
|
||||
}
|
||||
|
||||
fileprivate func createTrainingSuccess(checkInData: CheckInData) {
|
||||
trainingCheckInController.checkInWithViewController(self, checkInData: checkInData, success: { checkIn in
|
||||
// TODO
|
||||
}) { error in
|
||||
trainingCheckInController.checkInWithViewController(self, checkInData: checkInData, success: { (checkIn) in
|
||||
self.createTrainingSuccess(checkIn: checkIn)
|
||||
}) { (error) in
|
||||
self.createTrainingFailure(error: error)
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate func createTrainingSuccess(checkIn: CheckIn) {
|
||||
dismiss(animated: true) {
|
||||
self.delegate?.createTrainingViewController(self, didCheckIn: checkIn)
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate func createTrainingFailure(error: Error) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ import UIKit
|
||||
import AVFoundation
|
||||
|
||||
protocol ScanViewControllerDelegate: class {
|
||||
|
||||
|
||||
func scanViewController(_ controller: ScanViewController, didCheckIn checkIn: CheckIn)
|
||||
|
||||
|
||||
}
|
||||
|
||||
class ScanViewController: UIViewController {
|
||||
@@ -205,7 +205,7 @@ extension ScanViewController: AVCaptureMetadataOutputObjectsDelegate {
|
||||
fileprivate func checkIn(withCheckInData checkInData: CheckInData) {
|
||||
regattaCheckInController.checkInWithViewController(self, checkInData: checkInData, success: { [weak self] (checkIn) in
|
||||
self?.checkInSuccess(checkIn: checkIn)
|
||||
}) { [weak self] error in
|
||||
}) { [weak self] (error) in
|
||||
self?.checkInFailure(error: error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ class TrainingTableViewController: CheckInTableViewController {
|
||||
if (segue.identifier == Segue.CreateTraining) {
|
||||
guard let createTrainingNC = segue.destination as? UINavigationController else { return }
|
||||
guard let createTrainingVC = createTrainingNC.viewControllers[0] as? CreateTrainingViewController else { return }
|
||||
createTrainingVC.delegate = self
|
||||
createTrainingVC.trainingCoreDataManager = trainingCoreDataManager;
|
||||
createTrainingVC.trainingController = trainingController
|
||||
}
|
||||
@@ -126,3 +127,13 @@ extension TrainingTableViewController: CheckInTableViewControllerDelegate {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - CreateTrainingViewControllerDelegate
|
||||
|
||||
extension TrainingTableViewController: CreateTrainingViewControllerDelegate {
|
||||
|
||||
func createTrainingViewController(_ controller: CreateTrainingViewController, didCheckIn checkIn: CheckIn) {
|
||||
performSegue(forCheckIn: checkIn)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user