Skip to content

Commit

Permalink
Merge pull request #50 from WeTransfer/feature/window-management
Browse files Browse the repository at this point in the history
Don't make notification window key as it could conflict with the main window
  • Loading branch information
kairadiagne authored Dec 18, 2020
2 parents d838a4b + be26c30 commit 12d943c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Sources/UINotificationCenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public final class UINotificationCenter {
// MARK: Private properties

/// The window which will be placed on top of the application window.
/// This window is used to present the notifications on and will be hided when all notifications are presented.
/// This window is used to present the notifications on and will be hidden when notifications are dismissed.
internal let window: UIWindow

/// Handles queueing of all notifications. Contains a queue of `UINotificationRequest` objects.
Expand Down
7 changes: 2 additions & 5 deletions Sources/UINotificationPresentationContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public final class UINotificationPresentationContext {
private func prepareContainerWindow() {
containerWindow.windowLevel = windowLevel
#if !TEST
containerWindow.makeKeyAndVisible()
containerWindow.isHidden = false
#endif
}

Expand Down Expand Up @@ -94,9 +94,6 @@ public final class UINotificationPresentationContext {
/// Move the window behind the key application window.
containerWindow.windowLevel = UIWindow.Level.normal - 1
containerWindow.rootViewController = nil

/// Make sure the key window of the app is visible again.
guard let applicationWindow = UIApplication.shared.windows.first(where: { $0 != self.containerWindow }) else { return }
applicationWindow.makeKeyAndVisible()
containerWindow.isHidden = true
}
}

0 comments on commit 12d943c

Please sign in to comment.