         debug.addAction(UIAlertAction(title: "Cancel",
                                       style: .cancel, handler: nil))
 
-        var topMostViewController = AppDelegate.shared?.window?.rootViewController
+        var topMostViewController: UIViewController? = rootViewController
         while topMostViewController?.presentedViewController != nil {
-            topMostViewController = topMostViewController?.presentedViewController
+            topMostViewController = topMostViewController?.presentedViewController!
         }
         topMostViewController?.present(debug, animated: true, completion: nil)
     }


}

class DebugMenu {
    static let shared: DebugMenu = DebugMenu()

    func enableDebugGesture(_ viewController: UIViewController) {

    }

    @objc func openDebugAlert() {
        guard let rootViewController = AppDelegate.shared?.window?.rootViewController else {
            Log.warn("Debug alert unable to present since the window rootViewController is nil")
            return
        }

        var debug: UIAlertController

        if let dictionary = Bundle.main.infoDictionary,
