Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: organice pwa as share target #795

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

tbruckmaier
Copy link
Contributor

Hi,

this WIP pull request aims to make organice show up as a share target on android, as described in #52

First of all, I cannot get any PWA to show up as share target on my phone, not even the sample PWAs like https://github.com/GoogleChrome/samples/blob/gh-pages/web-share/README.md#web-share-demo
That being said, I won't be able to finish this PR since I can neither use nor test it properly.
Maybe someelse wants to finish the PR though (there is not much left to do imo). Or maybe the new /capture page is useful on its own already.

Implemented so far:

  • a new route /capture is implemented, which lets the user select capture template & target file (capture template settings are used here, e.g. which capture template is available in which files). Either one or both parameters can also be passed as URL parameters, the form is then populated with these values
  • on submitting the form, the user is forwarded to the selected file & the capture process is triggered
  • any captureVariable_ url parameters are forwarded through the process, so you can open the initial page /caputre?captureVariable_foo=bar, select file & template interactively, and the capture variables are still used in the following capture process
  • "Share targets" on android receive three parameters: title, text, url: these will be mapped into the capture variables v_title, v_text, v_url (see below for the strange variable names)

TODOs

  • The url /capture should be used as the share target, with the captureVaraible_* parameters filled. I have added this already to the manifest, so it should work already. No idea why this does not work on my phone, but maybe someone else can test it.
  • probably the capture page can be styled a bit nicer

Some open questions / further ideas:

  • the replacement of capture variables seems odd to me (or maybe I was doing something wrong?): the single letter placeholders like %u or %t get replaced before any custom variables (like captureVariable_url / %url), so there can be no capture variables starting with certain letter (for example %title woiuld be replaced to [1970-01-01]itle). Is that behaviour intended? Or am I doing something wrong? I have prefixed the capture variables with v_ meanwhile
  • this PR makes organice show up as a single share target. It might also be possible to make certain capture templates show up as share targets on their own (mabye with a template setting). This should be a separate issue imo
  • when the user submits the form on the /capture route, the capture process is directly triggered and the captured content saved to the file. Under some circumstances it could be preferable to show the capture popup and let the user change the captured content interactively

- added new route /capture, which lets the user select a capture
  template & target file (both parameters can be passed in the url)
- upon submit, forward the user to the target file and trigger the
  capture process there
- updated manifest, so the new capture route shows up at a share target
  in android (untested)
@chasecaleb
Copy link
Contributor

I'm not a maintainer here, but I think this would be a great feature!

Unfortunately I have too many other things going on so I don't think I'll be able to contribute to this anytime soon, so hopefully someone else can. I could at least do some quick testing if/when this gets further along though.

@tbruckmaier
Copy link
Contributor Author

Hi @chasecaleb , I have deployed my branch on https://organice.24hoursparty.de/. Would you be open to install that page as PWA and see if sharing works for you? That would at least give us a hint if the missing share functionality is a issue with my phone or the code.

@munen
Copy link
Collaborator

munen commented May 26, 2022

Hi @tbruckmaier

First, thank you for coming up with such a fantastic PR!🙏🏻

Unfortunately, I’m not an Android user myself, but I did install your deployed version to my iPhone to check if it would work there. According to https://caniuse.com/web-share, it just might. Having said so, I haven’t used any PWA as a share target yet. But I’d very much like organice to work like that(;

Unfortunately, so far, I have had no luck with your installation. However, I also tried the Scrapbook PWA from your initial post, and it also didn’t show up as a share target. I tried finding out if I need to configure something somewhere but haven’t found anything so far.

@munen
Copy link
Collaborator

munen commented May 26, 2022

@schoettl or @branch14 Does the scrapbook share PWA show up as a share target on your Android phones? If so, does organice show up after installing from https://organice.24hoursparty.de/?

@schoettl
Copy link
Collaborator

Hi all, I just tried the sample PWA https://scrapbook-pwa.web.app/ on Android 10 and tried to share a photo. It doesn't show up as a share target :( I even tried a smartphone reboot.

@munen
Copy link
Collaborator

munen commented May 27, 2022

That’s really interesting. So… the official Google samples don’t work, but the API still exists. Curious.

Thank you for checking it out @schoettl 🙏🏻

@tbruckmaier
Copy link
Contributor Author

That is really strange, I have blamed the issue on my non-standard phone setup (quite old LineageOS 14 ~= Android 7, no google play services, root, Chromium instead of regular Chrome). @schoettl do you have a more regular setup? Also, is Chrome your default browser? (I think I have read someone having issues because of that).
And could you maybe try https://mconverter.eu/ ? It is also a PWA which accepts files through the android share menu, and they claim in a recent blog post (march 2022) that "nearly a quarter of all daily conversions getting initiated through the share menu" . So surely we are doing something wrong?

@munen If we cannot solve this issue, do you think the new /capture route is beneficial nevertheless?

@munen
Copy link
Collaborator

munen commented May 28, 2022

@tbruckmaier The demo video on https://mconverter.eu/ is pretty impressive. I'd love this workflow to be available on organice! I did try it (on my iPhone 13 pro) and it did not work. Having said so, they don't claim it should work on iOS(; That itself is not a blocker for inclusion to organice, of course. It only means I unfortunately cannot really help with the issue.

If we cannot solve this issue, do you think the new /capture route is beneficial nevertheless?

I mean, the sharing API seems to be a thing (we had the first draft PR in 2019). If anyone can get it to work, I'm all for pulling this in. If it won't work, then we can always leave the PR in a draft state for someone else to pick up later. Or do you see another possible use case for the /capture route? I'm open to suggestions, of course.

@schoettl
Copy link
Collaborator

Oh, I forgot that my default browser on Android is Firefox!

Installing the demo app via Android Chrome works, now I've got the share target.

I'll try organice.24hoursparty.de tomorrow...

@schoettl
Copy link
Collaborator

OK, I installed Organice from 24hours... as app in Chrome on Android 10. I can't sign in, Dropbox is not working and I can't get WebDAV working ATM, the docker test server is not reachable from other than localhost... although it should because it's bound to 0.0.0.0

But so far, Organice does not show up as share target. @tbruckmaier For which types of shares it's supposed to work? Webseites shared from browser? Files?

@munen
Copy link
Collaborator

munen commented May 29, 2022

@schoettl It makes sense that Dropbox won’t work (unless it’s been set up as an app). We could merge to develop and deploy to Staging for that.

However, it should show up as a sharing target anyway, I suppose. @tbruckmaier Or should it only show up when logged in?

@branch14
Copy link
Member

branch14 commented May 30, 2022

@munen I "installed" organice from 24hoursparty.de via Chrome and Firefox on Android. I tried to log in via Gitlab, which did not work. "Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method." Organice did not show up as a share target.

But I might add Gitlab did recognize a login from a "new location" and notified me via email.

@munen
Copy link
Collaborator

munen commented May 30, 2022

@branch14 thank you for checking it out! That’s GitLab synchronization did not work is expected if OP did not set it up. However that should be independent of the shared target functionality.

@tbruckmaier Seems we have no dice on the matter so far 😢

- maybe that part was missing for being used as share target?
- method is actually optional, but maybe browsers still expect it?
@tbruckmaier
Copy link
Contributor Author

tbruckmaier commented May 30, 2022

Thanks everyone for testing, what a pity that it still does not work.

A last idea which came to my mind, maybe the integration does not work with the dynamically generated manifest (right now, the manifest is generated in JS dynamically instead of the regular manifest.json? I have (re-)added manifest.json therefore.

I have deployed it to 24hoursparty.de again, would you all be so kind and test it again? @branch14 @schoettl Probably best to uninstall the PWA and reinstall it freshly.

And if that does not work, as a last straw, could you have a look at the changed manifest code? Maybe it is a stupid typo or other issue which I somehow don't see?

Regarding the login issues with dropbox and gitlab, I have not done anything special to that part of the code or the server setup. From my understanding, this should not interfere with the sharing part though.

But so far, Organice does not show up as share target. @tbruckmaier For which types of shares it's supposed to work? Webseites shared from browser? Files?

Organice should show up when sharing regular text, so for instance the url from a browser (i think)

@schoettl
Copy link
Collaborator

I reinstalled the app from 27hours... and tried to share selected text, websites, and photos. No success, it doesn't show up :/

@tbruckmaier
Copy link
Contributor Author

Alright, thanks for the feedback, I am officially out of ideas.

@munen I leave it up to you what to do with this PR. Honestly, I will probably not be using organice a lot, since I mostly need something on the phone to capture notes, and will continue to use orgzly for that.

I personally would prefer to have something like the /capture route, which I built with the idea of emacs' interactive capture menu in mind. my idea was, whenever you want to capture something, you can use the same shortcut to that route, and then choose the appropriate template interactively. But since you are using the app a lot more than I do, you probably have a better idea if that is a useful addition.

@munen
Copy link
Collaborator

munen commented May 30, 2022

@tbruckmaier It is a useful addition. I'm looking forward to seeing it work at some point.

For the time being, before you give up on organice, let me introduce you to a feature that you might not now. I also capture stuff from the web using organice - even on the Desktop where I also have Emacs (and otherwise make extensive use of capture templates [for expenses, todos, meeting minutes,etc]). The feature I use for capturing is bookmarklets. Here's some documentation on it: https://organice.200ok.ch/documentation.html#bookmarklets

It might be helpful for your use-case, it might not be.

In any case, thank you for putting up a great effort. And maybe see you around at another point in time 🙏

@munen
Copy link
Collaborator

munen commented May 30, 2022

For the moment, let's leave the PR here for someone to pick up at a later point in time and good luck to this future person!

@tbruckmaier
Copy link
Contributor Author

@munen Thanks for the tipp, that is indeed my backup plan, once firefox on mobile supports bookmarklets again ;)

@branch14 branch14 changed the title WIP: organice as share target WIP: organice pwa as share target Jun 16, 2022
@czlucius
Copy link

czlucius commented Jun 20, 2022

@munen Thanks for the tipp, that is indeed my backup plan, once firefox on mobile supports bookmarklets again ;)

I believe they already do, and that issue was just not closed (will be closed after testing)
Can try opening up a bookmarklet in Stable, and it will open up in the current tab and not a new tab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants