sindresorhus / Actions

⚙️ Supercharge your shortcuts
https://sindresorhus.com/actions
MIT License
2.49k stars 103 forks source link

Action proposal: Get flashlight status #228

Closed Snipeye closed 4 months ago

Snipeye commented 4 months ago

Description

I control flashlight status with some shortcuts on the action button on my iPhone, but sometimes I want to use context to change the behavior of the button (if the flashlight is on, it should turn it off instead of doing other stuff). Variable tracking the state only works when I don’t use the lock screen or control center buttons for the flashlight - otherwise it gets out of sync.

If I could use a shortcut to get the status (on or off, what percent brightness) that would be incredibly helpful.

sindresorhus commented 4 months ago

Duplicate of #179

Snipeye commented 4 months ago

I scrolled through to find duplicates, sorry I missed that one.

I'm not an iOS developer, but this item from apple's documentation had me believing it would be possible:

https://developer.apple.com/documentation/avfoundation/avcapturedevice/1624605-torchlevel

There's also an "isTorchActive" item for a pure bool response.

Am I misunderstanding them?

sindresorhus commented 4 months ago

That only returns the torch level / status if the app itself enabled the torch. It will not get the system status of the torch.

Snipeye commented 4 months ago

Ah, understood. I'm... going to go file a bug report through apple's feedback on that. Doubtful it'll change anything, but that's just stupid.