tasomaniac / OpenLinkWith

Open the current webpage you have in another app. Magic! 🔮
https://play.google.com/store/apps/details?id=com.tasomaniac.openwith
Apache License 2.0
391 stars 33 forks source link

Support for custom URI schemes. #95

Open pressRtowin opened 1 year ago

pressRtowin commented 1 year ago

I have some apps that I have multiple instances of installed. They use magic links with custom URI schemes to log in, but I have no way to control which copy of the app gets opened when I load the link from my browser. It doesn't appear that OpenLinkWith supports these links, as when I select the link and share to OpenLinkWith, the intended target apps aren't given as choices, but browsers are.

1fexd commented 1 year ago

Could you provide such a magic link?

pressRtowin commented 1 year ago

Could you provide such a magic link?

Not really, as they are used for authentication. That being said:

  1. Magic links are fairly well documented online
  2. The fact that they are magic links is, as far as I can tell, entirely irrelevant here as that's just the function of the link, and magic links can be implemented as standard web addresses as well. The issue at hand is that there is no support for custom URI schemes to be directed towards a specific application if multiple apps exist which can handle them. That detail was only included as an example of why it's important to have the ability to direct such links to the preferred application.
1fexd commented 1 year ago

I have pushed this as a test to https://github.com/1fexd/OpenLinkWith/tree/feature/custom-uri-schemes, can you build it yourself to test it or should I provide you with an APK?

pressRtowin commented 1 year ago

I have no way to build it at the moment, but I can test it out if you're able to provide an apk

1fexd commented 1 year ago

uploaded here https://transfer.sh/K8MNKp/app-floss-release.apk

pressRtowin commented 1 year ago

Well I've run into one problem already. Despite the applications being set to not open links, tapping on the custom URI link immediately opens the app without any prompt.

What I can do is copy and paste the custom URI link, then share it and open it using Open Link With that way, however doing so only returns a list of the available browser apps on my device, and when selecting any of them, you can see that Open Link With has taken customscheme://whatever/goes/here and replaced it with https://customscheme//whatever/goes/here, which is the same behavior as before.

It's worth noting that https://github.com/TrianguloY/UrlChecker, which among other things also includes similar functionality to Open Link With, is able to correctly parse the custom URI scheme and pass it on to the appropriate app. The only problem is that it's unable to correctly open an app installed under the Dual Messenger profile (User 95) and will instead open the copy of the app installed on the main user (User 0) even when attempting to open from a copy of URL Checker which is itself installed on User 95. This is a common symptom of Dual Messenger apps for some reason. Unlike work profile and Secure Folder apps (Users 10 and 150), which behave as fully independent profiles, the Dual Messenger profile is deeply integrated with the main user, which causes some (but not all) apps to have trouble distinguishing them.

See this for a deep dive on how various activity launching apps handle launching activities on various profiles. Not sure if it'd help here, but it illustrates my point about Samsung's Dual Messenger feature being very . . . odd.

1fexd commented 1 year ago

Wow, I did not know about that app. Maybe it would be easier to contribute to that app by implementing a fancy "share-sheet" (the thingy OpenLinkWith has right now) instead of fixing this app.

pressRtowin commented 1 year ago

Wow, I did not know about that app. Maybe it would be easier to contribute to that app by implementing a fancy "share-sheet" (the thingy OpenLinkWith has right now) instead of fixing this app.

Tbh, I'd love if URL Checker had a share sheet rather than a drop down menu. It is able to redirect links to open in multiple other apps, but for the custom URI, it simply doesn't see that there's any other option other than the app installed on User 0 for both URL Checker on User 0 and User 95. I also find OpenLinkWith's behavior of showing the package name if multiple apps of the same name are installed to be invaluable, something that URL Checker doesn't have.

1fexd commented 1 year ago

Tbh, I'd love if URL Checker had a share sheet rather than a drop down menu.

I have opened an issue about this topic.

Ilithy commented 1 year ago

I also find OpenLinkWith's behavior of showing the package name if multiple apps of the same name are installed to be invaluable

This is very interesting and relevant, and I think deserves to be sent to the developer of URLCheck to be added as an option for displaying apps in the "famous" drop-down menu (Open and Share module)

pressRtowin commented 1 year ago

Actually, I think I've discovered the root issue here.

So I have 4 copies of both OpenLinkWith and URL Checker installed (in Main, Dual, Work, and Secure Folder profiles), and while the copies of both programs in the Main, Work, and Secure Folder profiles correctly display the applications installed in their respective profiles, the copy of OpenLinkWith and URL Checker installed on the Dual Messenger profile both show User 0's applications, not User 95's.

pressRtowin commented 1 year ago

@1fexd I'm not sure if this is due to the changes in 2.10 (since there is still no apk available here for it) or if it's something you changed in trying to get custom URI schemes to work, but I wanted to let you know that the version you sent me has also completely removed OpenLinkWith from the "Open with" dialog. It only appears in the "Share" dialog now. It's also not able to be set as a browser anymore (the in-app toggle still exists but the application does not get listed with other browsers when choosing a default one in the OS settings.