Skip to content

Commit 47a3296

Browse files
committed
fix: macOS 14 settings bug
1 parent bede4a0 commit 47a3296

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

uCopy.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@
361361
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
362362
CODE_SIGN_STYLE = Automatic;
363363
COMBINE_HIDPI_IMAGES = YES;
364-
CURRENT_PROJECT_VERSION = 7;
364+
CURRENT_PROJECT_VERSION = 8;
365365
DEVELOPMENT_ASSET_PATHS = "\"uCopy/Preview Content\"";
366366
DEVELOPMENT_TEAM = 7WS42S6435;
367367
ENABLE_HARDENED_RUNTIME = YES;
@@ -377,7 +377,7 @@
377377
"@executable_path/../Frameworks",
378378
);
379379
MACOSX_DEPLOYMENT_TARGET = 13.0;
380-
MARKETING_VERSION = 1.2;
380+
MARKETING_VERSION = 1.3;
381381
PRODUCT_BUNDLE_IDENTIFIER = com.faichou.uCopy;
382382
PRODUCT_NAME = "$(TARGET_NAME)";
383383
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -394,7 +394,7 @@
394394
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
395395
CODE_SIGN_STYLE = Automatic;
396396
COMBINE_HIDPI_IMAGES = YES;
397-
CURRENT_PROJECT_VERSION = 7;
397+
CURRENT_PROJECT_VERSION = 8;
398398
DEVELOPMENT_ASSET_PATHS = "\"uCopy/Preview Content\"";
399399
DEVELOPMENT_TEAM = 7WS42S6435;
400400
ENABLE_HARDENED_RUNTIME = YES;
@@ -410,7 +410,7 @@
410410
"@executable_path/../Frameworks",
411411
);
412412
MACOSX_DEPLOYMENT_TARGET = 13.0;
413-
MARKETING_VERSION = 1.2;
413+
MARKETING_VERSION = 1.3;
414414
PRODUCT_BUNDLE_IDENTIFIER = com.faichou.uCopy;
415415
PRODUCT_NAME = "$(TARGET_NAME)";
416416
SWIFT_EMIT_LOC_STRINGS = YES;

uCopy/HistoryView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ struct HistoryView: View {
3535
let fetchRequest: NSFetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: "History")
3636
let batchDeleteRequest = NSBatchDeleteRequest(fetchRequest: fetchRequest)
3737
try? context.executeAndMergeChanges(using: batchDeleteRequest)
38+
try? context.save()
3839
}
3940
}
4041
}

uCopy/uCopyApp.swift

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,21 @@ struct uCopyApp: App {
3333
MenuBarExtra("Menu Bar", systemImage: "clipboard") {
3434
HistoryView()
3535
.environment(\.managedObjectContext, dataController.container.viewContext)
36-
Button("Perferences...") {
37-
NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil)
38-
for window in NSApplication.shared.windows {
39-
if window.title == "General" || window.title == "Snippet" || window.title == "About" {
40-
window.level = .floating
41-
}
36+
if #available(macOS 14, *) {
37+
SettingsLink {
38+
Text("Perferences...")
4239
}
43-
}.keyboardShortcut(",")
40+
.keyboardShortcut(",")
41+
} else {
42+
Button("Perferences...") {
43+
NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil)
44+
for window in NSApplication.shared.windows {
45+
if window.title == "General" || window.title == "Snippet" || window.title == "About" {
46+
window.level = .floating
47+
}
48+
}
49+
}.keyboardShortcut(",")
50+
}
4451
Divider()
4552
Button("Quit") {
4653
monitor.terminate()

0 commit comments

Comments
 (0)