2024-05-05 13:12:19 +02:00
|
|
|
import AppIntents
|
2024-05-06 08:38:37 +02:00
|
|
|
import WidgetKit
|
2024-05-05 13:12:19 +02:00
|
|
|
|
2024-05-05 19:31:28 +02:00
|
|
|
struct LatestPostsWidgetConfiguration: WidgetConfigurationIntent {
|
2024-06-26 11:05:35 +02:00
|
|
|
static let title: LocalizedStringResource = "Timeline Widget Configuration"
|
2024-05-05 13:12:19 +02:00
|
|
|
static let description = IntentDescription("Choose the account and timeline for this widget")
|
2024-05-06 08:38:37 +02:00
|
|
|
|
2024-05-05 13:12:19 +02:00
|
|
|
@Parameter(title: "Account")
|
2024-05-05 19:41:04 +02:00
|
|
|
var account: AppAccountEntity
|
2024-05-06 08:38:37 +02:00
|
|
|
|
2024-05-05 13:12:19 +02:00
|
|
|
@Parameter(title: "Timeline")
|
2024-05-05 19:41:04 +02:00
|
|
|
var timeline: TimelineFilterEntity
|
2024-05-05 13:12:19 +02:00
|
|
|
}
|
|
|
|
|
2024-05-05 19:31:28 +02:00
|
|
|
extension LatestPostsWidgetConfiguration {
|
|
|
|
static var previewAccount: LatestPostsWidgetConfiguration {
|
|
|
|
let intent = LatestPostsWidgetConfiguration()
|
2024-05-05 13:12:19 +02:00
|
|
|
intent.account = .init(account: .init(server: "Test", accountName: "Test account"))
|
|
|
|
intent.timeline = .init(timeline: .home)
|
|
|
|
return intent
|
|
|
|
}
|
|
|
|
}
|