Skip to content

Commit

Permalink
Merge pull request #968 from kiwix/962-regression-opening-app-with-zi…
Browse files Browse the repository at this point in the history
…m-doesnt-open-zim

Fix opening app with ZIM doesn't open ZIM
  • Loading branch information
kelson42 authored Sep 7, 2024
2 parents 28ee7db + b13e466 commit a88669f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
3 changes: 2 additions & 1 deletion App/App_macOS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ struct RootView: View {
browser.load(url: url)
}
.onReceive(tabCloses) { publisher in
// closing one window either by CMD+W || red(X) close button
guard windowTracker.current == publisher.object as? NSWindow else {
// when exiting full screen video, we get the same notification
// but that's not comming from our window
Expand All @@ -210,8 +211,8 @@ struct RootView: View {
}
}
.onReceive(appTerminates) { _ in
// CMD+Q -> Quit Kiwix, this also closes the last window
navigation.isTerminating = true
browser.persistAllTabIdsFromWindows()
}.task {
switch AppType.current {
case .kiwix:
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## 3.5.2

- FIX:
- Opening ZIM file from macOS Finder (@BPerlakiH #968)

## 3.5.1
- FIX:
Expand Down
7 changes: 0 additions & 7 deletions ViewModel/BrowserViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -597,13 +597,6 @@ final class BrowserViewModel: NSObject, ObservableObject,
}

// PERSISTENCE:
func persistAllTabIdsFromWindows() {
let urls = NSApplication.shared.windows.compactMap { window in
window.accessibilityURL()
}
UserDefaults.standard[.windowURLs] = urls
}

private func storeTabIDInCurrentWindow() {
guard let tabID,
let windowNumber,
Expand Down

0 comments on commit a88669f

Please sign in to comment.