diff --git a/Delta/Base.lproj/Settings.storyboard b/Delta/Base.lproj/Settings.storyboard index 5310b17..3e05720 100644 --- a/Delta/Base.lproj/Settings.storyboard +++ b/Delta/Base.lproj/Settings.storyboard @@ -227,11 +227,11 @@ - + - + @@ -254,11 +254,11 @@ - + - + @@ -278,11 +278,11 @@ - + - + @@ -882,7 +882,7 @@ - + diff --git a/Delta/Game Selection/GamesViewController.swift b/Delta/Game Selection/GamesViewController.swift index e0d8796..3eecdc3 100644 --- a/Delta/Game Selection/GamesViewController.swift +++ b/Delta/Game Selection/GamesViewController.swift @@ -411,8 +411,7 @@ private extension GamesViewController switch result { case .success: toastView = RSTToastView(text: NSLocalizedString("Sync Complete", comment: ""), detailText: nil) - case .failure(let error as HarmonyError): toastView = RSTToastView(text: NSLocalizedString("Sync Failed", comment: ""), detailText: error.failureReason) - case .failure(let error): toastView = RSTToastView(text: NSLocalizedString("Sync Failed", comment: ""), detailText: error.localizedDescription) + case .failure(let error): toastView = RSTToastView(text: NSLocalizedString("Sync Failed", comment: ""), detailText: error.failureReason) } toastView.addTarget(self, action: #selector(GamesViewController.presentSyncResultsViewController), for: .touchUpInside) diff --git a/Delta/Settings/Syncing/GameSyncStatusViewController.swift b/Delta/Settings/Syncing/GameSyncStatusViewController.swift index ab098d4..dac324f 100644 --- a/Delta/Settings/Syncing/GameSyncStatusViewController.swift +++ b/Delta/Settings/Syncing/GameSyncStatusViewController.swift @@ -55,8 +55,17 @@ class GameSyncStatusViewController: UITableViewController let recordedObject = self.dataSource.item(at: indexPath) as! SyncableManagedObject - let recordSyncStatusViewController = segue.destination as! RecordSyncStatusViewController - recordSyncStatusViewController.recordedObject = recordedObject + do + { + let records = try SyncManager.shared.recordController.fetchRecords(for: [recordedObject]) + + let recordSyncStatusViewController = segue.destination as! RecordSyncStatusViewController + recordSyncStatusViewController.record = records.first + } + catch + { + print(error) + } } } diff --git a/Delta/Settings/Syncing/RecordSyncStatusViewController.swift b/Delta/Settings/Syncing/RecordSyncStatusViewController.swift index efb7810..de5639b 100644 --- a/Delta/Settings/Syncing/RecordSyncStatusViewController.swift +++ b/Delta/Settings/Syncing/RecordSyncStatusViewController.swift @@ -35,7 +35,6 @@ extension RecordSyncStatusViewController class RecordSyncStatusViewController: UITableViewController { - var recordedObject: SyncableManagedObject! var record: Record? private let dateFormatter: DateFormatter = { @@ -85,16 +84,6 @@ private extension RecordSyncStatusViewController { func update() { - do - { - let records = try SyncManager.shared.recordController.fetchRecords(for: [self.recordedObject]) - self.record = records.first - } - catch - { - print(error) - } - if let record = self.record { self.syncingEnabledSwitch.isEnabled = !record.isConflicted diff --git a/Delta/Settings/Syncing/RecordVersionsViewController.swift b/Delta/Settings/Syncing/RecordVersionsViewController.swift index f3622b0..4013466 100644 --- a/Delta/Settings/Syncing/RecordVersionsViewController.swift +++ b/Delta/Settings/Syncing/RecordVersionsViewController.swift @@ -242,7 +242,7 @@ private extension RecordVersionsViewController guard let indexPath = self._selectedVersionIndexPath else { return } - func finish(_ result: Result>) + func finish(_ result: Result) { DispatchQueue.main.async { diff --git a/Delta/Syncing/SyncManager.swift b/Delta/Syncing/SyncManager.swift index f3795de..d4b6fcc 100644 --- a/Delta/Syncing/SyncManager.swift +++ b/Delta/Syncing/SyncManager.swift @@ -84,7 +84,7 @@ extension SyncManager self.isAuthenticated = true } - catch let error as _AuthenticationError where error.code == .noSavedCredentials + catch AuthenticationError.noSavedCredentials { // Ignore } diff --git a/Delta/Syncing/SyncResultViewController.swift b/Delta/Syncing/SyncResultViewController.swift index 01548e2..878a724 100644 --- a/Delta/Syncing/SyncResultViewController.swift +++ b/Delta/Syncing/SyncResultViewController.swift @@ -47,7 +47,7 @@ extension SyncResultViewController class SyncResultViewController: UITableViewController { - private(set) var result: Result<[Record: Result]>! + private(set) var result: Result<[Record: Result], SyncError>! private lazy var dataSource = self.makeDataSource() @@ -70,11 +70,23 @@ class SyncResultViewController: UITableViewController self.tableView.dataSource = self.dataSource } + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) + { + guard segue.identifier == "showRecordStatus" else { return } + + guard let cell = sender as? UITableViewCell, let indexPath = self.tableView.indexPath(for: cell) else { return } + + guard let recordError = self.dataSource.item(at: indexPath).value as? RecordError else { return } + + let recordSyncStatusViewController = segue.destination as! RecordSyncStatusViewController + recordSyncStatusViewController.record = recordError.record + } } extension SyncResultViewController { - class func make(result: Result<[Record: Result]>) -> UINavigationController + class func make(result: Result<[Record: Result], SyncError>) -> UINavigationController { let storyboard = UIStoryboard(name: "SyncResultsViewController", bundle: nil) @@ -169,7 +181,7 @@ private extension SyncResultViewController errors.append(error) } } - catch SyncError.cancelled + catch SyncError.other(.cancelled) { // Do nothing } @@ -326,4 +338,15 @@ extension SyncResultViewController } } } + + override func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? + { + let section = self.sortedErrors[indexPath.section] + + switch section.group + { + case .other: return nil + default: return indexPath + } + } } diff --git a/Delta/Syncing/SyncResultsViewController.storyboard b/Delta/Syncing/SyncResultsViewController.storyboard index ff1a967..86d00ce 100644 --- a/Delta/Syncing/SyncResultsViewController.storyboard +++ b/Delta/Syncing/SyncResultsViewController.storyboard @@ -52,6 +52,7 @@ + @@ -73,6 +74,14 @@ + + + + + + + + diff --git a/External/Harmony b/External/Harmony index 7f28cf5..3ac5af8 160000 --- a/External/Harmony +++ b/External/Harmony @@ -1 +1 @@ -Subproject commit 7f28cf57b0f68a26e342d392c94de18b29db9acd +Subproject commit 3ac5af8d95bc9c9be04ddcc0da471b532366f4e4