You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-ios/SessionMessagingKit/Messages/Control Messages/Group Update Messages/GroupUpdateMemberLeftNotifi...

54 lines
2.2 KiB
Swift

// Copyright © 2024 Rangeproof Pty Ltd. All rights reserved.
//
// stringlint:disable
import Foundation
import GRDB
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()
Fixed a bunch of issues found by QA • Updated the GroupMembers handling to updated the current users entry if they have the admin key and their current state is not correct • Updated the "groups have been upgraded" banner to be visible for non-admins • Updated the code to prevent changes from being able to be made on group configs without the admin key (was crashing previously) • Added the new "deleted" group state and copy • Fixed a layout issue on the settings screen when the editable text is too long • Fixed a case sensitive contact sorting issue • Fixed an issue where the groups v2 min version banner was appearing on legacy groups screens • Fixed a bug where profile information may not be updated due to a timestamp resolution issue • Fixed a bug where the group name would incorrectly be used in the block modal for group message requests • Fixed a bug where the block button wasn't appearing within the group message request screen • Fixed a bug where there was an incorrect timestamp conversion when checking whether to drop a message that was sent earlier than the 'deleteBefore' timestamp • Fixed an issue where the "you left the group" message wouldn't be visible if you rejoined a group • Fixed an issue where crashing during the initial creation of a group could result in it's state never loading • Fixed an issue where deleting before a timestamp wasn't correctly using the network-offset timestamp • Fixed an issue where the submodule was pointing at the wrong repo • Removed some duplicate code
1 year ago
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(_ db: Database, threadId: String) -> 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()
contentProto.setDataMessage(try dataMessage.build())
return try contentProto.build()
} catch {
SNLog("Couldn't construct data extraction notification proto from: \(self).")
return nil
}
}
// MARK: - Description
public var description: String { "GroupUpdateMemberLeftNotificationMessage()" }
}