 
 import UIKit
 
-private let RADInfoBannerViewWithNavigationBarHeight: CGFloat = 30.0
-private let RADInfoBannerViewWithoutNavigationBarHeight: CGFloat = 50.0
+private let RADInfoBannerViewHeight: CGFloat = 30.0
+private let RADInfoBannerViewHeightPadding: CGFloat = 10.0
 
 public class RADInfoBannerView: UIView {
     

    }
    
    override public func updateConstraints() {
        var topOffset: CGFloat = 0.0
        if let navigationController = self.topViewController as? UINavigationController {
            if navigationController.navigationBarHidden == false {
                topOffset = 20.0 + CGRectGetHeight(navigationController.navigationBar.frame) // 20 px for status bar + navigation bar height
            }
        }
        

        return self
    }
    
    public func hide(afterDelay delay: Double? = nil, animated: Bool = true) {
        if let delay = delay {
            let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(delay * Double(NSEC_PER_SEC)))
            dispatch_after(delayTime, dispatch_get_main_queue()) {
                self.hideInfoBannerView(animated)
            }
        } else {
            self.hideInfoBannerView(animated)
        }
    }
    
    public class func showInfoBannerView(text: String, showActivityIndicatorView: Bool = false, hideAfter delay: Double? = nil) -> RADInfoBannerView {
        let infoBannerView = RADInfoBannerView(text: text, showActivityIndicatorView: showActivityIndicatorView)
        infoBannerView.show()
        if let delay = delay {
            infoBannerView.hide(afterDelay: delay)
        }
        return infoBannerView
    }
    
    public class func hideAllInfoBannerViewInView(view: UIView) {
        for view in view.subviews where view is RADInfoBannerView {
            (view as! RADInfoBannerView).hide(animated: false)
        }
    }
    
