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

fix logging mail

parent f31d9a45
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,8 @@ class Logger { ...@@ -19,7 +19,8 @@ class Logger {
static fileprivate func sendCheck() { 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 //Do not send duplicate mails
let tmpNextDeadline = Date(timeIntervalSinceNow: TimeInterval(loggingInterval)) let tmpNextDeadline = Date(timeIntervalSinceNow: TimeInterval(loggingInterval))
nextDeadline = tmpNextDeadline nextDeadline = tmpNextDeadline
...@@ -316,7 +317,8 @@ class Logger { ...@@ -316,7 +317,8 @@ class Logger {
static private func sendLog(logMailAddress: String = logReceiver) { static private func sendLog(logMailAddress: String = logReceiver) {
let jsonEncoder = JSONEncoder() let jsonEncoder = JSONEncoder()
if let data = try? jsonEncoder.encode(Maildata()), let text = String(data: data, encoding: .utf8), text.count > 0 { 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() LogInUserDefaults.handler.reset()
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment