mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-11-29 08:29:22 +00:00
Fix MainActor Equatable warnings in message views and update test callers (#1916)
* Fix MainActor Equatable warnings in message views and update test callers * Update Xcode LastUpgradeCheck and scheme versions to 2720 --------- Co-authored-by: jack <jackjackbits@users.noreply.github.com>
This commit is contained in:
1 parent
c513183123
commit
87ae09c316
8 files changed
+29
-8
No files matched your search
Generated
+1
-1
@@ -326,7 +326,7 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = YES;
|
||||
LastUpgradeCheck = 2650;
|
||||
LastUpgradeCheck = 2720;
|
||||
};
|
||||
buildConfigurationList = 3EA424CBD51200895D361189 /* Build configuration list for PBXProject "bitchat" */;
|
||||
developmentRegion = en;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "2650"
|
||||
LastUpgradeVersion = "2720"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "2650"
|
||||
LastUpgradeVersion = "2720"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -16,6 +16,7 @@ struct TextMessageView: View, Equatable {
|
||||
@EnvironmentObject private var conversationUIModel: ConversationUIModel
|
||||
|
||||
let message: BitchatMessage
|
||||
private let messageIdentity: ObjectIdentifier
|
||||
/// Value snapshot of the message's mutable delivery status, captured at
|
||||
/// construction. `BitchatMessage` is a reference type mutated in place by
|
||||
/// `ConversationStore`, and SwiftUI compares reference-typed view fields
|
||||
@@ -29,11 +30,12 @@ struct TextMessageView: View, Equatable {
|
||||
|
||||
init(message: BitchatMessage) {
|
||||
self.message = message
|
||||
self.messageIdentity = ObjectIdentifier(message)
|
||||
self.deliveryStatus = message.deliveryStatus
|
||||
}
|
||||
|
||||
nonisolated static func == (lhs: TextMessageView, rhs: TextMessageView) -> Bool {
|
||||
lhs.message === rhs.message && lhs.deliveryStatus == rhs.deliveryStatus
|
||||
lhs.messageIdentity == rhs.messageIdentity && lhs.deliveryStatus == rhs.deliveryStatus
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
|
||||
@@ -853,14 +853,32 @@ private struct MessageRowView: View, Equatable {
|
||||
@ThemedPalette private var palette
|
||||
|
||||
let message: BitchatMessage
|
||||
private let messageIdentity: ObjectIdentifier
|
||||
let deliveryStatus: DeliveryStatus
|
||||
let privatePeer: PeerID?
|
||||
@Binding var imagePreviewURL: URL?
|
||||
@Binding var showSidebar: Bool
|
||||
let onInsertMention: (String) -> Void
|
||||
|
||||
init(
|
||||
message: BitchatMessage,
|
||||
deliveryStatus: DeliveryStatus,
|
||||
privatePeer: PeerID?,
|
||||
imagePreviewURL: Binding<URL?>,
|
||||
showSidebar: Binding<Bool>,
|
||||
onInsertMention: @escaping (String) -> Void
|
||||
) {
|
||||
self.message = message
|
||||
self.messageIdentity = ObjectIdentifier(message)
|
||||
self.deliveryStatus = deliveryStatus
|
||||
self.privatePeer = privatePeer
|
||||
self._imagePreviewURL = imagePreviewURL
|
||||
self._showSidebar = showSidebar
|
||||
self.onInsertMention = onInsertMention
|
||||
}
|
||||
|
||||
nonisolated static func == (lhs: MessageRowView, rhs: MessageRowView) -> Bool {
|
||||
lhs.message === rhs.message
|
||||
lhs.messageIdentity == rhs.messageIdentity
|
||||
&& lhs.deliveryStatus == rhs.deliveryStatus
|
||||
&& lhs.privatePeer == rhs.privatePeer
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ struct MessageDeduplicationServiceTests {
|
||||
|
||||
let lock = NSLock()
|
||||
var failReads = true
|
||||
let store = NostrProcessedEventStore(fileURL: fileURL) { url in
|
||||
let store = NostrProcessedEventStore(fileURL: fileURL, readData: { url in
|
||||
lock.lock()
|
||||
let shouldFail = failReads
|
||||
lock.unlock()
|
||||
@@ -419,7 +419,7 @@ struct MessageDeduplicationServiceTests {
|
||||
throw NSError(domain: NSCocoaErrorDomain, code: NSFileReadNoPermissionError)
|
||||
}
|
||||
return try Data(contentsOf: url)
|
||||
}
|
||||
})
|
||||
|
||||
// Transient failure during initial load must not poison the cache.
|
||||
#expect(store.load().isEmpty)
|
||||
|
||||
@@ -28,6 +28,7 @@ final class PanicWipeCoverageTests: XCTestCase {
|
||||
var clearCalls = 0
|
||||
let service = GeohashPresenceService(
|
||||
availableChannelsProvider: { [] },
|
||||
isLocationAuthorized: { true },
|
||||
locationChanges: Empty().eraseToAnyPublisher(),
|
||||
torReadyPublisher: Empty().eraseToAnyPublisher(),
|
||||
torIsReady: { false },
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import struct Foundation.Date
|
||||
|
||||
public enum DeliveryStatus: Codable, Equatable, Hashable {
|
||||
public enum DeliveryStatus: Codable, Equatable, Hashable, Sendable {
|
||||
case notSentYet // Created but not yet handed to any transport
|
||||
case sending
|
||||
case sent // Left our device
|
||||
|
||||
Reference in new issue
Block a user