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