<commit_before>//
//  SettingsViewController.swift
//  Cantaloupe
//
//  Created by <NAME> on 9/26/14.
//  Copyright (c) 2014 <NAME>. All rights reserved.
//

import UIKit

class SettingsViewController: UITableViewController {

    required init(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    enum SettingCell:Int {
        case None = 0
        case Logout
        case Username
        case Contact
    }
    
    let kSettingsCellIdentifier = "kSettingsCell"
    let kSectionHeaderHeight = 30.0
    
    var settingItems:Array<SettingCell>
    var userItems:Array<SettingCell>
    var helpItems:Array<SettingCell>
    
    override init(style: UITableViewStyle) {
        self.settingItems = [SettingCell.Logout]
        self.userItems = [SettingCell.Username]
        self.helpItems = [SettingCell.Contact]
        super.init(style: style)
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.navigationItem.title = "Settings"
        self.tableView.registerClass(SettingsViewCell.self, forCellReuseIdentifier: kSettingsCellIdentifier)
    }
    
    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
        // TODO: Integrate with google analytics
    }
    
    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 3
    }

    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        if (section == 0) {
            return self.settingItems.count
        } else if (section == 1) {
            return self.userItems.count
        } else if (section == 2) {
            return self.helpItems.count
        } else {
            return 0
        }
    }
    
    override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
        let headerViewFrame = CGRectMake(0, 0, CGRectGetWidth(tableView.bounds), CGFloat(kSectionHeaderHeight))
        let headerView = UIView(frame: headerViewFrame)
        
        let leftPadding = CGFloat(15.0)
        
        let headerFrame = CGRectMake(leftPadding, 0, CGRectGetWidth(tableView.bounds) - leftPadding, CGFloat(kSectionHeaderHeight))
        let header = UILabel(frame: headerFrame)
        
        var text:NSString
        
        if (section == 0) {
            text = "MANAGEMENT"
        } else if (section == 1) {
            text = "INFORMATION"
        } else if (section == 2) {
            text = "HELP"
        } else {
            text = "????"
        }
        
        header.text = text
        header.font = UIFont(name: "Lato-Regular", size: 14)
        header.textColor = UIColor.grayColor()
        headerView.addSubview(header)
        return headerView
    }
    
    override func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return CGFloat(kSectionHeaderHeight)
    }
    

}<commit_msg>Add some more information in the setting view controller<commit_after>//
//  SettingsViewController.swift
//  Cantaloupe
//
//  Created by <NAME> on 9/26/14.
//  Copyright (c) 2014 <NAME>. All rights reserved.
//

import UIKit

class SettingsViewController: UITableViewController {

    required init(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    enum SettingCell:Int {
        case None = 0
        case Logout
        case Username
        case Contact
    }
    
    let kSettingsCellIdentifier = "kSettingsCell"
    let kSectionHeaderHeight = 30.0
    
    var settingItems:Array<SettingCell>
    var userItems:Array<SettingCell>
    var helpItems:Array<SettingCell>
    
    override init(style: UITableViewStyle) {
        self.settingItems = [SettingCell.Logout]
        self.userItems = [SettingCell.Username]
        self.helpItems = [SettingCell.Contact]
        super.init(style: style)
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.navigationItem.title = "Settings"
        self.tableView.registerClass(SettingsViewCell.self, forCellReuseIdentifier: kSettingsCellIdentifier)
    }
    
    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
        // TODO: Integrate with google analytics
    }
    
    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 3
    }

    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        if (section == 0) {
            return self.settingItems.count
        } else if (section == 1) {
            return self.userItems.count
        } else if (section == 2) {
            return self.helpItems.count
        } else {
            return 0
        }
    }
    
    override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
        let headerViewFrame = CGRectMake(0, 0, CGRectGetWidth(tableView.bounds), CGFloat(kSectionHeaderHeight))
        let headerView = UIView(frame: headerViewFrame)
        
        let leftPadding = CGFloat(15.0)
        
        let headerFrame = CGRectMake(leftPadding, 0, CGRectGetWidth(tableView.bounds) - leftPadding, CGFloat(kSectionHeaderHeight))
        let header = UILabel(frame: headerFrame)
        
        var text:NSString
        
        if (section == 0) {
            text = "MANAGEMENT"
        } else if (section == 1) {
            text = "INFORMATION"
        } else if (section == 2) {
            text = "HELP"
        } else {
            text = "????"
        }
        
        header.text = text
        header.font = UIFont(name: "Lato-Regular", size: 14)
        header.textColor = UIColor.grayColor()
        headerView.addSubview(header)
        return headerView
    }
    
    override func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return CGFloat(kSectionHeaderHeight)
    }
    
    override func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
        return 0.01
    }
    
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier(kSettingsCellIdentifier, forIndexPath: indexPath) as SettingsViewCell
        
        self.customizeCell(cell, indexPath:indexPath)
        return cell
    }
    
    func customizeCell(cell: SettingsViewCell, indexPath:NSIndexPath) {
        var cellType = SettingCell.None
        
        var backingData:Array<SettingCell>
        
        if (indexPath.section == 0) {
            backingData = self.settingItems
        } else if (indexPath.section == 1) {
            backingData = self.userItems
        } else if (indexPath.section == 2) {
            backingData = self.helpItems
        } else {
            return
        }
        
        let row = indexPath.row
        if (row < backingData.count) {
            cellType = backingData[row]
        }
        
        switch cellType {
        case .Logout:
            cell.textLabel!.text = "Logout"
            cell.tag = SettingCell.Logout.toRaw()
            break
        case .Username:
            cell.textLabel!.text = "Username"
            cell.detailTextLabel!.text = "My username here"
            cell.tag = SettingCell.Username.toRaw()
        case .Contact:
            cell.textLabel!.text = "Contact"
            cell.tag = SettingCell.Contact.toRaw()
        default:
            break
        }
    }
}
{'fraction_non_alphanumeric': 0.08920311880533897, 'fraction_numerical': 0.00845777719043214, 'mean_word_length': 2.141552511415525, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 24, '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': '4109875', 'n_tokens_mistral': 2229, 'n_tokens_neox': 2114, 'n_words': 484}