Skip to content

Instantly share code, notes, and snippets.

@frosty
Created April 9, 2017 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frosty/8c68ce16e768dabc45977fa0b52cfc4d to your computer and use it in GitHub Desktop.
Save frosty/8c68ce16e768dabc45977fa0b52cfc4d to your computer and use it in GitHub Desktop.
diff --git a/WordPress/Classes/ViewRelated/Notifications/Controllers/NotificationsViewController.swift b/WordPress/Classes/ViewRelated/Notifications/Controllers/NotificationsViewController.swift
index afea6d00d..ee190bf8e 100644
--- a/WordPress/Classes/ViewRelated/Notifications/Controllers/NotificationsViewController.swift
+++ b/WordPress/Classes/ViewRelated/Notifications/Controllers/NotificationsViewController.swift
@@ -514,7 +514,26 @@ extension NotificationsViewController {
return
}
- performSegue(withIdentifier: NotificationDetailsViewController.classNameWithoutNamespaces(), sender: note)
+ if let controller = storyboard?.instantiateViewController(withIdentifier: "NotificationDetailsViewController") as? NotificationDetailsViewController {
+ configureDetailsViewController(controller, withNote: note)
+
+ workaroundShowDetailViewController(controller)
+ }
+ }
+
+ private func workaroundShowDetailViewController(_ viewController: UIViewController) {
+ if UIApplication.shared.applicationState != .active {
+ var navigationController = self.navigationController
+
+ if let controllerCount = splitViewController?.viewControllers.count,
+ controllerCount > 1 {
+ navigationController = splitViewController?.viewControllers.last as? UINavigationController
+ }
+
+ navigationController?.pushViewController(viewController, animated: true)
+ } else {
+ showDetailViewController(viewController, sender: self)
+ }
}
fileprivate func prepareToShowDetailsForNotification(_ note: Notification) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment