Skip to content

Attachment support#49

Open
FabioTacke wants to merge 3 commits into
dtrenz:developfrom
TICESoftware:attachmentSupport
Open

Attachment support#49
FabioTacke wants to merge 3 commits into
dtrenz:developfrom
TICESoftware:attachmentSupport

Conversation

@FabioTacke

Copy link
Copy Markdown

Add the ability to attach files (e. g. log files) to the message.

Comment thread Sources/BugShaker.swift
- body: Custom email body (plain text).
*/
public class func configure(to recipients: [String], subject: String?, body: String? = nil) {
public class func configure(to recipients: [String], subject: String?, body: String? = nil, attachments: (() -> [MailAttachment])? = nil) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 120 characters or less: currently 143 characters (line_length)


let attachment = BugShaker.MailAttachment(data: try! Data(contentsOf: file), mimeType: "text/plain", fileName: fileName)

BugShaker.configure(to: [ "example@email.com" ], subject: "Bug Report", body: "Hi Developers, I am reporting a bug where...", attachments: [attachment])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 120 characters or less: currently 156 characters (line_length)


try! fileContent.write(to: file, atomically: true, encoding: .utf8)

let attachment = BugShaker.MailAttachment(data: try! Data(contentsOf: file), mimeType: "text/plain", fileName: fileName)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Force Try Violation: Force tries should be avoided. (force_try)
Line Length Violation: Line should be 120 characters or less: currently 124 characters (line_length)

let fileContent = "This is the content of the file."
let file = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask)[0].appendingPathComponent(fileName)

try! fileContent.write(to: file, atomically: true, encoding: .utf8)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Force Try Violation: Force tries should be avoided. (force_try)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants