core/features/content
InsanusMokrassar ff973e63fc start migration onto ktor-based serialization of data 2022-06-12 18:54:28 +06:00
..
binary fixes in auth 2022-05-20 00:15:49 +06:00
client temporal potentially working variant (bot not building 2022-03-26 14:19:20 +06:00
common start migration onto ktor-based serialization of data 2022-06-12 18:54:28 +06:00
server add previews in binary content 2022-03-18 19:04:57 +06:00
text fixes in auth 2022-05-20 00:15:49 +06:00
README.md add information about content client provider to readme 2022-03-18 00:04:04 +06:00

README.md

How to create content?

For example, you want to create content named MyFormat. To do this, you must perform the following actions:

  1. Copy template folder from core/features in core/features/content
  2. Rename this folder in myformat
  3. Inside the myformat folder rename all the template on content.myformat
  4. In the settings.gradle file in the includes array add the following code:
        String[] includes = [
            ...
            ":features:content:myformat:common",
            ":features:content:myformat:client",
            ":features:content:myformat:server",
            ...
        ]
    
  5. In the core/features/content/myformat/common/src folder create folders with appropriate subfolders commonMain/kotlin/dev/inmo/postssystem/features/content/myformat/common:
  6. 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())
           }
       }
    
  7. In two di.kt file located in core/client/src/commonMain/kotlin/dev/inmo/postsystem/client and core/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