<commit_before>//
//  EmailBuilder.swift
//  SendToMe
//
//  Created by <NAME> on 1/30/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation
import SwiftMandrill
import SendToMeFramework

/// Email builder that will build the email object based on the sharing content
public class EmailBuilder
{
    
    /**
     Builds the email object based on the sharing content
     
     - parameter sharingContent: sharing content
     
     - returns: returns email object
     */
    public class func buildEmailWithSharingContent(sharingContent:ShareContent, comment:String?)->MandrillEmail
    {
        let emailObject = MandrillEmail()
        let emailDataStorage = EmailDataStorage()
        
        var emailSubject = "app_name".localized
        
        //If we got a title use that for the email subject if not use the app name
        if let urlTitle = sharingContent.title
        {
            emailSubject  = urlTitle
        }
        else if let comment = comment where !comment.isEmpty
        {
           
                emailSubject = comment
            
        }
        
        let mandrillTo = MandrillTo(email: emailDataStorage.getEmail())
        
        emailObject.to = [mandrillTo]
        emailObject.subject = emailSubject
        emailObject.from = Keys.from_email
        emailObject.fromName = "app_name".localized
        emailObject.html = "\(comment!)</br>\(sharingContent.url!)"
        
        return emailObject
    }
    
}<commit_msg>Latest changes in email builder<commit_after>//
//  EmailBuilder.swift
//  SendToMe
//
//  Created by <NAME> on 1/30/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation
import SwiftMandrill
import SendToMeFramework

/// Email builder that will build the email object based on the sharing content
public class EmailBuilder
{
    
    /**
     Builds the email object based on the sharing content
     
     - parameter sharingContent: sharing content
     
     - returns: returns email object
     */
    public class func buildEmailWithSharingContent(sharingContent:ShareContent, comment:String?)->MandrillEmail
    {
        let emailObject = MandrillEmail()
        let emailDataStorage = EmailDataStorage()
        
        var emailSubject = "app_name".localized
        
        //If we got a title use that for the email subject if not use the app name
        if let urlTitle = sharingContent.title
        {
            emailSubject  = urlTitle
        }
        else if let comment = comment where !comment.isEmpty
        {
            emailSubject = comment
        }
        
        let mandrillTo = MandrillTo(email: emailDataStorage.getEmail())
        
        emailObject.to = [mandrillTo]
        emailObject.subject = emailSubject
        emailObject.from = Keys.from_email
        emailObject.fromName = "app_name".localized
        emailObject.html = "\(comment!)</br>\(sharingContent.url!)"
        
        return emailObject
    }
    
}
{'fraction_non_alphanumeric': 0.07509218907140462, 'fraction_numerical': 0.006034193764666443, 'mean_word_length': 2.11482254697286, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '514244', 'n_tokens_mistral': 805, 'n_tokens_neox': 766, 'n_words': 236}