Browse Source

setting up and show debugtoolkit in coordinator

nayooti 5 years ago
parent
commit
8aa814d029
2 changed files with 8 additions and 14 deletions
  1. 0 10
      deltachat-ios/AppDelegate.swift
  2. 8 4
      deltachat-ios/Coordinator/AppCoordinator.swift

+ 0 - 10
deltachat-ios/AppDelegate.swift

@@ -1,5 +1,4 @@
 import AudioToolbox
-import DBDebugToolkit
 import Reachability
 import SwiftyBeaver
 import UIKit
@@ -47,8 +46,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     }
 
     func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
-        DBDebugToolkit.setup()
-        DBDebugToolkit.setupCrashReporting()
 
         let console = ConsoleDestination()
         logger.addDestination(console)
@@ -228,13 +225,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
         } catch {
             logger.info("could not start reachability notifier")
         }
-
-        let info: [DBCustomVariable] = dcContext.getInfo().map { kv in
-            let value = kv.count > 1 ? kv[1] : ""
-            return DBCustomVariable(name: kv[0], value: value)
-        }
-
-        DBDebugToolkit.add(info)
     }
 
     @objc private func reachabilityChanged(note: Notification) {

+ 8 - 4
deltachat-ios/Coordinator/AppCoordinator.swift

@@ -327,10 +327,14 @@ class SettingsCoordinator: Coordinator {
     }
 
     func showDebugToolkit() {
-
-        let vc = UIViewController()
-        vc.view.backgroundColor = .red
-        navigationController.present(vc, animated: true, completion: nil)
+        DBDebugToolkit.setup(with: [])  // emtpy array will override default device shake trigger
+        DBDebugToolkit.setupCrashReporting()
+        let info: [DBCustomVariable] = dcContext.getInfo().map { kv in
+            let value = kv.count > 1 ? kv[1] : ""
+            return DBCustomVariable(name: kv[0], value: value)
+        }
+        DBDebugToolkit.add(info)
+        DBDebugToolkit.showMenu()
     }
 }