Skip to content
Snippets Groups Projects
Commit 79f8e92f authored by Oliver Wiese's avatar Oliver Wiese
Browse files

fix logging mail

parent f31d9a45
Branches
Tags
No related merge requests found
......@@ -19,7 +19,8 @@ class Logger {
static fileprivate func sendCheck() {
if nextDeadline <= Date() && AppDelegate.getAppDelegate().currentReachabilityStatus != .notReachable && UserManager.loadUserValue(Attribute.accountname) != nil && UserDefaults.standard.bool(forKey: "launchedBefore"){
let deadlineIsNow = nextDeadline <= Date()
if deadlineIsNow && AppDelegate.getAppDelegate().currentReachabilityStatus != .notReachable && UserManager.loadUserValue(Attribute.accountname) != nil && UserDefaults.standard.bool(forKey: "launchedBefore"){
//Do not send duplicate mails
let tmpNextDeadline = Date(timeIntervalSinceNow: TimeInterval(loggingInterval))
nextDeadline = tmpNextDeadline
......@@ -316,7 +317,8 @@ class Logger {
static private func sendLog(logMailAddress: String = logReceiver) {
let jsonEncoder = JSONEncoder()
if let data = try? jsonEncoder.encode(Maildata()), let text = String(data: data, encoding: .utf8), text.count > 0 {
AppDelegate.getAppDelegate().mailHandler.send([logMailAddress], ccEntrys: [], bccEntrys: [], subject: "[Enzevalos] Log", message: text, callback: sendCallback, loggingMail: true, uiState: .letter)
let mail = OutgoingMail.createLoggingMail(addr: logMailAddress, textcontent: text)
mail.send()
}
LogInUserDefaults.handler.reset()
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment