Bläddra i källkod

store and log dc_get_info

dignifiedquire 6 år sedan
förälder
incheckning
5fb0e5a2bf

+ 19 - 0
deltachat-ios/AppDelegate.swift

@@ -35,8 +35,21 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
 
     var state = ApplicationState.stopped
 
+    private func getCoreInfo() -> [[String]] {
+        if let cInfo = dc_get_info(mailboxPointer) {
+            let info = String(cString: cInfo)
+            logger.info(info)
+            return info.components(separatedBy: "\n").map { val in
+                val.components(separatedBy: "=")
+            }
+        }
+
+        return []
+    }
+
     func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
         DBDebugToolkit.setup()
+        DBDebugToolkit.setupCrashReporting()
 
         let console = ConsoleDestination()
         logger.addDestination(console)
@@ -188,6 +201,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
         } catch {
             logger.info("could not start reachability notifier")
         }
+
+        let info: [DBCustomVariable] = getCoreInfo().map { kv in
+            let value = kv.count > 1 ? kv[1] : ""
+            return DBCustomVariable(name: kv[0], value: value)
+        }
+        DBDebugToolkit.add(info)
     }
 
     @objc func reachabilityChanged(note: Notification) {

+ 1 - 1
deltachat-ios/TopViews/SettingsController.swift

@@ -208,7 +208,7 @@ internal final class SettingsViewController: QuickTableViewController {
                     return
                 }
             }
-            
+
             if let sender = sender as? SwitchRow {
                 logger.info("got bool switch")
                 let value = sender.switchValue

+ 8 - 0
deltachat-ios/Wrapper.swift

@@ -589,48 +589,56 @@ class MRConfig {
         }
         set {}
     }
+
     class var configuredMailServer: String {
         get {
             return getOptStr("configured_mail_server") ?? ""
         }
         set {}
     }
+
     class var configuredMailUser: String {
         get {
             return getOptStr("configured_mail_user") ?? ""
         }
         set {}
     }
+
     class var configuredMailPw: String {
         get {
             return getOptStr("configured_mail_pw") ?? ""
         }
         set {}
     }
+
     class var configuredMailPort: String {
         get {
             return getOptStr("configured_mail_port") ?? ""
         }
         set {}
     }
+
     class var configuredSendServer: String {
         get {
             return getOptStr("configured_send_server") ?? ""
         }
         set {}
     }
+
     class var configuredSendUser: String {
         get {
             return getOptStr("configured_send_user") ?? ""
         }
         set {}
     }
+
     class var configuredSendPw: String {
         get {
             return getOptStr("configured_send_pw") ?? ""
         }
         set {}
     }
+
     class var configuredSendPort: String {
         get {
             return getOptStr("configured_send_port") ?? ""