     ///
     /// - Note: By default, window level is set so it appears on the top of the
     /// currently visible window.
-    open func adjustWindowLevel(_ callback: @escaping () -> Void) {
-        adjustWindowLevel = { [weak self] in
+    open func adjustWindowAttributes(_ callback: @escaping (_ window: UIWindow, _ willShow: Bool) -> Void) {
+        adjustWindowAttributes = { [weak self] window, willShow in
             self?.setDefaultWindowLevel()
-            callback()
+            callback(window, willShow)
         }
     }
 

        self.windowLevel = maxWinLevel + 1
    }

    private lazy var adjustWindowLevel: (() -> Void)? = { [weak self] in
        self?.setDefaultWindowLevel()
    }

    /// A block to adjust window level so this HUD is displayed appropriately.
    ///
    /// For example, you can adjust the window level so this HUD is always shown
    /// behind the passcode screen to ensure that this HUD is not shown before user

        let duration = enabled ? self.duration.show : self.duration.hide

        isEnabled = enabled
        adjustWindowAttributes?(window, enabled)
        setNeedsStatusBarAppearanceUpdate()

        if enabled {
            window.isHidden = false

            guard animated else {
                view.alpha = 1
