Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status bar does not reappear after messageView disappears. #445

Open
JMchou opened this issue Dec 20, 2020 · 8 comments
Open

Status bar does not reappear after messageView disappears. #445

JMchou opened this issue Dec 20, 2020 · 8 comments

Comments

@JMchou
Copy link

JMchou commented Dec 20, 2020

To cover the status bar I set preferStatusBarHidden to true on the config object. However I found that the Status bar remain hidden even after the message view is retracted. I'm not sure if this is an unintended behavior or I'm not using the framework correctly.

@wtmoose
Copy link
Member

wtmoose commented Dec 20, 2020

Can you try 8.0.5? I think this may be the same underlying problem as #446.

@JMchou
Copy link
Author

JMchou commented Dec 21, 2020

I updated the pod to version 8.0.5, but the problem still persists.

@RSickenberg
Copy link

RSickenberg commented Jan 30, 2021

Same issue and 8.0.5 didn't fixed it but 8.0.3 did.

@sbrioux
Copy link

sbrioux commented Oct 6, 2021

This issue also exists with 9.0.4

Any ideas on a future fix?

@RSickenberg
Copy link

Also on 9.0.5 😢

@dtroupe18
Copy link

While not ideal you could tap into the eventListeners to reset the statusBar

var config: SwiftMessages.Config = .init()
config.prefersStatusBarHidden = true // hide status bar during message
config.presentationContext = .window(windowLevel: .statusBar)

config.eventListeners.append { [weak self] event in

    if case .didHide = event {

        // Unhide the status bar
 
        // This will cause the status bars hidden status to be set by the current viewController.
        self?.setNeedsStatusBarAppearanceUpdate()
    }
}

If you wrap your calls to SwiftMessages.show() in another class you could append this event listener to every message (if needed).

@RSickenberg
Copy link

If you wrap your calls to SwiftMessages.show() in another class you could append this event listener to every message (if needed).

Or in my case, pass a reference of the underlying viewController and call the method on it.

@fredpi
Copy link

fredpi commented May 27, 2022

Building upon the code posted by @dtroupe18, the following code doesn't require a reference to a specific view controller (self), but still accomplishes the same result:

config.eventListeners.append { event in
    if case .didHide = event {
        UIApplication.shared.windows.first { $0.isKeyWindow }?.rootViewController?.setNeedsStatusBarAppearanceUpdate()
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants