floccusaddon/floccus

SendIntent crashes on Android

kolinger opened this issue · 2 comments

Which version of floccus are you using?

5.0.7

Describe the Bug

Android app crashes here on SendIntent.finish()

https://github.com/floccusaddon/floccus/blob/develop/src/ui/views/native/AddBookmarkIntent.vue#L173

When new bookmark is saved via SendIntent/share to Floccus. The reason is that AndroidManifest.xml isn't inline with send-intent, it's missing activity that should handle the SendIntent and instead Floccus tries to handle SendIntent itself and thus crashes - this is outline in send-intent documentation: https://github.com/carsten-klaffke/send-intent?tab=readme-ov-file#android

Apart of that Send intent doesn't work properly, it doesn't auto sync, it seems buggy overall. For example most of the time added bookmark doesn't propagate into the tree unless floccus is restarted. The communication between SendIndent and main activity doesn't seem to work right.

Expected Behavior

No crash

To Reproduce

Share URL to Floccus

Hello 👋

Thank you for taking the time to open this issue with floccus. I know it's frustrating when software
causes problems. You have made the right choice to come here and open an issue to make sure your problem gets looked at
and if possible solved.
I'm Marcel and I created floccus and have been maintaining it ever since.
I currently work for Nextcloud which leaves me with less time for side projects like this one
than I used to have.
I still try to answer all issues and if possible fix all bugs here, but it sometimes takes a while until I get to it.
Until then, please be patient.
Note also that GitHub is a place where people meet to make software better together. Nobody here is under any obligation
to help you, solve your problems or deliver on any expectations or demands you may have, but if enough people come together we can
collaborate to make this software better. For everyone.
Thus, if you can, you could also have a look at other issues to see whether you can help other people with your knowledge
and experience. If you have coding experience it would also be awesome if you could step up to dive into the code and
try to fix the odd bug yourself. Everyone will be thankful for extra helping hands!
One last word: If you feel, at any point, like you need to vent, this is not the place for it; you can go to the forum,
to twitter or somewhere else. But this is a technical issue tracker, so please make sure to
focus on the tech and keep your opinions to yourself.

I look forward to working with you on this issue
Cheers 💙

If I fix the crash (declaring extra activity in AndroidManifest as per send-intent readme) and neutralize SendIntent.finish() then bookmark gets added reliably into the tree and auto sync works too but of course now floccus stays open and send intent is never finished. Also the floccus I see isn't the actual floccus that's the activity of send intent and thus if this activity exits then main activity resumes and doesn't see new bookmark/changes, quite confusing. This makes sense since finish() exits the activity that handled the intent and if finish() is removed then the activity continues and can do everything but that's not correct then two floccuses exist at the same time. If fininish() is called then added bookmark isn't visible the same way in main activity.

There should be some kind of mechanism to make sure bookmark is saved before finish() is called. Also not sure how to handle auto sync in this instance since the activity exits and doesn't have time to handle auto sync as usual. I guess the proper way would be handling sync in background and signal the background task to do sync and then intent can exit peacefully or just wait for AlarmManager to trigged periodic sync - not ideal that could take ages.

There needs to be a check if tree was changed in background since as of now main activity thinks the tree didn't change when it was modified by send intent activity and shows old render of the tree and also synces old version of the tree until floccus is restarted.

The crash makes it seem like it's working more properly since it kills the main activity and forces to reload the tree when floccus is next activated but of course then auto sync doesn't have chance to run since floccus is crashed. If the crash is fixed then send intent gets it's own activity as it should and then the synchronization between main activity issue arises.

This reflects pretty much my user experience that sync doesn't happen after using Send intent unless I manually open floccus and periodic sync will also never occur even if I wait days since main activity of floccus is crashed thus AlarmManager never gets triggered.