Closed royherma closed 7 years ago
Ended up implementing a fix myself by adding a boolean isDisplaying
flag.
Sounds good.
This is very annoying. I think it should be solved in the library itself.
@royherma How would you detect if it's currently displayed? Any reliable way other than manually tracking this using sirenDidShowUpdateDialog(alertType:)
, sirenUserDidLaunchAppStore()
, sirenUserDidSkipVersion()
and sirenUserDidCancel
?
Could you share some context about why you're setting the alert type multiple times? Just want to better understand the problem you're solving.
@mamouneyya Are you asking to figure out if a UIAlertController is being displayed?
More context would be ideal. The more detail, the easier it will be for us to answer this question.
Well, I'm a little bit confused now. I followed the instructions by calling checkVersion
method at the following AppDelegate's methods:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
//...
Siren.sharedInstance.checkVersion(checkType: .immediately)
return true
}
func applicationDidBecomeActive(_ application: UIApplication) {
Siren.sharedInstance.checkVersion(checkType: .daily)
}
func applicationWillEnterForeground(_ application: UIApplication) {
if Defaults[.AppUpdateAlertType] == .force {
Siren.sharedInstance.checkVersion(checkType: .immediately)
}
}
However, the library seems to be presenting an alert with each call of those even though a one or more are already presented (e.g. I'm getting three alerts when in force mode)...
First things first,
What version of your app is currently in the store, if any? What version is currently set in the info.plist?
It's not published to the store yet, so I am trying with the bundle identifier 'com.apple.itunesconnect.mobile' and version 1.0, as suggested in the README file. The problem is not with the fact that the library does show an alert (it should do so).. the problem is that it displays another alert though a one is already displayed.. ending up with three stacked alerts.
ok, got it - thanks for that detailed explanation. This is most likely a bug in Siren and I will take a look at it now. I don't use .force
often, meaning I also don't make use of Siren in applicationWillEnterForeground
, which is probably why the issue is popping up.
Thanks for the info. I'll look at it now.
@royherma @mamouneyya @getaaron
The fix was merged and is available in Siren v1.1.3 via all dependency managers.
I can confirm that the update fixed the issue for me. Thank you!
I've got logic that sets
Siren.sharedInstance.alertType
several times, and its causing Siren to pop-up multiple alerts on top of each other. Any way to only allow 1 alert at a time?Thanks!