<commit_before>//
//  Copyright (c) 2015 Actor LLC. <https://actor.im>
//

import UIKit

class ComposeController: ContactsBaseViewController, UISearchBarDelegate, UISearchDisplayDelegate {

    @IBOutlet weak var tableView: UITableView!
    
    var searchView: UISearchBar?
    var searchDisplay: UISearchDisplayController?
    var searchSource: ContactsSearchSource?
    
    init() {
        super.init(contentSection: 1, nibName: "ComposeController", bundle: nil)
        self.navigationItem.title = NSLocalizedString("ComposeTitle", comment: "Compose Title")
        self.extendedLayoutIncludesOpaqueBars = true
    }

    required init(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func viewDidLoad() {
        view.backgroundColor = UIColor.whiteColor()
        
        bindTable(tableView, fade: true)
        
        searchView = UISearchBar()
        searchView!.delegate = self
        searchView!.frame = CGRectMake(0, 0, 0, 44)
        searchView!.keyboardAppearance = MainAppTheme.common.isDarkKeyboard ? UIKeyboardAppearance.Dark : UIKeyboardAppearance.Light
        
        MainAppTheme.search.styleSearchBar(searchView!)
        
        searchDisplay = UISearchDisplayController(searchBar: searchView, contentsController: self)
        searchDisplay?.searchResultsDelegate = self
        searchDisplay?.searchResultsTableView.rowHeight = 56
        searchDisplay?.searchResultsTableView.separatorStyle = UITableViewCellSeparatorStyle.None
        searchDisplay?.searchResultsTableView.backgroundColor = Resources.BackyardColor
        searchDisplay?.searchResultsTableView.frame = tableView.frame
        
        var header = TableViewHeader(frame: CGRectMake(0, 0, 320, 44))
        header.addSubview(searchView!)
        
        var headerShadow = UIImageView(frame: CGRectMake(0, -4, 320, 4));
        headerShadow.image = UIImage(named: "CardTop2");
        headerShadow.contentMode = UIViewContentMode.ScaleToFill;
        header.addSubview(headerShadow);
        
        tableView.tableHeaderView = header
 
        searchSource = ContactsSearchSource(searchDisplay: searchDisplay!)

        super.viewDidLoad()
    }
    
    func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 2
    }
    
    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        if (section == 1) {
            return super.tableView(tableView, numberOfRowsInSection: section)
        } else {
            return 2
        }
    }
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        if (indexPath.section == 1) {
            return super.tableView(tableView, cellForRowAtIndexPath: indexPath)
        } else {
            if (indexPath.row == 1) {
                let reuseId = "create_group";
                var res = ContactActionCell(reuseIdentifier: reuseId)
                res.bind("ic_add_user",
                    actionTitle: NSLocalizedString("CreateGroup", comment: "Create Group"),
                    isLast: false)
                return res
            } else {<commit_msg>fix(iOS): Removing "join public group" from compose<commit_after>//
//  Copyright (c) 2015 Actor LLC. <https://actor.im>
//

import UIKit

class ComposeController: ContactsBaseViewController, UISearchBarDelegate, UISearchDisplayDelegate {

    @IBOutlet weak var tableView: UITableView!
    
    var searchView: UISearchBar?
    var searchDisplay: UISearchDisplayController?
    var searchSource: ContactsSearchSource?
    
    init() {
        super.init(contentSection: 1, nibName: "ComposeController", bundle: nil)
        self.navigationItem.title = NSLocalizedString("ComposeTitle", comment: "Compose Title")
        self.extendedLayoutIncludesOpaqueBars = true
    }

    required init(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func viewDidLoad() {
        view.backgroundColor = UIColor.whiteColor()
        
        bindTable(tableView, fade: true)
        
        searchView = UISearchBar()
        searchView!.delegate = self
        searchView!.frame = CGRectMake(0, 0, 0, 44)
        searchView!.keyboardAppearance = MainAppTheme.common.isDarkKeyboard ? UIKeyboardAppearance.Dark : UIKeyboardAppearance.Light
        
        MainAppTheme.search.styleSearchBar(searchView!)
        
        searchDisplay = UISearchDisplayController(searchBar: searchView, contentsController: self)
        searchDisplay?.searchResultsDelegate = self
        searchDisplay?.searchResultsTableView.rowHeight = 56
        searchDisplay?.searchResultsTableView.separatorStyle = UITableViewCellSeparatorStyle.None
        searchDisplay?.searchResultsTableView.backgroundColor = Resources.BackyardColor
        searchDisplay?.searchResultsTableView.frame = tableView.frame
        
        var header = TableViewHeader(frame: CGRectMake(0, 0, 320, 44))
        header.addSubview(searchView!)
        
        var headerShadow = UIImageView(frame: CGRectMake(0, -4, 320, 4));
        headerShadow.image = UIImage(named: "CardTop2");
        headerShadow.contentMode = UIViewContentMode.ScaleToFill;
        header.addSubview(headerShadow);
        
        tableView.tableHeaderView = header
 
        searchSource = ContactsSearchSource(searchDisplay: searchDisplay!)

        super.viewDidLoad()
    }
    
    func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 2
    }
    
    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        if (section == 1) {
            return super.tableView(tableView, numberOfRowsInSection: section)
        } else {
            return 1
        }
    }
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        if (indexPath.section == 1) {
            return super.tableView(tableView, cellForRowAtIndexPath: indexPath)
        } else {
            if (indexPath.row == 0) {
                let reuseId = "create_group";
                var res = ContactActionCell(reuseIdentifier: reuseId)
                res.bind("ic_add_user",
                    actionTitle: NSLocalizedString("CreateGroup", comment: "Create Group"),
                    isLast: false)
                return res
            } else {
{'fraction_non_alphanumeric': 0.08508989460632362, 'fraction_numerical': 0.009609423434593924, 'mean_word_length': 2.749564206856479, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 2, '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': '2769960', 'n_tokens_mistral': 1825, 'n_tokens_neox': 1706, 'n_words': 358}