Commit bb5599ef authored by Soomin Lee's avatar Soomin Lee

AppCoordinator: Prepare for migration

parent 9099f28c
...@@ -22,6 +22,8 @@ class Services: NSObject { ...@@ -22,6 +22,8 @@ class Services: NSObject {
private var playerController: VLCPlayerDisplayController private var playerController: VLCPlayerDisplayController
private var tabBarController: UITabBarController private var tabBarController: UITabBarController
private var services = Services() private var services = Services()
private var migrationViewController = VLCMigrationViewController(nibName: String(describing: VLCMigrationViewController.self),
bundle: nil)
@objc init(viewController: UIViewController) { @objc init(viewController: UIViewController) {
self.viewController = viewController self.viewController = viewController
...@@ -33,6 +35,8 @@ class Services: NSObject { ...@@ -33,6 +35,8 @@ class Services: NSObject {
// Init the HTTP Server and clean its cache // Init the HTTP Server and clean its cache
// FIXME: VLCHTTPUploaderController should perhaps be a service? // FIXME: VLCHTTPUploaderController should perhaps be a service?
VLCHTTPUploaderController.sharedInstance().cleanCache() VLCHTTPUploaderController.sharedInstance().cleanCache()
services.medialibraryManager.migrationDelegate = self
services.medialibraryManager.prepareMigrationIfNeeded()
} }
private func setupChildViewControllers() { private func setupChildViewControllers() {
...@@ -57,3 +61,21 @@ class Services: NSObject { ...@@ -57,3 +61,21 @@ class Services: NSObject {
childCoordinators.append(tabbarCoordinator) childCoordinators.append(tabbarCoordinator)
} }
} }
extension AppCoordinator: MediaLibraryMigrationDelegate {
func medialibraryDidStartMigration(_ medialibrary: VLCMediaLibraryManager) {
tabBarController.present(migrationViewController, animated: true, completion: nil)
}
func medialibraryDidFinishMigration(_ medialibrary: VLCMediaLibraryManager) {
if tabBarController.presentedViewController === migrationViewController {
tabBarController.dismiss(animated: true, completion: nil)
}
}
func medialibraryDidStopMigration(_ medialibrary: VLCMediaLibraryManager) {
if tabBarController.presentedViewController === migrationViewController {
tabBarController.dismiss(animated: true, completion: nil)
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment