diff --git a/QuickDrop.xcodeproj/project.pbxproj b/QuickDrop.xcodeproj/project.pbxproj index 30550ff..f41b44f 100644 --- a/QuickDrop.xcodeproj/project.pbxproj +++ b/QuickDrop.xcodeproj/project.pbxproj @@ -1319,7 +1319,7 @@ MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; - SHARED_BUILD = 88; + SHARED_BUILD = 89; SHARED_VERSION = 2.6.1; STRING_CATALOG_GENERATE_SYMBOLS = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; @@ -1382,7 +1382,7 @@ MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = macosx; - SHARED_BUILD = 88; + SHARED_BUILD = 89; SHARED_VERSION = 2.6.1; STRING_CATALOG_GENERATE_SYMBOLS = YES; SWIFT_COMPILATION_MODE = wholemodule; diff --git a/QuickDrop/View/QuickDropToastView.swift b/QuickDrop/View/QuickDropToastView.swift index ddb0be0..f85207e 100644 --- a/QuickDrop/View/QuickDropToastView.swift +++ b/QuickDrop/View/QuickDropToastView.swift @@ -14,7 +14,7 @@ struct QuickDropToastView: View { @ObservedObject var settings = Settings.shared @ObservedObject var receiveModel: ReceiveModel - @State var autoHider: DispatchWorkItem? = nil + @State var autoHider = DispatchWorkItem(block: {}) /// Cancel while receiving. public var onCancel: () -> Void @@ -79,12 +79,10 @@ struct QuickDropToastView: View { actions.closeToastAction() }) - DispatchQueue.main.asyncAfter(deadline: .now() + 10) { - self.autoHider?.perform() - } + DispatchQueue.main.asyncAfter(deadline: .now() + 10, execute: self.autoHider) } .onDisappear { - self.autoHider?.cancel() + self.autoHider.cancel() } } .buttonStyle(.bordered) @@ -116,7 +114,6 @@ struct QuickDropToastView: View { ) .shadow(color: Color.black.opacity(0.1), radius: 20) .frame(maxWidth: .infinity) - .opacity(isFileTransferRestricted() ? 0 : 1) } } diff --git a/QuickDrop/ViewModel/ReceiveModel.swift b/QuickDrop/ViewModel/ReceiveModel.swift index 1ac3052..6602a4a 100644 --- a/QuickDrop/ViewModel/ReceiveModel.swift +++ b/QuickDrop/ViewModel/ReceiveModel.swift @@ -23,6 +23,7 @@ class ReceiveModel: ObservableObject, InboundAppDelegate { #if os(macOS) @Published var progress: Double? = nil @Published var toastActions: ToastViewAction? = nil + private var pendingReview = false private var toastWindow: NSWindow? private var toastHosting: NSHostingView? #endif @@ -231,6 +232,10 @@ class ReceiveModel: ObservableObject, InboundAppDelegate { #if os(macOS) + if currentCount == 0 { + pendingReview = true + } + let openFilesAction = { if !savedFiles.isEmpty { log("[SaveFilesManager] Opening \(savedFiles.count) file(s) in Finder.") @@ -285,7 +290,11 @@ class ReceiveModel: ObservableObject, InboundAppDelegate { func showReviewIfAppropriate(currentTransmissionCount: Int) { // 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) { SKStoreReviewController.requestReview() }