←back to thread

225 points awaseem | 2 comments | | HN request time: 0.521s | source

Hi HN!

Super proud to showcase Foqos! I wanted to create a way to physically block apps on my phone, always had a bunch of NFC tags, combined the 2 together over the holiday break and Foqos was born. You can create profiles, write them to NFC tags and track your weekly focus.

Its completely open source and will always be free! There is an affiliate link in the app for nfc tags and donations are completely optional

Link here: https://apps.apple.com/ca/app/foqos/id6736793117

Show context
nozzlegear ◴[] No.42783134[source]
Neat! Any idea if it'd be possible to make this work with macOS as well? I don't think Macs have NFC, but they do sync things like Do Not Disturb states between iOS and macOS.
replies(1): >>42783184 #
awaseem ◴[] No.42783184[source]
I can look into it, I tried to find a way to trigger Focus modes on iOS a profile being active and it seems they only allow you to read the state and no write or update it
replies(1): >>42783265 #
filoleg ◴[] No.42783265[source]
I might be misreading what you are asking, but I just went into Shortcuts app and tried creating a new one, and there are both “Get Current Focus” and “Set Focus” actions.

Is this what you were looking for? “Set Focus” allows setting any focus mode (including custom ones, you can see one in my screenshot) on/off. And if you choose “on”, there is an additional conditional afterwards (until manually turned off/until time/until leaving location/until a calendar event ends).

Here is a screenshot of how it looks (https://ibb.co/R6gdRq4).

replies(1): >>42784017 #
awaseem ◴[] No.42784017[source]
Yeah I can't find a clear way to do this from Swift and APIs apple exposes. I can be very wrong though and just didn't dig hard enough
replies(1): >>42784190 #
1. filoleg ◴[] No.42784190[source]
Ah, you were trying to do it through Swift/within an actual app, thanks for clarifying.

I think you are right, I couldn’t find a way to directly set status from within Swift, but there is a somewhat janky workaround I thought of. You should be able to have Shortcut hooks within your app (i.e., once the shortcut is triggered, it triggers an action within your app; or, inversed, have your app trigger a shortcut), and then have an official companion Shortcut for your users they can install with a single click. There might be other valid approaches, but they all seem to involve Shortcuts in some way.

However, it is definitely a suboptimal approach, compared to just doing it all within the app (which I couldnt find a way to do either).

replies(1): >>42785973 #
2. awaseem ◴[] No.42785973[source]
Maybe they'll add it in the next wwdc!