<commit_before>//
//  FeeSelector.swift
//  breadwallet
//
//  Created by <NAME> on 2017-07-20.
//  Copyright © 2017-2019 Breadwinner AG. All rights reserved.
//

import UIKit

//TODO:CRYPTO_V2 - these should come from BlockchainDB eventually
enum FeeLevel: Int {
    case economy
    case regular
    case priority
    
    //Time in millis
    func preferredTime(forCurrency: Currency) -> Int {
        guard forCurrency.uid == Currencies.btc.uid else {
            return Int(C.secondsInMinute) * 3 * 1000 // 3 mins
        }
        
        switch self {
        case .economy:
            return Int(C.secondsInMinute) * 60 * 10 * 1000 //10 hrs
        case .regular:
            return Int(C.secondsInMinute) * 60 * 1000 //60 mins
        case .priority:
            return 0
        }
    }
}

class FeeSelector: UIView {

    init() {
        super.init(frame: .zero)
        setupViews()
    }

    var didUpdateFee: ((FeeLevel) -> Void)?

    private let topBorder = UIView(color: .secondaryShadow)
    private let header = UILabel(font: .customMedium(size: 16.0), color: .darkText)
    private let subheader = UILabel(font: .customBody(size: 14.0), color: .grayTextTint)
    private let warning = UILabel.wrapping(font: .customBody(size: 14.0), color: .red)
    private let control = UISegmentedControl(items: [S.FeeSelector.economy, S.FeeSelector.regular, S.FeeSelector.priority])

    private func setupViews() {
        addSubview(topBorder)
        addSubview(control)<commit_msg>[IOS-1426] Update regular fee time<commit_after>//
//  FeeSelector.swift
//  breadwallet
//
//  Created by <NAME> on 2017-07-20.
//  Copyright © 2017-2019 Breadwinner AG. All rights reserved.
//

import UIKit

//TODO:CRYPTO_V2 - these should come from BlockchainDB eventually
enum FeeLevel: Int {
    case economy
    case regular
    case priority
    
    //Time in millis
    func preferredTime(forCurrency: Currency) -> Int {
        guard forCurrency.uid == Currencies.btc.uid else {
            return Int(C.secondsInMinute) * 3 * 1000 // 3 mins
        }
        
        switch self {
        case .economy:
            return Int(C.secondsInMinute) * 60 * 7 * 1000 //7 hrs
        case .regular:
            return Int(C.secondsInMinute) * 50 * 1000 //50 mins
        case .priority:
            return Int(C.secondsInMinute) * 10 * 1000 //10 mins
        }
    }
}

class FeeSelector: UIView {

    init() {
        super.init(frame: .zero)
        setupViews()
    }

    var didUpdateFee: ((FeeLevel) -> Void)?

    private let topBorder = UIView(color: .secondaryShadow)
    private let header = UILabel(font: .customMedium(size: 16.0), color: .darkText)
    private let subheader = UILabel(font: .customBody(size: 14.0), color: .grayTextTint)
    private let warning = UILabel.wrapping(font: .customBody(size: 14.0), color: .red)
    private let control = UISegmentedControl(items: [S.FeeSelector.economy, S.FeeSelector.regular, S.FeeSelector.priority])

    private func setupViews() {
        addSubview(topBorder)
        addSubview(control)
{'fraction_non_alphanumeric': 0.11067452521283562, 'fraction_numerical': 0.036345776031434185, 'mean_word_length': 2.390677025527192, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '3219522', 'n_tokens_mistral': 1073, 'n_tokens_neox': 957, 'n_words': 259}