acez / bookmark-companion

Bookmark Companion iOS Application
MIT License
26 stars 0 forks source link

Feature request - sync on share #26

Closed TheFitzZZ closed 1 year ago

TheFitzZZ commented 1 year ago

Thanks to your quick fix for the share from Firefox I was able to play with the app a bit more and found that the sync only happens when the full app is started.

Question/kind feature request: Would it be possible to do a sync upon creating a new bookmark when doing at in the share scenario so I don't need to open the app at all? :-)

acez commented 1 year ago

That is a very good point to add to the Todo list.

I think the most critical part here is to show sync fail/success to the user without interfering with bookmark creation with the share sheet. For example, in my setup I don't have my Linkding instance publicly exposed but only in my local network - so sync might not work when I am on the go. But I think it is then important to show to the user that a manual sync with the App might be needed in that case without breaking the flow of creating a bookmark fast.

Thank you for you suggestion, I will try to find a good way to make this work. :-)

TheFitzZZ commented 1 year ago

Thank you for taking it into account!

Some ideas (please discard if stupid:

Both ways don't interfere with the flow :-)

acez commented 1 year ago

Thanks for the input. I'll probably go more into direction of the first point, as the connection might be lost between opening the sheet and saving the bookmark (e.g. moving out of a local network).

At least that might be a good starting point. I'll plan to look a bit more in detail into the Background Tasks API from Apple so the application can try to sync the data periodically even when it is not brought into foreground for a while. If this is possible, this might be a good solution to share bookmarks without always bringing up the app to trigger sync then.

TheFitzZZ commented 1 year ago

Another idea I got from Bitwarden: their app asked for notification permissions to allow for background updates. Unsure if their app is also open-source so you can take a peek, but maybe the idea alone might help you. Cheers :)

acez commented 1 year ago

Thanks for the hint :-) I looked briefly into the code of the bitwarden app. It seems that they are using push notifications from their server to the clients to trigger full syncs. That would not work sadly :-( The relevant (at least I think so :-D) code pieces from the bitwarden source are:

But I am currently testing background tasks on iOS on my local machine to see if we can at least send the created bookmark to the backend (we don't need to trigger a full sync in that case). Stay tuned - I can hopefully release a new version with that feature soon. :-)

acez commented 1 year ago

Seems like using background tasks would require a lot of rewrites, so I added the "easy" way now to the App. When creating a bookmark it checks if the backend is available and shows a warning, that the bookmark will be saved only locally. If the backend is available, it will directly create the bookmark on the backend. The behavior will be the same in the App and in the share extension.

I just uploaded the app to be reviewed by Apple. As soon as it is released, I will add a not to the issue here. :-)

acez commented 1 year ago

It's now available on the AppStore https://github.com/acez/bookmark-companion/releases/tag/v1.4.0

If something is not working, feel free to reopen that issue. Thanks again for your suggestion :-)

TheFitzZZ commented 1 year ago

Tested, works perfectly :-) Thank you so much!

Please add a buy-me-a-beverage button so I can sponsor you a drink or something ;-)