Is your feature request related to a problem? Please describe.
If I click on a deck link the browser pops up
Describe the solution you'd like
Open it directly in the deck app
It's working for the android file app and it's super convenient:
https://github.com/nextcloud/android/pull/5345
SyncManager#readAccountsForHostWithReadAccessToBoard @desperateCoder IntentFilter in AndroidManifest](https://github.com/stefan-niedermann/nextcloud-deck/issues/498#issuecomment-631775782)Activity to pick the correct Account to use](https://github.com/stefan-niedermann/nextcloud-deck/issues/498#issuecomment-631615680)If i understood you correct, the link must propose to open links beginning with the protocol nc:// followed by directlink/ plus for example deck/5/list/4/card3. So for example a link that gets opened by deck is:
nc://directlink/deck/5/list/4/card/3
This is possible, but who uses this kind of link? The greates user experience would be to detect a link with the part [...]/index.php/apps/deck/[...] and try to parse it. Unfortunately i don't know a way to achieve this because in our scenario the hostname is variable and we do not have a custom protocol.
Therefore your proposed solution would work but, well, where are such links used?
I don't know how to solve it, but I think if User A sends a board or card link to User B via Chat or Mail and User B opens the link on mobile it would be nice if the deck app opens an not the browser.
🤷♂️ Maybe one can create intent-filters dynamically at runtime (when we know the hosts).
Any help, hints and PRs appreciated.
If i understood you correct, the link must propose to open links beginning with the protocol
nc://followed bydirectlink/plus for exampledeck/5/list/4/card3. So for example a link that gets opened by deck is:
nc://directlink/deck/5/list/4/card/3This is possible, but who uses this kind of link? The greates user experience would be to detect a link with the part
[...]/index.php/apps/deck/[...]and try to parse it. Unfortunately i don't know a way to achieve this because in our scenario thehostnameis variable and we do not have a custom protocol.Therefore your proposed solution would work but, well, where are such links used?
Actuallyc this is exactly the same what the android app does:
look here: https://github.com/nextcloud/android/pull/5345/files#diff-84fb62e1c8a8f1b095012858ba4dc95dR124-R131
For your app this should work (didn't test):
<data android:scheme="http"
android:scheme="https"
android:host="*"
android:pathPattern=".*/index.php/apps/deck/.*"
/>
to make it work also if pretty urls are enabled, this is proably better:
<data android:scheme="http"
android:scheme="https"
android:host="*"
android:pathPattern=".*/apps/deck/.*"
/>
interesting. Will this not open a app chooser everytime one clicks any link?
interesting. Will this not open a app chooser everytime one clicks _any_ link?
No, because it will only open the app chooser if the pattern matches, which is the pattern that you told him to look for: in this case the link must be a http or https link and contain /index.php/apps/deck/ or /apps/deck/
Aah, i got it. Will have a look at it, thanks for the hint!
btw: links from the deck app seems to contain always the following: /apps/deck/#/
So you could probably expand the pattern that I've suggested from ".*/apps/deck/.*" to ".*/apps/deck/#/.*"
But you should make sure that all links contain that pattern yourself.
Actually, to make it also in multiuser-environments right, the following is maybe helpful:
https://github.com/nextcloud/android/pull/5345#issuecomment-582066821
Although I have to say, that point 4 and 5 were differently implemented: the app always presents an account chooser, if more than one account matching the domain was found.
And point 3 wasn't completely implemented: it doesn't open the browser if no username was found matching the domain. There was a discussion about it, but it was decided to not implement it in this PR:
https://github.com/nextcloud/android/pull/5345#discussion_r383392981
Instead of opening the link in the browser, you could also decide to ask the user, if they want to create an account...
The sync step is necessary in order to make sure that the board hasn't shared recently with the user.
I would handle it similar to receiving push notifications: We open an activity with a button "Open in browser" and a disabled button "Open in app" which gets only enabled as soon as we are sure we have a user with access permission.
- If no user matches the account, _open link in browser_
You could also offer the user to log into an existing account that matches the url...
Yeaaaaaaaaah.... let's start with small steps and enhance it later :laughing:
There are some issues, because we use only Single-Sign-On and it's not that easy because first we would have to fix https://github.com/nextcloud/Android-SingleSignOn/issues/106 (or need to be able to pass a host to the "Add Account" activity of the files app)
actually this wouldn't work:
<data android:scheme="http"
android:scheme="https"
android:host="*"
android:pathPattern=".*/apps/deck/.*"
/>
What will work though is:
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="*" />
<data android:pathPattern="/.*apps/deck/..*" />
I think I'm done here, but I couln't test it yet (no UI). If it dies, just tell, gonna be fixed.
Okay, i think i have a proof of concept in PR #563
Though there are some issues left (see linked PR), help would be appreciated.
Most helpful comment
Yeaaaaaaaaah.... let's start with small steps and enhance it later :laughing:
There are some issues, because we use only Single-Sign-On and it's not that easy because first we would have to fix https://github.com/nextcloud/Android-SingleSignOn/issues/106 (or need to be able to pass a host to the "Add Account" activity of the files app)