浏览代码

Merge pull request #1090 from deltachat/show-debug-state

show DEBUG state in debug-toolkit, replace some printf by logger.errorwq
cyBerta 4 年之前
父节点
当前提交
f616a2a343
共有 2 个文件被更改,包括 13 次插入5 次删除
  1. 4 4
      deltachat-ios/AppDelegate.swift
  2. 9 1
      deltachat-ios/Controller/SettingsController.swift

+ 4 - 4
deltachat-ios/AppDelegate.swift

@@ -63,7 +63,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
         do {
             try reachability.startNotifier()
         } catch {
-            print("Unable to start notifier")
+            logger.error("Unable to start notifier")
         }
         
         let notificationOption = launchOptions?[.remoteNotification]
@@ -333,15 +333,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
 
     func application(
       _ application: UIApplication,
-      didFailToRegisterForRemoteNotificationsWithError error: Error) {
-      print("Notifications: Failed to register: \(error)")
+        didFailToRegisterForRemoteNotificationsWithError error: Error) {
+        logger.error("Notifications: Failed to register: \(error)")
     }
     
      func application(
         _ application: UIApplication,
         didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
         // TODO: got notification from apple, check for new messages
-        print("Notifications: didReceiveRemoteNotification", userInfo)
+        logger.verbose("Notifications: didReceiveRemoteNotification \(userInfo)")
     }
     
     private func userNotificationCenter(_: UNUserNotificationCenter, willPresent _: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {

+ 9 - 1
deltachat-ios/Controller/SettingsController.swift

@@ -469,10 +469,18 @@ internal final class SettingsViewController: UITableViewController, ProgressAler
     }
 
     private func showDebugToolkit() {
-        let info: [DBCustomVariable] = dcContext.getInfo().map { kv in
+        var info: [DBCustomVariable] = dcContext.getInfo().map { kv in
             let value = kv.count > 1 ? kv[1] : ""
             return DBCustomVariable(name: kv[0], value: value)
         }
+
+        #if DEBUG
+        info.append(DBCustomVariable(name: "DEBUG", value: "1"))
+        #else
+        info.append(DBCustomVariable(name: "DEBUG", value: "0"))
+        #endif
+
+
         DBDebugToolkit.add(info)
         DBDebugToolkit.showMenu()
     }