Skip to content

Commit

Permalink
Convert remaining view controller transitions.
Browse files Browse the repository at this point in the history
  • Loading branch information
charlon committed Jun 17, 2020
1 parent 7783381 commit f64806d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 31 deletions.
15 changes: 0 additions & 15 deletions myuw-ios/AppAuthController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,6 @@ extension AppAuthController {
os_log("showError", log: .ui, type: .info)

// show the error controller
/*
let appDelegate = UIApplication.shared.delegate as! AppDelegate
let errorController = ErrorController()
let navController = UINavigationController(rootViewController: errorController)
appDelegate.window!.rootViewController = navController
*/

UIApplication.shared.delegate?.window!?.rootViewController = UINavigationController(rootViewController: ErrorController())
}

Expand All @@ -365,14 +358,6 @@ extension AppAuthController {
os_log("showApplication", log: .ui, type: .info)

// MARK: transition to appController (tabs)
/*
let appController = ApplicationController()
let appDelegate = UIApplication.shared.delegate as! AppDelegate
// set the main controller as the root controller on app load
appDelegate.window!.rootViewController = appController
*/

// root view controller
UIApplication.shared.delegate?.window!?.rootViewController = ApplicationController()
}

Expand Down
24 changes: 8 additions & 16 deletions myuw-ios/WebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,8 @@ class WebViewController: UIViewController, WKNavigationDelegate {
sender.endRefreshing()
}
else {
let errorController = ErrorController()
let navController = UINavigationController(rootViewController: errorController)
appDelegate.window!.rootViewController = navController
// show error controller
UIApplication.shared.delegate?.window!?.rootViewController = UINavigationController(rootViewController: ErrorController())
}
}

Expand All @@ -134,12 +133,9 @@ class WebViewController: UIViewController, WKNavigationDelegate {
{
if(error.code == NSURLErrorNotConnectedToInternet) {
os_log("HTTP request failed: %@", log: .webview, type: .error, error.localizedDescription)

// show error controller
let appDelegate = UIApplication.shared.delegate as! AppDelegate
let errorController = ErrorController()
let navController = UINavigationController(rootViewController: errorController)
appDelegate.window!.rootViewController = navController
UIApplication.shared.delegate?.window!?.rootViewController = UINavigationController(rootViewController: ErrorController())

}
}
Expand All @@ -159,18 +155,14 @@ class WebViewController: UIViewController, WKNavigationDelegate {

// if user signed out... then clear authstate
if url!.absoluteString.contains("/logout/") {

// should we clear all cookies manually?


// call the appAuth signout method
let appAuthController = AppAuthController()
appAuthController.signOut()

// show the appAuth controller
let navController = UINavigationController(rootViewController: appAuthController)
let appDelegate = UIApplication.shared.delegate as! AppDelegate
// set appAuth controller as rootViewController
appDelegate.window!.rootViewController = navController
UIApplication.shared.delegate?.window!?.rootViewController = UINavigationController(rootViewController: appAuthController)

}

// display all cookies in WKWebsiteDataStore
Expand Down

0 comments on commit f64806d

Please sign in to comment.