2024-05-02 09:37:38 +00:00
|
|
|
import AppIntents
|
2024-05-04 11:19:19 +00:00
|
|
|
import Foundation
|
2024-05-02 09:37:38 +00:00
|
|
|
|
2024-05-04 09:34:51 +00:00
|
|
|
struct PostImageIntent: AppIntent {
|
2024-05-02 09:37:38 +00:00
|
|
|
static let title: LocalizedStringResource = "Post an image to Mastodon"
|
2024-10-28 09:57:48 +00:00
|
|
|
static let description: IntentDescription =
|
|
|
|
"Use Ice Cubes to compose a post with an image to Mastodon"
|
2024-05-02 09:37:38 +00:00
|
|
|
static let openAppWhenRun: Bool = true
|
2024-05-04 11:19:19 +00:00
|
|
|
|
2024-10-28 09:57:48 +00:00
|
|
|
@Parameter(
|
|
|
|
title: "Image",
|
|
|
|
description: "Image to post on Mastodon",
|
|
|
|
supportedTypeIdentifiers: ["public.image"],
|
|
|
|
inputConnectionBehavior: .connectToPreviousIntentResult)
|
2024-05-02 09:37:38 +00:00
|
|
|
var images: [IntentFile]?
|
2024-05-04 11:19:19 +00:00
|
|
|
|
2024-05-02 09:37:38 +00:00
|
|
|
func perform() async throws -> some IntentResult {
|
|
|
|
AppIntentService.shared.handledIntent = .init(intent: self)
|
|
|
|
return .result()
|
|
|
|
}
|
|
|
|
}
|