mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-19 21:06:10 +00:00
Merge branch 'master'
#Conflicts: # QuickDrop.xcodeproj/project.pbxproj
This commit is contained in:
commit
f638814add
3 files changed
+32
-20
No files matched your search
@@ -930,13 +930,13 @@
|
|||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
MACOSX_DEPLOYMENT_TARGET = 11.5;
|
||||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
SHARED_BUILD = 61;
|
SHARED_BUILD = 63;
|
||||||
SHARED_VERSION = 1.12.2;
|
SHARED_VERSION = 1.12.4;
|
||||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
@@ -993,12 +993,12 @@
|
|||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
MACOSX_DEPLOYMENT_TARGET = 11.5;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
SHARED_BUILD = 61;
|
SHARED_BUILD = 63;
|
||||||
SHARED_VERSION = 1.12.2;
|
SHARED_VERSION = 1.12.4;
|
||||||
SWIFT_COMPILATION_MODE = wholemodule;
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||||
|
|||||||
+25
-11
@@ -228,6 +228,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
|
|
||||||
|
|
||||||
@objc func openPlusScreen() {
|
@objc func openPlusScreen() {
|
||||||
|
// If window already exists and is visible, just bring it to the front
|
||||||
|
if let window = plusWindow, window.isVisible {
|
||||||
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
|
window.makeKeyAndOrderFront(nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Create the welcome screen SwiftUI view
|
// Create the welcome screen SwiftUI view
|
||||||
let plusView = PlusView(closeView: {
|
let plusView = PlusView(closeView: {
|
||||||
log("Closing plus screen")
|
log("Closing plus screen")
|
||||||
@@ -235,26 +242,33 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Create an NSWindow to host the SwiftUI view
|
// Create an NSWindow to host the SwiftUI view
|
||||||
plusWindow = NSWindow(
|
let window = NSWindow(
|
||||||
contentRect: NSRect(x: 0, y: 0, width: plusViewWidth, height: plusViewHeight),
|
contentRect: NSRect(x: 0, y: 0, width: plusViewWidth, height: plusViewHeight),
|
||||||
styleMask: [.titled, .closable],
|
styleMask: [.titled, .closable],
|
||||||
backing: .buffered,
|
backing: .buffered,
|
||||||
defer: false
|
defer: false
|
||||||
)
|
)
|
||||||
|
|
||||||
plusWindow?.styleMask.insert(.fullSizeContentView)
|
window.styleMask.insert(.fullSizeContentView)
|
||||||
plusWindow?.titleVisibility = .hidden
|
window.titleVisibility = .hidden
|
||||||
plusWindow?.titlebarAppearsTransparent = true
|
window.titlebarAppearsTransparent = true
|
||||||
|
|
||||||
plusWindow?.center()
|
window.center()
|
||||||
plusWindow?.isReleasedWhenClosed = false
|
window.isReleasedWhenClosed = false
|
||||||
plusWindow?.setFrameAutosaveName("PlusScreen")
|
window.setFrameAutosaveName("PlusScreen")
|
||||||
plusWindow?.contentView = NSHostingView(rootView: plusView)
|
window.contentView = NSHostingView(rootView: plusView)
|
||||||
|
|
||||||
|
// Reset reference when closed by red button
|
||||||
|
NotificationCenter.default.addObserver(forName: NSWindow.willCloseNotification, object: window, queue: .main) { [weak self] _ in
|
||||||
|
self?.plusWindow = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
plusWindow = window
|
||||||
|
|
||||||
// Ensure the window is always on top
|
// Ensure the window is always on top
|
||||||
NSApp.activate(ignoringOtherApps: true) // Brings the whole app to the front
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
plusWindow?.makeKeyAndOrderFront(nil)
|
window.makeKeyAndOrderFront(nil)
|
||||||
plusWindow?.level = .normal
|
window.level = .normal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ struct LicensePage: View {
|
|||||||
|
|
||||||
|
|
||||||
func openLicenseWindow() -> NSWindow {
|
func openLicenseWindow() -> NSWindow {
|
||||||
// Create a new NSWindow and retain it in the `newWindow` property
|
|
||||||
let window = NSWindow(
|
let window = NSWindow(
|
||||||
contentRect: NSRect(x: 0, y: 0, width: 500, height: 400),
|
contentRect: NSRect(x: 0, y: 0, width: 500, height: 400),
|
||||||
styleMask: [.titled, .closable, .resizable],
|
styleMask: [.titled, .closable, .resizable],
|
||||||
@@ -37,10 +36,9 @@ func openLicenseWindow() -> NSWindow {
|
|||||||
window.contentView = NSHostingView(rootView: LicensePage())
|
window.contentView = NSHostingView(rootView: LicensePage())
|
||||||
|
|
||||||
// Ensure the window is always on top
|
// Ensure the window is always on top
|
||||||
NSApp.activate(ignoringOtherApps: true) // Brings the whole app to the front
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
window.makeKeyAndOrderFront(nil)
|
window.makeKeyAndOrderFront(nil)
|
||||||
window.level = .normal
|
window.level = .normal
|
||||||
|
|
||||||
// Retain the window to prevent deallocation
|
|
||||||
return window
|
return window
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user