mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-19 21:06:10 +00:00
Remove showCopiedToClipboardAlert
This commit is contained in:
1 parent
772de6c6e0
commit
ebfe2c3832
4 files changed
+10
-9
No files matched your search
@@ -25,7 +25,7 @@ class InboundNearbyConnection: NearbyConnection {
|
|||||||
private var currentState: State = .initial
|
private var currentState: State = .initial
|
||||||
private var cipherCommitment: Data?
|
private var cipherCommitment: Data?
|
||||||
private var textPayloadID: Int64 = 0
|
private var textPayloadID: Int64 = 0
|
||||||
private var isPlainTextTransfer = false
|
var isPlainTextTransfer = false
|
||||||
|
|
||||||
var wasUserRejected = false
|
var wasUserRejected = false
|
||||||
var delegate: InboundNearbyConnectionDelegate?
|
var delegate: InboundNearbyConnectionDelegate?
|
||||||
@@ -188,9 +188,6 @@ class InboundNearbyConnection: NearbyConnection {
|
|||||||
let pasteboard = NSPasteboard.general
|
let pasteboard = NSPasteboard.general
|
||||||
pasteboard.clearContents()
|
pasteboard.clearContents()
|
||||||
pasteboard.setString(urlStr, forType: .string)
|
pasteboard.setString(urlStr, forType: .string)
|
||||||
|
|
||||||
NearbyConnectionManager.shared.mainAppDelegate?.showCopiedToClipboardAlert()
|
|
||||||
|
|
||||||
#elseif os(iOS)
|
#elseif os(iOS)
|
||||||
// iOS clipboard
|
// iOS clipboard
|
||||||
UIPasteboard.general.string = urlStr
|
UIPasteboard.general.string = urlStr
|
||||||
@@ -444,7 +441,7 @@ class InboundNearbyConnection: NearbyConnection {
|
|||||||
let metadata = TransferMetadata(files: [], id: id, pinCode: pinCode, textDescription: textMetadata.textTitle, transferType: isClipboardText ? .text : .url)
|
let metadata = TransferMetadata(files: [], id: id, pinCode: pinCode, textDescription: textMetadata.textTitle, transferType: isClipboardText ? .text : .url)
|
||||||
textPayloadID = textMetadata.payloadID
|
textPayloadID = textMetadata.payloadID
|
||||||
|
|
||||||
if isClipboardText{
|
if isClipboardText {
|
||||||
isPlainTextTransfer = true
|
isPlainTextTransfer = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ public class NearbyConnectionManager: NSObject, NetServiceDelegate, InboundNearb
|
|||||||
incomingConnections.removeValue(forKey: connection.id)
|
incomingConnections.removeValue(forKey: connection.id)
|
||||||
|
|
||||||
if !connection.wasUserRejected {
|
if !connection.wasUserRejected {
|
||||||
mainAppDelegate?.incomingTransfer(id: connection.id, from: connection.remoteDeviceInfo ?? RemoteDeviceInfo(name: "??", type: .unknown), didFinishWith: error)
|
mainAppDelegate?.connectionWasTerminated(wasPlainTextTransfer: connection.isPlainTextTransfer, from: connection.remoteDeviceInfo ?? RemoteDeviceInfo(name: "??", type: .unknown), didFinishWith: error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ protocol OutboundNearbyConnectionDelegate {
|
|||||||
|
|
||||||
public protocol MainAppDelegate {
|
public protocol MainAppDelegate {
|
||||||
func obtainUserConsent(for transfer: TransferMetadata, from device: RemoteDeviceInfo)
|
func obtainUserConsent(for transfer: TransferMetadata, from device: RemoteDeviceInfo)
|
||||||
func incomingTransfer(id: String, from device: RemoteDeviceInfo, didFinishWith error: Error?)
|
func connectionWasTerminated(wasPlainTextTransfer: Bool, from device: RemoteDeviceInfo, didFinishWith error: Error?)
|
||||||
func showCopiedToClipboardAlert()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -412,7 +412,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func incomingTransfer(id: String, from device: RemoteDeviceInfo, didFinishWith error: Error?) {
|
func connectionWasTerminated(wasPlainTextTransfer: Bool, from device: RemoteDeviceInfo, didFinishWith error: Error?) {
|
||||||
|
|
||||||
if let error = error {
|
if let error = error {
|
||||||
|
|
||||||
@@ -423,6 +423,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
|
|
||||||
ErrorAlertHandler.shared.showErrorAlert(for: device.name ?? "Android", error: error)
|
ErrorAlertHandler.shared.showErrorAlert(for: device.name ?? "Android", error: error)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if wasPlainTextTransfer {
|
||||||
|
showCopiedToClipboardAlert()
|
||||||
|
}
|
||||||
|
|
||||||
let currentCount = transmissionCount()
|
let currentCount = transmissionCount()
|
||||||
if currentCount == 0 {
|
if currentCount == 0 {
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
||||||
|
|||||||
Reference in new issue
Block a user