Set email subjects statically

App name is constant.
This commit is contained in:
Davide De Rosa 2019-04-07 16:56:38 +02:00
parent 651e3857e1
commit e68c46d729
3 changed files with 8 additions and 12 deletions

View File

@ -84,7 +84,7 @@ class IssueReporter: NSObject {
let vc = MFMailComposeViewController() let vc = MFMailComposeViewController()
vc.setToRecipients([AppConstants.IssueReporter.Email.recipient]) vc.setToRecipients([AppConstants.IssueReporter.Email.recipient])
vc.setSubject(AppConstants.IssueReporter.Email.subject(GroupConstants.App.name)) vc.setSubject(AppConstants.IssueReporter.Email.subject)
vc.setMessageBody(AppConstants.IssueReporter.Email.body(description ?? AppConstants.IssueReporter.Email.template, metadata), isHTML: false) vc.setMessageBody(AppConstants.IssueReporter.Email.body(description ?? AppConstants.IssueReporter.Email.template, metadata), isHTML: false)
if let raw = debugLog { if let raw = debugLog {
let attachment = DebugLog(raw: raw).decoratedData() let attachment = DebugLog(raw: raw).decoratedData()

View File

@ -210,7 +210,7 @@ class OrganizerViewController: UITableViewController, TableModelHost {
let vc = MFMailComposeViewController() let vc = MFMailComposeViewController()
vc.setToRecipients([AppConstants.Translations.Email.recipient]) vc.setToRecipients([AppConstants.Translations.Email.recipient])
vc.setSubject(AppConstants.Translations.Email.subject(GroupConstants.App.name)) vc.setSubject(AppConstants.Translations.Email.subject)
vc.setMessageBody(AppConstants.Translations.Email.body(AppConstants.Translations.Email.template), isHTML: false) vc.setMessageBody(AppConstants.Translations.Email.body(AppConstants.Translations.Email.template), isHTML: false)
vc.mailComposeDelegate = self vc.mailComposeDelegate = self
vc.apply(Theme.current) vc.apply(Theme.current)

View File

@ -112,15 +112,13 @@ public class AppConstants {
public class Email { public class Email {
public static let recipient = "issues@\(Domain.name)" public static let recipient = "issues@\(Domain.name)"
public static func subject(_ appName: String) -> String { public static let subject = "\(GroupConstants.App.name) - Report issue"
return "\(appName) - Report issue";
}
public static func body(_ description: String, _ metadata: String) -> String { public static func body(_ description: String, _ metadata: String) -> String {
return "Hi,\n\n\(description)\n\n\(metadata)\n\nRegards"; return "Hi,\n\n\(description)\n\n\(metadata)\n\nRegards"
} }
public static let template = "description of the issue: "; public static let template = "description of the issue: "
} }
public class Filenames { public class Filenames {
@ -147,15 +145,13 @@ public class AppConstants {
public class Email { public class Email {
public static let recipient = "translate@\(Domain.name)" public static let recipient = "translate@\(Domain.name)"
public static func subject(_ appName: String) -> String { public static let subject = "\(GroupConstants.App.name) - Translations"
return "\(appName) - Translations";
}
public static func body(_ description: String) -> String { public static func body(_ description: String) -> String {
return "Hi,\n\n\(description)\n\nRegards"; return "Hi,\n\n\(description)\n\nRegards"
} }
public static let template = "I offer to translate to: "; public static let template = "I offer to translate to: "
} }
} }