mirror of
https://github.com/lux-tel/session-ios.git
synced 2026-10-30 20:38:32 +00:00
• 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
35 lines
1.2 KiB
Swift
35 lines
1.2 KiB
Swift
// Copyright © 2025 Rangeproof Pty Ltd. All rights reserved.
|
|
|
|
import Foundation
|
|
import SessionUtilitiesKit
|
|
|
|
public extension LoadPageEvent {
|
|
func target<ID>(with current: PagedData.LoadResult<ID>) -> PagedData.Target<ID>? {
|
|
switch target {
|
|
case .initial: return .initial
|
|
case .initialPageAround(let erasedId):
|
|
guard let id: ID = erasedId as? ID else { return .initial }
|
|
|
|
return .initialPageAround(id: id)
|
|
|
|
case .nextPage(let lastIndex):
|
|
guard lastIndex == current.info.lastIndex else { return nil }
|
|
|
|
return .pageAfter
|
|
|
|
case .previousPage(let firstIndex):
|
|
guard firstIndex == current.info.firstPageOffset else { return nil }
|
|
|
|
return .pageBefore
|
|
|
|
case .jumpTo(let erasedId, let padding):
|
|
guard
|
|
let id: ID = erasedId as? ID,
|
|
!current.info.currentIds.contains(id)
|
|
else { return nil }
|
|
|
|
return .jumpTo(id: id, padding: padding)
|
|
}
|
|
}
|
|
}
|