Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: implement new slow sync - WPB-10727 #1999

Open
wants to merge 19 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a1cfc5f
add getMLSOneToOneConversation endpoint, refactor getLegalHoldStatus …
jullianm Oct 3, 2024
1d6796b
add pullMLSOneOnOneConversation repo method, add UTs - WPB-10727
jullianm Oct 3, 2024
4a41195
refactor existing repo methods, fix UTs - WPB-10727
jullianm Oct 3, 2024
60767d2
add OneOnOneResolverUseCase, perform slow sync in SyncManager, add UTs
jullianm Oct 3, 2024
f5663e2
lint and format - WPB-10727
jullianm Oct 3, 2024
aeed41e
factor out fetchAllUserIdsWithOneOnOneConversation method to user rep…
jullianm Oct 3, 2024
79ab5ab
remove public access from oneOnOneResolver, add MLSProvider struct, f…
jullianm Oct 9, 2024
6808852
add internal test helper method - WPB-10727 (#1999)
jullianm Oct 9, 2024
557391b
fix threading violation - WPB-10727 (#1999)
jullianm Oct 9, 2024
61c3ae4
add Sendable to Conversation value type objects - WPB-10727 (#1999)
jullianm Oct 9, 2024
fccfda8
add SyncManager Error enum, add UT for slow sync failure - WPB-10727 …
jullianm Oct 9, 2024
b598b9c
fix legalhold naming - WPB-10727 (#1999)
jullianm Oct 11, 2024
25021b3
rename OneOnOneResolveError, remove invoke() method, create MLSProvid…
jullianm Oct 11, 2024
e151fbc
rename Error with Failure - WPB-10727
jullianm Nov 15, 2024
a9bd9d0
Merge branch 'develop' into refactor/implement-new-slow-sync
jullianm Nov 15, 2024
4af8a0e
fix remaining conflicts, clean up code - WPB-10727 (#1999)
jullianm Nov 15, 2024
d6014c1
fix OneOnOneResolver tests - WPB-10727 (#1999)
jullianm Nov 15, 2024
43ad84d
lint and format - WPB-10727 (#1999)
jullianm Nov 15, 2024
f5820cb
Trigger Build
jullianm Nov 15, 2024
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
4 changes: 2 additions & 2 deletions WireAPI/Sources/WireAPI/APIs/TeamsAPI/TeamsAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public protocol TeamsAPI {
/// - userID: The id of the member.
/// - Returns: The legalhold of the member.

func getLegalhold(
func getLegalholdInfo(
for teamID: Team.ID,
userID: UUID
) async throws -> TeamMemberLegalHold
) async throws -> TeamMemberLegalholdInfo

}
12 changes: 6 additions & 6 deletions WireAPI/Sources/WireAPI/APIs/TeamsAPI/TeamsAPIV0.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ class TeamsAPIV0: TeamsAPI, VersionedAPI {

// MARK: - Get team member legalhold

func getLegalhold(
func getLegalholdInfo(
for teamID: Team.ID,
userID: UUID
) async throws -> TeamMemberLegalHold {
) async throws -> TeamMemberLegalholdInfo {
let request = HTTPRequest(
path: "\(basePath(for: teamID))/legalhold/\(userID.transportString())",
method: .get
Expand All @@ -110,7 +110,7 @@ class TeamsAPIV0: TeamsAPI, VersionedAPI {
let response = try await httpClient.executeRequest(request)

return try ResponseParser()
.success(code: .ok, type: TeamMemberLegalHoldResponseV0.self)
.success(code: .ok, type: TeamMemberLegalholdResponseV0.self)
.failure(code: .notFound, error: TeamsAPIError.invalidRequest)
.failure(code: .notFound, label: "no-team-member", error: TeamsAPIError.teamMemberNotFound)
.parse(response)
Expand Down Expand Up @@ -315,7 +315,7 @@ struct LegalHoldLastPrekeyV0: Decodable, ToAPIModelConvertible {
}
}

struct TeamMemberLegalHoldResponseV0: Decodable, ToAPIModelConvertible {
struct TeamMemberLegalholdResponseV0: Decodable, ToAPIModelConvertible {

let lastPrekey: LegalHoldLastPrekeyV0
let status: LegalholdStatusV0
Expand All @@ -325,8 +325,8 @@ struct TeamMemberLegalHoldResponseV0: Decodable, ToAPIModelConvertible {
case lastPrekey = "last_prekey"
}

func toAPIModel() -> TeamMemberLegalHold {
TeamMemberLegalHold(
func toAPIModel() -> TeamMemberLegalholdInfo {
TeamMemberLegalholdInfo(
status: status.toAPIModel(),
prekey: lastPrekey.toAPIModel()
)
Expand Down
6 changes: 3 additions & 3 deletions WireAPI/Sources/WireAPI/APIs/TeamsAPI/TeamsAPIV4.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ class TeamsAPIV4: TeamsAPIV3 {

// MARK: - Get team member legalhold

override func getLegalhold(
override func getLegalholdInfo(
for teamID: Team.ID,
userID: UUID
) async throws -> TeamMemberLegalHold {
) async throws -> TeamMemberLegalholdInfo {
let request = HTTPRequest(
path: "\(basePath(for: teamID))/legalhold/\(userID.transportString())",
method: .get
Expand All @@ -104,7 +104,7 @@ class TeamsAPIV4: TeamsAPIV3 {

// New: 400
return try ResponseParser()
.success(code: .ok, type: TeamMemberLegalHoldResponseV0.self)
.success(code: .ok, type: TeamMemberLegalholdResponseV0.self)
.failure(code: .badRequest, error: TeamsAPIError.invalidRequest)
.failure(code: .notFound, label: "no-team-member", error: TeamsAPIError.teamMemberNotFound)
.parse(response)
Expand Down
6 changes: 3 additions & 3 deletions WireAPI/Sources/WireAPI/APIs/TeamsAPI/TeamsAPIV5.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ class TeamsAPIV5: TeamsAPIV4 {

// MARK: - Get team member legalhold

override func getLegalhold(
override func getLegalholdInfo(
for teamID: Team.ID,
userID: UUID
) async throws -> TeamMemberLegalHold {
) async throws -> TeamMemberLegalholdInfo {
let request = HTTPRequest(
path: "\(basePath(for: teamID))/legalhold/\(userID.transportString())",
method: .get
Expand All @@ -101,7 +101,7 @@ class TeamsAPIV5: TeamsAPIV4 {

// New: 404 invalid request.
return try ResponseParser()
.success(code: .ok, type: TeamMemberLegalHoldResponseV0.self)
.success(code: .ok, type: TeamMemberLegalholdResponseV0.self)
.failure(code: .notFound, error: TeamsAPIError.invalidRequest)
.failure(code: .notFound, label: "no-team-member", error: TeamsAPIError.teamMemberNotFound)
.parse(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct ConversationReceiptModeUpdateEventDecoder {
return ConversationReceiptModeUpdateEvent(
conversationID: conversationID,
senderID: senderID,
newRecieptMode: payload.receiptMode
newReceiptMode: payload.receiptMode
johnxnguyen marked this conversation as resolved.
Show resolved Hide resolved
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public extension Conversation {

/// Represents a conversation's member.

struct Member: Equatable, Codable {
struct Member: Equatable, Codable, Sendable {

public let qualifiedID: QualifiedID?
public let id: UUID?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// Changed metadata for a member of a conversation.

public struct ConversationMemberChange: Equatable, Codable {
public struct ConversationMemberChange: Equatable, Codable, Sendable {

/// The id of the member.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// The reason why a member was removed from a conversation.

public enum ConversationMemberLeaveReason: String, Codable {
public enum ConversationMemberLeaveReason: String, Codable, Sendable {

/// The user has been removed from the team and therefore removed
/// from all conversations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Foundation
/// The contents of a message, typically as a base-64 encoded
/// Protobuf string.

public enum MessageContent: Equatable, Codable {
public enum MessageContent: Equatable, Codable, Sendable {

/// Encrypted message content.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@
// along with this program. If not, see http://www.gnu.org/licenses/.
//

public typealias LegalHoldPrekey = Prekey
public typealias LegalholdPrekey = Prekey

/// The team member legal hold.
public struct TeamMemberLegalHold: Equatable, Sendable {
public struct TeamMemberLegalholdInfo: Equatable, Sendable {

/// The legal hold status

public let status: LegalholdStatus

/// The legal hold prekey

public let prekey: LegalHoldPrekey
public let prekey: LegalholdPrekey

public init(
status: LegalholdStatus,
prekey: LegalHoldPrekey
prekey: LegalholdPrekey
) {
self.status = status
self.prekey = prekey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// An event where the access settings of a conversation were updated.

public struct ConversationAccessUpdateEvent: Equatable, Codable {
public struct ConversationAccessUpdateEvent: Equatable, Codable, Sendable {

/// The id of the conversation.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// An event where the conversation's guest link code was updated.

public struct ConversationCodeUpdateEvent: Equatable, Codable {
public struct ConversationCodeUpdateEvent: Equatable, Codable, Sendable {

/// The id of the conversation.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// An event where a new conversation was created.

public struct ConversationCreateEvent: Equatable, Codable {
public struct ConversationCreateEvent: Equatable, Codable, Sendable {

/// The id of the conversation.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// An event where a conversation was deleted.

public struct ConversationDeleteEvent: Equatable, Codable {
public struct ConversationDeleteEvent: Equatable, Codable, Sendable {

/// The id of the conversation.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// An event concerning conversations.

public enum ConversationEvent: Equatable, Codable {
public enum ConversationEvent: Equatable, Codable, Sendable {

/// A conversation's access settings were updated.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// An event where an mls message was received in a conversation.

public struct ConversationMLSMessageAddEvent: Equatable, Codable {
public struct ConversationMLSMessageAddEvent: Equatable, Codable, Sendable {

/// The id of the conversation.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// An event where an mls welcome message was received in a conversation.

public struct ConversationMLSWelcomeEvent: Equatable, Codable {
public struct ConversationMLSWelcomeEvent: Equatable, Codable, Sendable {

/// The id of the conversation.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// An event where some participants were added to a conversation.

public struct ConversationMemberJoinEvent: Equatable, Codable {
public struct ConversationMemberJoinEvent: Equatable, Codable, Sendable {

/// The id of the conversation.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// An event where some participants were removed from a conversation.

public struct ConversationMemberLeaveEvent: Equatable, Codable {
public struct ConversationMemberLeaveEvent: Equatable, Codable, Sendable {

/// The id of the conversation.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// An event where some metadata changed for a member in a conversation.

public struct ConversationMemberUpdateEvent: Equatable, Codable {
public struct ConversationMemberUpdateEvent: Equatable, Codable, Sendable {

/// The id of the conversation.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// An event where the message timer of a conversation was updated.

public struct ConversationMessageTimerUpdateEvent: Equatable, Codable {
public struct ConversationMessageTimerUpdateEvent: Equatable, Codable, Sendable {

/// The id of the conversation.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// An event where a proteus message was received in a conversation.

public struct ConversationProteusMessageAddEvent: Equatable, Codable {
public struct ConversationProteusMessageAddEvent: Equatable, Codable, Sendable {

/// The id of the conversation.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// An event where the message protocol was updated in a conversation.

public struct ConversationProtocolUpdateEvent: Equatable, Codable {
public struct ConversationProtocolUpdateEvent: Equatable, Codable, Sendable {

/// The id of the conversation.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// An event where the receipt mode of a conversation was updated.

public struct ConversationReceiptModeUpdateEvent: Equatable, Codable {
public struct ConversationReceiptModeUpdateEvent: Equatable, Codable, Sendable {

/// The id of the conversation.

Expand All @@ -35,6 +35,6 @@ public struct ConversationReceiptModeUpdateEvent: Equatable, Codable {
/// A value of `1` indicates read reciepts are enabled
/// and any other value indicates receipts are disabled.

public let newRecieptMode: Int
public let newReceiptMode: Int

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// An event where the conversation's name was changed.

public struct ConversationRenameEvent: Equatable, Codable {
public struct ConversationRenameEvent: Equatable, Codable, Sendable {

/// The id of the conversation.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// An event where a user is typing in a conversation.

public struct ConversationTypingEvent: Equatable, Codable {
public struct ConversationTypingEvent: Equatable, Codable, Sendable {

/// The id of the conversation.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Foundation
/// that can be used to incrementaly update the state of
/// the client.

public enum UpdateEvent: Equatable, Codable {
public enum UpdateEvent: Equatable, Codable, Sendable {

/// A conversation event.

Expand Down
2 changes: 1 addition & 1 deletion WireAPI/Sources/WireAPI/Models/User/LegalholdStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// Represents all possible legalhold status for a user.

public enum LegalholdStatus {
public enum LegalholdStatus: Sendable {

/// Legalhold is active for the user.

Expand Down
2 changes: 1 addition & 1 deletion WireAPI/Sources/WireAPI/Models/User/UserID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@

import Foundation

/// Fully quallified user identifier.
/// Fully qualified user identifier.

public typealias UserID = QualifiedID
2 changes: 1 addition & 1 deletion WireAPI/Sources/WireAPI/Models/UserClient/Prekey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation

/// A Proteus client prekey used to establish a Proteus session.

public struct Prekey: Equatable, Codable {
public struct Prekey: Equatable, Codable, Sendable {

/// The prekey id.

Expand Down
Loading