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

ignoreDuplicates is not working #328

Closed
AlirezaSN opened this issue Jul 22, 2019 · 4 comments
Closed

ignoreDuplicates is not working #328

AlirezaSN opened this issue Jul 22, 2019 · 4 comments

Comments

@AlirezaSN
Copy link

Hi, i use ignoreDuplicates property but when i call my function 10 times in a short time, just one Message appears. where did i make a mistake? :)

my call code:

DispatchQueue.main.async {
      for _ in 10.countableRange {
             Toast.show("Hi", color: .red)
      }
}

my function:

public class func show(_ message: String, color: UIColor,
                           config: SwiftMessages.Config? = nil,
                           completion: (() -> Void)? = nil) {
        let messageView = self.bundleView ?? MessageView.viewFromNib(layout: .cardView)
        let bgView = messageView.backgroundView ?? messageView
        bgView.backgroundColor = color
        messageView.configureDropShadow()
        messageView.configureContent(body: message)
        //messageView.customId = Toast.currentFullDateTimeString
        if let font = Helper.shared.fonts.first {
            messageView.bodyLabel?.font = font.withSize(15.0)
        }
        var conf = config ?? SwiftMessages.defaultConfig
        conf.presentationContext = .window(windowLevel: UIWindow.Level.normal)
        conf.eventListeners.append { event in
            if event == .didHide { completion?() }
        }
        conf.ignoreDuplicates = false
        SwiftMessages.show(config: conf, view: messageView)
}

meanwhile, the customId property is private and we can't set a dynamic string.

thanks a lot.

@wtmoose
Copy link
Member

wtmoose commented Jul 22, 2019

Its a bug. Thanks for letting me know.

I guess that feature isn't used much and nobody noticed until you did. If you're in a hurry, MessageView.id is writable.

@AlirezaSN
Copy link
Author

i'll check it. thank you 👍👍

@wtmoose
Copy link
Member

wtmoose commented Aug 4, 2019

This is a bug, so leaving open

@wtmoose
Copy link
Member

wtmoose commented Oct 25, 2020

Should be fixed in 8.0.3

@wtmoose wtmoose closed this as completed Oct 25, 2020
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

2 participants