Skip to content

Commit 9cf8181

Browse files
committed
Fix bug where closing the main window didn't work properly.
1 parent efb581a commit 9cf8181

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

App/Sources/UI/Releases/Release3_27.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import Bonzai
22
import Inject
33
import SwiftUI
44

5+
private let currentVersion: Version = .v3273
6+
57
struct Release3_27: View {
68
@ObserveInjection var inject
79
enum ButtonAction {
@@ -111,12 +113,12 @@ private struct HeaderOverlay: View {
111113
HStack(alignment: .center) {
112114
Text("Keyboard Cowboy")
113115
.font(Font.system(size: 20, design: .rounded))
114-
Text("3.27.2")
116+
Text(currentVersion.rawValue)
115117
.foregroundStyle(.white)
116118
.font(Font.system(size: 24, design: .rounded))
117119
.allowsTightening(true)
118120
.fontWeight(.heavy)
119-
.shadow(color: Color(.systemOrange), radius: 10)
121+
.shadow(color: currentVersion.color, radius: 10)
120122
}
121123
.padding(.vertical, 8)
122124
.padding(.horizontal, 16)
@@ -161,6 +163,10 @@ private struct ChangesView: View {
161163
@ObserveInjection var inject
162164

163165
private let changes: [Change<AnyView>] = [
166+
Change(icon: { BugFixIconView(size: 24).anyView },
167+
text: "Fix bug where closing the main window didn't work as expected.",
168+
version: .v3273),
169+
164170
Change(icon: { BugFixIconView(size: 24).anyView },
165171
text: "Fix bug where keyboard sequences became unreliable.",
166172
version: .v3272),

App/Sources/UI/Windows/MainWindow.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@ import SwiftUI
55
@MainActor
66
final class MainWindow: NSObject, NSWindowDelegate {
77
private var window: NSWindow?
8-
private let core: Core
98
private let windowOpener: WindowOpener
9+
private let core: Core
10+
11+
private(set) static var shared: MainWindow!
1012

11-
init(core: Core) {
13+
init(core: Core, windowOpener: WindowOpener) {
1214
self.core = core
13-
self.windowOpener = WindowOpener(core: core)
15+
self.windowOpener = windowOpener
16+
super.init()
17+
Self.shared = self
1418
}
1519

1620
func open() {

App/Sources/UI/Windows/WindowOpener.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ import SwiftUI
44
@MainActor
55
final class WindowOpener: ObservableObject {
66
private let core: Core
7+
private var mainWindow: MainWindow!
78
private lazy var windowSwitcherWindow = WindowSwitcherWindow(commandRunner: core.commandRunner)
89

910
init(core: Core) {
1011
self.core = core
12+
self.mainWindow = MainWindow.shared ?? MainWindow(core: core, windowOpener: self)
1113
NotificationCenter.default.addObserver(self, selector: #selector(openMainWindow), name: .openKeyboardCowboy, object: nil)
1214
}
1315

1416
@objc func openMainWindow() {
15-
MainWindow(core: core).open()
17+
mainWindow.open()
1618
}
1719

1820
func openWindowSwitcher(_ snapshot: UserSpace.Snapshot) {

Project.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ let mainAppTarget = Target.target(
5555
"CURRENT_PROJECT_VERSION": SettingValue(stringLiteral: buildNumber),
5656
"DEVELOPMENT_TEAM": env["TEAM_ID"],
5757
"ENABLE_HARDENED_RUNTIME": true,
58-
"MARKETING_VERSION": "3.27.2",
58+
"MARKETING_VERSION": "3.27.3",
5959
"PRODUCT_NAME": "Keyboard Cowboy",
6060
"SWIFT_STRICT_CONCURRENCY": "complete",
6161
"SWIFT_VERSION": "6.0",

0 commit comments

Comments
 (0)