SwiftMessages
SwiftMessages copied to clipboard
Status bar does not reappear after messageView disappears.
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.
Can you try 8.0.5? I think this may be the same underlying problem as #446.
I updated the pod to version 8.0.5, but the problem still persists.
Same issue and 8.0.5
didn't fixed it but 8.0.3
did.
This issue also exists with 9.0.4
Any ideas on a future fix?
Also on 9.0.5
😢
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).
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.
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()
}
}