Console App

This commit is contained in:
shabinder 2021-06-20 02:16:59 +05:30
parent f057e53994
commit 581f4d0104
5 changed files with 64 additions and 6 deletions

View File

@ -0,0 +1,29 @@
@file:Suppress("FunctionName")
package common
import io.ktor.client.HttpClient
import io.ktor.client.features.HttpTimeout
import io.ktor.client.features.json.JsonFeature
import io.ktor.client.features.json.serializer.KotlinxSerializer
import io.ktor.client.features.logging.DEFAULT
import io.ktor.client.features.logging.LogLevel
import io.ktor.client.features.logging.Logger
import io.ktor.client.features.logging.Logging
import kotlinx.serialization.json.Json
internal val client = HttpClient {
install(HttpTimeout)
install(JsonFeature) {
serializer = KotlinxSerializer(
Json {
ignoreUnknownKeys = true
isLenient = true
}
)
}
install(Logging) {
logger = Logger.DEFAULT
level = LogLevel.INFO
}
}

View File

@ -0,0 +1,29 @@
package common
import utils.byOptionalProperty
import utils.byProperty
internal data class Parameters(
val githubToken: String,
val ownerName: String,
val repoName: String,
val branchName: String,
val filePath: String,
val imageDescription: String,
val commitMessage: String,
val tagName: String
) {
companion object {
fun initParameters() = Parameters(
githubToken = "GH_TOKEN".byProperty,
ownerName = "OWNER_NAME".byProperty,
repoName = "REPO_NAME".byProperty,
branchName = "BRANCH_NAME".byOptionalProperty ?: "main",
filePath = "FILE_PATH".byOptionalProperty ?: "README.md",
imageDescription = "IMAGE_DESCRIPTION".byOptionalProperty ?: "IMAGE",
commitMessage = "COMMIT_MESSAGE".byOptionalProperty ?: "HTML-TO-IMAGE Update",
tagName = "TAG_NAME".byOptionalProperty ?: "HTI"
// hctiKey = "HCTI_KEY".analytics_html_img.getByProperty
)
}
}

View File

@ -38,8 +38,8 @@ kotlin {
implementation(compose.desktop.currentOs)
implementation(project(":common:database"))
implementation(project(":common:dependency-injection"))
implementation(project(":common:compose"))
implementation(project(":common:data-models"))
implementation(project(":common:compose"))
implementation(project(":common:root"))
// Decompose

View File

@ -27,5 +27,6 @@ include(
":android",
":desktop",
":web-app",
":console-app",
":maintenance-tasks"
)

View File

@ -42,7 +42,6 @@ fun RBuilder.App(attrs: AppProps.() -> Unit): ReactElement {
}
}
@Suppress("EXPERIMENTAL_IS_NOT_ENABLED", "NON_EXPORTABLE_TYPE")
@OptIn(ExperimentalJsExport::class)
@JsExport
@ -52,6 +51,10 @@ class App(props: AppProps): RComponent<AppProps, RState>(props) {
private val ctx = DefaultComponentContext(lifecycle = lifecycle)
private val dependencies = props.dependencies
override fun RBuilder.render() {
renderableChild(RootR::class, root)
}
private val root = SpotiFlyerRoot(ctx,
object : SpotiFlyerRoot.Dependencies {
override val storeFactory: StoreFactory = LoggingStoreFactory(DefaultStoreFactory)
@ -107,8 +110,4 @@ class App(props: AppProps): RComponent<AppProps, RState>(props) {
override fun componentWillUnmount() {
lifecycle.destroy()
}
override fun RBuilder.render() {
renderableChild(RootR::class, root)
}
}