Closed SebRut closed 2 days ago
@fgl27 I'll work on this branch so maybe we can discuss implementation details over here. For now I added basic deeplink parsing and marked my open points. I hope to find more consecutive time in the next days to work on this. I also added kotlin support as I'm more familiar with it, but if thats not ok, I can also switch to java only again quickly :)
Seems you are doing too much
my idea is to support https://twitch.tv and that is it
send the URL to the front end and let the JS code handle it, as little code as possible in the APK.
on the JS too as it will only parse the URL get what is and open wherever it was sent
I tried just adding support for twitch.tv links but according to https://developer.android.com/training/app-links/deep-linking it seems like this isn't possible because the app would have to be verified for the twitch.tv domain.
Note: Starting in Android 12 (API level 31), a generic web intent resolves to an activity in your app only if your app is approved for the specific domain contained in that web intent. If your app isn't approved for the domain, the web intent resolves to the user's default browser app instead.
The way to go would be to define a custom scheme like in this PR, although we could do most of the handling in JS. App code would only check if intent matches for example "smarttvtwitch://" and pass it to the web app. This would mean that you cant just open twitch.tv links but would have to explicitly make the decision to use the SmartTwitchTV app, which would be fine for the home-assistant integration use case mentioned in the original issue I guess.
What do you think of this approach?
Yes sure, for home assistant that is OK.
We can skip twitch.tv links handle and only do the home assistant.
Thank you for the search
are you sure we can't have something as simple? as...
add the handling of the URI to the existing code
Uri data = intent.getData();
a boolean to identify the action convert that to a string and send that to the JS code,
Do we need classes etc as you made?
I just don't see the point of all of that if we only care for one extra piece of information from the intent that can be converted to a variable.
@fgl27 I tried to add the simpler code variant, not really sure if the code for passing it to the webview is correct. You can test it using adb adb shell am start -W -a android.intent.action.VIEW -d smarttvtwitch://channel/CHANNEL
.
I had no time for this...
I'm working on some issues once I get all sorted out I'll get back at this.
if the PR doesn't merge for wherever reason due to my changes I just fix that myself.
I have merged and worked on this I have changed the URL format to support a single host allowing support of any 'Types' without having to publish a new APK
The final URL is:
smarttvtwitch://data/Type/Value
Types are anything that the JS code supports
Once is ready this code will do the JS support
This should allow the handling of deeplinks like (see #159)
smarttvtwitch://channel/CHANNEL
smarttvtwitch://livestream/CHANNEL
smarttvtwitch://video/VIDEO_ID