OneList icon indicating copy to clipboard operation
OneList copied to clipboard

[Feature] WebDav/Nextcloud support

Open napcode opened this issue 4 years ago • 4 comments

Thanks for making this app. I like it a lot!

It would be nice though, to store the lists/data via WebDav. That way, I can keep them in sync between devices.

napcode avatar Dec 06 '19 20:12 napcode

@napcode This is already partly possible with the storage access framework:

if you have the nextcloudapp installed, you can access nextcloud directly there.

The problem: Onelist currently fails to create a new file there, which means that you can only open, edit, save and delete lists that are already present on your nc-instance.

newhinton avatar Apr 04 '20 12:04 newhinton

When selecting a folder from nextcloud via the SAF, following happens in the log:

W/DocumentsContract: Failed to create document android.os.ParcelableException: java.io.FileNotFoundException: Failed to upload document with path /test-1585905948476.1list

also, when checked, https://github.com/lolo-io/OneList/blob/3b4b2105871f0cb986277f30f811576564e0ab47/app/src/main/java/com/lolo/io/onelist/dialogs/EditListDialog.kt#L70-L75

those lines fail.

I took them apart, and it seems that

createFile("text/x-json", list.fileName)

returns null. I could not find a solution for this. Until a proper fix is found, here is the workaround:

Export your lists to the local filesystem. Upload them to the desired location, and then delete them from onelist. After that, you can readd them from "local" storage, except that you now can select Nextcloud as your storage, and that keeps them in sync. They are available offline.

I tested this, and i found that it works quiet well, EXCEPT that it is prone to corruption. That means that if you do many things in quick succession, nextcloud's upload messes with the file and corrupts it. So be careful while using this, this can and will lead to filecorruption!

newhinton avatar Apr 04 '20 14:04 newhinton

I could not find a solution that is always working for saving files in an external folder chosen by the user. Android puts a lot of security there to prevent apps from creating files on users storages without them knowing. To put files in a dropbox folder you have to get permission from Dropbox and I think it is the same for WebDav & NextCloud, which means specific dev for each provider. I will try to find a way of getitng this to work, but I think choosing a folder, and then creating files in it isn't really appreciated by Android.

lolo-io avatar Apr 11 '20 15:04 lolo-io

Well, try look at other's code may be helps? The great tasks.org app is also written in kotlin, it is a todo-list app and it supports nextcloud/WebDAV

issu-shooter avatar May 09 '21 02:05 issu-shooter