Skip to content

Linux + iPhone Continuity / iMessage / SMS

fix(ios): build warnings and swift updates

Zack Bartelc6b5680d5d47
diff --git a/apple/Tether/ViewModels/TetherViewModel.swift b/apple/Tether/ViewModels/TetherViewModel.swift
index c0d03c2..dea647f 100644
--- a/apple/Tether/ViewModels/TetherViewModel.swift
+++ b/apple/Tether/ViewModels/TetherViewModel.swift
@@ -381,7 +381,7 @@ final class TetherViewModel {
do {
let fileData = try Data(contentsOf: url)
- self.sendFile(data: fileData, filename: filename)
+ await self.sendFile(data: fileData, filename: filename)
} catch {
await MainActor.run {
self.errorMessage = "File transfer failed: \(error.localizedDescription)"
@@ -428,11 +428,12 @@ final class TetherViewModel {
let end = min(offset + self.fileChunkSize, fileData.count)
let chunk = fileData[offset..<end]
let base64 = chunk.base64EncodedString()
+ let index = chunkIndex
await MainActor.run {
self.connection.send(.fileChunk(
transferId: transferId,
- chunkIndex: chunkIndex,
+ chunkIndex: index,
data: base64
))
diff --git a/apple/TetherShareExtension/ShareViewController.swift b/apple/TetherShareExtension/ShareViewController.swift
index 8a48c00..6f1ea99 100644
--- a/apple/TetherShareExtension/ShareViewController.swift
+++ b/apple/TetherShareExtension/ShareViewController.swift
@@ -122,6 +122,12 @@ final class ShareViewController: UIViewController {
if let original = await loadOriginalImage(provider) {
return original
}
+ // Instant Markup (screenshot editor) hands back raw encoded bytes;
+ // name them after the provider's first image type.
+ let ext = provider.registeredTypeIdentifiers
+ .compactMap { UTType($0) }
+ .first { $0.conforms(to: .image) }?
+ .preferredFilenameExtension ?? "png"
return await withCheckedContinuation { continuation in
provider.loadItem(forTypeIdentifier: UTType.image.identifier, options: nil) { item, _ in
if let image = item as? UIImage, let data = image.jpegData(compressionQuality: 0.9) {
@@ -129,11 +135,6 @@ final class ShareViewController: UIViewController {
} else if let url = item as? URL {
continuation.resume(returning: readFile(at: url, defaultFilename: "image.jpg"))
} else if let data = item as? Data {
- // Instant Markup (screenshot editor) hands back raw encoded bytes.
- let ext = provider.registeredTypeIdentifiers
- .compactMap { UTType($0) }
- .first { $0.conforms(to: .image) }?
- .preferredFilenameExtension ?? "png"
continuation.resume(returning: .file(data, filename: "image.\(ext)"))
} else {
continuation.resume(returning: nil)
@@ -546,7 +547,7 @@ private struct ShareSheetView: View {
Image(systemName: failed ? "xmark.circle.fill" : "checkmark.circle.fill")
.font(.system(size: 48))
.foregroundStyle(failed ? .red : .green)
- .symbolEffect(.bounce, isActive: !reduceMotion)
+ .modifier(BounceEffect(isActive: !reduceMotion))
.accessibilityHidden(true)
Text(message)
.multilineTextAlignment(.center)
@@ -699,3 +700,16 @@ private struct ActionButton: View {
.buttonStyle(.plain)
}
}
+
+// Indefinite bounce needs iOS 18; the extension still supports iOS 17.
+private struct BounceEffect: ViewModifier {
+ let isActive: Bool
+
+ func body(content: Content) -> some View {
+ if #available(iOS 18.0, *) {
+ content.symbolEffect(.bounce, isActive: isActive)
+ } else {
+ content
+ }
+ }
+}