Skip to content

Commit

Permalink
Always check to make sure that only one Bulletin is open at a time
Browse files Browse the repository at this point in the history
Fixes #330 - "Attempt to present a Bulletin on top of another Bulletin window"
  • Loading branch information
aaronbrethorst committed Aug 21, 2021
1 parent 83ed144 commit 69819e8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions OBAKit/Alerts/AgencyAlertBulletin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ class AgencyAlertBulletin: NSObject {
}

func show(in application: UIApplication) {
guard !bulletinManager.isShowingBulletin else {
return
}

bulletinManager.showBulletin(in: application)
}
}
4 changes: 4 additions & 0 deletions OBAKit/Errors/ErrorBulletin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ class ErrorBulletin: NSObject {
}

func show(in app: UIApplication) {
guard !bulletinManager.isShowingBulletin else {
return
}

bulletinManager.showBulletin(in: app)
}
}
4 changes: 4 additions & 0 deletions OBAKit/PushNotifications/AlarmBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ class AlarmBuilder: NSObject {
// MARK: - Public Methods

public func showBulletin(above viewController: UIViewController) {
guard !bulletinManager.isShowingBulletin else {
return
}

bulletinManager.showBulletin(above: viewController)
}

Expand Down
6 changes: 5 additions & 1 deletion OBAKit/Reachability/Reachability.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ class ReachabilityBulletin: NSObject {
}

func showStatus(_ status: ConnectivityResult, in application: UIApplication) {
guard !status.isConnected else {
guard
!status.isConnected,
!bulletinManager.isShowingBulletin
else {
return
}

Expand All @@ -50,6 +53,7 @@ class ReachabilityBulletin: NSObject {
}

dismiss()

bulletinManager.showBulletin(in: application)
}

Expand Down
3 changes: 3 additions & 0 deletions OBAKit/Regions/RegionMismatchBulletin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ class RegionMismatchBulletin: NSObject {
}

func show(in app: UIApplication) {
guard !bulletinManager.isShowingBulletin else {
return
}
bulletinManager.showBulletin(in: app)
}
}

0 comments on commit 69819e8

Please sign in to comment.