mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-19 04:46:08 +00:00
Fix icons for older macOS versions
This commit is contained in:
1 parent
b6e3943374
commit
71ef68d4cb
3 files changed
+23
-23
No files matched your search
@@ -415,11 +415,7 @@ class NearbyConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static func hkdf(inputKeyMaterial: SymmetricKey, salt: Data, info: Data, outputByteCount: Int) -> SymmetricKey {
|
static func hkdf(inputKeyMaterial: SymmetricKey, salt: Data, info: Data, outputByteCount: Int) -> SymmetricKey {
|
||||||
if #available(macOS 11.0, *) {
|
return HKDF<SHA256>.deriveKey(inputKeyMaterial: inputKeyMaterial, salt: salt, info: info, outputByteCount: outputByteCount)
|
||||||
return HKDF<SHA256>.deriveKey(inputKeyMaterial: inputKeyMaterial, salt: salt, info: info, outputByteCount: outputByteCount)
|
|
||||||
} else {
|
|
||||||
return SymmetricKey(data: hkdfExpand(prk: hkdfExtract(salt: salt, ikm: inputKeyMaterial.withUnsafeBytes { Data(bytes: $0.baseAddress!, count: $0.count) }), info: info, length: outputByteCount))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func finalizeKeyExchange(peerKey: Securemessage_GenericPublicKey) throws {
|
func finalizeKeyExchange(peerKey: Securemessage_GenericPublicKey) throws {
|
||||||
|
|||||||
@@ -304,15 +304,9 @@ class OutboundNearbyConnection: NearbyConnection {
|
|||||||
let typeID = try? url.resourceValues(forKeys: [.typeIdentifierKey]).typeIdentifier
|
let typeID = try? url.resourceValues(forKeys: [.typeIdentifierKey]).typeIdentifier
|
||||||
meta.mimeType = "application/octet-stream"
|
meta.mimeType = "application/octet-stream"
|
||||||
if let typeID = typeID {
|
if let typeID = typeID {
|
||||||
if #available(macOS 11.0, *) {
|
let type = UTType(typeID)
|
||||||
let type = UTType(typeID)
|
if let type = type, let mimeType = type.preferredMIMEType {
|
||||||
if let type = type, let mimeType = type.preferredMIMEType {
|
meta.mimeType = mimeType
|
||||||
meta.mimeType = mimeType
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if let mimeType = UTTypeCopyPreferredTagWithClass(typeID as CFString, kUTTagClassMIMEType) {
|
|
||||||
meta.mimeType = (mimeType.takeRetainedValue() as NSString) as String
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if meta.mimeType.starts(with: "image/") {
|
if meta.mimeType.starts(with: "image/") {
|
||||||
@@ -400,14 +394,10 @@ class OutboundNearbyConnection: NearbyConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let fileBuffer: Data
|
let fileBuffer: Data
|
||||||
if #available(macOS 10.15.4, *) {
|
guard let _fileBuffer = try currentTransfer!.handle!.read(upToCount: 512 * 1024) else {
|
||||||
guard let _fileBuffer = try currentTransfer!.handle!.read(upToCount: 512 * 1024) else {
|
throw NearbyError.inputOutput
|
||||||
throw NearbyError.inputOutput
|
|
||||||
}
|
|
||||||
fileBuffer = _fileBuffer
|
|
||||||
} else {
|
|
||||||
fileBuffer = currentTransfer!.handle!.readData(ofLength: 512 * 1024)
|
|
||||||
}
|
}
|
||||||
|
fileBuffer = _fileBuffer
|
||||||
|
|
||||||
var transfer = Location_Nearby_Connections_PayloadTransferFrame()
|
var transfer = Location_Nearby_Connections_PayloadTransferFrame()
|
||||||
transfer.packetType = .data
|
transfer.packetType = .data
|
||||||
|
|||||||
@@ -40,11 +40,11 @@ struct WelcomeScreen: View {
|
|||||||
openPrivacyPolicy()
|
openPrivacyPolicy()
|
||||||
}
|
}
|
||||||
|
|
||||||
ExternalLinkLabel(label: "AndroidApp", icon: "smartphone") {
|
ExternalLinkLabel(label: "AndroidApp", icon: getPhoneIcon()) {
|
||||||
openAppAdvertisementView()
|
openAppAdvertisementView()
|
||||||
}
|
}
|
||||||
|
|
||||||
ExternalLinkLabel(label: "TransmitUsingCable", icon: "cable.connector") {
|
ExternalLinkLabel(label: "TransmitUsingCable", icon: getCableIcon()) {
|
||||||
openCableTransmissionView()
|
openCableTransmissionView()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,6 +90,20 @@ struct WelcomeScreen: View {
|
|||||||
NSWorkspace.shared.open(url)
|
NSWorkspace.shared.open(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getPhoneIcon() -> String {
|
||||||
|
if #available(macOS 14.0, *) {
|
||||||
|
return "smartphone"
|
||||||
|
}
|
||||||
|
return "iphone.rear.camera"
|
||||||
|
}
|
||||||
|
|
||||||
|
func getCableIcon() -> String {
|
||||||
|
if #available(macOS 12.0, *) {
|
||||||
|
return "cable.connector"
|
||||||
|
}
|
||||||
|
return "externaldrive.connected.to.line.below.fill"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user