Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #259 from florianbuerger/master
Browse files Browse the repository at this point in the history
Allow HTML body content
  • Loading branch information
mliberatore authored May 10, 2019
2 parents 8851237 + 7a710d5 commit 6b7260d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
17 changes: 14 additions & 3 deletions PinpointKit/PinpointKit/Sources/Core/FeedbackConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@

/// Encapsulates configuration properties for all feedback to be sent.
public struct FeedbackConfiguration {

/// Encapsulates body content of the feedback submission. Suitable for an email body.
public struct Body {
public var content: String
public var isHTML: Bool

public init(_ content: String, isHTML: Bool = false) {
self.content = content
self.isHTML = isHTML
}
}

/// The value of the default parameter for `title` in the initializer.
public static let DefaultTitle = "Bug Report"
Expand All @@ -21,8 +32,8 @@ public struct FeedbackConfiguration {
/// A short, optional title of the feedback submission. Suitable for an email subject.
public var title: String?

/// An optional plain-text body of the feedback submission. Suitable for an email body.
public var body: String?
/// An optional body of the feedback submission.
public var body: Body?

/// A file name without an extension for the logs text file.
public var logsFileName: String
Expand All @@ -47,7 +58,7 @@ public struct FeedbackConfiguration {
public init(screenshotFileName: String = "Screenshot",
recipients: [String],
title: String? = FeedbackConfiguration.DefaultTitle,
body: String? = nil,
body: Body? = nil,
logsFileName: String = "logs",
additionalInformation: [String: AnyObject]? = nil,
presentationStyle: UIModalPresentationStyle = .fullScreen) {
Expand Down
2 changes: 1 addition & 1 deletion PinpointKit/PinpointKit/Sources/Core/MailSender.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private extension MFMailComposeViewController {
}

if let body = feedback.configuration.body {
setMessageBody(body, isHTML: false)
setMessageBody(body.content, isHTML: body.isHTML)
}

try attach(feedback.screenshot, screenshotFileName: feedback.configuration.screenshotFileName)
Expand Down
2 changes: 1 addition & 1 deletion PinpointKit/PinpointKit/Sources/Core/PinpointKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ open class PinpointKit {
- parameter body: The default body text of the feedback.
- parameter delegate: A delegate that is notified of significant events.
*/
public convenience init(feedbackRecipients: [String], title: String? = FeedbackConfiguration.DefaultTitle, body: String? = nil, delegate: PinpointKitDelegate? = nil) {
public convenience init(feedbackRecipients: [String], title: String? = FeedbackConfiguration.DefaultTitle, body: FeedbackConfiguration.Body? = nil, delegate: PinpointKitDelegate? = nil) {
let feedbackConfiguration = FeedbackConfiguration(recipients: feedbackRecipients, title: title, body: body)
let configuration = Configuration(feedbackConfiguration: feedbackConfiguration)

Expand Down

0 comments on commit 6b7260d

Please sign in to comment.