-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initialize dictionary with data in multiplatform compose resources #27
Comments
I see. But you can just use the regular constructor of the FeatureDictionary. Adding a function like fun createFeatureDictionary(
featuresAccess: ResourceAccessAdapter,
brandFeaturesAccess: ResourceAccessAdapter?,
) = FeatureDictionary(
featureCollection = IDLocalizedFeatureCollection(featuresAccess),
brandFeatureCollection = brandFeaturesAccess?.let { IDBrandPresetsFeatureCollection(it) }
) Then, you just need to implement a |
It took way too long to find this out, but you can use val buffer = Buffer()
UnsafeBufferOperations.moveToTail(buffer, byteArray) to wrap a |
Is there a method like |
Not exactly, but it can be checked with |
Currently, there are 2 options to initialize the dictionary, either by providing
FileSystem
orAssetManager
, but onlyFileSystem
is available in the common source set of the Kotlin Multiplatform project. In case when we keep our presets data in compose resources, they are not available fromFileSystem
, they are bundled into apk, thus right now it's not possible to get them with osmfeatures library in the common source set.To get a raw file from compose resources we can use
Res.readBytes("files/presets/preset.json")
(reference).To solve this issue, I propose to make
FeatureDictionary.create()
accept aRes
object as a parameter and read presets from compose resources byRes.readBytes()
The text was updated successfully, but these errors were encountered: