<commit_before>//
//  TTSettingsViewController.swift
//  TrolleyTracker
//
//  Created by <NAME> on 6/16/15.
//  Copyright (c) 2015 Code For Greenville. All rights reserved.
//

import UIKit
import MessageUI


class TTSettingsViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()
      
      self.view.addSubview(self.tableView)
      
      let views = ["tableview": self.tableView]
      
      NSLayoutConstraint.activateConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|[tableview]|", options: nil, metrics: nil, views: views))
      
      NSLayoutConstraint.activateConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|[tableview]|", options: nil, metrics: nil, views: views))
    }
 
  
  ///MARK: TableView
  
  lazy var tableView: UITableView = {
    var tableView = UITableView()
   
    tableView.setTranslatesAutoresizingMaskIntoConstraints(false)
    
    tableView.dataSource = self
    tableView.delegate = self
    
    tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: NSStringFromClass(UITableViewCell.self))
    
    return tableView
  }()
  
  /// MARK: UITableViewDataSource
  
  func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    var cell: UITableViewCell = tableView.dequeueReusableCellWithIdentifier(NSStringFromClass(UITableViewCell.self), forIndexPath: indexPath) as! UITableViewCell
    
    if indexPath.section == 0 {
      cell.textLabel?.text = NSLocalizedString("Feedback", comment: "Feedback Button")
    }
    else if indexPath.section == 1 {
      cell.textLabel?.text = NSLocalizedString("Tell Friends", comment: "Feedback Button")
    }
    
    return cell
  }
 
  func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return 1
  }
  
  func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    return 2
  }
  
  /// MARK: UITableViewDelegate
  
  func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
   
    if indexPath.section == 0 {
      giveFeedBackButton()
    }
    else if indexPath.section == 1 {
      //tell friends
    }
  }
  
  
  func giveFeedBackButton() {
   
    var emailTitle = "TrolleyTracker Feedback"
    var messageBody = "Hi TrolleyTracker,\n\nI have some feedback to provide about my application using experience:\n\n"
    var toRecipents = ["<EMAIL>"]
    
    var mc: MFMailComposeViewController = MFMailComposeViewController()
    mc.setSubject(emailTitle)
    mc.setMessageBody(messageBody, isHTML: false)
    mc.setToRecipients(toRecipents)
    
    self.presentViewController(mc, animated: true, completion: nil)
  }
  
 
 /// MARK: Actions
  
  func dismiss() {<commit_msg>Added share sheet to settings<commit_after>//
//  TTSettingsViewController.swift
//  TrolleyTracker
//
//  Created by <NAME> on 6/16/15.
//  Copyright (c) 2015 Code For Greenville. All rights reserved.
//

import UIKit
import MessageUI


class TTSettingsViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()
      
      self.view.addSubview(self.tableView)
      
      let views = ["tableview": self.tableView]
      
      NSLayoutConstraint.activateConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|[tableview]|", options: nil, metrics: nil, views: views))
      
      NSLayoutConstraint.activateConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|[tableview]|", options: nil, metrics: nil, views: views))
    }
 
  
  ///MARK: TableView
  
  lazy var tableView: UITableView = {
    var tableView = UITableView()
   
    tableView.setTranslatesAutoresizingMaskIntoConstraints(false)
    
    tableView.dataSource = self
    tableView.delegate = self
    
    tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: NSStringFromClass(UITableViewCell.self))
    
    return tableView
  }()
  
  /// MARK: UITableViewDataSource
  
  func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    var cell: UITableViewCell = tableView.dequeueReusableCellWithIdentifier(NSStringFromClass(UITableViewCell.self), forIndexPath: indexPath) as! UITableViewCell
    
    if indexPath.section == 0 {
      cell.textLabel?.text = NSLocalizedString("Feedback", comment: "Feedback Button")
    }
    else if indexPath.section == 1 {
      cell.textLabel?.text = NSLocalizedString("Tell Friends", comment: "Feedback Button")
    }
    
    return cell
  }
 
  func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return 1
  }
  
  func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    return 2
  }
  
  /// MARK: UITableViewDelegate
  
  func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
   
    if indexPath.section == 0 {
      giveFeedBackButton()
    }
    else if indexPath.section == 1 {
      //show share sheet
      var shareSheetViewController = UIActivityViewController(activityItems: [NSLocalizedString("Check out Trolley Tracker!", comment: "Share Action"), NSLocalizedString("https://yeahthattrolley.com", comment: "Marketing URL")], applicationActivities: nil)
      
      self.presentViewController(shareSheetViewController, animated: true, completion: nil)
    }
  }
  
  
  func giveFeedBackButton() {
   
    var emailTitle = "TrolleyTracker Feedback"
    var messageBody = "Hi TrolleyTracker,\n\nI have some feedback to provide about my application using experience:\n\n"
    var toRecipents = ["<EMAIL>"]
    
    var mc: MFMailComposeViewController = MFMailComposeViewController()
    mc.setSubject(emailTitle)
    mc.setMessageBody(messageBody, isHTML: false)
    mc.setToRecipients(toRecipents)
    
    self.presentViewController(mc, animated: true, completion: nil)
  }
  
 
 /// MARK: Actions
  
  func dismiss() {
{'fraction_non_alphanumeric': 0.09530938123752496, 'fraction_numerical': 0.00499001996007984, 'mean_word_length': 3.6360832690824982, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 1, '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': '3304239', 'n_tokens_mistral': 1891, 'n_tokens_neox': 1736, 'n_words': 384}