Skip to content

Commit

Permalink
fix: macOS 14 settings bug
Browse files Browse the repository at this point in the history
  • Loading branch information
FaiChou committed Nov 14, 2023
1 parent bede4a0 commit 47a3296
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
8 changes: 4 additions & 4 deletions uCopy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 8;
DEVELOPMENT_ASSET_PATHS = "\"uCopy/Preview Content\"";
DEVELOPMENT_TEAM = 7WS42S6435;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -377,7 +377,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.2;
MARKETING_VERSION = 1.3;
PRODUCT_BUNDLE_IDENTIFIER = com.faichou.uCopy;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -394,7 +394,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 8;
DEVELOPMENT_ASSET_PATHS = "\"uCopy/Preview Content\"";
DEVELOPMENT_TEAM = 7WS42S6435;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -410,7 +410,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.2;
MARKETING_VERSION = 1.3;
PRODUCT_BUNDLE_IDENTIFIER = com.faichou.uCopy;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
1 change: 1 addition & 0 deletions uCopy/HistoryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ struct HistoryView: View {
let fetchRequest: NSFetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: "History")
let batchDeleteRequest = NSBatchDeleteRequest(fetchRequest: fetchRequest)
try? context.executeAndMergeChanges(using: batchDeleteRequest)
try? context.save()
}
}
}
Expand Down
21 changes: 14 additions & 7 deletions uCopy/uCopyApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,21 @@ struct uCopyApp: App {
MenuBarExtra("Menu Bar", systemImage: "clipboard") {
HistoryView()
.environment(\.managedObjectContext, dataController.container.viewContext)
Button("Perferences...") {
NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil)
for window in NSApplication.shared.windows {
if window.title == "General" || window.title == "Snippet" || window.title == "About" {
window.level = .floating
}
if #available(macOS 14, *) {
SettingsLink {
Text("Perferences...")
}
}.keyboardShortcut(",")
.keyboardShortcut(",")
} else {
Button("Perferences...") {
NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil)
for window in NSApplication.shared.windows {
if window.title == "General" || window.title == "Snippet" || window.title == "About" {
window.level = .floating
}
}
}.keyboardShortcut(",")
}
Divider()
Button("Quit") {
monitor.terminate()
Expand Down

0 comments on commit 47a3296

Please sign in to comment.