 
 import Foundation
 import SnapKit
-
+import Shared
 
 class SnackBarUX {
     static var MaxWidth: CGFloat = 400

    }

    override func shouldPersist(browser: Browser) -> Bool {
        if browser.url != prevURL {
            prevURL = browser.url
            count++
            return count < maxCount
        }



/**
 * A special version of a snackbar that persists for maxCount page loads.
 * Defaults to waiting for 1 load (i.e. will persist over one page load),
 * which is useful for things like saving passwords.
 */
class CountdownSnackBar: SnackBar {
    private var maxCount: Int? = nil
    private var count = 0
    private var prevURL: NSURL? = nil
    private var timer: (() -> ())? = nil

    init(maxCount: Int = 2, timeout: NSTimeInterval? = 1, attrText: NSAttributedString, img: UIImage?, buttons: [SnackButton]?) {
        self.maxCount = maxCount
        super.init(attrText: attrText, img: img, buttons: buttons)

        // We debounce calls here to avoid sites that have lots of redirects after they're shown.
        // GMail has a lot, and they can take a bit, so the default timeout is a little high (5 seconds).
        if let timeout = timeout {
            // Using a timer means that count isn't updated until AFTER the page has loaded.
            // We decrease the count by 1 to account for this.
            self.maxCount?--
            self.timer = debounce(timeout, {
                self.count++
            })
        }
    }

    override init(frame: CGRect) {
