mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 19:45:22 +00:00
Merge pull request #897 from permissionlesstech/fix/swift6-concurrency-warnings
Fix Swift 6 concurrency warnings
This commit is contained in:
@@ -53,9 +53,10 @@ struct BitchatApp: App {
|
|||||||
// Inject live Noise service into VerificationService to avoid creating new BLE instances
|
// Inject live Noise service into VerificationService to avoid creating new BLE instances
|
||||||
VerificationService.shared.configure(with: chatViewModel.meshService.getNoiseService())
|
VerificationService.shared.configure(with: chatViewModel.meshService.getNoiseService())
|
||||||
// Prewarm Nostr identity and QR to make first VERIFY sheet fast
|
// Prewarm Nostr identity and QR to make first VERIFY sheet fast
|
||||||
|
let nickname = chatViewModel.nickname
|
||||||
DispatchQueue.global(qos: .utility).async {
|
DispatchQueue.global(qos: .utility).async {
|
||||||
let npub = try? idBridge.getCurrentNostrIdentity()?.npub
|
let npub = try? idBridge.getCurrentNostrIdentity()?.npub
|
||||||
_ = VerificationService.shared.buildMyQRString(nickname: chatViewModel.nickname, npub: npub)
|
_ = VerificationService.shared.buildMyQRString(nickname: nickname, npub: npub)
|
||||||
}
|
}
|
||||||
|
|
||||||
appDelegate.chatViewModel = chatViewModel
|
appDelegate.chatViewModel = chatViewModel
|
||||||
|
|||||||
@@ -465,17 +465,17 @@ struct ContentView: View {
|
|||||||
} else {
|
} else {
|
||||||
// Schedule a delayed scroll
|
// Schedule a delayed scroll
|
||||||
scrollThrottleTimer?.invalidate()
|
scrollThrottleTimer?.invalidate()
|
||||||
scrollThrottleTimer = Timer.scheduledTimer(withTimeInterval: TransportConfig.uiScrollThrottleSeconds, repeats: false) { _ in
|
scrollThrottleTimer = Timer.scheduledTimer(withTimeInterval: TransportConfig.uiScrollThrottleSeconds, repeats: false) { [weak viewModel] _ in
|
||||||
lastScrollTime = Date()
|
Task { @MainActor in
|
||||||
let contextKey: String = {
|
lastScrollTime = Date()
|
||||||
switch locationManager.selectedChannel {
|
let contextKey: String = {
|
||||||
case .mesh: return "mesh"
|
switch locationManager.selectedChannel {
|
||||||
case .location(let ch): return "geo:\(ch.geohash)"
|
case .mesh: return "mesh"
|
||||||
}
|
case .location(let ch): return "geo:\(ch.geohash)"
|
||||||
}()
|
}
|
||||||
let count = windowCountPublic
|
}()
|
||||||
let target = viewModel.messages.suffix(count).last.map { "\(contextKey)|\($0.id)" }
|
let count = windowCountPublic
|
||||||
DispatchQueue.main.async {
|
let target = viewModel?.messages.suffix(count).last.map { "\(contextKey)|\($0.id)" }
|
||||||
if let target = target { proxy.scrollTo(target, anchor: .bottom) }
|
if let target = target { proxy.scrollTo(target, anchor: .bottom) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -643,9 +643,11 @@ struct ContentView: View {
|
|||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
.onChange(of: messageText) { newValue in
|
.onChange(of: messageText) { newValue in
|
||||||
autocompleteDebounceTimer?.invalidate()
|
autocompleteDebounceTimer?.invalidate()
|
||||||
autocompleteDebounceTimer = Timer.scheduledTimer(withTimeInterval: 0.15, repeats: false) { _ in
|
autocompleteDebounceTimer = Timer.scheduledTimer(withTimeInterval: 0.15, repeats: false) { [weak viewModel] _ in
|
||||||
let cursorPosition = newValue.count
|
let cursorPosition = newValue.count
|
||||||
viewModel.updateAutocomplete(for: newValue, cursorPosition: cursorPosition)
|
Task { @MainActor in
|
||||||
|
viewModel?.updateAutocomplete(for: newValue, cursorPosition: cursorPosition)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user