mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Removed the logic for 'oversizedText' (not sent by either iOS or Android and not handled at all by desktop) Updated the HomeViewModel (and ConversationCell) to use the same query model as Global Search Added an 'albumIndex' property to the InteractionAttachment so we can enforce a correct order (apparently SQLite doesn't do this by default) Updated the YDB to GRDB migration to avoid creating GroupMembers if the current user isn't a member of a ClosedGroup (be consistent with the running logic) Updated the attachment description logic to be consistent throughout Cleaned up the Interaction preview generation logic
33 lines
1.3 KiB
Swift
33 lines
1.3 KiB
Swift
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
|
|
|
import Foundation
|
|
import GRDB
|
|
import DifferenceKit
|
|
import SignalUtilitiesKit
|
|
|
|
public class MessageRequestsViewModel {
|
|
/// This value is the current state of the view
|
|
public private(set) var viewData: [ConversationCell.ViewModel] = []
|
|
|
|
/// This is all the data the screen needs to populate itself, please see the following link for tips to help optimise
|
|
/// performance https://github.com/groue/GRDB.swift#valueobservation-performance
|
|
///
|
|
/// **Note:** The 'trackingConstantRegion' is optimised in such a way that the request needs to be static
|
|
/// otherwise there may be situations where it doesn't get updates, this means we can't have conditional queries
|
|
public lazy var observableViewData = ValueObservation
|
|
.trackingConstantRegion { db -> [ConversationCell.ViewModel] in
|
|
let userPublicKey: String = getUserHexEncodedPublicKey(db)
|
|
|
|
return try ConversationCell.ViewModel
|
|
.messageRequestsQuery(userPublicKey: userPublicKey)
|
|
.fetchAll(db)
|
|
}
|
|
.removeDuplicates()
|
|
|
|
// MARK: - Functions
|
|
|
|
public func updateData(_ updatedData: [ConversationCell.ViewModel]) {
|
|
self.viewData = updatedData
|
|
}
|
|
}
|