<commit_before>//
//  KeyboardAction+Demo.swift
//  KeyboardKitExampleKeyboard
//
//  Created by <NAME> on 2019-04-30.
//  Copyright © 2019 <NAME>. All rights reserved.
//

import UIKit
import KeyboardKit

extension KeyboardAction {
    
    var isInputAction: Bool {
        switch self {
        case .character, .image: return true
        default: return false
        }
    }
    
    var isSystemAction: Bool {
        return !isInputAction
    }

    var keyboardImage: UIImage? {
        switch self {
        case .image(_, let keyboardImageName, _): return UIImage(named: keyboardImageName)
        case .switchKeyboard: return Asset.Images.Buttons.switchKeyboard.image
        default: return nil
        }
    }
    
    var keyboardText: String? {
        switch self {
        case .character(let text): return text
        default: return nil
        }
    }
    
    var keyboardWidth: CGFloat {
        switch self {
        case .none: return 20
        case .space: return 100
        case .switchKeyboard: return 60
        default: return 50
        }
    }
    
    func isDark(in viewController: KeyboardInputViewController) -> Bool {
        let appearance = viewController.textDocumentProxy.keyboardAppearance ?? .default
        return appearance == .dark
    }
    
    func keyboardColor(in viewController: KeyboardInputViewController) -> UIColor {
        let isDark = self.isDark(in: viewController)
        let asset = isSystemAction
            ? (isDark ? Asset.Colors.darkSystemButton : Asset.Colors.lightSystemButton)
            : (isDark ? Asset.Colors.darkButton : Asset.Colors.lightButton)
        return asset.color
    }
    
    func keyboardTextColor(in viewController: KeyboardInputViewController) -> UIColor {
        let isDark = self.isDark(in: viewController)
        let asset = isSystemAction<commit_msg>Adjust action texts and width in demo<commit_after>//
//  KeyboardAction+Demo.swift
//  KeyboardKitExampleKeyboard
//
//  Created by <NAME> on 2019-04-30.
//  Copyright © 2019 <NAME>. All rights reserved.
//

import UIKit
import KeyboardKit

extension KeyboardAction {
    
    var isInputAction: Bool {
        switch self {
        case .character, .image: return true
        default: return false
        }
    }
    
    var isSystemAction: Bool {
        return !isInputAction
    }

    var keyboardImage: UIImage? {
        switch self {
        case .image(_, let keyboardImageName, _): return UIImage(named: keyboardImageName)
        case .switchKeyboard: return Asset.Images.Buttons.switchKeyboard.image
        default: return nil
        }
    }
    
    var keyboardText: String? {
        switch self {
        case .backspace: return "⇦"
        case .character(let text): return text
        case .shift: return "⇧"
        default: return nil
        }
    }
    
    var keyboardWidth: CGFloat {
        switch self {
        case .none: return 10
        case .shift, .backspace: return 60
        case .switchKeyboard, .switchToNumericKeyboard, .switchToSymbolKeyboard: return 100
        case .space: return 200
        default: return 50
        }
    }
    
    func isDark(in viewController: KeyboardInputViewController) -> Bool {
        let appearance = viewController.textDocumentProxy.keyboardAppearance ?? .default
        return appearance == .dark
    }
    
    func keyboardColor(in viewController: KeyboardInputViewController) -> UIColor {
        let isDark = self.isDark(in: viewController)
        let asset = isSystemAction
            ? (isDark ? Asset.Colors.darkSystemButton : Asset.Colors.lightSystemButton)
            : (isDark ? Asset.Colors.darkButton : Asset.Colors.lightButton)
        return asset.color
    }
    
    func keyboardTextColor(in viewController: KeyboardInputViewController) -> UIColor {
        let isDark = self.isDark(in: viewController)
        let asset = isSystemAction
{'fraction_non_alphanumeric': 0.08112965340179717, 'fraction_numerical': 0.011553273427471117, 'mean_word_length': 2.2520868113522536, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '5898122', 'n_tokens_mistral': 1106, 'n_tokens_neox': 1062, 'n_words': 290}