Skip to content

Try opening redirect link automatically on native app #434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Diegorro98
Copy link

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
Copy link
Member

bramkragten commented Jun 21, 2024

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
Copy link
Author

@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.

@Diegorro98 Diegorro98 changed the title Try opening redirect link on native app Try opening redirect link automatically on native app Jun 22, 2024
@Diegorro98
Copy link
Author

Diegorro98 commented Mar 15, 2025

I'm coming back to this concept, because the addition of a button maybe is too traumatic. So I added a condition where the redirect link is opened automatically only if the user agent is Windows, that way we avoid the Safari issue and other potential issues with other OS.
Also, at Windows, at Chromium explorers at least, the attempt of opening the app is invisible.

@@ -56,6 +62,12 @@ const render = (showTroubleshooting: boolean) => {
return;
}

if (!isMobile && navigator.userAgent.includes("Windows")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do like this idea, but agree with Bram that the user should never aware of this.

Just allowing it for Windows is ok. But prefer if we could also allow it for Chromium browsers on Mac, but that can be in a subsequent PR.

I will ask a Windows users to verify the behavior and then this can be merged. Definitely better than another button.

@balloob balloob closed this May 5, 2025
@balloob balloob reopened this May 5, 2025
@balloob
Copy link
Member

balloob commented May 5, 2025

Triggering CI to get a preview build

@balloob
Copy link
Member

balloob commented May 5, 2025

@balloob
Copy link
Member

balloob commented May 5, 2025

This is giving an error on Firefox and so that should be filtered out. Instead of filtering by Operating System, we have to find the browsers that work.

@Diegorro98
Copy link
Author

Diegorro98 commented May 5, 2025

You mean this one?
image
I'm not able to get any error from the deploy links

EDIT: Nevermind, it was because Google redirect was using an empty domain.
But I still not able to reproduce any error on Firefox (version 138.0.1 (64-bit))

@Diegorro98
Copy link
Author

I checked it with Jorg, and it seems like it is a edge case issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants