Files
Morgan Pretty 6bcd3f43a6 Refactoring to move pro state management to VMs instead of views
• Refactored the MessageViewModel to be a dumb data types instead of a monolithic query
• Refactored the ConversationViewModel due to handle the updated MessageViewModel
• Refactored OWSAudioPlayer into Swift
• Refactored the OpenGroupManager and OpenGroupManagerCache to be a single actor (CommunityManager), it also holds community state in memory
• Removed a bunch of GRDB-specific relationship code (just makes things messy since we have raw SQL elsewhere)
• Fixed a bug where the ObservationBuilder could incorrectly run queries in cancelled contexts resulting in potential buggy outputs
• Fixed a bug where outgoing voice messages might not be able to be played
2025-11-13 14:26:38 +11:00

62 lines
1.7 KiB
Swift

// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
import Foundation
import GRDB
import SessionUtilitiesKit
public struct Quote: Sendable, Codable, Equatable, Hashable, FetchableRecord, PersistableRecord, TableRecord, ColumnExpressible {
public static var databaseTableName: String { "quote" }
public typealias Columns = CodingKeys
public enum CodingKeys: String, CodingKey, ColumnExpression {
case interactionId
case authorId
case timestampMs
}
/// The id for the interaction this Quote belongs to
public let interactionId: Int64
/// The id for the author this Quote belongs to
public let authorId: String
/// The timestamp in milliseconds since epoch when the quoted interaction was sent
public let timestampMs: Int64
// MARK: - Interaction
public init(
interactionId: Int64,
authorId: String,
timestampMs: Int64
) {
self.interactionId = interactionId
self.authorId = authorId
self.timestampMs = timestampMs
}
}
// MARK: - Mutation
public extension Quote {
func with(
interactionId: Int64? = nil,
authorId: String? = nil,
timestampMs: Int64? = nil
) -> Quote {
return Quote(
interactionId: interactionId ?? self.interactionId,
authorId: authorId ?? self.authorId,
timestampMs: timestampMs ?? self.timestampMs
)
}
func withOriginalMessageDeleted() -> Quote {
return Quote(
interactionId: self.interactionId,
authorId: self.authorId,
timestampMs: self.timestampMs
)
}
}