Fix App Intents

This commit is contained in:
世界
2023-10-06 18:27:59 +08:00
parent 1e262e239a
commit 0eeab5023f
+3 -3
View File
@@ -104,7 +104,7 @@ struct ToggleServiceIntent: AppIntent {
Summary("Toggle sing-box service")
}
func perform() async throws -> some IntentResult {
func perform() async throws -> some IntentResult & ReturnsValue<Bool> {
guard let extensionProfile = try await (ExtensionProfile.load()) else {
return .result(value: false)
}
@@ -129,7 +129,7 @@ struct GetServiceStatus: AppIntent {
Summary("Get is sing-box service started")
}
func perform() async throws -> some IntentResult {
func perform() async throws -> some IntentResult & ReturnsValue<Bool> {
guard let extensionProfile = try await (ExtensionProfile.load()) else {
return .result(value: false)
}
@@ -147,7 +147,7 @@ struct GetCurrentProfile: AppIntent {
Summary("Get current sing-box profile")
}
func perform() async throws -> some IntentResult {
func perform() async throws -> some IntentResult & ReturnsValue<String> {
guard let profile = try await ProfileManager.get(SharedPreferences.selectedProfileID.get()) else {
throw NSError(domain: "No profile selected", code: 0)
}