Files
Morgan Pretty eddffae6a1 Refactored a number of processes to no longer require database access
• Refactored the MessageSender to no longer require database access
• Refactored the attachment upload process to no longer require database access
• Updated the OpenGroupAPI to no longer require database access
• Added back logic to send the `endCall` message when receiving a call while on another call
• Added `community` to `AuthenticationMethod` to help standardise the code behaviour
• Updated the `toProto` functions to no longer required a `Database` instance
• Updated a bunch of functions to be @MainActor (so we can ditch thread swapping code)
2025-06-03 08:51:05 +10:00

54 lines
2.3 KiB
Swift

// Copyright © 2024 Rangeproof Pty Ltd. All rights reserved.
//
// stringlint:disable
import Foundation
import SessionUtilitiesKit
public final class GroupUpdateMemberLeftNotificationMessage: ControlMessage {
private enum CodingKeys: String, CodingKey {
case memberLeftCodableId
}
/// This value shouldn't be used for any logic, it's just used to ensure this type can be uniquely encoded/decoded by
/// the `Message.createMessageFrom(_:sender:)` function and won't collide with other message types due
/// to having the same keys
private let memberLeftCodableId: UUID = UUID()
public override var isSelfSendValid: Bool { true }
public override var processWithBlockedSender: Bool { true }
// MARK: - Proto Conversion
public override class func fromProto(_ proto: SNProtoContent, sender: String, using dependencies: Dependencies) -> GroupUpdateMemberLeftNotificationMessage? {
guard proto.dataMessage?.groupUpdateMessage?.memberLeftNotificationMessage != nil else { return nil }
return GroupUpdateMemberLeftNotificationMessage()
}
public override func toProto() -> SNProtoContent? {
do {
let memberLeftNotificationMessageBuilder: SNProtoGroupUpdateMemberLeftNotificationMessage.SNProtoGroupUpdateMemberLeftNotificationMessageBuilder = SNProtoGroupUpdateMemberLeftNotificationMessage.builder()
let groupUpdateMessage = SNProtoGroupUpdateMessage.builder()
groupUpdateMessage.setMemberLeftNotificationMessage(try memberLeftNotificationMessageBuilder.build())
let dataMessage = SNProtoDataMessage.builder()
dataMessage.setGroupUpdateMessage(try groupUpdateMessage.build())
let contentProto = SNProtoContent.builder()
if let sigTimestampMs = sigTimestampMs { contentProto.setSigTimestamp(sigTimestampMs) }
contentProto.setDataMessage(try dataMessage.build())
return try contentProto.build()
} catch {
Log.warn(.messageSender, "Couldn't construct data extraction notification proto from: \(self).")
return nil
}
}
// MARK: - Description
public var description: String { "GroupUpdateMemberLeftNotificationMessage()" }
}