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 */; }; FDC438C927BB706500C60D73 /* SendDirectMessageRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDC438C827BB706500C60D73 /* SendDirectMessageRequest.swift */; };
FDC438CB27BB7DB100C60D73 /* UpdateMessageRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDC438CA27BB7DB100C60D73 /* UpdateMessageRequest.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 */; }; 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 */; }; FDC498B72AC15F7D00EDD897 /* AppNotificationCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDC498B62AC15F7D00EDD897 /* AppNotificationCategory.swift */; };
FDC498B92AC15FE300EDD897 /* AppNotificationAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDC498B82AC15FE300EDD897 /* AppNotificationAction.swift */; }; FDC498B92AC15FE300EDD897 /* AppNotificationAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDC498B82AC15FE300EDD897 /* AppNotificationAction.swift */; };
FDC498BB2AC1606C00EDD897 /* AppNotificationUserInfoKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDC498BA2AC1606C00EDD897 /* AppNotificationUserInfoKey.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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 7B71A98E2925E2A600E54854 /* SessionFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionFooterView.swift; sourceTree = "<group>"; };
@ -3944,7 +3942,6 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
FD3C907027E445E500CD579F /* MessageReceiverDecryptionSpec.swift */, FD3C907027E445E500CD579F /* MessageReceiverDecryptionSpec.swift */,
7B6ACADD2A32D3A9009AFB73 /* MessageReceiverSpec.swift */,
FD3C906C27E43C4B00CD579F /* MessageSenderEncryptionSpec.swift */, FD3C906C27E43C4B00CD579F /* MessageSenderEncryptionSpec.swift */,
); );
path = "Sending & Receiving"; path = "Sending & Receiving";
@ -6485,7 +6482,6 @@
FDC2908B27D707F3005DAE71 /* SendMessageRequestSpec.swift in Sources */, FDC2908B27D707F3005DAE71 /* SendMessageRequestSpec.swift in Sources */,
FDC290A827D9B46D005DAE71 /* NimbleExtensions.swift in Sources */, FDC290A827D9B46D005DAE71 /* NimbleExtensions.swift in Sources */,
FD7692F72A53A2ED000E4B70 /* SessionThreadViewModelSpec.swift in Sources */, FD7692F72A53A2ED000E4B70 /* SessionThreadViewModelSpec.swift in Sources */,
FDC439632AC2492700A56963 /* MessageReceiverSpec.swift in Sources */,
FD0969F92A69FFE700C5C365 /* Mocked.swift in Sources */, FD0969F92A69FFE700C5C365 /* Mocked.swift in Sources */,
FDC2908F27D70938005DAE71 /* SendDirectMessageRequestSpec.swift in Sources */, FDC2908F27D70938005DAE71 /* SendDirectMessageRequestSpec.swift in Sources */,
FDC438BD27BB2AB400C60D73 /* Mockable.swift in Sources */, FDC438BD27BB2AB400C60D73 /* Mockable.swift in Sources */,

@ -198,7 +198,7 @@ final class InfoMessageCell: MessageCell {
guard let cellViewModel: MessageViewModel = self.viewModel else { return } guard let cellViewModel: MessageViewModel = self.viewModel else { return }
if cellViewModel.variant == .infoDisappearingMessagesUpdate && cellViewModel.canDoFollowingSetting() { 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, authorId: userPublicKey,
timestampMs: currentTimestampMs, timestampMs: currentTimestampMs,
serverHash: nil, serverHash: nil,
updatedConfiguration: updatedConfig, updatedConfiguration: updatedConfig
isPreviousOff: !self.config.isEnabled
) )
let duration: UInt32? = { let duration: UInt32? = {

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

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

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

Loading…
Cancel
Save