Skip to content

Commit e1bcf8d

Browse files
committed
Fix warnings
1 parent f14883e commit e1bcf8d

55 files changed

Lines changed: 768 additions & 766 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Sources/App/Assist/Local/SpeechSynthesizer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ protocol SpeechSynthesizerProtocol: AnyObject {
1212

1313
/// A text-to-speech synthesizer using Apple's AVSpeechSynthesizer framework.
1414
/// Speaks text locally on the device without sending audio data to a server.
15-
final class SpeechSynthesizer: NSObject, SpeechSynthesizerProtocol, AVSpeechSynthesizerDelegate {
15+
final class SpeechSynthesizer: NSObject, SpeechSynthesizerProtocol, AVSpeechSynthesizerDelegate, @unchecked Sendable {
1616
private let synthesizer = AVSpeechSynthesizer()
1717
private let voice: AVSpeechSynthesisVoice?
1818

Sources/App/BarcodeScanner/Camera/BarcodeScannerCamera.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ protocol BarcodeScannerCameraDelegate: AnyObject {
77
func didDetectBarcode(_ code: String, format: String)
88
}
99

10-
final class BarcodeScannerCamera: NSObject {
10+
final class BarcodeScannerCamera: NSObject, @unchecked Sendable {
1111
private let captureSession = AVCaptureSession()
1212
private var isCaptureSessionConfigured = false
1313
private var deviceInput: AVCaptureDeviceInput?

Sources/App/ClientEvents/LocationHistoryDetailViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,8 @@ private extension LocationHistoryDetailViewController {
369369

370370
extension LocationHistoryDetailViewController: MKMapViewDelegate {
371371
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
372-
let view = MKPinAnnotationView(annotation: annotation, reuseIdentifier: nil)
373-
view.pinTintColor = .purple
372+
let view = MKMarkerAnnotationView(annotation: annotation, reuseIdentifier: nil)
373+
view.markerTintColor = .purple
374374
return view
375375
}
376376

Sources/App/Frontend/ConnectivityCheck/ConnectivityChecker.swift

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Foundation
22
import Network
3+
import os
34

45
@MainActor
56
class ConnectivityChecker {
@@ -84,7 +85,7 @@ class ConnectivityChecker {
8485
}
8586
var storage = sockaddr_storage()
8687
data.withUnsafeBytes { bytes in
87-
memcpy(&storage, bytes.baseAddress!, min(bytes.count, MemoryLayout<sockaddr_storage>.size))
88+
_ = memcpy(&storage, bytes.baseAddress!, min(bytes.count, MemoryLayout<sockaddr_storage>.size))
8889
}
8990

9091
var hostname = [CChar](repeating: 0, count: Int(NI_MAXHOST))
@@ -140,35 +141,34 @@ class ConnectivityChecker {
140141
using: .tcp
141142
)
142143

143-
var completed = false
144-
let timeoutTask = DispatchWorkItem {
145-
if !completed {
146-
completed = true
147-
connection.cancel()
148-
continuation.resume(throwing: NSError(
149-
domain: "ConnectivityChecker",
150-
code: -1,
151-
userInfo: [NSLocalizedDescriptionKey: "Connection timeout"]
152-
))
144+
// Returns true only on the first call, so the continuation is resumed exactly once
145+
let completed = OSAllocatedUnfairLock(initialState: false)
146+
let markCompleted: @Sendable () -> Bool = {
147+
completed.withLock { done in
148+
if done { return false }
149+
done = true
150+
return true
153151
}
154152
}
153+
let timeoutTask = DispatchWorkItem {
154+
guard markCompleted() else { return }
155+
connection.cancel()
156+
continuation.resume(throwing: NSError(
157+
domain: "ConnectivityChecker",
158+
code: -1,
159+
userInfo: [NSLocalizedDescriptionKey: "Connection timeout"]
160+
))
161+
}
155162

156163
connection.stateUpdateHandler = { state in
157-
guard !completed else { return }
158-
159164
switch state {
160165
case .ready:
161-
completed = true
166+
guard markCompleted() else { return }
162167
timeoutTask.cancel()
163168
connection.cancel()
164169
continuation.resume()
165-
case let .failed(error):
166-
completed = true
167-
timeoutTask.cancel()
168-
connection.cancel()
169-
continuation.resume(throwing: error)
170-
case let .waiting(error):
171-
completed = true
170+
case let .failed(error), let .waiting(error):
171+
guard markCompleted() else { return }
172172
timeoutTask.cancel()
173173
connection.cancel()
174174
continuation.resume(throwing: error)

Sources/App/Frontend/DownloadManager/DownloadManagerView.swift

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,25 @@ struct DownloadManagerView: View {
6060
}
6161
}
6262

63-
private var successView: some View {
64-
VStack(spacing: DesignSystem.Spaces.three) {
65-
Image(systemSymbol: .checkmark)
66-
.foregroundStyle(.green)
67-
.font(.system(size: 100))
63+
@ViewBuilder
64+
private var successCheckmark: some View {
65+
let checkmark = Image(systemSymbol: .checkmark)
66+
.foregroundStyle(.green)
67+
.font(.system(size: 100))
68+
if #available(iOS 18, *) {
69+
checkmark
6870
.symbolEffect(
6971
.bounce,
7072
options: .nonRepeating
7173
)
74+
} else {
75+
checkmark
76+
}
77+
}
78+
79+
private var successView: some View {
80+
VStack(spacing: DesignSystem.Spaces.three) {
81+
successCheckmark
7282
Text(verbatim: L10n.DownloadManager.Finished.title)
7383
.font(.title.bold())
7484
if let url = viewModel.lastURLCreated {

Sources/App/Frontend/DownloadManager/DownloadManagerViewModel.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ extension DownloadManagerViewModel: WKDownloadDelegate {
5757
}
5858
progressObservation?.invalidate()
5959
progressObservation = download.progress.observe(\.completedUnitCount) { [weak self] progress, _ in
60-
guard let self else { return }
61-
self.progress = bytesToMBString(progress.completedUnitCount)
60+
let completedUnitCount = progress.completedUnitCount
61+
Task { @MainActor [weak self] in
62+
guard let self else { return }
63+
self.progress = bytesToMBString(completedUnitCount)
64+
}
6265
}
6366
return url
6467
} else {

Sources/App/Frontend/Extensions/WebViewGestureHandler.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ final class WebViewGestureHandler {
4343
private func showSidebar() {
4444
webView?.webViewExternalMessageHandler
4545
.sendExternalBus(message: .init(command: WebViewExternalBusOutgoingMessage.showSidebar.rawValue))
46+
.cauterize()
4647
}
4748

4849
private func webViewNavigateBack() {

Sources/App/Onboarding/API/OnboardingAuthStepClientCertificate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ final class OnboardingAuthStepClientCertificate: OnboardingAuthPreStep {
110110

111111
DispatchQueue.main.async {
112112
let view = ClientCertificateOnboardingView(
113-
onImport: { [weak self] certificate in
113+
onImport: { certificate in
114114
Current.Log.info("[mTLS] Certificate imported: \(certificate.displayName)")
115-
self?.authDetails.clientCertificate = certificate
115+
self.authDetails.clientCertificate = certificate
116116
sender.dismiss(animated: true) {
117117
seal.fulfill(())
118118
}

Sources/App/Onboarding/Views/OnboardingErrorView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct OnboardingErrorView: View {
3636
viewAppeared = true
3737
}
3838
.sheet(isPresented: $showShareSheet, content: {
39-
ShareActivityView(activityItems: [Current.Log.archiveURL()])
39+
ShareActivityView(activityItems: [Current.Log.archiveURL()].compactMap { $0 })
4040
})
4141
}
4242

Sources/App/Scenes/CarPlaySceneDelegate.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ class CarPlaySceneDelegate: UIResponder {
227227

228228
private func observeCarPlayConfigChanges() {
229229
configObservation?.cancel()
230-
let observation = ValueObservation.tracking(CarPlayConfig.fetchOne)
230+
let observation = ValueObservation.tracking { db in
231+
try CarPlayConfig.fetchOne(db)
232+
}
231233
configObservation = observation.start(
232234
in: Current.database(),
233235
onError: { error in

0 commit comments

Comments
 (0)