<commit_before>//
//  ModuleSelectorViewController.swift
//  ModuleSendEditor
//
//  Created by <NAME> on 23.02.15.
//  Copyright (c) 2015 Nettbureau AS. All rights reserved.
//

import UIKit

protocol ModuleSelectorViewControllerDelegate{
    func moduleSelectorViewController(moduleSelectorViewController: ModuleSelectorViewController, didSelectModule module: ComposerModule)
    func moduleSelectorViewControllerWasDismissed(moduleSelectorViewController: ModuleSelectorViewController)
}

class ModuleSelectorViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UITableViewDelegate, UITableViewDataSource {

    var imagePicker = UIImagePickerController()
    var delegate: ModuleSelectorViewControllerDelegate?
    @IBOutlet weak var moduleSelectorView: UIView!
    
    @IBOutlet weak var moduleSelectorViewBottomConstraint: NSLayoutConstraint!

    let moduleTypeStrings = [NSLocalizedString("big headline table view cell title", comment: "Title for table view cell"),
                            NSLocalizedString("small headline table view cell title", comment: "Title for table view cell"),
                            NSLocalizedString("normal text table view cell title", comment: "Title for table view cell"),
                            NSLocalizedString("image table view cell title", comment: "Title for table view cell")]
    
    @IBOutlet weak var tableView: UITableView!

    override func viewDidLoad() {
        super.viewDidLoad()
        
        var tblView = UIView(frame: CGRectZero)
        tableView.tableFooterView = tblView
        tableView.tableFooterView?.hidden = true
        
    }

    func addHeadline() {
        addTextModule(UIFontTextStyleHeadline)
    }
    
    func addSubheadline() {
        addTextModule(UIFontTextStyleSubheadline)
    }

    func addBody() {
        addTextModule(UIFontTextStyleBody)
    }
    
    @IBAction func closeButtonAction(sender: UIButton) {
        self.delegate?.moduleSelectorViewControllerWasDismissed(self)
    }
    
    func addTextModule(textStyle: String){
        let selectedModule = TextComposerModule(moduleWithFont: UIFont.preferredFontForTextStyle(textStyle))
        delegate?.moduleSelectorViewController(self, didSelectModule: selectedModule)
    }
    
    func addImage() {
        if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.SavedPhotosAlbum){
            imagePicker.delegate = self
            imagePicker.sourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum
            imagePicker.allowsEditing = true
            self.presentViewController(imagePicker, animated: true, completion: nil)
        }
    }
    <commit_msg>remove scroll from module selector view<commit_after>//
//  ModuleSelectorViewController.swift
//  ModuleSendEditor
//
//  Created by <NAME> on 23.02.15.
//  Copyright (c) 2015 Nettbureau AS. All rights reserved.
//

import UIKit

protocol ModuleSelectorViewControllerDelegate{
    func moduleSelectorViewController(moduleSelectorViewController: ModuleSelectorViewController, didSelectModule module: ComposerModule)
    func moduleSelectorViewControllerWasDismissed(moduleSelectorViewController: ModuleSelectorViewController)
}

class ModuleSelectorViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UITableViewDelegate, UITableViewDataSource {

    var imagePicker = UIImagePickerController()
    var delegate: ModuleSelectorViewControllerDelegate?
    @IBOutlet weak var moduleSelectorView: UIView!
    
    @IBOutlet weak var moduleSelectorViewBottomConstraint: NSLayoutConstraint!

    let moduleTypeStrings = [NSLocalizedString("big headline table view cell title", comment: "Title for table view cell"),
                            NSLocalizedString("small headline table view cell title", comment: "Title for table view cell"),
                            NSLocalizedString("normal text table view cell title", comment: "Title for table view cell"),
                            NSLocalizedString("image table view cell title", comment: "Title for table view cell")]
    
    @IBOutlet weak var tableView: UITableView!

    override func viewDidLoad() {
        super.viewDidLoad()
        
        var tblView = UIView(frame: CGRectZero)
        tableView.tableFooterView = tblView
        tableView.tableFooterView?.hidden = true
        tableView.scrollEnabled = false
    }
    
    func addHeadline() {
        addTextModule(UIFontTextStyleHeadline)
    }
    
    func addSubheadline() {
        addTextModule(UIFontTextStyleSubheadline)
    }

    func addBody() {
        addTextModule(UIFontTextStyleBody)
    }
    
    @IBAction func closeButtonAction(sender: UIButton) {
        self.delegate?.moduleSelectorViewControllerWasDismissed(self)
    }
    
    func addTextModule(textStyle: String){
        let selectedModule = TextComposerModule(moduleWithFont: UIFont.preferredFontForTextStyle(textStyle))
        delegate?.moduleSelectorViewController(self, didSelectModule: selectedModule)
    }
    
    func addImage() {
        if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.SavedPhotosAlbum){
            imagePicker.delegate = self
            imagePicker.sourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum
            imagePicker.allowsEditing = true
            self.presentViewController(imagePicker, animated: true, completion: nil)
        }
    }
    
{'fraction_non_alphanumeric': 0.0669943564536683, 'fraction_numerical': 0.0036409976333515383, 'mean_word_length': 3.5069729286300246, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '516715', 'n_tokens_mistral': 1420, 'n_tokens_neox': 1332, 'n_words': 321}