icerockdev / moko-resources

Resources access for mobile (android & ios) Kotlin Multiplatform development
https://moko.icerock.dev/
Apache License 2.0
1.12k stars 125 forks source link

Add in readme examples of files resources #223

Open moffpage opened 3 years ago

moffpage commented 3 years ago

Android has a limit 32,767 on strings encoded in UTF-8 in our APKs (it's gonna replace the original string with "STRING TOO LARGE" notice). If we need to load a string locally (like user agreement), for now we have to either split the string into multiple parts and put each in their own text view, or use some kind of IO API. Are you interested in adding an implementation that we could use in commonMain using your library, without needing to use expect/actual mechanisms or korio (or kotlinx-io) library which I don't have experience with?

Alex009 commented 3 years ago

@moffpage you can use files support of moko-resources - as here https://github.com/icerockdev/moko-resources/tree/master/sample/mpp-library/src/commonMain/resources/MR/files https://github.com/icerockdev/moko-resources/blob/master/sample/mpp-library/src/commonMain/kotlin/com/icerockdev/library/Testing.kt#L115

moffpage commented 3 years ago

Thanks! Sorry, missed the Files support mentioning in the documentation, it's included in the features list (in the first feature). It's easy to forget about though. Maybe you could update the README.md file with 10-th case?

Alex009 commented 3 years ago

yes, we should add it into readme :)

moffpage commented 3 years ago

Thank you!