Skip to content

Commit

Permalink
Merge pull request #712 from deltachat/temporary-additional-info
Browse files Browse the repository at this point in the history
temporary additional info
  • Loading branch information
nayooti authored May 18, 2020
2 parents 083f58b + ccf23aa commit e696999
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions DcCore/DcCore/DC/Wrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public class DcContext {
public var logger: Logger?
let contextPointer: OpaquePointer
public var lastErrorString: String?
public var lastWarningString: String = "" // temporary thing to get a grip on some weird errors
public var maxConfigureProgress: Int = 0 // temporary thing to get a grip on some weird errors

private init() {
var version = ""
Expand Down Expand Up @@ -292,6 +294,8 @@ public class DcContext {
}

public func configure() {
maxConfigureProgress = 0
lastWarningString = ""
dc_configure(contextPointer)
}

Expand Down
2 changes: 2 additions & 0 deletions DcCore/DcCore/DC/events.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ public func callbackSwift(event: CInt, data1: CUnsignedLong, data2: CUnsignedLon

case DC_EVENT_WARNING:
let s = String(cString: data2String)
DcContext.shared.lastWarningString = s
DcContext.shared.logger?.warning("event: \(s)")

case DC_EVENT_CONFIGURE_PROGRESS:
DcContext.shared.maxConfigureProgress = max(DcContext.shared.maxConfigureProgress, Int(data1))
DcContext.shared.logger?.info("configure progress: \(Int(data1)) \(Int(data2))")
let nc = NotificationCenter.default
DispatchQueue.main.async {
Expand Down
2 changes: 2 additions & 0 deletions deltachat-ios/Controller/AccountSetupController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,8 @@ class AccountSetupController: UITableViewController, ProgressAlertHandler {
var errorMessage = ui["errorMessage"] as? String
if let appDelegate = UIApplication.shared.delegate as? AppDelegate, appDelegate.reachability.connection == .none {
errorMessage = String.localized("login_error_no_internet_connection")
} else {
errorMessage = "\(errorMessage ?? "no message")\n\n(warning=\(DcContext.shared.lastWarningString) (progress=\(DcContext.shared.maxConfigureProgress))"
}
self.updateProgressAlert(error: errorMessage)
} else if ui["done"] as! Bool {
Expand Down

0 comments on commit e696999

Please sign in to comment.