-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #521 from igorescodro/amm/domain
Convert the Domain module to a KMP module
- Loading branch information
Showing
132 changed files
with
904 additions
and
779 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
plugins { | ||
id("com.escodro.kotlin-module") | ||
id("com.android.lint") | ||
id("com.escodro.android-library") // TODO revert to Kotlin-only | ||
} | ||
|
||
dependencies { | ||
implementation(projects.domain) | ||
implementation(projects.libraries.core) | ||
|
||
implementation(libs.koin.core) | ||
implementation(libs.kotlinx.coroutines.core) | ||
implementation(libs.kotlinx.datetime) | ||
} | ||
|
||
android { | ||
namespace = "com.escodro.repository" | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,15 +1,54 @@ | ||
plugins { | ||
id("com.escodro.kotlin-module") | ||
id("com.android.lint") | ||
kotlin("multiplatform") | ||
id("com.android.library") | ||
id("com.escodro.kotlin-quality") | ||
} | ||
|
||
dependencies { | ||
implementation(libs.koin.core) | ||
implementation(libs.logging) | ||
runtimeOnly(libs.logback) | ||
implementation(libs.kotlinx.coroutines.core) | ||
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi::class) | ||
kotlin { | ||
targetHierarchy.default() | ||
|
||
testImplementation(libs.test.junit) | ||
testImplementation(libs.test.mockk) | ||
testImplementation(libs.kotlinx.coroutines.test) | ||
android { | ||
compilations.all { | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
} | ||
} | ||
|
||
listOf( | ||
iosX64(), | ||
iosArm64(), | ||
iosSimulatorArm64() | ||
).forEach { | ||
it.binaries.framework { | ||
baseName = "domain" | ||
} | ||
} | ||
|
||
sourceSets { | ||
val commonMain by getting { | ||
dependencies { | ||
implementation(libs.koin.core) | ||
implementation(libs.kotlinx.coroutines.core) | ||
implementation(libs.logging) | ||
implementation(libs.logback) | ||
implementation(libs.kotlinx.datetime) | ||
} | ||
} | ||
val commonTest by getting { | ||
dependencies { | ||
implementation(kotlin("test")) | ||
implementation(libs.kotlinx.coroutines.test) | ||
} | ||
} | ||
} | ||
} | ||
|
||
android { | ||
namespace = "com.escodro.domain" | ||
compileSdk = Integer.parseInt(libs.versions.android.sdk.compile.get()) | ||
defaultConfig { | ||
minSdk = Integer.parseInt(libs.versions.android.sdk.min.get()) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
19 changes: 19 additions & 0 deletions
19
domain/src/commonMain/kotlin/com.escodro/domain/provider/DateTimeProvider.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 com.escodro.domain.provider | ||
|
||
import kotlinx.datetime.Instant | ||
import kotlinx.datetime.LocalDateTime | ||
|
||
/** | ||
* Provide the date and time to be used on the task use cases, respecting the Inversion of Control. | ||
*/ | ||
interface DateTimeProvider { | ||
|
||
/** | ||
* Gets the current [Instant]. | ||
* | ||
* @return the current [Instant] | ||
*/ | ||
fun getCurrentInstant(): Instant | ||
|
||
fun getCurrentLocalDateTime(): LocalDateTime | ||
} |
15 changes: 15 additions & 0 deletions
15
domain/src/commonMain/kotlin/com.escodro/domain/provider/DateTimeProviderImpl.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,15 @@ | ||
package com.escodro.domain.provider | ||
|
||
import kotlinx.datetime.Clock | ||
import kotlinx.datetime.Instant | ||
import kotlinx.datetime.LocalDateTime | ||
import kotlinx.datetime.TimeZone | ||
import kotlinx.datetime.toLocalDateTime | ||
|
||
internal class DateTimeProviderImpl : DateTimeProvider { | ||
|
||
override fun getCurrentInstant(): Instant = Clock.System.now() | ||
|
||
override fun getCurrentLocalDateTime(): LocalDateTime = getCurrentInstant() | ||
.toLocalDateTime(TimeZone.currentSystemDefault()) | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.