nextcloud-deck icon indicating copy to clipboard operation
nextcloud-deck copied to clipboard

open link to a deck board/card directly in the deck app

Open jakobroehrl opened this issue 4 years ago • 17 comments

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

ToDo

jakobroehrl avatar May 14 '20 20:05 jakobroehrl

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?

stefan-niedermann avatar May 14 '20 21:05 stefan-niedermann

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.

jakobroehrl avatar May 16 '20 18:05 jakobroehrl

🤷‍♂️ Maybe one can create intent-filters dynamically at runtime (when we know the hosts).

Any help, hints and PRs appreciated.

stefan-niedermann avatar May 16 '20 18:05 stefan-niedermann

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?

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/.*"
                    />

szaimen avatar May 20 '20 16:05 szaimen

interesting. Will this not open a app chooser everytime one clicks any link?

stefan-niedermann avatar May 20 '20 16:05 stefan-niedermann

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/

szaimen avatar May 20 '20 16:05 szaimen

Aah, i got it. Will have a look at it, thanks for the hint!

stefan-niedermann avatar May 20 '20 16:05 stefan-niedermann

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.

szaimen avatar May 20 '20 16:05 szaimen

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

szaimen avatar May 20 '20 17:05 szaimen

  • If no user matches the account, open link in browser
  • Else: Synchronize all boards of the given user lists from this host
    • If no user has permission to access to this board / card, open link in browser
    • Else if only one user has access to this board / card, open it in the app
    • Else if multiple users have access to this board / card, display an account chooser from which view this board / card should be opened

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.

stefan-niedermann avatar May 20 '20 17:05 stefan-niedermann

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

szaimen avatar May 20 '20 18:05 szaimen

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)

stefan-niedermann avatar May 20 '20 18:05 stefan-niedermann

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/..*" />

szaimen avatar May 20 '20 22:05 szaimen

I think I'm done here, but I couln't test it yet (no UI). If it dies, just tell, gonna be fixed.

desperateCoder avatar Jun 27 '20 21:06 desperateCoder

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.

stefan-niedermann avatar Jun 28 '20 15:06 stefan-niedermann

Wait, so, is this supposed to be working or not? If i get a notification with nextcloud services with a link to the relevant card, should that link be opening the deck app? because right now its just opening firefox.

I've been really struggling with lack of notifications for deck and this would solve my issue.

mstyp avatar Aug 03 '22 13:08 mstyp

Since this is still an open Pull Request, this has not been merged yet and is therefore not supposed to work.

stefan-niedermann avatar Aug 03 '22 15:08 stefan-niedermann