Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
Fixes #174
  • Loading branch information
sindresorhus committed Oct 23, 2023
1 parent d985ee7 commit 1e2d06a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
2 changes: 2 additions & 0 deletions Actions.xcodeproj/project.pbxproj
Expand Up @@ -1091,6 +1091,7 @@
INFOPLIST_KEY_NSContactsUsageDescription = "Required to get the user's name in the “Get User Details” action.";
INFOPLIST_KEY_NSFaceIDUsageDescription = "Required to use the “Authenticate” action.";
INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © Sindre Sorhus";
INFOPLIST_KEY_NSLocalNetworkUsageDescription = "Required to use the “Is Host Reachable” and “Is Web Server Reachable” actions with devices on your local network.";
INFOPLIST_KEY_NSSpeechRecognitionUsageDescription = "Required to use the “Transcribe Audio” action.";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
Expand Down Expand Up @@ -1139,6 +1140,7 @@
INFOPLIST_KEY_NSContactsUsageDescription = "Required to get the user's name in the “Get User Details” action.";
INFOPLIST_KEY_NSFaceIDUsageDescription = "Required to use the “Authenticate” action.";
INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © Sindre Sorhus";
INFOPLIST_KEY_NSLocalNetworkUsageDescription = "Required to use the “Is Host Reachable” and “Is Web Server Reachable” actions with devices on your local network.";
INFOPLIST_KEY_NSSpeechRecognitionUsageDescription = "Required to use the “Transcribe Audio” action.";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
Expand Down
3 changes: 2 additions & 1 deletion Intents Extension/Actions/GetAverageColor.swift
Expand Up @@ -3,11 +3,12 @@ import AppIntents
struct GetAverageColorIntent: AppIntent {
static let title: LocalizedStringResource = "Get Average Color"

// FB13291593: https://github.com/feedback-assistant/reports/issues/429
static let description = IntentDescription(
"""
Returns the average color of the input colors.
IMPORTANT: Because of a bug in the Shortcuts app, you must first make the colors you want with the “Color” action, then pass the colors to the “List” action, and then pass the list to this action.
IMPORTANT: Because of a bug in the Shortcuts app, you must first make the colors you want with the “Color” action, then pass the colors to the “List” action, and then pass the list to this action. (If you work at Apple → FB13291593)
""",
categoryName: "Color",
searchKeywords: [
Expand Down
20 changes: 8 additions & 12 deletions Intents Extension/Actions/IsAudioPlaying.swift
@@ -1,6 +1,8 @@
import AppIntents
import AVFAudio

// https://github.com/feedback-assistant/reports/issues/438

@available(macOS, unavailable)
struct IsAudioPlaying: AppIntent, CustomIntentMigratedAppIntent {
static let intentClassName = "IsAudioPlayingIntent"
Expand All @@ -13,22 +15,16 @@ Returns whether there is audio currently playing on the device.
Important: The action simply returns the value that iOS provides, so if there are any false-positives, there is unfortunately no much we can do about it. I recommend trying to restart your device, which sometimes fixues such issues.
Known issues:
- It will return “false” if audio is playing through AirPlay. There is unfortunately no way to detect this.
- It returns true for a while after you end a call, even though no audio is playing.
Known issues
- It incorrectly returns “true” if the microphone is active.
- It incorrectly returns “true” if you have the “Accessibility › Sound Recognition” system setting enabled.
- It returns “false” if audio is playing through AirPlay. There is unfortunately no way to detect this.
- It returns “true” for a while after you end a call, even though no audio is playing.
""",
categoryName: "Device"
)

func perform() async throws -> some IntentResult & ReturnsValue<Bool> {
// Try to work around problems with this action. No idea if this actually works.
defer {
Task {
try? await Task.sleep(for: .seconds(0.1))
exit(0)
}
}

return .result(value: AVAudioSession.sharedInstance().isOtherAudioPlaying)
.result(value: AVAudioSession.sharedInstance().isOtherAudioPlaying)
}
}
2 changes: 2 additions & 0 deletions Shared/Actions/IsAccessibilityFeatureOn.swift
Expand Up @@ -10,6 +10,8 @@ struct IsAccessibilityFeatureOn: AppIntent {
"""
Returns whether a certain accessibility feature is enabled.
NOTE: The “Assistive Touch” check only works when “Guided Access” is enabled.
On macOS, only the following are available. The rest always return false.
- Reduce Motion
- Reduce Transparency
Expand Down

0 comments on commit 1e2d06a

Please sign in to comment.