2.1 KiB
2.1 KiB
How to create content?
For example, you want to create content named MyFormat
. To do this, you must perform the following actions:
- Copy
template
folder fromcore/features
incore/features/content
- Rename this folder in
myformat
- Inside the
myformat
folder rename all thetemplate
oncontent.myformat
- In the
settings.gradle
file in theincludes
array add the following code:String[] includes = [ ... ":features:content:myformat:common", ":features:content:myformat:client", ":features:content:myformat:server", ... ]
- In the
core/features/content/myformat/common/src
folder create folders with appropriate subfolderscommonMain/kotlin/dev/inmo/postssystem/features/content/myformat/common
: - In the last folder
сommon
, create a data class and the configurator as shown below:// MyFormatContent.kt @Serializable data class MyFormatContent( // Your code ) : Content // MyFormatContentSerializerModuleConfigurator.kt object MyFormatContentSerializerModuleConfigurator : ContentSerializersModuleConfigurator.Element { override fun PolymorphicModuleBuilder<Content>.invoke() { subclass(MyFormatContent::class, MyFormatContent.serializer()) } }
- In two
di.kt
file located incore/client/src/commonMain/kotlin/dev/inmo/postsystem/client
andcore/server/src/main/java/dev/inmo/postsystem/client
respectively add the following string:
singleWithRandomQualifier<ContentSerializersModuleConfigurator.Element> { MyFormatContentSerializerModuleConfigurator }
Client
Currently, this information is actual only for JS (browser) clients. Other client platforms will be added later
Besides, you may (and it is strongly recommended to) create your own client ContentClientProvider
realization.
This realization will contain all main functions for drawing of content on the client side.
Server
On the server side it is required to