2024-05-05 11:12:19 +00:00
|
|
|
import AppAccount
|
2024-05-06 06:38:37 +00:00
|
|
|
import AppIntents
|
2024-05-05 11:12:19 +00:00
|
|
|
import Env
|
|
|
|
import Foundation
|
|
|
|
import Models
|
|
|
|
import Network
|
|
|
|
import Timeline
|
|
|
|
|
|
|
|
public struct TimelineFilterEntity: Identifiable, AppEntity {
|
|
|
|
public var id: String { timeline.id }
|
|
|
|
|
|
|
|
public let timeline: TimelineFilter
|
|
|
|
|
|
|
|
public static let defaultQuery = DefaultTimelineEntityQuery()
|
|
|
|
|
|
|
|
public static let typeDisplayRepresentation: TypeDisplayRepresentation = "TimelineFilter"
|
|
|
|
|
|
|
|
public var displayRepresentation: DisplayRepresentation {
|
|
|
|
DisplayRepresentation(title: "\(timeline.title)")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public struct DefaultTimelineEntityQuery: EntityQuery {
|
2024-05-06 06:38:37 +00:00
|
|
|
public init() {}
|
|
|
|
|
|
|
|
public func entities(for _: [TimelineFilter.ID]) async throws -> [TimelineFilterEntity] {
|
|
|
|
[.home, .trending, .federated, .local].map { .init(timeline: $0) }
|
2024-05-05 11:12:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public func suggestedEntities() async throws -> [TimelineFilterEntity] {
|
2024-05-06 06:38:37 +00:00
|
|
|
[.home, .trending, .federated, .local].map { .init(timeline: $0) }
|
2024-05-05 11:12:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public func defaultResult() async -> TimelineFilterEntity? {
|
|
|
|
.init(timeline: .home)
|
|
|
|
}
|
|
|
|
}
|