<commit_before>//
//  PrototypeController.swift
//  PrototypeFrameWork
//
//  Created by <NAME> on 28.05.16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation
import NSHash
import SSZipArchive
import GCDWebServer
import KeychainSwift

open class PrototypeController: NSObject {
    open static let sharedInstance = PrototypeController()
    fileprivate static var webServer: GCDWebServer!
    fileprivate static var containerMap = [String: String]()
    
    fileprivate static let PrototypeControllerMD5HashKey = "PrototypeControllerMD5HashKey"
    
    fileprivate var completionHandler: ((Void) -> Void)?
    
    fileprivate var feedbackBubble: FeedbackBubble!
    
    open var shouldShowFeedbackButton: Bool = true {
        didSet {
            if shouldShowFeedbackButton {
                isFeedbackButtonHidden = false
                addFeedbackButton()
            } else {
                isFeedbackButtonHidden = true
            }
        }
    }
    
    var isFeedbackButtonHidden: Bool = false {
        didSet {
            if isFeedbackButtonHidden {
                feedbackBubble?.isHidden = true
            } else {
                feedbackBubble?.isHidden = false
            }
        }
    }
    
    open func preloadPrototypes(_ containers: [String]? = ["container"], _ completionHandler: ((Void) -> Void)? = nil) {
        let containers = containers ?? ["container"]
        
        tryToFetchReleaseInfos()
        
        let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
        deleteOldContainers(in: documentsPath)
        
        for containerFile in containers {<commit_msg>fetch release info when showing feedback button<commit_after>//
//  PrototypeController.swift
//  PrototypeFrameWork
//
//  Created by <NAME> on 28.05.16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation
import NSHash
import SSZipArchive
import GCDWebServer
import KeychainSwift

open class PrototypeController: NSObject {
    open static let sharedInstance = PrototypeController()
    fileprivate static var webServer: GCDWebServer!
    fileprivate static var containerMap = [String: String]()
    
    fileprivate static let PrototypeControllerMD5HashKey = "PrototypeControllerMD5HashKey"
    
    fileprivate var completionHandler: ((Void) -> Void)?
    
    fileprivate var feedbackBubble: FeedbackBubble!
    
    open var shouldShowFeedbackButton: Bool = true {
        didSet {
            if shouldShowFeedbackButton {
                isFeedbackButtonHidden = false
                addFeedbackButton()
                tryToFetchReleaseInfos()
            } else {
                isFeedbackButtonHidden = true
            }
        }
    }
    
    var isFeedbackButtonHidden: Bool = false {
        didSet {
            if isFeedbackButtonHidden {
                feedbackBubble?.isHidden = true
            } else {
                feedbackBubble?.isHidden = false
            }
        }
    }
    
    open func preloadPrototypes(_ containers: [String]? = ["container"], _ completionHandler: ((Void) -> Void)? = nil) {
        let containers = containers ?? ["container"]
        
        tryToFetchReleaseInfos()
        
        let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
        deleteOldContainers(in: documentsPath)
        
        for containerFile in containers {
{'fraction_non_alphanumeric': 0.07467438494934878, 'fraction_numerical': 0.007525325615050651, 'mean_word_length': 2.3166986564299425, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '814523', 'n_tokens_mistral': 925, 'n_tokens_neox': 881, 'n_words': 229}