mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-19 20:29:02 +00:00
add js as target for shared code
This commit is contained in:
parent
6a6bd3e827
commit
8b4af8272f
4 changed files with 44 additions and 1 deletions
|
|
@ -97,7 +97,6 @@ if (propFile.canRead()) {
|
|||
}
|
||||
} else {
|
||||
println 'signing.properties not found'
|
||||
android.buildTypes.release.signingConfig = null
|
||||
}
|
||||
|
||||
detekt {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,12 @@ kotlin {
|
|||
android()
|
||||
ios()
|
||||
|
||||
js(IR) {
|
||||
browser()
|
||||
nodejs()
|
||||
binaries.library()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
@file:OptIn(ExperimentalJsExport::class)
|
||||
|
||||
package com.habitrpg.shared.habitica
|
||||
|
||||
@JsExport
|
||||
actual class PlatformLogger actual constructor() {
|
||||
actual val enabled: Boolean
|
||||
get() = true
|
||||
|
||||
actual fun logDebug(tag: String, message: String) {
|
||||
console.log("[🥦] $tag: $message")
|
||||
}
|
||||
|
||||
actual fun logInfo(tag: String, message: String) {
|
||||
console.log("[🍋] $tag: $message")
|
||||
}
|
||||
|
||||
actual fun logWarning(tag: String, message: String) {
|
||||
console.log("[🍊] $tag: $message")
|
||||
}
|
||||
|
||||
actual fun logError(tag: String, message: String) {
|
||||
console.log("[🍎] $tag: $message")
|
||||
}
|
||||
|
||||
@JsName("logErrorException")
|
||||
actual fun logError(tag: String, message: String, exception: Throwable) {
|
||||
console.log("[🍎] $tag: $message\n${exception}")
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.habitrpg.shared.habitica
|
||||
|
||||
actual class Platform actual constructor() {
|
||||
actual val platform: String
|
||||
get() = "JS!"
|
||||
}
|
||||
|
||||
actual interface HParcelable
|
||||
Loading…
Reference in a new issue