home-assistant / my.home-assistant.io

The portal to your home.
https://my.home-assistant.io/
34 stars 19 forks source link

Try opening redirect link automatically on native app #434

Open Diegorro98 opened 7 months ago

Diegorro98 commented 7 months ago

Currently there is no way to open redirect links at the Home Assistant app at Windows because WSA doesn't register the app web link (and even if it did, web browsers at Windows doesn't open links on apps unless they are PWAs...).

This modifications will try to open the redirect link directly on the app (except if mobile is set to 1) and is completely invisible for users that doesn't have the app installed.

bramkragten commented 3 months ago

I don't agree with your statement that this change will be invisible for non app users, Safari will for instance show this message now to users:

CleanShot 2024-06-21 at 12 28 35

If we want to do this, we will first have to check if the url scheme is registered.

Another option could be to add a new button that will (try to) open the link in the app.

Diegorro98 commented 3 months ago

@bramkragten Thanks for your feedback! As I don't have any Apple device I could not test it, and this is a big issue. I made some research about how to avoid that pop up, but unfortunately, none of the things I've tried have worked but I know this can be done; i.e. WhatsApp deeplink, when you use https://wa.me/<telephone_number>, it tries to open the app, or at least at Windows (you can see the failed attempt at the console log), but in safari the pop up doesn't appear if WhatsApp is not installed.

About using creating a new button, before creating this commit, I made another commit in another branch with this idea and also with the code from this pr, but I don't remember why I didn't continue that way. Maybe I wanted to avoid modifying the UI. I'm going to separate the code and make another PR, because both ideas can coexists in fact so we can also try to fix the issue at this PR.