SwiftKickMobile / SwiftMessages

A very flexible message bar for UIKit and SwiftUI.
MIT License
7.31k stars 743 forks source link

Behaviour of fast toggling display and hidden is weird #314

Closed tylerlantern closed 5 years ago

tylerlantern commented 5 years ago

If I would to show two message streak. It supposed to be hiding the first one and displaying the new second one. For now, the second one will never show up. So I fixed it by adding newMessageView.id = UUID().uuidString To reproduce an issue, you have to set both title and body to be static text

Below is the chunk of code to reproduce an issue

    SwiftMessages.hide()
    let newMessageView: MessageView = MessageView.viewFromNib(layout: .centeredView)
    newMessageView.button?.isHidden = true
    newMessageView.titleLabel?.text = "staticTitle"
    newMessageView.bodyLabel?.text = "staticBody"
    newMessageView.configureTheme(
      backgroundColor: Colors.aquaBlue,
      foregroundColor: UIColor.white,
      iconImage: nil,
      iconText: nil)
    newMessageView.iconImageView?.isHidden = true
    newMessageView.iconLabel?.isHidden = true
    var config = SwiftMessages.defaultConfig
    config.presentationStyle = .top
    if let seconds = seconds {
      config.duration = .seconds(seconds: seconds)
    }else {
      config.duration = .indefinite(delay: 0, minimum: 1.5)
    }
    config.dimMode = .none
    config.presentationContext = .window(windowLevel: UIWindow.Level.statusBar)
    SwiftMessages.pauseBetweenMessages = 0
    SwiftMessages.show(config: config, view: newMessageView)
wtmoose commented 5 years ago

config.ignoreDuplicates = true