laurent22 / joplin

Joplin - the privacy-focused note taking app with sync capabilities for Windows, macOS, Linux, Android and iOS.
https://joplinapp.org
Other
46.37k stars 5.04k forks source link

Mobile (iOS/Android) implement external-links/x-callback-url #9204

Closed fatflyingpigs closed 1 month ago

fatflyingpigs commented 1 year ago

Making an issue for the mobile part of #5168. To my knowledge this has not yet been implemented on any mobile platform. It seems there are a number of other bug reports that mention this, without a successful fix. https://github.com/laurent22/joplin/issues?q=is%3Aissue+x-callback & https://discourse.joplinapp.org/search?q=x-callback

Implementing this feature allows for NFC tags to be used on mobile devices with Joplin.

Environment

Joplin version: Latest (iOS 12.12.3) Platforms: iOS 17.0.3 and iOS 15.7.1 (and Android from what I've read, but I haven't tested).

Steps to reproduce (iOS)

  1. In app, copy the markdown link for the note. eg: [My Test Note](:/1586e8e9da1e495eb08c7b4cdf1a6f50)
  2. Modify it to a proper external link and copy. eg: joplin://x-callback-url/openNote?id=1586e8e9da1e495eb08c7b4cdf1a6f50
  3. Switch to a different note
  4. [Optional] Close the app
  5. Paste the external link into safari or other browser
  6. Joplin launches, but not to the correct note

Describe what you expected to happen

Step 6 above should launch to the correct note. Extra: UI entry to copy the external link, similar to the markdown link in the app. Currently desktop app has this

Logfile

No relevant entries in the logfile

Relevant

https://reactnative.dev/docs/linking?syntax=ios

github-actions[bot] commented 1 year ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? If you require support or are requesting an enhancement or feature then please create a topic on the Joplin forum. This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

personalizedrefrigerator commented 1 year ago

Still an issue.

Note: This feature has also been requested on Discord and the Joplin Forum.

github-actions[bot] commented 11 months ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? If you require support or are requesting an enhancement or feature then please create a topic on the Joplin forum. This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

brandondasilva commented 5 months ago

It would be great if this was a feature on mobile. I use the external links all the time but not being able to open to a note directly on my Android phone and iPad slows me down a lot.

GonzRon commented 1 month ago

hi @laurent22 and @tiberiusteng I am the developer of NoteNFC, I just finished updating the app to make deep links to notes via NFC tags. Unfortunately, I ran into this issue, if joplin is running, scanning the NFC tag launches the joplin x-callback URL and opens the correct note. If joplin is not running, or is not in the background, the joplin app opens, but does not open the deep link to the correct joplin note. It seems like the callback URL in the intent is lost when the app is not running, but works if the app is running even in the background.

tiberiusteng commented 1 month ago

@GonzRon I've reproduced the issue, will create a new PR if I figure out how to fix it.

GonzRon commented 1 month ago

@GonzRon I've reproduced the issue, will create a new PR if I figure out how to fix it. @tiberiusteng -> I suspect (but could 100% be wrong), that it has to do with the Android lifecycle management of the process, here's another issue that seemingly could also stem from the same root cause:

https://github.com/laurent22/joplin/issues/11264 and https://github.com/laurent22/joplin/issues/11197

It does it without biometric lock too. When I switch the phone back on, the note is displayed for a short time then it disappear and this blank screen + header is displayed instead. It's just a massive [sic] issue though, since it's possible to go back to the note by pressing the back arrow and selecting the note again

/// The following is my pure speculation, so not verified or vetted, but maybe you are already starting to suspect similar issue?

it would appear that perhaps upon cold start, the app lifecycle management is maybe starting twice (or some such similar behavior)? The first "startup" the data is present, but the second time (or suspected reload), the data goes missing and therefore you end up with a missing x-callback-url as is the case for this issue. Or as is the case for the other issues, you simply just end up on a blank screen, as the inner react UI framework was unable to figure out where to go (data lost or not received). So there must be some interaction between the android wrapper (in terms of app lifecycle management and passing state data), and the inner react framework.

tiberiusteng commented 1 month ago

@GonzRon I think it's a different issue. React-Native have two different code path to handle incoming URLs when app is already open or causing app launch, and previously I only handled it when app is already open. I've created a PR handling app starting case (#11280).

GonzRon commented 1 month ago

@tiberiusteng I'm almost 100% you are correct and I was wrong! Similar symptoms but different root cause. You nailed it sir! TY!!!!

GonzRon commented 3 weeks ago

@tiberiusteng I can confirm 3.2.1 android issue is fixed :) 👍