Skip to content

Commit

Permalink
[Chore] Generate & update sample project
Browse files Browse the repository at this point in the history
  • Loading branch information
bot-nimble committed Aug 29, 2023
1 parent 365405a commit 2476689
Show file tree
Hide file tree
Showing 33 changed files with 278 additions and 285 deletions.
6 changes: 3 additions & 3 deletions sample/android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ val keystoreProperties = loadProperties("$rootDir/signing.properties")

android {
namespace = "co.nimblehq.kmm.template.android"
compileSdk = Versions.ANDROID_COMPILE_SDK_VERSION
compileSdk = Versions.ANDROID_COMPILE_SDK
defaultConfig {
applicationId = "co.nimblehq.kmm.template.android"
minSdk = Versions.ANDROID_MIN_SDK_VERSION
targetSdk = Versions.ANDROID_TARGET_SDK_VERSION
minSdk = Versions.ANDROID_MIN_SDK
targetSdk = Versions.ANDROID_TARGET_SDK
versionCode = Versions.ANDROID_VERSION_CODE
versionName = Versions.ANDROID_VERSION_NAME
}
Expand Down
4 changes: 0 additions & 4 deletions sample/buildKonfig.properties.sample

This file was deleted.

4 changes: 4 additions & 0 deletions sample/buildSrc/src/main/java/BuildTypes.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
object BuildTypes {
const val DEBUG = "debug"
const val RELEASE = "release"
}
44 changes: 1 addition & 43 deletions sample/buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,45 +1,3 @@
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 NAPIER = "2.6.1"

const val ROBOLECTRIC = "4.9.1"

const val TIMBER = "5.0.1"
const val TURBINE = "0.12.1"
}

object Dependencies {

object AndroidX {
Expand Down Expand Up @@ -94,7 +52,7 @@ object Dependencies {

const val JUNIT = "junit:junit:${Versions.JUNIT}"

const val KOTEST_ASSERTIONS = "io.kotest:kotest-assertions-core:${Versions.KOTEST}"
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}"
Expand Down
5 changes: 5 additions & 0 deletions sample/buildSrc/src/main/java/Flavors.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
object Flavors {
const val PRODUCTION = "production"
const val STAGING = "staging"
const val DIMENSION_VERSION = "version"
}
3 changes: 3 additions & 0 deletions sample/buildSrc/src/main/java/Modules.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object Modules {
const val SHARED = ":shared"
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
object Flavors {
const val PRODUCTION = "production"
const val STAGING = "staging"
const val DIMENSION_VERSION = "version"
}

object BuildTypes {
const val DEBUG = "debug"
const val RELEASE = "release"
}

object Modules {
const val SHARED = ":shared"
}

object Plugins {
const val ANDROID = "android"
const val ANDROID_APPLICATION = "com.android.application"
Expand Down
42 changes: 42 additions & 0 deletions sample/buildSrc/src/main/java/Versions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
object Versions {
const val ANDROID_COMPILE_SDK = 33
const val ANDROID_MIN_SDK = 24
const val ANDROID_TARGET_SDK = 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 NAPIER = "2.6.1"

const val ROBOLECTRIC = "4.9.1"

const val TIMBER = "5.0.1"
const val TURBINE = "0.12.1"
}
214 changes: 107 additions & 107 deletions sample/ios/sample.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions sample/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ kotlin {
implementation(kotlin("test"))
with(Dependencies.Test) {
implementation(COROUTINES)
implementation(KOTEST_ASSERTIONS)
implementation(KOTEST)
implementation(KOTLINX_RESOURCES)
implementation(MOCKATIVE)
implementation(TURBINE)
Expand Down Expand Up @@ -114,9 +114,9 @@ ksp {

android {
namespace = "co.nimblehq.kmm.template"
compileSdk = Versions.ANDROID_COMPILE_SDK_VERSION
compileSdk = Versions.ANDROID_COMPILE_SDK
defaultConfig {
minSdk = Versions.ANDROID_MIN_SDK_VERSION
minSdk = Versions.ANDROID_MIN_SDK
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.nimblehq.kmm.template.di.module
package co.nimblehq.kmm.template.di.modules

import io.ktor.client.engine.android.Android
import org.koin.core.module.Module
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package co.nimblehq.kmm.template.data.remote.datasources

import co.nimblehq.kmm.template.data.remote.models.responses.Response
import co.nimblehq.kmm.template.data.remote.ApiClient

interface RemoteDataSource {
suspend fun getUsers(): List<Response>
}

internal class RemoteDataSourceImpl(private val apiClient: ApiClient) : RemoteDataSource {
override suspend fun getUsers(): List<Response> {
return apiClient.get(
path = "users"
)
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package co.nimblehq.kmm.template.data.remote.models.responses

import co.nimblehq.kmm.template.domain.models.Model
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class Response(
@SerialName("id") val id: Int?
)

fun Response.toModel() = Model(id)
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package co.nimblehq.kmm.template.data.repositories

import co.nimblehq.kmm.template.data.extensions.flowTransform
import co.nimblehq.kmm.template.data.remote.datasources.UserRemoteDataSource
import co.nimblehq.kmm.template.data.remote.model.responses.toModel
import co.nimblehq.kmm.template.domain.model.UserModel
import co.nimblehq.kmm.template.data.remote.datasources.RemoteDataSource
import co.nimblehq.kmm.template.data.remote.models.responses.toModel
import co.nimblehq.kmm.template.domain.models.Model
import co.nimblehq.kmm.template.domain.repositories.Repository
import kotlinx.coroutines.flow.Flow

class RepositoryImpl(
private val userRemoteDataSource: UserRemoteDataSource
private val remoteDataSource: RemoteDataSource
) : Repository {
override fun getUsers(): Flow<List<UserModel>> = flowTransform {
userRemoteDataSource.getUsers().map { it.toModel() }
override fun getUsers(): Flow<List<Model>> = flowTransform {
remoteDataSource.getUsers().map { it.toModel() }
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package co.nimblehq.kmm.template.di

import co.nimblehq.kmm.template.di.module.*
import co.nimblehq.kmm.template.di.modules.*
import org.koin.core.KoinApplication
import org.koin.core.context.startKoin
import org.koin.dsl.KoinAppDeclaration
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.nimblehq.kmm.template.di.module
package co.nimblehq.kmm.template.di.modules

import org.koin.core.module.Module

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package co.nimblehq.kmm.template.di.modules

import co.nimblehq.kmm.template.data.remote.datasources.RemoteDataSource
import org.koin.dsl.module
import co.nimblehq.kmm.template.data.remote.ApiClient
import co.nimblehq.kmm.template.data.remote.datasources.RemoteDataSourceImpl
import org.koin.core.module.dsl.singleOf
import org.koin.dsl.bind

val remoteModule = module {
singleOf(::ApiClient)
singleOf(::RemoteDataSourceImpl) bind RemoteDataSource::class
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.nimblehq.kmm.template.di.module
package co.nimblehq.kmm.template.di.modules

import org.koin.core.module.dsl.singleOf
import org.koin.dsl.module
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package co.nimblehq.kmm.template.di.modules

import org.koin.core.module.dsl.singleOf
import org.koin.dsl.module
import co.nimblehq.kmm.template.domain.usecases.UseCaseImpl
import co.nimblehq.kmm.template.domain.usecases.UseCase
import org.koin.dsl.bind

val useCaseModule = module {
singleOf(::UseCaseImpl) bind UseCase::class
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package co.nimblehq.kmm.template.domain.models

data class Model(
val id: Int?
)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package co.nimblehq.kmm.template.domain.repositories

import co.nimblehq.kmm.template.domain.model.UserModel
import co.nimblehq.kmm.template.domain.models.Model
import kotlinx.coroutines.flow.Flow

interface Repository {
fun getUsers(): Flow<List<UserModel>>
fun getUsers(): Flow<List<Model>>
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package co.nimblehq.kmm.template.domain.usecases

import co.nimblehq.kmm.template.domain.models.Model
import co.nimblehq.kmm.template.domain.repositories.Repository
import kotlinx.coroutines.flow.Flow

interface UseCase {
operator fun invoke(): Flow<List<Model>>
}

class UseCaseImpl(private val repository: Repository) : UseCase {

override fun invoke(): Flow<List<Model>> = repository.getUsers()
}
Loading

0 comments on commit 2476689

Please sign in to comment.