 import HubFramework
 
 /// The delegate of the application
-@UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate {
+@UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, HUBLiveServiceDelegate {
     var window: UIWindow?
     var navigationController: UINavigationController?
     var hubManager: HUBManager!
+    
+    // MARK: - UIApplicationDelegate
 
     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
         let window = UIWindow(frame: UIScreen.main.bounds)
         
         self.window = window
         navigationController = UINavigationController()
+        
         hubManager = makeHubManager()
-
+        
         window.rootViewController = navigationController
         window.makeKeyAndVisible()
         

            return false
        }
        
        viewController.view.backgroundColor = .white
        navigationController?.pushViewController(viewController, animated: animated)
        
        return true
    }
}


        registerPrettyPicturesFeature()
        registerReallyLongListFeature()
        registerTodoListFeature()
        startLiveService()
        
        return true
    }
    
    func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
        return open(viewURI: url, animated: true)
    }
    
    func applicationWillEnterForeground(_ application: UIApplication) {
        startLiveService()
    }
    
    func applicationDidEnterBackground(_ application: UIApplication) {
        hubManager.liveService?.stop()
    }
    
    // MARK: - HUBLiveServiceDelegate
    
    func liveService(_ liveService: HUBLiveService, didCreateViewController viewController: UIViewController) {
        prepareAndPush(viewController: viewController, animated: true)
    }
    
    // MARK: - Private
