Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,19 @@
)
}

public func createInitiateResetMLSConversationUseCase() -> some InitiateResetMLSConversationUseCaseProtocol {
InitiateResetMLSConversationUseCase(
api: mlsAPI,
mlsService: mlsService,
conversationLocalStore: conversationLocalStore,
conversationRepository: conversationRepository,
lockRepository: ResetMLSConversationLockRepository(
userID: selfUserID
),
selfDomain: backendMetadata.domain
)
}

// MARK: - Other

public private(set) lazy var conversationProtobufMessageProcessor = ConversationProtobufMessageProcessor(
Expand Down Expand Up @@ -821,7 +834,7 @@
)

public lazy var workAgent: WorkAgent = .init(scheduler: PriorityOrderWorkItemScheduler())

Check warning on line 837 in WireDomain/Sources/WireDomain/Components/ClientSessionComponent.swift

View workflow job for this annotation

GitHub Actions / Test Results

Actor-isolated default value in a nonisolated context; this is an error in the Swift 6 language mode

Actor-isolated default value in a nonisolated context; this is an error in the Swift 6 language mode
public lazy var conversationUpdatesGenerator: IncrementalGeneratorProtocol = ConversationUpdatesGenerator(
repository: conversationRepository,
context: syncContext,
Expand All @@ -830,7 +843,7 @@
self?.workAgent.submitItem(workItem)
}
)

Check warning on line 846 in WireDomain/Sources/WireDomain/Components/ClientSessionComponent.swift

View workflow job for this annotation

GitHub Actions / Test Results

Actor-isolated default value in a nonisolated context; this is an error in the Swift 6 language mode

Actor-isolated default value in a nonisolated context; this is an error in the Swift 6 language mode
public lazy var commitPendingProposalsGenerator: LiveGeneratorProtocol = CommitPendingProposalsGenerator(
repository: conversationRepository,
mlsService: mlsService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
// MARK: - Public

public func qualifiedID(for conversation: ZMConversation) async -> QualifiedID? {
await context.perform {

Check warning on line 60 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.qualifiedID
}
}
Expand All @@ -66,7 +66,7 @@
_ lastReadMessage: LastRead,
in conversation: ZMConversation
) async {
await context.perform { [context] in

Check warning on line 69 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
guard conversation.isSelfConversation else {
return
}
Expand All @@ -82,7 +82,7 @@
_ clearedMessage: Cleared,
in conversation: ZMConversation
) async {
await context.perform { [context] in

Check warning on line 85 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
guard conversation.isSelfConversation else {
return
}
Expand Down Expand Up @@ -112,10 +112,11 @@
epoch: UInt64,
conversation: ZMConversation
) async {
await context.perform {

Check warning on line 115 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.mlsStatus = .ready
conversation.epoch = epoch
conversation.mlsGroupID = mlsGroupID
conversation.commitPendingProposalDate = nil
}
}

Expand All @@ -123,9 +124,10 @@
newMLSGroupID: MLSGroupID,
conversation: ZMConversation
) async {
await context.perform {

Check warning on line 127 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.mlsStatus = .pendingJoinAfterReset
conversation.mlsGroupID = newMLSGroupID
conversation.commitPendingProposalDate = nil
conversation.epoch = 0
}
}
Expand All @@ -147,7 +149,7 @@
public func fetchOtherUserIDInOneOnOneConversation(
conversation: ZMConversation
) async -> WireDataModel.QualifiedID? {
await context.perform {

Check warning on line 152 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
guard conversation.conversationType == .oneOnOne else {
WireLogger.conversation.info(
"conversation type is not expected 'oneOnOne', aborting."
Expand All @@ -158,7 +160,7 @@

guard
let otherUser = conversation.localParticipantsExcludingSelf.first,
let otherUserID = otherUser.remoteIdentifier,

Check warning on line 163 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'self' with non-Sendable type 'ConversationLocalStore' in a '@Sendable' closure

Capture of 'self' with non-Sendable type 'ConversationLocalStore' in a '@sendable' closure

Check warning on line 163 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Implicit capture of 'self' requires that 'ConversationLocalStore' conforms to 'Sendable'

Implicit capture of 'self' requires that 'ConversationLocalStore' conforms to 'Sendable'
let otherUserDomain = otherUser.domain ?? self.localDomain
else {
WireLogger.conversation.warn(
Expand All @@ -184,7 +186,7 @@
let mutedStatus = mutedStatusInfo.status
let mutedReference = mutedStatusInfo.referenceDate

if let mutedStatus, let mutedReference {

Check warning on line 189 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'localConversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'localConversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
localConversation.updateMutedStatus(
status: Int32(mutedStatus),
referenceDate: mutedReference
Expand Down Expand Up @@ -248,9 +250,9 @@

await context.perform {
// If user is already part of the conversation, its role will be updated.
// If not, user will be added to the conversation.

Check warning on line 253 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.addParticipantAndUpdateConversationState(

Check warning on line 254 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'user' with non-Sendable type 'ZMUser' in a '@Sendable' closure

Capture of 'user' with non-Sendable type 'ZMUser' in a '@sendable' closure
user: user,

Check warning on line 255 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'role' with non-Sendable type 'Role' in a '@Sendable' closure

Capture of 'role' with non-Sendable type 'Role' in a '@sendable' closure
role: role
)
}
Expand All @@ -259,7 +261,7 @@
public func increaseUnreadCount(
for conversation: ZMConversation
) async {
await context.perform {

Check warning on line 264 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.internalEstimatedUnreadCount += 1
}
}
Expand All @@ -267,7 +269,7 @@
public func decreaseUnreadCount(
for conversation: ZMConversation
) async {
await context.perform {

Check warning on line 272 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.internalEstimatedUnreadCount -= 1
}
}
Expand All @@ -275,7 +277,7 @@
public func increaseUnreadSelfMentionCount(
for conversation: ZMConversation
) async {
await context.perform {

Check warning on line 280 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.internalEstimatedUnreadSelfMentionCount += 1
}
}
Expand All @@ -283,7 +285,7 @@
public func increaseUnreadSelfReplyCount(
for conversation: ZMConversation
) async {
await context.perform {

Check warning on line 288 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.internalEstimatedUnreadSelfReplyCount += 1
}
}
Expand All @@ -298,7 +300,7 @@
permission: Conversation.ChannelPermission,
conversation: ZMConversation
) async {
await context.perform {

Check warning on line 303 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure

Check warning on line 303 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'permission' with non-Sendable type 'Conversation.ChannelPermission' in a '@Sendable' closure

Capture of 'permission' with non-Sendable type 'Conversation.ChannelPermission' in a '@sendable' closure
conversation.privateChannelPermission = PrivateChannelPermission(permission)
}
}
Expand All @@ -313,7 +315,7 @@
domain: conversationDomain
)

await context.perform {

Check warning on line 318 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation?' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation?' in a '@sendable' closure
conversation?.channelHistoryDepth = historyDepth
}
}
Expand Down Expand Up @@ -345,9 +347,9 @@
]
)
}

Check warning on line 350 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Conformance of 'NSManagedObject' to 'Sendable' is unavailable in iOS; this is an error in the Swift 6 language mode

Conformance of 'NSManagedObject' to 'Sendable' is unavailable in iOS; this is an error in the Swift 6 language mode

Check warning on line 350 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Conformance of 'NSManagedObject' to 'Sendable' is unavailable in iOS; this is an error in the Swift 6 language mode

Conformance of 'NSManagedObject' to 'Sendable' is unavailable in iOS; this is an error in the Swift 6 language mode
let usersAndRoles = await withTaskGroup(of: UserAndRole?.self) { taskGroup in
for newParticipant in participants {

Check warning on line 352 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Conformance of 'NSManagedObject' to 'Sendable' is unavailable in iOS; this is an error in the Swift 6 language mode

Conformance of 'NSManagedObject' to 'Sendable' is unavailable in iOS; this is an error in the Swift 6 language mode

Check warning on line 352 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Passing closure as a 'sending' parameter risks causing data races between code in the current task and concurrent execution of the closure; this is an error in the Swift 6 language mode

Passing closure as a 'sending' parameter risks causing data races between code in the current task and concurrent execution of the closure; this is an error in the Swift 6 language mode
taskGroup.addTask { [self] in
let user = await context.perform { [context] in
ZMUser.fetchOrCreate(
Expand All @@ -371,7 +373,7 @@
}

var usersAndRoles: [UserAndRole?] = []

Check warning on line 376 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Conformance of 'NSManagedObject' to 'Sendable' is unavailable in iOS; this is an error in the Swift 6 language mode

Conformance of 'NSManagedObject' to 'Sendable' is unavailable in iOS; this is an error in the Swift 6 language mode
for await userAndRole in taskGroup {
usersAndRoles.append(userAndRole)
}
Expand Down Expand Up @@ -400,8 +402,8 @@
)
}

await context.perform {

Check warning on line 405 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'localConversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'localConversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
localConversation.addParticipantsAndUpdateConversationState(

Check warning on line 406 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'usersAndRoles' with non-Sendable type '[UserAndRole]' (aka 'Array<(user: ZMUser, role: Optional<Role>)>') in a '@Sendable' closure

Capture of 'usersAndRoles' with non-Sendable type '[UserAndRole]' (aka 'Array<(user: ZMUser, role: Optional<Role>)>') in a '@sendable' closure
usersAndRoles: usersAndRoles
)
}
Expand All @@ -411,7 +413,7 @@
user: ZMUser,
conversation: ZMConversation
) async {
await context.perform { [context] in

Check warning on line 416 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'user' with non-Sendable type 'ZMUser' in a '@Sendable' closure

Capture of 'user' with non-Sendable type 'ZMUser' in a '@sendable' closure

Check warning on line 416 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure

Check warning on line 416 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Implicit capture of 'conversation' requires that 'ZMConversation' conforms to 'Sendable'

Implicit capture of 'conversation' requires that 'ZMConversation' conforms to 'Sendable'
if user.objectID.isTemporaryID || conversation.objectID.isTemporaryID {
do {
try context.obtainPermanentIDs(for: [user, conversation])
Expand All @@ -429,7 +431,7 @@
to conversation: ZMConversation
) async {
await context.perform { [context] in
let systemMessage = ZMSystemMessage(nonce: UUID(), managedObjectContext: context)

Check warning on line 434 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'message' with non-Sendable type 'SystemMessage' in a '@Sendable' closure

Capture of 'message' with non-Sendable type 'SystemMessage' in a '@sendable' closure
systemMessage.systemMessageType = message.type
systemMessage.sender = message.sender
systemMessage.users = message.users ?? Set()
Expand All @@ -448,7 +450,7 @@
systemMessage.relevantForConversationStatus = message.relevantForStatus
systemMessage.participantsRemovedReason = message.removedReason
systemMessage.domains = message.domains

Check warning on line 453 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.append(systemMessage)
}
}
Expand Down Expand Up @@ -546,7 +548,7 @@
domain: conversationDomain
)

await context.perform {

Check warning on line 551 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.isPendingMetadataRefresh = true
conversation.needsToBeUpdatedFromBackend = true
}
Expand Down Expand Up @@ -587,7 +589,7 @@
public func conversationNeedsBackendUpdate(
_ conversation: ZMConversation
) async -> Bool {
await context.perform {

Check warning on line 592 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.needsToBeUpdatedFromBackend
}
}
Expand All @@ -595,7 +597,7 @@
public func isConversationArchived(
_ conversation: ZMConversation
) async -> Bool {
await context.perform {

Check warning on line 600 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.isArchived
}
}
Expand All @@ -603,7 +605,7 @@
public func isConversationForcedReadOnly(
_ conversation: ZMConversation
) async -> Bool {
await context.perform {

Check warning on line 608 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.isForcedReadOnly
}
}
Expand All @@ -613,7 +615,7 @@
senderID: UUID?,
conversation: ZMConversation
) async -> Bool {
await context.perform {

Check warning on line 618 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.isMessageSilenced(message, senderID: senderID)
}
}
Expand All @@ -636,7 +638,7 @@
) async {
let scheduledDate = date + TimeInterval(commitDelay)

await context.perform {

Check warning on line 641 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.commitPendingProposalDate = scheduledDate
}
}
Expand All @@ -647,7 +649,7 @@
date: Date
) async {
// Update the legal hold state in the conversation
await context.perform {

Check warning on line 652 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.updateSecurityLevelIfNeededAfterReceiving(
message: genericMessage,
timestamp: date
Expand All @@ -672,8 +674,8 @@
return
}

await context.perform {

Check warning on line 677 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.addParticipantAndSystemMessageIfMissing(

Check warning on line 678 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'participant' with non-Sendable type 'ZMUser' in a '@Sendable' closure

Capture of 'participant' with non-Sendable type 'ZMUser' in a '@sendable' closure
participant,
date: date
)
Expand All @@ -683,7 +685,7 @@
public func conversationMutedMessageTypes(
_ conversation: ZMConversation
) async -> MutedMessageTypes {
await context.perform {

Check warning on line 688 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.mutedMessageTypes
}
}
Expand All @@ -692,7 +694,7 @@
_ conversation: ZMConversation
) async -> MutedMessageTypes {
await context.perform { [context] in
let selfUser = ZMUser.selfUser(in: context)

Check warning on line 697 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
return selfUser.mutedMessagesTypes.union(conversation.mutedMessageTypes)
}
}
Expand All @@ -700,7 +702,7 @@
public func lastReadServerTimestamp(
_ conversation: ZMConversation
) async -> Date? {
await context.perform {

Check warning on line 705 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.lastReadServerTimeStamp
}
}
Expand All @@ -708,7 +710,7 @@
public func conversationMessageDestructionTimeout(
_ conversation: ZMConversation
) async -> MessageDestructionTimeoutValue {
await context.perform {

Check warning on line 713 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.activeMessageDestructionTimeoutValue ?? .init(rawValue: 0)
}
}
Expand All @@ -717,7 +719,7 @@
timeoutValue: Double,
for conversation: ZMConversation
) async {
await context.perform {

Check warning on line 722 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.setMessageDestructionTimeoutValue(
.init(rawValue: timeoutValue),
for: .groupConversation
Expand All @@ -729,7 +731,7 @@
hasReadReceiptsEnabled: Bool,
for conversation: ZMConversation
) async {
await context.perform {

Check warning on line 734 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.hasReadReceiptsEnabled = hasReadReceiptsEnabled
}
}
Expand All @@ -737,7 +739,7 @@
public func messageProtocol(
for conversation: ZMConversation
) async -> WireDataModel.MessageProtocol {
await context.perform {

Check warning on line 742 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.messageProtocol
}
}
Expand All @@ -745,13 +747,13 @@
public func isGroupConversation(
_ conversation: ZMConversation
) async -> Bool {
await context.perform {

Check warning on line 750 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.conversationType == .group
}
}

public func isSelfConversation(_ conversation: ZMConversation) async -> Bool {
await context.perform {

Check warning on line 756 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.conversationType == .self
}
}
Expand All @@ -759,7 +761,7 @@
public func name(
for conversation: ZMConversation
) async -> String? {
await context.perform {

Check warning on line 764 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.displayName
}
}
Expand All @@ -779,7 +781,7 @@
}

let allGroupConversations = await context.perform {
// swiftformat:disable:next redundantProperty

Check warning on line 784 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'user' with non-Sendable type 'ZMUser' in a '@Sendable' closure

Capture of 'user' with non-Sendable type 'ZMUser' in a '@sendable' closure
let allGroupConversations: [ZMConversation] = user.participantRoles.compactMap {
guard $0.conversation?.conversationType == .group else {
return nil
Expand All @@ -793,9 +795,9 @@

for conversation in allGroupConversations {
let (userTeam, isTeamMember, conversationTeam, conversationID, conversationDomain) = await context.perform {
(

Check warning on line 798 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'user' with non-Sendable type 'ZMUser' in a '@Sendable' closure

Capture of 'user' with non-Sendable type 'ZMUser' in a '@sendable' closure
user.team,
user.isTeamMember,

Check warning on line 800 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.team,
conversation.remoteIdentifier as UUID,
conversation.domain
Expand Down Expand Up @@ -830,8 +832,8 @@
)
}

await context.perform {

Check warning on line 835 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.removeParticipantAndUpdateConversationState(

Check warning on line 836 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'user' with non-Sendable type 'ZMUser' in a '@Sendable' closure

Capture of 'user' with non-Sendable type 'ZMUser' in a '@sendable' closure
user: user,
initiatingUser: user
)
Expand All @@ -845,7 +847,7 @@
) async -> Role {
await context.perform { [context] in
Role.fetchOrCreateRole(
with: role,

Check warning on line 850 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
teamOrConversation: TeamOrConversation.matching(conversation),
in: context
)
Expand All @@ -857,7 +859,7 @@
accessModes: [String],
accessRoles: [String]
) async {
await context.perform { [context] in

Check warning on line 862 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.accessModeStrings = accessModes
conversation.accessRoleStringsV2 = accessRoles

Expand All @@ -880,7 +882,7 @@
isDeletedRemotely: Bool,
conversation: ZMConversation
) async {
await context.perform {

Check warning on line 885 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.isDeletedRemotely = isDeletedRemotely
}
}
Expand All @@ -890,9 +892,9 @@
users: Set<ZMUser>,
initiatingUser: ZMUser
) async {
await context.perform {

Check warning on line 895 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.removeParticipantsAndUpdateConversationState(

Check warning on line 896 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'users' with non-Sendable type 'Set<ZMUser>' in a '@Sendable' closure

Capture of 'users' with non-Sendable type 'Set<ZMUser>' in a '@sendable' closure
users: users,

Check warning on line 897 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'initiatingUser' with non-Sendable type 'ZMUser' in a '@Sendable' closure

Capture of 'initiatingUser' with non-Sendable type 'ZMUser' in a '@sendable' closure
initiatingUser: initiatingUser
)
}
Expand All @@ -901,7 +903,7 @@
public func localParticipants(
in conversation: ZMConversation
) async -> Set<ZMUser> {
await context.perform {

Check warning on line 906 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.localParticipants
}
}
Expand All @@ -909,7 +911,7 @@
public func conversationName(
conversation: ZMConversation
) async -> String? {
await context.perform {

Check warning on line 914 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.userDefinedName
}
}
Expand All @@ -918,7 +920,7 @@
newName: String,
conversation: ZMConversation
) async {
await context.perform {

Check warning on line 923 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
conversation.userDefinedName = newName
}
}
Expand Down Expand Up @@ -958,10 +960,10 @@
domain: conversation.qualifiedID?.domain
)

await context.perform { [self] in

Check warning on line 963 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'localConversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'localConversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
localConversation.conversationType = .connection

Check warning on line 965 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'self' with non-Sendable type 'ConversationLocalStore' in a '@Sendable' closure

Capture of 'self' with non-Sendable type 'ConversationLocalStore' in a '@sendable' closure
commonUpdate(

Check warning on line 966 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'Conversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'Conversation' in a '@sendable' closure
from: conversation,
for: localConversation,
serverTimestamp: serverTimestamp,
Expand Down Expand Up @@ -1015,15 +1017,15 @@
domain: conversation.qualifiedID?.domain
)

let mlsGroupID = await context.perform {

Check warning on line 1020 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'Conversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'Conversation' in a '@sendable' closure
conversation.mlsGroupID
}

await context.perform { [self] in

Check warning on line 1024 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'localConversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'localConversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
localConversation.conversationType = .`self`
localConversation.isPendingMetadataRefresh = false

Check warning on line 1027 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'self' with non-Sendable type 'ConversationLocalStore' in a '@Sendable' closure

Capture of 'self' with non-Sendable type 'ConversationLocalStore' in a '@sendable' closure
commonUpdate(

Check warning on line 1028 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'Conversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'Conversation' in a '@sendable' closure
from: conversation,
for: localConversation,
serverTimestamp: serverTimestamp,
Expand Down Expand Up @@ -1072,13 +1074,13 @@
domain: conversation.qualifiedID?.domain
)

await context.perform { [self] in

Check warning on line 1077 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'localConversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'localConversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure

Check warning on line 1077 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Mutation of captured var 'isInitialFetch' in concurrently-executing code

Mutation of captured var 'isInitialFetch' in concurrently-executing code
isInitialFetch = localConversation.isPendingInitialFetch

localConversation.conversationType = .group
localConversation.remoteIdentifier = id
localConversation.isPendingMetadataRefresh = false
localConversation.isPendingInitialFetch = false

Check warning on line 1083 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'Conversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'Conversation' in a '@sendable' closure
localConversation.groupType = conversation.groupType.map { groupType in
switch groupType {
case .group:
Expand All @@ -1101,7 +1103,7 @@
.disabled
}
} ?? .disabled

Check warning on line 1106 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'self' with non-Sendable type 'ConversationLocalStore' in a '@Sendable' closure

Capture of 'self' with non-Sendable type 'ConversationLocalStore' in a '@sendable' closure
commonUpdate(
from: conversation,
for: localConversation,
Expand All @@ -1114,7 +1116,7 @@
from: conversation,
for: localConversation
)

Check warning on line 1119 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Reference to captured var 'isInitialFetch' in concurrently-executing code

Reference to captured var 'isInitialFetch' in concurrently-executing code
if isInitialFetch {
assignMessageProtocol(
from: conversation,
Expand Down Expand Up @@ -1149,9 +1151,9 @@
isMLSEnabled: isMLSEnabled
)

await context.perform { [self] in

Check warning on line 1154 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Reference to captured var 'isInitialFetch' in concurrently-executing code

Reference to captured var 'isInitialFetch' in concurrently-executing code
if isInitialFetch {
// we just got a new conversation, we display new conversation header

Check warning on line 1156 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'localConversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'localConversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
localConversation.appendNewConversationSystemMessage(
at: .distantPast,
users: localConversation.localParticipants
Expand All @@ -1166,7 +1168,7 @@
}

// If we discover this group is actually a fake one on one,
// then we should link the one on one user.

Check warning on line 1171 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'self' with non-Sendable type 'ConversationLocalStore' in a '@Sendable' closure

Capture of 'self' with non-Sendable type 'ConversationLocalStore' in a '@sendable' closure
linkOneOnOneUserIfNeeded(for: localConversation)

// All metadata has been updated, object does not need to be updated from backend
Expand Down Expand Up @@ -1201,14 +1203,14 @@
let conversationType = BackendConversationType.clientConversationType(
rawValue: conversationTypeRawValue
)

Check warning on line 1206 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'localConversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'localConversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
if localConversation.oneOnOneUser?.connection?.status == .sent {
localConversation.conversationType = .connection
} else {
localConversation.conversationType = conversationType
}

Check warning on line 1212 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'self' with non-Sendable type 'ConversationLocalStore' in a '@Sendable' closure

Capture of 'self' with non-Sendable type 'ConversationLocalStore' in a '@sendable' closure
assignMessageProtocol(

Check warning on line 1213 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'Conversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'Conversation' in a '@sendable' closure
from: conversation,
for: localConversation
)
Expand Down Expand Up @@ -1309,7 +1311,7 @@
domain: conversationDomain
)

return await context.perform {

Check warning on line 1314 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'handler' with non-Sendable type '(ZMConversation) -> (ZMConversation, MLSGroupID?)' in a '@Sendable' closure

Capture of 'handler' with non-Sendable type '(ZMConversation) -> (ZMConversation, MLSGroupID?)' in a '@sendable' closure

Check warning on line 1314 in WireDomain/Sources/WireDomain/Repositories/Conversations/LocalStore/ConversationLocalStore.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@Sendable' closure

Capture of 'conversation' with non-Sendable type 'ZMConversation' in a '@sendable' closure
handler(conversation)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,9 @@ public protocol ConversationRepositoryProtocol: Sendable {
func isSelfAnActiveMember(
in groupID: WireDataModel.MLSGroupID
) async -> Bool

/// Reset the pendingProposalDate for the conversation
/// - Parameter groupID: mlsGroupID of the conversation
func clearPendingProposals(in groupID: WireDataModel.MLSGroupID) async

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@

import Foundation
import WireDataModel
import WireLogging

Check warning on line 21 in WireDomain/Sources/WireDomain/Repositories/Conversations/Repository/ConversationRepository.swift

View workflow job for this annotation

GitHub Actions / Test Results

Add '@preconcurrency' to suppress 'Sendable'-related warnings from module 'WireNetwork'

Add '@preconcurrency' to suppress 'Sendable'-related warnings from module 'WireNetwork'
import WireNetwork

public final class ConversationRepository: ConversationRepositoryProtocol {

// MARK: - Properties

Check warning on line 27 in WireDomain/Sources/WireDomain/Repositories/Conversations/Repository/ConversationRepository.swift

View workflow job for this annotation

GitHub Actions / Test Results

Stored property 'conversationsAPI' of 'Sendable'-conforming class 'ConversationRepository' has non-Sendable type 'any ConversationsAPI'; this is an error in the Swift 6 language mode

Stored property 'conversationsAPI' of 'Sendable'-conforming class 'ConversationRepository' has non-Sendable type 'any ConversationsAPI'; this is an error in the Swift 6 language mode
private let conversationsAPI: any ConversationsAPI

Check warning on line 28 in WireDomain/Sources/WireDomain/Repositories/Conversations/Repository/ConversationRepository.swift

View workflow job for this annotation

GitHub Actions / Test Results

Stored property 'conversationsLocalStore' of 'Sendable'-conforming class 'ConversationRepository' has non-Sendable type 'any ConversationLocalStoreProtocol'; this is an error in the Swift 6 language mode

Stored property 'conversationsLocalStore' of 'Sendable'-conforming class 'ConversationRepository' has non-Sendable type 'any ConversationLocalStoreProtocol'; this is an error in the Swift 6 language mode
private let conversationsLocalStore: any ConversationLocalStoreProtocol

Check warning on line 29 in WireDomain/Sources/WireDomain/Repositories/Conversations/Repository/ConversationRepository.swift

View workflow job for this annotation

GitHub Actions / Test Results

Stored property 'userLocalStore' of 'Sendable'-conforming class 'ConversationRepository' has non-Sendable type 'any UserLocalStoreProtocol'; this is an error in the Swift 6 language mode

Stored property 'userLocalStore' of 'Sendable'-conforming class 'ConversationRepository' has non-Sendable type 'any UserLocalStoreProtocol'; this is an error in the Swift 6 language mode
private let userLocalStore: any UserLocalStoreProtocol

Check warning on line 30 in WireDomain/Sources/WireDomain/Repositories/Conversations/Repository/ConversationRepository.swift

View workflow job for this annotation

GitHub Actions / Test Results

Stored property 'teamRepository' of 'Sendable'-conforming class 'ConversationRepository' has non-Sendable type 'any TeamRepositoryProtocol'; this is an error in the Swift 6 language mode

Stored property 'teamRepository' of 'Sendable'-conforming class 'ConversationRepository' has non-Sendable type 'any TeamRepositoryProtocol'; this is an error in the Swift 6 language mode
private let teamRepository: any TeamRepositoryProtocol

Check warning on line 31 in WireDomain/Sources/WireDomain/Repositories/Conversations/Repository/ConversationRepository.swift

View workflow job for this annotation

GitHub Actions / Test Results

Stored property 'messageRepository' of 'Sendable'-conforming class 'ConversationRepository' has non-Sendable type 'any MessageRepositoryProtocol'; this is an error in the Swift 6 language mode

Stored property 'messageRepository' of 'Sendable'-conforming class 'ConversationRepository' has non-Sendable type 'any MessageRepositoryProtocol'; this is an error in the Swift 6 language mode
private let messageRepository: any MessageRepositoryProtocol
private let localDomain: String
private let isFederationEnabled: Bool
private let isMLSEnabled: Bool

Check warning on line 35 in WireDomain/Sources/WireDomain/Repositories/Conversations/Repository/ConversationRepository.swift

View workflow job for this annotation

GitHub Actions / Test Results

Stored property 'mlsProvider' of 'Sendable'-conforming class 'ConversationRepository' has non-Sendable type 'MLSProvider'; this is an error in the Swift 6 language mode

Stored property 'mlsProvider' of 'Sendable'-conforming class 'ConversationRepository' has non-Sendable type 'MLSProvider'; this is an error in the Swift 6 language mode
private let mlsProvider: MLSProvider

// MARK: - Object lifecycle
Expand Down Expand Up @@ -390,6 +390,13 @@
return isSelfAnActiveMember
}

public func clearPendingProposals(in groupID: WireDataModel.MLSGroupID) async {
await conversationsLocalStore.execute(identifier: groupID) { conversation, context in
conversation?.commitPendingProposalDate = nil
context.saveOrRollback()
}
}

// MARK: - Private

private func addSystemMessage(
Expand Down Expand Up @@ -424,9 +431,9 @@

private func getRemovedUsers(
from userIDs: Set<UserID>
) async -> [WireDataModel.ZMUser] {

Check warning on line 434 in WireDomain/Sources/WireDomain/Repositories/Conversations/Repository/ConversationRepository.swift

View workflow job for this annotation

GitHub Actions / Test Results

Conformance of 'NSManagedObject' to 'Sendable' is unavailable in iOS; this is an error in the Swift 6 language mode

Conformance of 'NSManagedObject' to 'Sendable' is unavailable in iOS; this is an error in the Swift 6 language mode

Check warning on line 434 in WireDomain/Sources/WireDomain/Repositories/Conversations/Repository/ConversationRepository.swift

View workflow job for this annotation

GitHub Actions / Test Results

Conformance of 'NSManagedObject' to 'Sendable' is unavailable in iOS; this is an error in the Swift 6 language mode

Conformance of 'NSManagedObject' to 'Sendable' is unavailable in iOS; this is an error in the Swift 6 language mode
await withTaskGroup(of: WireDataModel.ZMUser.self) { taskGroup in
for userID in userIDs {

Check warning on line 436 in WireDomain/Sources/WireDomain/Repositories/Conversations/Repository/ConversationRepository.swift

View workflow job for this annotation

GitHub Actions / Test Results

Conformance of 'NSManagedObject' to 'Sendable' is unavailable in iOS; this is an error in the Swift 6 language mode

Conformance of 'NSManagedObject' to 'Sendable' is unavailable in iOS; this is an error in the Swift 6 language mode
taskGroup.addTask { [self] in
await userLocalStore.fetchOrCreateUser(
id: userID.id,
Expand All @@ -436,7 +443,7 @@
}

var users: [WireDataModel.ZMUser] = []

Check warning on line 446 in WireDomain/Sources/WireDomain/Repositories/Conversations/Repository/ConversationRepository.swift

View workflow job for this annotation

GitHub Actions / Test Results

Conformance of 'NSManagedObject' to 'Sendable' is unavailable in iOS; this is an error in the Swift 6 language mode

Conformance of 'NSManagedObject' to 'Sendable' is unavailable in iOS; this is an error in the Swift 6 language mode
for await user in taskGroup {
users.append(user)
}
Expand Down
3 changes: 3 additions & 0 deletions WireDomain/Sources/WireDomain/WorkAgent/WorkAgent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ public actor WorkAgent {
task = nil
}

public func clearSchedulerQueue() async {
await scheduler.clearAllItems()
}
}

extension LogAttributes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@ struct CommitPendingProposalItem: WorkItem, CustomStringConvertible {
private let repository: ConversationRepositoryProtocol
private let mlsService: MLSServiceInterface

let _internalID = UUID()

var id: String {
"commitPendingProposalItem_\(_internalID)_\(groupID)_\(conversationID)"
}

var description: String {
"CommitPendingProposalItem: \(id), mlsGroupID: \(groupID), conversationID: \(conversationID)"
"CommitPendingProposalItem: \(_internalID), mlsGroupID: \(groupID), conversationID: \(conversationID)"
}

let id = UUID()
var priority: WorkItemPriority {
.medium
}
Expand Down Expand Up @@ -60,6 +65,12 @@ struct CommitPendingProposalItem: WorkItem, CustomStringConvertible {
return
}

guard try await mlsService.conversationExists(groupID: groupID) else {
logger.warn("mls group does not exist, clearing pending proposal", attributes: logAttributes)
await repository.clearPendingProposals(in: groupID)
return
}

logger.info("committing pending proposals now...", attributes: logAttributes)
try await mlsService.commitPendingProposals(in: groupID)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@

struct RepairFaultyMLSRemovalKeysWorkItem: WorkItem {

let id = UUID()
var id: String {
"repairFaultyMLSRemovalKeys_\(UUID().uuidString)"
}

var priority: WorkItemPriority {
.low
}

Check warning on line 37 in WireDomain/Sources/WireDomain/WorkAgent/WorkItem/RepairFaultyMLSRemovalKeysWorkItem.swift

View workflow job for this annotation

GitHub Actions / Test Results

Stored property 'journal' of 'Sendable'-conforming struct 'RepairFaultyMLSRemovalKeysWorkItem' has non-Sendable type 'any JournalProtocol'; this is an error in the Swift 6 language mode

Stored property 'journal' of 'Sendable'-conforming struct 'RepairFaultyMLSRemovalKeysWorkItem' has non-Sendable type 'any JournalProtocol'; this is an error in the Swift 6 language mode
private let journal: any JournalProtocol

Check warning on line 38 in WireDomain/Sources/WireDomain/WorkAgent/WorkItem/RepairFaultyMLSRemovalKeysWorkItem.swift

View workflow job for this annotation

GitHub Actions / Test Results

Stored property 'repairUseCase' of 'Sendable'-conforming struct 'RepairFaultyMLSRemovalKeysWorkItem' has non-Sendable type 'any RepairRemovalKeysUseCaseProtocol'; this is an error in the Swift 6 language mode

Stored property 'repairUseCase' of 'Sendable'-conforming struct 'RepairFaultyMLSRemovalKeysWorkItem' has non-Sendable type 'any RepairRemovalKeysUseCaseProtocol'; this is an error in the Swift 6 language mode
private let repairUseCase: any RepairRemovalKeysUseCaseProtocol

init(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@ import WireNetwork
struct UpdateConversationItem: WorkItem {
private let repository: ConversationRepositoryProtocol

let id = UUID()
let _internalID = UUID()

var id: String {
"updateConversationItem_\(_internalID.uuidString)_\(conversationID)"
}

var description: String {
"UpdateConversationItem: \(_internalID.uuidString), conversationID: \(conversationID)"
}

var priority: WorkItemPriority {
.medium
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protocol WorkItem: Sendable {

/// A unique identifier for this item.

var id: UUID { get }
var id: String { get }

/// The urgency or importance of this ticket.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,10 @@ actor PriorityOrderWorkItemScheduler: WorkItemScheduler {
}
}

func clearAllItems() async {
blockerQueue.removeAll()
highQueue.removeAll()
mediumQueue.removeAll()
lowQueue.removeAll()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@ protocol WorkItemScheduler: Sendable {
/// - Returns: The next available item.

func dequeueNextItem() async -> (any WorkItem)?

/// Clears all items from queues

func clearAllItems() async
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ struct PriorityOrderWorkItemSchedulerTests {

private struct MockWorkItem: WorkItem, Equatable {

let id = UUID()
let id = UUID().uuidString
let priority: WorkItemPriority
func start() async throws {}

Expand Down
23 changes: 22 additions & 1 deletion WireDomain/Tests/WireDomainTests/WorkAgent/WorkAgentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,28 @@ struct WorkAgentTests {
#expect(await item.startCalls == 1)
}

@Test("Clear items are removed")
func clearItems() async throws {
// Given
let item = MockWorkItem(priority: .medium)
await sut.submitItem(item)
await Task.yield()

#expect(await scheduler.enqueuedItems.count == 1)

// When
await sut.clearSchedulerQueue()

// Then
#expect(await scheduler.items.isEmpty)
#expect(await scheduler.enqueuedItems.isEmpty)
}

}

private actor MockWorkItem: WorkItem {

let id = UUID()
let id = UUID().uuidString
let priority: WorkItemPriority

var startCalls = 0
Expand Down Expand Up @@ -137,4 +154,8 @@ private actor MockScheduler: WorkItemScheduler {
return item
}

func clearAllItems() async {
enqueuedItems.removeAll()
items.removeAll()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class CommitPendingProposalItemTests {
self.mlsGroupID = .random()
self.mlsService = .init()
mlsService.commitPendingProposalsIn_MockMethod = { _ in }
mlsService.conversationExistsGroupID_MockValue = true
repository.isSelfAnActiveMemberIn_MockValue = true
}

Expand Down Expand Up @@ -76,6 +77,22 @@ class CommitPendingProposalItemTests {
#expect(mlsService.commitPendingProposalsIn_Invocations.isEmpty)
}

@Test("It does not call commitPendingProposal when mlsGroup does not exist")
func startDoesNotCommitWhenMLSGroupDoesNotExist() async throws {
// Given
repository.clearPendingProposalsIn_MockMethod = { _ in }
mlsService.conversationExistsGroupID_MockValue = false

sut = makeProposalItem()

// When
try await sut.start()

// Then
#expect(mlsService.commitPendingProposalsIn_Invocations.isEmpty)
#expect(repository.clearPendingProposalsIn_Invocations.count == 1)
}

@Test("It logs properly")
func loggingDescription() {
// Given
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public actor BackoffRetrier {
_ seconds: Double
) async throws -> Void

enum Failure: Error {
public enum Failure: Error {
case exceededMaxAttempts(latestError: any Error)
}

Expand All @@ -36,14 +36,16 @@ public actor BackoffRetrier {

public init(
policy: BackoffRetryPolicy = .init(),
monitoringNetwork: Bool = true,
sleep: @escaping SleepFunction = { delay in
try await Task.sleep(nanoseconds: UInt64(delay * 1_000_000_000))
}
) {
self.policy = policy
self.sleep = sleep

setupObservers()
if monitoringNetwork {
setupObservers()
}
}

deinit {
Expand Down
Loading
Loading