contentful / vault

Easy persistence of Contentful data for Android over SQLite.
https://contentful.github.io/vault/
Apache License 2.0
85 stars 19 forks source link

Rich text fields #156

Closed quido3 closed 3 years ago

quido3 commented 4 years ago

Is Rich Text fields possible with Vault? I have not found any documentation regarding it and it seems that the implementation is not compatible with any of the Rich Text classes provided in the main implementation of Contentful.

I am currently syncing the fields as String. It's working and seems to have all the data in it as text, but I don't know what I could do with the String.

ZardozSpeaks commented 3 years ago

According to the support person I talked with, it isn't currently possible with Vault.

I wasn't even able to find an easy way to persist RichText using the standard SDK. It appears that some of the internal objects don't implement serializable so it isn't really possible to easily map a string representation back to an object. I ultimately wasn't able to find a solution that didn't involve writing to a file and a lot of reflection into the RichTextFactory class to get the object back in a usable form.

quido3 commented 3 years ago

I solved this in one way. You can persist the Rich Text as a String. The String will be in a weird form, but it's possible to convert that back into a RichTextDocument. This rrequires a fork to get public access to the Rich Text classes.

On Tue, 11 Aug 2020, 22.17 David Remington, notifications@github.com wrote:

According to the support person I talked with, it isn't currently possible with Vault.

I wasn't even able to find an easy way to persist RichText using the standard SDK. It appears that some of the internal objects don't implement serializable so it isn't really possible to easily map a string representation back to an object. I ultimately wasn't able to find a solution that didn't involve writing to a file and a lot of reflection into the RichTextFactory class to get the object back in a usable form.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/contentful/vault/issues/156#issuecomment-672210227, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKRGCTJAK2E2O6TRGY46ADSAGKMLANCNFSM4IG5UWDQ .