diff --git a/Delta/Game Selection/GamesViewController.swift b/Delta/Game Selection/GamesViewController.swift index 54be978..d12debf 100644 --- a/Delta/Game Selection/GamesViewController.swift +++ b/Delta/Game Selection/GamesViewController.swift @@ -13,6 +13,7 @@ import MobileCoreServices import DeltaCore import Roxas +import Harmony class GamesViewController: UIViewController { @@ -61,6 +62,9 @@ class GamesViewController: UIViewController super.init(coder: aDecoder) self.fetchedResultsController.delegate = self + + NotificationCenter.default.addObserver(self, selector: #selector(GamesViewController.syncingDidStart(_:)), name: SyncCoordinator.didStartSyncingNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(GamesViewController.syncingDidFinish(_:)), name: SyncCoordinator.didFinishSyncingNotification, object: nil) } } @@ -387,6 +391,32 @@ private extension GamesViewController } } } + + @objc func syncingDidStart(_ notification: Notification) + { + DispatchQueue.main.async { + let toastView = RSTToastView(text: NSLocalizedString("Syncing...", comment: ""), detailText: nil) + toastView.activityIndicatorView.startAnimating() + toastView.show(in: self.view) + } + } + + @objc func syncingDidFinish(_ notification: Notification) + { + DispatchQueue.main.async { + guard let result = notification.userInfo?[SyncCoordinator.syncResultKey] as? Result<[Result]> else { return } + + let toastView: RSTToastView + + switch result + { + case .success: toastView = RSTToastView(text: NSLocalizedString("Sync Complete", comment: ""), detailText: nil) + case .failure(let error): toastView = RSTToastView(error: error) + } + + toastView.show(in: self.view, duration: 2.0) + } + } } //MARK: - UIPageViewController - diff --git a/External/Harmony b/External/Harmony index 2c8aed1..0b5901b 160000 --- a/External/Harmony +++ b/External/Harmony @@ -1 +1 @@ -Subproject commit 2c8aed14f6287e45eb3c32017de590ec4323e64f +Subproject commit 0b5901b1617724af4e9d16092b2a5e1b1fcd9b29 diff --git a/External/Roxas b/External/Roxas index 8b544e7..c157270 160000 --- a/External/Roxas +++ b/External/Roxas @@ -1 +1 @@ -Subproject commit 8b544e7328de5f8481b5571ebf8e0a5312d1b74a +Subproject commit c1572706ff7b463ed8ae4686c7bed4bb489fcffa