generated from nimblehq/git-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[12] Integrate Moko Resources to share project resources between plat…
…forms
- Loading branch information
Showing
25 changed files
with
308 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<<<<<<< HEAD | ||
======= | ||
object Versions { | ||
const val ANDROID_COMPILE_SDK_VERSION = 33 | ||
const val ANDROID_MIN_SDK_VERSION = 24 | ||
const val ANDROID_TARGET_SDK_VERSION = 33 | ||
const val ANDROID_VERSION_CODE = 1 | ||
const val ANDROID_VERSION_NAME = "1.0.0" | ||
const val ANDROIDX_ACTIVITY_COMPOSE = "1.7.1" | ||
|
||
const val BUILD_KONFIG = "0.13.3" | ||
|
||
const val COMPOSE = "1.4.3" | ||
const val COMPOSE_COMPILER = "1.4.7" | ||
const val COMPOSE_NAVIGATION = "2.6.0" | ||
|
||
const val DETEKT = "1.23.0" | ||
|
||
const val GRADLE = "8.0.2" | ||
|
||
const val JUNIT = "4.13.2" | ||
|
||
const val KOIN = "3.3.2" | ||
const val KOIN_ANDROID = "3.3.2" | ||
const val KOIN_ANDROIDX_COMPOSE = "3.4.1" | ||
const val KOTLIN = "1.8.21" | ||
const val KOTLIN_COROUTINES = "1.7.3" | ||
const val KOTEST = "5.5.4" | ||
const val KOTLINX_RESOURCES = "0.2.4" | ||
const val KOVER = "0.7.3" | ||
const val KSP = "1.8.21-1.0.11" | ||
const val KTOR = "2.1.1" | ||
|
||
const val MOCKATIVE = "1.3.0" | ||
const val MOCKK = "1.13.3" | ||
|
||
const val MOKO_RESOURCES = "0.23.0" | ||
const val MOKO_GRAPHICS = "0.9.0" | ||
|
||
const val NAPIER = "2.6.1" | ||
|
||
const val ROBOLECTRIC = "4.9.1" | ||
|
||
const val TIMBER = "5.0.1" | ||
const val TURBINE = "0.12.1" | ||
} | ||
|
||
>>>>>>> 9d544fd ([12] Integrate Moko Resources to share project resources between platforms) | ||
object Dependencies { | ||
|
||
object AndroidX { | ||
const val ACTIVITY_COMPOSE = "androidx.activity:activity-compose:${Versions.ANDROIDX_ACTIVITY_COMPOSE}" | ||
} | ||
|
||
object Compose { | ||
const val FOUNDATION = "androidx.compose.foundation:foundation:${Versions.COMPOSE}" | ||
|
||
const val MATERIAL = "androidx.compose.material:material:${Versions.COMPOSE}" | ||
|
||
const val NAVIGATION = "androidx.navigation:navigation-compose:${Versions.COMPOSE_NAVIGATION}" | ||
|
||
const val UI = "androidx.compose.ui:ui:${Versions.COMPOSE}" | ||
const val UI_GRAPHICS = "androidx.compose.ui:ui-graphics:${Versions.COMPOSE}" | ||
const val UI_TOOLING = "androidx.compose.ui:ui-tooling:${Versions.COMPOSE}" | ||
const val UI_TOOLING_PREVIEW = "androidx.compose.ui:ui-tooling-preview:${Versions.COMPOSE}" | ||
} | ||
|
||
object Koin { | ||
const val CORE = "io.insert-koin:koin-core:${Versions.KOIN}" | ||
const val ANDROID = "io.insert-koin:koin-android:${Versions.KOIN_ANDROID}" | ||
const val COMPOSE = "io.insert-koin:koin-androidx-compose:${Versions.KOIN_ANDROIDX_COMPOSE}" | ||
} | ||
|
||
object Ktor { | ||
const val ANDROID = "io.ktor:ktor-client-android:${Versions.KTOR}" | ||
const val AUTH = "io.ktor:ktor-client-auth:${Versions.KTOR}" | ||
|
||
const val CIO = "io.ktor:ktor-client-cio:${Versions.KTOR}" | ||
const val CORE = "io.ktor:ktor-client-core:${Versions.KTOR}" | ||
const val CONTENT_NEGOTIATION = "io.ktor:ktor-client-content-negotiation:${Versions.KTOR}" | ||
|
||
const val IOS = "io.ktor:ktor-client-ios:${Versions.KTOR}" | ||
|
||
const val JSON = "io.ktor:ktor-serialization-kotlinx-json:${Versions.KTOR}" | ||
|
||
const val LOGGING = "io.ktor:ktor-client-logging:${Versions.KTOR}" | ||
|
||
const val SERIALIZATION = "io.ktor:ktor-client-serialization:${Versions.KTOR}" | ||
} | ||
|
||
object Log { | ||
const val NAPIER = "io.github.aakira:napier:${Versions.NAPIER}" | ||
const val TIMBER = "com.jakewharton.timber:timber:${Versions.TIMBER}" | ||
} | ||
|
||
object Moko { | ||
const val RESOURCES_GENERATOR = "dev.icerock.moko:resources-generator:${Versions.MOKO_RESOURCES}" | ||
const val RESOURCES = "dev.icerock.moko:resources:${Versions.MOKO_RESOURCES}" | ||
const val RESOURCES_COMPOSE = "dev.icerock.moko:resources-compose:${Versions.MOKO_RESOURCES}" | ||
const val GRAPHICS = "dev.icerock.moko:graphics:${Versions.MOKO_GRAPHICS}" | ||
} | ||
|
||
object Test { | ||
const val COMPOSE_UI_TEST_JUNIT = "androidx.compose.ui:ui-test-junit4:${Versions.COMPOSE}" | ||
const val COMPOSE_UI_TEST_MANIFEST = "androidx.compose.ui:ui-test-manifest:${Versions.COMPOSE}" | ||
const val COROUTINES = "org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.KOTLIN_COROUTINES}" | ||
|
||
const val JUNIT = "junit:junit:${Versions.JUNIT}" | ||
|
||
const val KOTEST = "io.kotest:kotest-assertions-core:${Versions.KOTEST}" | ||
const val KOTLINX_RESOURCES = "com.goncalossilva:resources:${Versions.KOTLINX_RESOURCES}" | ||
|
||
const val MOCKATIVE = "io.mockative:mockative:${Versions.MOCKATIVE}" | ||
const val MOCKATIVE_PROCESSOR = "io.mockative:mockative-processor:${Versions.MOCKATIVE}" | ||
const val MOCKK = "io.mockk:mockk:${Versions.MOCKK}" | ||
const val MOCKK_ANDROID = "io.mockk:mockk-android:${Versions.MOCKK}" | ||
|
||
const val MOKO_RESOURCES_TEST = "dev.icerock.moko:resources-test:${Versions.MOKO_RESOURCES}" | ||
|
||
const val ROBOLECTRIC = "org.robolectric:robolectric:${Versions.ROBOLECTRIC}" | ||
|
||
const val TURBINE = "app.cash.turbine:turbine:${Versions.TURBINE}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
sample/shared/src/androidMain/kotlin/co/nimblehq/kmm/template/Strings.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package co.nimblehq.kmm.template | ||
|
||
import android.content.Context | ||
import dev.icerock.moko.resources.StringResource | ||
import dev.icerock.moko.resources.desc.Resource | ||
import dev.icerock.moko.resources.desc.StringDesc | ||
import dev.icerock.moko.resources.format | ||
|
||
actual class Strings(private val context: Context) { | ||
actual fun get( | ||
id: StringResource, | ||
args: List<Any>, | ||
): String { | ||
return if (args.isEmpty()) { | ||
StringDesc.Resource(id).toString(context = context) | ||
} else { | ||
id.format(*args.toTypedArray()).toString(context) | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
sample/shared/src/commonMain/kotlin/co/nimblehq/kmm/template/Strings.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package co.nimblehq.kmm.template | ||
|
||
import dev.icerock.moko.resources.StringResource | ||
|
||
expect class Strings { | ||
fun get(id: StringResource, args: List<Any> = emptyList()): String | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<resources> | ||
<string name="greeting">Hello, %s!</string> | ||
</resources> |
19 changes: 19 additions & 0 deletions
19
sample/shared/src/iosMain/kotlin/co/nimblehq/kmm/template/Strings.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package co.nimblehq.kmm.template | ||
|
||
import dev.icerock.moko.resources.StringResource | ||
import dev.icerock.moko.resources.desc.Resource | ||
import dev.icerock.moko.resources.desc.StringDesc | ||
import dev.icerock.moko.resources.format | ||
|
||
actual class Strings { | ||
actual fun get( | ||
id: StringResource, | ||
args: List<Any>, | ||
): String { | ||
return if (args.isEmpty()) { | ||
StringDesc.Resource(id).localized() | ||
} else { | ||
id.format(*args.toTypedArray()).localized() | ||
} | ||
} | ||
} |
Oops, something went wrong.