Fixed build issues, removed invalid unit tests and missing copy

pull/731/head
Morgan Pretty 5 months ago
parent 661720a988
commit 84492be016

@ -818,7 +818,6 @@
FDC438C927BB706500C60D73 /* SendDirectMessageRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDC438C827BB706500C60D73 /* SendDirectMessageRequest.swift */; };
FDC438CB27BB7DB100C60D73 /* UpdateMessageRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDC438CA27BB7DB100C60D73 /* UpdateMessageRequest.swift */; };
FDC438CD27BC641200C60D73 /* Set+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDC438CC27BC641200C60D73 /* Set+Utilities.swift */; };
FDC439632AC2492700A56963 /* MessageReceiverSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B6ACADD2A32D3A9009AFB73 /* MessageReceiverSpec.swift */; };
FDC498B72AC15F7D00EDD897 /* AppNotificationCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDC498B62AC15F7D00EDD897 /* AppNotificationCategory.swift */; };
FDC498B92AC15FE300EDD897 /* AppNotificationAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDC498B82AC15FE300EDD897 /* AppNotificationAction.swift */; };
FDC498BB2AC1606C00EDD897 /* AppNotificationUserInfoKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDC498BA2AC1606C00EDD897 /* AppNotificationUserInfoKey.swift */; };
@ -1249,7 +1248,6 @@
7B521E0929BFF84400C3C36A /* GroupLeavingJob.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupLeavingJob.swift; sourceTree = "<group>"; };
7B5233C32900E90F00F8F375 /* SessionLabelCarouselView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionLabelCarouselView.swift; sourceTree = "<group>"; };
7B5233C5290636D700F8F375 /* _018_DisappearingMessagesConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = _018_DisappearingMessagesConfiguration.swift; sourceTree = "<group>"; };
7B6ACADD2A32D3A9009AFB73 /* MessageReceiverSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageReceiverSpec.swift; sourceTree = "<group>"; };
7B7037422834B81F000DCF35 /* ReactionContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReactionContainerView.swift; sourceTree = "<group>"; };
7B7037442834BCC0000DCF35 /* ReactionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReactionView.swift; sourceTree = "<group>"; };
7B71A98E2925E2A600E54854 /* SessionFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionFooterView.swift; sourceTree = "<group>"; };
@ -3944,7 +3942,6 @@
isa = PBXGroup;
children = (
FD3C907027E445E500CD579F /* MessageReceiverDecryptionSpec.swift */,
7B6ACADD2A32D3A9009AFB73 /* MessageReceiverSpec.swift */,
FD3C906C27E43C4B00CD579F /* MessageSenderEncryptionSpec.swift */,
);
path = "Sending & Receiving";
@ -6485,7 +6482,6 @@
FDC2908B27D707F3005DAE71 /* SendMessageRequestSpec.swift in Sources */,
FDC290A827D9B46D005DAE71 /* NimbleExtensions.swift in Sources */,
FD7692F72A53A2ED000E4B70 /* SessionThreadViewModelSpec.swift in Sources */,
FDC439632AC2492700A56963 /* MessageReceiverSpec.swift in Sources */,
FD0969F92A69FFE700C5C365 /* Mocked.swift in Sources */,
FDC2908F27D70938005DAE71 /* SendDirectMessageRequestSpec.swift in Sources */,
FDC438BD27BB2AB400C60D73 /* Mockable.swift in Sources */,

@ -198,7 +198,7 @@ final class InfoMessageCell: MessageCell {
guard let cellViewModel: MessageViewModel = self.viewModel else { return }
if cellViewModel.variant == .infoDisappearingMessagesUpdate && cellViewModel.canDoFollowingSetting() {
delegate?.handleItemTapped(cellViewModel, gestureRecognizer: gestureRecognizer)
delegate?.handleItemTapped(cellViewModel, cell: self, cellLocation: gestureRecognizer.location(in: self))
}
}
}

@ -486,8 +486,7 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel, Naviga
authorId: userPublicKey,
timestampMs: currentTimestampMs,
serverHash: nil,
updatedConfiguration: updatedConfig,
isPreviousOff: !self.config.isEnabled
updatedConfiguration: updatedConfig
)
let duration: UInt32? = {

@ -828,8 +828,7 @@ enum _003_YDBToGRDBMigration: Migration {
senderName: updateMessage.createdByRemoteName,
isEnabled: updateMessage.configurationIsEnabled,
durationSeconds: TimeInterval(updateMessage.configurationDurationSeconds),
type: nil,
isPreviousOff: false
type: nil
)
),
let infoMessageString: String = String(data: infoMessageData, encoding: .utf8)

@ -131,11 +131,9 @@ public extension DisappearingMessagesConfiguration {
public let isEnabled: Bool
public let durationSeconds: TimeInterval
public let type: DisappearingMessageType?
public let isPreviousOff: Bool?
var previewText: String {
guard Features.useNewDisappearingMessagesConfig && self.threadVariant != nil else { return legacyPreviewText }
guard self.threadVariant != .legacyGroup else { return previewTextLegacyGroup }
guard let senderName: String = senderName else {
guard isEnabled, durationSeconds > 0 else {
@ -161,51 +159,6 @@ public extension DisappearingMessagesConfiguration {
)
}
var previewTextLegacyGroup: String {
guard Features.useNewDisappearingMessagesConfig else { return legacyPreviewText }
guard let senderName: String = senderName else {
// Changed by this device or via synced transcript
guard isEnabled, durationSeconds > 0 else {
return "YOU_DISAPPEARING_MESSAGES_INFO_DISABLE_LEGACY".localized()
}
guard isPreviousOff == true else {
return String(
format: "YOU_DISAPPEARING_MESSAGES_INFO_UPDATE_LEGACY".localized(),
floor(durationSeconds).formatted(format: .long),
(type == .disappearAfterRead ? "DISAPPEARING_MESSAGE_STATE_READ".localized() : "DISAPPEARING_MESSAGE_STATE_SENT".localized())
)
}
return String(
format: "YOU_DISAPPEARING_MESSAGES_INFO_ENABLE_LEGACY".localized(),
floor(durationSeconds).formatted(format: .long),
(type == .disappearAfterRead ? "DISAPPEARING_MESSAGE_STATE_READ".localized() : "DISAPPEARING_MESSAGE_STATE_SENT".localized())
)
}
guard isEnabled, durationSeconds > 0 else {
return String(format: "DISAPPERING_MESSAGES_INFO_DISABLE_LEGACY".localized(), senderName)
}
guard isPreviousOff == true else {
return String(
format: "DISAPPERING_MESSAGES_INFO_UPDATE_LEGACY".localized(),
senderName,
floor(durationSeconds).formatted(format: .long),
(type == .disappearAfterRead ? "DISAPPEARING_MESSAGE_STATE_READ".localized() : "DISAPPEARING_MESSAGE_STATE_SENT".localized())
)
}
return String(
format: "DISAPPERING_MESSAGES_INFO_ENABLE_LEGACY".localized(),
senderName,
floor(durationSeconds).formatted(format: .long),
(type == .disappearAfterRead ? "DISAPPEARING_MESSAGE_STATE_READ".localized() : "DISAPPEARING_MESSAGE_STATE_SENT".localized())
)
}
private var legacyPreviewText: String {
guard let senderName: String = senderName else {
// Changed by this device or via synced transcript
@ -235,16 +188,14 @@ public extension DisappearingMessagesConfiguration {
func messageInfoString(
threadVariant: SessionThread.Variant?,
senderName: String?,
isPreviousOff: Bool
senderName: String?
) -> String? {
let messageInfo: MessageInfo = DisappearingMessagesConfiguration.MessageInfo(
threadVariant: threadVariant,
senderName: senderName,
isEnabled: isEnabled,
durationSeconds: durationSeconds,
type: type,
isPreviousOff: isPreviousOff
type: type
)
guard let messageInfoData: Data = try? JSONEncoder().encode(messageInfo) else { return nil }
@ -253,11 +204,9 @@ public extension DisappearingMessagesConfiguration {
}
func isValidV2Config() -> Bool {
if let type = self.type {
return !(self.durationSeconds > 0 && self.type == .unknown)
} else {
return self.durationSeconds == 0
}
guard self.type != nil else { return (self.durationSeconds == 0) }
return !(self.durationSeconds > 0 && self.type == .unknown)
}
}
@ -271,8 +220,7 @@ public extension DisappearingMessagesConfiguration {
authorId: String,
timestampMs: Int64,
serverHash: String?,
updatedConfiguration: DisappearingMessagesConfiguration,
isPreviousOff: Bool
updatedConfiguration: DisappearingMessagesConfiguration
) throws -> Int64? {
if Features.useNewDisappearingMessagesConfig {
switch threadVariant {
@ -315,8 +263,7 @@ public extension DisappearingMessagesConfiguration {
variant: .infoDisappearingMessagesUpdate,
body: updatedConfiguration.messageInfoString(
threadVariant: threadVariant,
senderName: (authorId != getUserHexEncodedPublicKey(db) ? Profile.displayName(db, id: authorId) : nil),
isPreviousOff: isPreviousOff
senderName: (authorId != getUserHexEncodedPublicKey(db) ? Profile.displayName(db, id: authorId) : nil)
),
timestampMs: timestampMs,
expiresInSeconds: (threadVariant == .legacyGroup ? nil : updatedConfiguration.durationSeconds), // Do not expire this control message in legacy groups

@ -118,8 +118,7 @@ extension MessageReceiver {
variant: .infoDisappearingMessagesUpdate,
body: updatedConfig.messageInfoString(
threadVariant: threadVariant,
senderName: (sender != currentUserPublicKey ? Profile.displayName(db, id: sender) : nil),
isPreviousOff: false
senderName: (sender != currentUserPublicKey ? Profile.displayName(db, id: sender) : nil)
),
timestampMs: timestampMs,
wasRead: SessionUtil.timestampAlreadyRead(
@ -234,8 +233,7 @@ extension MessageReceiver {
authorId: sender,
timestampMs: Int64(timestampMs),
serverHash: message.serverHash,
updatedConfiguration: updatedConfig,
isPreviousOff: !localConfig.isEnabled
updatedConfiguration: updatedConfig
)
default:
return

Loading…
Cancel
Save