mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-21 22:05:59 +00:00
Fix macOS toast view autohide
This commit is contained in:
1 parent
0c440b7511
commit
f948c30027
3 files changed
+15
-9
No files matched your search
@@ -1319,7 +1319,7 @@
|
|||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
SHARED_BUILD = 88;
|
SHARED_BUILD = 89;
|
||||||
SHARED_VERSION = 2.6.1;
|
SHARED_VERSION = 2.6.1;
|
||||||
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
||||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||||
@@ -1382,7 +1382,7 @@
|
|||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
SHARED_BUILD = 88;
|
SHARED_BUILD = 89;
|
||||||
SHARED_VERSION = 2.6.1;
|
SHARED_VERSION = 2.6.1;
|
||||||
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
||||||
SWIFT_COMPILATION_MODE = wholemodule;
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ struct QuickDropToastView: View {
|
|||||||
@ObservedObject var settings = Settings.shared
|
@ObservedObject var settings = Settings.shared
|
||||||
@ObservedObject var receiveModel: ReceiveModel
|
@ObservedObject var receiveModel: ReceiveModel
|
||||||
|
|
||||||
@State var autoHider: DispatchWorkItem? = nil
|
@State var autoHider = DispatchWorkItem(block: {})
|
||||||
|
|
||||||
/// Cancel while receiving.
|
/// Cancel while receiving.
|
||||||
public var onCancel: () -> Void
|
public var onCancel: () -> Void
|
||||||
@@ -79,12 +79,10 @@ struct QuickDropToastView: View {
|
|||||||
actions.closeToastAction()
|
actions.closeToastAction()
|
||||||
})
|
})
|
||||||
|
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 10) {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 10, execute: self.autoHider)
|
||||||
self.autoHider?.perform()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.onDisappear {
|
.onDisappear {
|
||||||
self.autoHider?.cancel()
|
self.autoHider.cancel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.buttonStyle(.bordered)
|
.buttonStyle(.bordered)
|
||||||
@@ -116,7 +114,6 @@ struct QuickDropToastView: View {
|
|||||||
)
|
)
|
||||||
.shadow(color: Color.black.opacity(0.1), radius: 20)
|
.shadow(color: Color.black.opacity(0.1), radius: 20)
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
.opacity(isFileTransferRestricted() ? 0 : 1)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class ReceiveModel: ObservableObject, InboundAppDelegate {
|
|||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
@Published var progress: Double? = nil
|
@Published var progress: Double? = nil
|
||||||
@Published var toastActions: ToastViewAction? = nil
|
@Published var toastActions: ToastViewAction? = nil
|
||||||
|
private var pendingReview = false
|
||||||
private var toastWindow: NSWindow?
|
private var toastWindow: NSWindow?
|
||||||
private var toastHosting: NSHostingView<QuickDropToastView>?
|
private var toastHosting: NSHostingView<QuickDropToastView>?
|
||||||
#endif
|
#endif
|
||||||
@@ -231,6 +232,10 @@ class ReceiveModel: ObservableObject, InboundAppDelegate {
|
|||||||
|
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
|
|
||||||
|
if currentCount == 0 {
|
||||||
|
pendingReview = true
|
||||||
|
}
|
||||||
|
|
||||||
let openFilesAction = {
|
let openFilesAction = {
|
||||||
if !savedFiles.isEmpty {
|
if !savedFiles.isEmpty {
|
||||||
log("[SaveFilesManager] Opening \(savedFiles.count) file(s) in Finder.")
|
log("[SaveFilesManager] Opening \(savedFiles.count) file(s) in Finder.")
|
||||||
@@ -285,7 +290,11 @@ class ReceiveModel: ObservableObject, InboundAppDelegate {
|
|||||||
|
|
||||||
func showReviewIfAppropriate(currentTransmissionCount: Int) {
|
func showReviewIfAppropriate(currentTransmissionCount: Int) {
|
||||||
// If distributed directly, do not request review here as it does not work
|
// If distributed directly, do not request review here as it does not work
|
||||||
if currentTransmissionCount == 0 && !DistributionDetector.isDirectDistributionEnabled {
|
if pendingReview && !DistributionDetector.isDirectDistributionEnabled {
|
||||||
|
|
||||||
|
// Dont request review again
|
||||||
|
pendingReview = false
|
||||||
|
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
||||||
SKStoreReviewController.requestReview()
|
SKStoreReviewController.requestReview()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user