From 607efa246cf333203222093fa917333aa7399864 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Wed, 26 Jun 2024 19:38:47 +0900 Subject: [PATCH 01/35] =?UTF-8?q?[ADD/#1]=20=EB=AA=A8=EB=93=88=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 2 + core-ui/.gitignore | 1 + core-ui/build.gradle.kts | 43 +++++++++++++++++++ core-ui/consumer-rules.pro | 0 core-ui/proguard-rules.pro | 21 +++++++++ .../terning/core/ExampleInstrumentedTest.kt | 24 +++++++++++ core-ui/src/main/AndroidManifest.xml | 4 ++ .../java/com/terning/core/ExampleUnitTest.kt | 17 ++++++++ data/.gitignore | 1 + data/build.gradle.kts | 43 +++++++++++++++++++ data/consumer-rules.pro | 0 data/proguard-rules.pro | 21 +++++++++ .../terning/data/ExampleInstrumentedTest.kt | 24 +++++++++++ data/src/main/AndroidManifest.xml | 4 ++ .../java/com/terning/data/ExampleUnitTest.kt | 17 ++++++++ domain/.gitignore | 1 + domain/build.gradle.kts | 9 ++++ .../main/java/com/terning/domain/MyClass.kt | 4 ++ feature/.gitignore | 1 + feature/build.gradle.kts | 43 +++++++++++++++++++ feature/consumer-rules.pro | 0 feature/proguard-rules.pro | 21 +++++++++ .../feature/ExampleInstrumentedTest.kt | 24 +++++++++++ feature/src/main/AndroidManifest.xml | 4 ++ feature/src/main/res/drawable/drawable.xml | 4 ++ .../com/terning/feature/ExampleUnitTest.kt | 17 ++++++++ gradle/libs.versions.toml | 7 +++ settings.gradle.kts | 5 ++- 28 files changed, 361 insertions(+), 1 deletion(-) create mode 100644 core-ui/.gitignore create mode 100644 core-ui/build.gradle.kts create mode 100644 core-ui/consumer-rules.pro create mode 100644 core-ui/proguard-rules.pro create mode 100644 core-ui/src/androidTest/java/com/terning/core/ExampleInstrumentedTest.kt create mode 100644 core-ui/src/main/AndroidManifest.xml create mode 100644 core-ui/src/test/java/com/terning/core/ExampleUnitTest.kt create mode 100644 data/.gitignore create mode 100644 data/build.gradle.kts create mode 100644 data/consumer-rules.pro create mode 100644 data/proguard-rules.pro create mode 100644 data/src/androidTest/java/com/terning/data/ExampleInstrumentedTest.kt create mode 100644 data/src/main/AndroidManifest.xml create mode 100644 data/src/test/java/com/terning/data/ExampleUnitTest.kt create mode 100644 domain/.gitignore create mode 100644 domain/build.gradle.kts create mode 100644 domain/src/main/java/com/terning/domain/MyClass.kt create mode 100644 feature/.gitignore create mode 100644 feature/build.gradle.kts create mode 100644 feature/consumer-rules.pro create mode 100644 feature/proguard-rules.pro create mode 100644 feature/src/androidTest/java/com/terning/feature/ExampleInstrumentedTest.kt create mode 100644 feature/src/main/AndroidManifest.xml create mode 100644 feature/src/main/res/drawable/drawable.xml create mode 100644 feature/src/test/java/com/terning/feature/ExampleUnitTest.kt diff --git a/build.gradle.kts b/build.gradle.kts index f74b04bf2..d84b68b97 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,4 +2,6 @@ plugins { alias(libs.plugins.android.application) apply false alias(libs.plugins.jetbrains.kotlin.android) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.jetbrains.kotlin.jvm) apply false } \ No newline at end of file diff --git a/core-ui/.gitignore b/core-ui/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/core-ui/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/core-ui/build.gradle.kts b/core-ui/build.gradle.kts new file mode 100644 index 000000000..f5bde3c7e --- /dev/null +++ b/core-ui/build.gradle.kts @@ -0,0 +1,43 @@ +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.jetbrains.kotlin.android) +} + +android { + namespace = "com.terning.core" + compileSdk = 34 + + defaultConfig { + minSdk = 28 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } +} + +dependencies { + + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.appcompat) + implementation(libs.material) + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.junit) + androidTestImplementation(libs.androidx.espresso.core) +} \ No newline at end of file diff --git a/core-ui/consumer-rules.pro b/core-ui/consumer-rules.pro new file mode 100644 index 000000000..e69de29bb diff --git a/core-ui/proguard-rules.pro b/core-ui/proguard-rules.pro new file mode 100644 index 000000000..481bb4348 --- /dev/null +++ b/core-ui/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/core-ui/src/androidTest/java/com/terning/core/ExampleInstrumentedTest.kt b/core-ui/src/androidTest/java/com/terning/core/ExampleInstrumentedTest.kt new file mode 100644 index 000000000..62607fa89 --- /dev/null +++ b/core-ui/src/androidTest/java/com/terning/core/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.terning.core + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.terning.core.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/core-ui/src/main/AndroidManifest.xml b/core-ui/src/main/AndroidManifest.xml new file mode 100644 index 000000000..a5918e68a --- /dev/null +++ b/core-ui/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/core-ui/src/test/java/com/terning/core/ExampleUnitTest.kt b/core-ui/src/test/java/com/terning/core/ExampleUnitTest.kt new file mode 100644 index 000000000..5881a2b99 --- /dev/null +++ b/core-ui/src/test/java/com/terning/core/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package com.terning.core + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/data/.gitignore b/data/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/data/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/data/build.gradle.kts b/data/build.gradle.kts new file mode 100644 index 000000000..25ac4c85e --- /dev/null +++ b/data/build.gradle.kts @@ -0,0 +1,43 @@ +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.jetbrains.kotlin.android) +} + +android { + namespace = "com.terning.data" + compileSdk = 34 + + defaultConfig { + minSdk = 28 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } +} + +dependencies { + + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.appcompat) + implementation(libs.material) + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.junit) + androidTestImplementation(libs.androidx.espresso.core) +} \ No newline at end of file diff --git a/data/consumer-rules.pro b/data/consumer-rules.pro new file mode 100644 index 000000000..e69de29bb diff --git a/data/proguard-rules.pro b/data/proguard-rules.pro new file mode 100644 index 000000000..481bb4348 --- /dev/null +++ b/data/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/data/src/androidTest/java/com/terning/data/ExampleInstrumentedTest.kt b/data/src/androidTest/java/com/terning/data/ExampleInstrumentedTest.kt new file mode 100644 index 000000000..e97b860eb --- /dev/null +++ b/data/src/androidTest/java/com/terning/data/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.terning.data + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.terning.data.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/data/src/main/AndroidManifest.xml b/data/src/main/AndroidManifest.xml new file mode 100644 index 000000000..a5918e68a --- /dev/null +++ b/data/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/data/src/test/java/com/terning/data/ExampleUnitTest.kt b/data/src/test/java/com/terning/data/ExampleUnitTest.kt new file mode 100644 index 000000000..12399759e --- /dev/null +++ b/data/src/test/java/com/terning/data/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package com.terning.data + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/domain/.gitignore b/domain/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/domain/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts new file mode 100644 index 000000000..ba1ceb047 --- /dev/null +++ b/domain/build.gradle.kts @@ -0,0 +1,9 @@ +plugins { + id("java-library") + alias(libs.plugins.jetbrains.kotlin.jvm) +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} \ No newline at end of file diff --git a/domain/src/main/java/com/terning/domain/MyClass.kt b/domain/src/main/java/com/terning/domain/MyClass.kt new file mode 100644 index 000000000..c43197669 --- /dev/null +++ b/domain/src/main/java/com/terning/domain/MyClass.kt @@ -0,0 +1,4 @@ +package com.terning.domain + +class MyClass { +} \ No newline at end of file diff --git a/feature/.gitignore b/feature/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/feature/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/feature/build.gradle.kts b/feature/build.gradle.kts new file mode 100644 index 000000000..48879e590 --- /dev/null +++ b/feature/build.gradle.kts @@ -0,0 +1,43 @@ +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.jetbrains.kotlin.android) +} + +android { + namespace = "com.terning.feature" + compileSdk = 34 + + defaultConfig { + minSdk = 28 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } +} + +dependencies { + + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.appcompat) + implementation(libs.material) + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.junit) + androidTestImplementation(libs.androidx.espresso.core) +} \ No newline at end of file diff --git a/feature/consumer-rules.pro b/feature/consumer-rules.pro new file mode 100644 index 000000000..e69de29bb diff --git a/feature/proguard-rules.pro b/feature/proguard-rules.pro new file mode 100644 index 000000000..481bb4348 --- /dev/null +++ b/feature/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/feature/src/androidTest/java/com/terning/feature/ExampleInstrumentedTest.kt b/feature/src/androidTest/java/com/terning/feature/ExampleInstrumentedTest.kt new file mode 100644 index 000000000..77b9600ed --- /dev/null +++ b/feature/src/androidTest/java/com/terning/feature/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.terning.feature + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.terning.feature.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/feature/src/main/AndroidManifest.xml b/feature/src/main/AndroidManifest.xml new file mode 100644 index 000000000..a5918e68a --- /dev/null +++ b/feature/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/feature/src/main/res/drawable/drawable.xml b/feature/src/main/res/drawable/drawable.xml new file mode 100644 index 000000000..a8b409b1d --- /dev/null +++ b/feature/src/main/res/drawable/drawable.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/feature/src/test/java/com/terning/feature/ExampleUnitTest.kt b/feature/src/test/java/com/terning/feature/ExampleUnitTest.kt new file mode 100644 index 000000000..511c25089 --- /dev/null +++ b/feature/src/test/java/com/terning/feature/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package com.terning.feature + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2349b7448..7b0b81fa8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -8,6 +8,9 @@ espressoCore = "3.5.1" lifecycleRuntimeKtx = "2.6.1" activityCompose = "1.8.0" composeBom = "2024.04.01" +appcompat = "1.6.1" +material = "1.10.0" +jetbrainsKotlinJvm = "1.9.0" [libraries] androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } @@ -24,8 +27,12 @@ androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-toolin androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" } androidx-material3 = { group = "androidx.compose.material3", name = "material3" } +androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } +material = { group = "com.google.android.material", name = "material", version.ref = "material" } [plugins] android-application = { id = "com.android.application", version.ref = "agp" } jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +android-library = { id = "com.android.library", version.ref = "agp" } +jetbrains-kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "jetbrainsKotlinJvm" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 9110da121..d222842ec 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -21,4 +21,7 @@ dependencyResolutionManagement { rootProject.name = "Terning-Android" include(":app") - \ No newline at end of file +include(":feature") +include(":data") +include(":domain") +include(":core-ui") From b916f05119324d194be6fd578121f498186b8907 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Wed, 26 Jun 2024 21:50:53 +0900 Subject: [PATCH 02/35] =?UTF-8?q?[FEAT/#1]=20=EC=9D=98=EC=A1=B4=EC=84=B1?= =?UTF-8?q?=20=EB=B0=8F=20=EB=9D=BC=EC=9D=B4=EB=B8=8C=EB=9F=AC=EB=A6=AC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 11 ++++ build.gradle.kts | 24 +++++++- core-ui/build.gradle.kts | 1 - data/build.gradle.kts | 1 + feature/build.gradle.kts | 2 + gradle/libs.versions.toml | 124 ++++++++++++++++++++++++++++++++++---- 6 files changed, 148 insertions(+), 15 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 613dd5e49..3d2438ad6 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,6 +1,9 @@ plugins { alias(libs.plugins.android.application) alias(libs.plugins.jetbrains.kotlin.android) + + // self +// alias(libs.plugins.serialization) } android { @@ -50,6 +53,11 @@ android { } dependencies { + implementation(project(":core-ui")) + implementation(project(":data")) + implementation(project(":domain")) + implementation(project(":feature")) + implementation(libs.androidx.core.ktx) implementation(libs.androidx.lifecycle.runtime.ktx) @@ -59,11 +67,14 @@ dependencies { implementation(libs.androidx.ui.graphics) implementation(libs.androidx.ui.tooling.preview) implementation(libs.androidx.material3) + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) androidTestImplementation(platform(libs.androidx.compose.bom)) androidTestImplementation(libs.androidx.ui.test.junit4) + debugImplementation(libs.androidx.ui.tooling) debugImplementation(libs.androidx.ui.test.manifest) } \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index d84b68b97..f741059c0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,4 +4,26 @@ plugins { alias(libs.plugins.jetbrains.kotlin.android) apply false alias(libs.plugins.android.library) apply false alias(libs.plugins.jetbrains.kotlin.jvm) apply false -} \ No newline at end of file + + + +} + +//plugins { +// alias(libs.plugins.android.application) apply false +// alias(libs.plugins.kotlin.android) apply false +// alias(libs.plugins.kotlin.jvm) apply false +// alias(libs.plugins.kotlin.serialization) apply false +// alias(libs.plugins.hilt) apply false +// alias(libs.plugins.ksp) apply false +// alias(libs.plugins.compose.compiler) apply false +// alias(libs.plugins.android.test) apply false +// alias(libs.plugins.android.library) apply false +//} + +buildscript { + repositories { + google() + mavenCentral() + } +} diff --git a/core-ui/build.gradle.kts b/core-ui/build.gradle.kts index f5bde3c7e..bfa7b9fba 100644 --- a/core-ui/build.gradle.kts +++ b/core-ui/build.gradle.kts @@ -33,7 +33,6 @@ android { } dependencies { - implementation(libs.androidx.core.ktx) implementation(libs.androidx.appcompat) implementation(libs.material) diff --git a/data/build.gradle.kts b/data/build.gradle.kts index 25ac4c85e..33a76174a 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -33,6 +33,7 @@ android { } dependencies { + implementation(project(":domain")) implementation(libs.androidx.core.ktx) implementation(libs.androidx.appcompat) diff --git a/feature/build.gradle.kts b/feature/build.gradle.kts index 48879e590..1d030d170 100644 --- a/feature/build.gradle.kts +++ b/feature/build.gradle.kts @@ -33,6 +33,8 @@ android { } dependencies { + implementation(project(":core-ui")) + implementation(project(":domain")) implementation(libs.androidx.core.ktx) implementation(libs.androidx.appcompat) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7b0b81fa8..b00b7fde4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,25 +1,83 @@ [versions] -agp = "8.5.0" +compileSdk = "34" +minSdk = "28" +targetSdk = "34" +versionName = "1.0.0" +versionCode = "10000" + +## Android gradle plugin +androidGradlePlugin = "8.5.0" +androidDesugarJdkLibs = "2.0.4" + +## AndroidX +androidxCore = "1.13.1" +androidxAppCompat = "1.6.1" +androidxLifecycle = "2.7.0" +androidxActivity = "1.9.0" +androidxDatastore = "1.1.1" + +## Compose +androidxComposeBom = "2024.04.01" +androidxComposeCompiler = "1.5.14" +androidxComposeNavigation = "2.8.0-beta02" +androidxComposeMaterial3 = "1.2.1" + +## Kotlin Symbol Processing +ksp = "2.0.0-1.0.21" + +## Hilt +hilt = "2.51.1" +hiltNavigationCompose = "1.2.0" + +## Network +okhttp = "4.12.0" +retrofit = "2.11.0" + +## Kotlin kotlin = "1.9.0" -coreKtx = "1.10.1" +kotlinxSerializationJson = "1.7.0-RC" +kotlinxImmutable = "0.3.7" + +## Coroutine +coroutine = "1.8.1" + +## Timber +timber = "5.0.1" + +## Test +# https://github.com/junit-team/junit4 junit = "4.13.2" junitVersion = "1.1.5" espressoCore = "3.5.1" -lifecycleRuntimeKtx = "2.6.1" -activityCompose = "1.8.0" -composeBom = "2024.04.01" -appcompat = "1.6.1" +kotest = "5.9.0" +espressoCoreVersion = "3.5.1" material = "1.10.0" +lifecycleRuntimeKtx = "2.6.1" + +## etc jetbrainsKotlinJvm = "1.9.0" [libraries] -androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } +androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCore" } +androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidxAppCompat" } junit = { group = "junit", name = "junit", version.ref = "junit" } androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } -androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } +androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "androidxActivity" } androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" } -androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" } -androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" } + +androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } + +androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" } +androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "androidxComposeMaterial3" } +androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" } +androidx-compose-ui-test = { group = "androidx.compose.ui", name = "ui-test-junit4" } +androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } +androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } +androidx-compose-ui-testManifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } +androidx-compose-navigation = { group = "androidx.navigation", name = "navigation-compose", version.ref = "androidxComposeNavigation" } +androidx-compose-navigation-test = { group = "androidx.navigation", name = "navigation-testing", version.ref = "androidxComposeNavigation" } +compose-compiler-gradle-plugin = { module = "org.jetbrains.kotlin:compose-compiler-gradle-plugin", version.ref = "kotlin" } + androidx-ui = { group = "androidx.compose.ui", name = "ui" } androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" } androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } @@ -27,12 +85,52 @@ androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-toolin androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" } androidx-material3 = { group = "androidx.compose.material3", name = "material3" } -androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } material = { group = "com.google.android.material", name = "material", version.ref = "material" } +android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" } +android-desugarJdkLibs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "androidDesugarJdkLibs" } +kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } + +androidx-lifecycle-runtimeCompose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "androidxLifecycle" } +androidx-lifecycle-viewModelCompose = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "androidxLifecycle" } +androidx-datastore = { group = "androidx.datastore", name = "datastore-preferences", version.ref = "androidxDatastore" } + +hilt-core = { group = "com.google.dagger", name = "hilt-core", version.ref = "hilt" } +hilt-compiler = { group = "com.google.dagger", name = "hilt-compiler", version.ref = "hilt" } + +hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" } +hilt-android-testing = { group = "com.google.dagger", name = "hilt-android-testing", version.ref = "hilt" } +hilt-android-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" } + +hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "hiltNavigationCompose" } + +okhttp-logging = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okhttp" } +retrofit-core = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" } +retrofit-kotlin-serialization = { module = "com.squareup.retrofit2:converter-kotlinx-serialization", version.ref = "retrofit" } + +kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" } +kotlinx-immutable = { group = "org.jetbrains.kotlinx", name = "kotlinx-collections-immutable", version.ref = "kotlinxImmutable" } + +coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutine" } +coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "coroutine" } +coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutine" } + +timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" } + +kotest-runner = { group = "io.kotest", name = "kotest-runner-junit5", version.ref = "kotest" } +kotest-assertions = { group = "io.kotest", name = "kotest-assertions-core", version.ref = "kotest" } +androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCoreVersion" } + [plugins] -android-application = { id = "com.android.application", version.ref = "agp" } +android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } -android-library = { id = "com.android.library", version.ref = "agp" } +android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" } jetbrains-kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "jetbrainsKotlinJvm" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } +hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } +compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } +android-test = { id = "com.android.test", version.ref = "androidGradlePlugin" } From b42cf8b9d4b3d2f754284c766cf625c157c5794a Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Wed, 26 Jun 2024 22:53:03 +0900 Subject: [PATCH 03/35] =?UTF-8?q?[FEAT/#1]=20app=20=EA=B7=B8=EB=9E=98?= =?UTF-8?q?=EB=93=A4=20=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 41 ++++++++++++++++++++++++++++++--------- build.gradle.kts | 24 +++++++---------------- core-ui/build.gradle.kts | 2 +- data/build.gradle.kts | 2 +- domain/build.gradle.kts | 2 +- feature/build.gradle.kts | 2 +- gradle/libs.versions.toml | 12 +----------- 7 files changed, 44 insertions(+), 41 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 3d2438ad6..f3c5e53c4 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,9 +1,7 @@ plugins { alias(libs.plugins.android.application) - alias(libs.plugins.jetbrains.kotlin.android) - - // self -// alias(libs.plugins.serialization) + alias(libs.plugins.kotlin.android) + // add more } android { @@ -58,8 +56,38 @@ dependencies { implementation(project(":domain")) implementation(project(":feature")) + // <1> KotlinDependencies + implementation(libs.kotlinx.serialization.json) + implementation(libs.coroutines.android) + //kotlin + // <2> AndroidXDependencies implementation(libs.androidx.core.ktx) + implementation(libs.androidx.appcompat) + implementation(libs.hilt.android) + // workManager + // hiltWorkManager + + // <3> KaptDependencies + implementation(libs.hilt.compiler) + // hiltWorkManagerCompiler + + // <4> TestDependencies + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.junit) + androidTestImplementation(libs.androidx.espresso.core) + androidTestImplementation(platform(libs.androidx.compose.bom)) + + // <5> ThirdPartyDependencies + // okHttpBom + // okHttp + implementation(libs.okhttp.logging) + implementation(libs.retrofit.core) + // retrofitJsonConverter + implementation(libs.timber) + // ossLicense + + // original implementation(libs.androidx.lifecycle.runtime.ktx) implementation(libs.androidx.activity.compose) implementation(platform(libs.androidx.compose.bom)) @@ -68,11 +96,6 @@ dependencies { implementation(libs.androidx.ui.tooling.preview) implementation(libs.androidx.material3) - testImplementation(libs.junit) - - androidTestImplementation(libs.androidx.junit) - androidTestImplementation(libs.androidx.espresso.core) - androidTestImplementation(platform(libs.androidx.compose.bom)) androidTestImplementation(libs.androidx.ui.test.junit4) debugImplementation(libs.androidx.ui.tooling) diff --git a/build.gradle.kts b/build.gradle.kts index f741059c0..dac7b3438 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,25 +1,15 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { alias(libs.plugins.android.application) apply false - alias(libs.plugins.jetbrains.kotlin.android) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.kotlin.jvm) apply false alias(libs.plugins.android.library) apply false - alias(libs.plugins.jetbrains.kotlin.jvm) apply false - - - -} - -//plugins { -// alias(libs.plugins.android.application) apply false -// alias(libs.plugins.kotlin.android) apply false -// alias(libs.plugins.kotlin.jvm) apply false -// alias(libs.plugins.kotlin.serialization) apply false -// alias(libs.plugins.hilt) apply false -// alias(libs.plugins.ksp) apply false + alias(libs.plugins.kotlin.serialization) apply false + alias(libs.plugins.hilt) apply false + alias(libs.plugins.ksp) apply false // alias(libs.plugins.compose.compiler) apply false -// alias(libs.plugins.android.test) apply false -// alias(libs.plugins.android.library) apply false -//} + alias(libs.plugins.android.test) apply false +} buildscript { repositories { diff --git a/core-ui/build.gradle.kts b/core-ui/build.gradle.kts index bfa7b9fba..5b346eaf6 100644 --- a/core-ui/build.gradle.kts +++ b/core-ui/build.gradle.kts @@ -1,6 +1,6 @@ plugins { alias(libs.plugins.android.library) - alias(libs.plugins.jetbrains.kotlin.android) + alias(libs.plugins.kotlin.android) } android { diff --git a/data/build.gradle.kts b/data/build.gradle.kts index 33a76174a..246be57e1 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -1,6 +1,6 @@ plugins { alias(libs.plugins.android.library) - alias(libs.plugins.jetbrains.kotlin.android) + alias(libs.plugins.kotlin.android) } android { diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts index ba1ceb047..83b4de090 100644 --- a/domain/build.gradle.kts +++ b/domain/build.gradle.kts @@ -1,6 +1,6 @@ plugins { id("java-library") - alias(libs.plugins.jetbrains.kotlin.jvm) + alias(libs.plugins.kotlin.jvm) } java { diff --git a/feature/build.gradle.kts b/feature/build.gradle.kts index 1d030d170..1ca021a40 100644 --- a/feature/build.gradle.kts +++ b/feature/build.gradle.kts @@ -1,6 +1,6 @@ plugins { alias(libs.plugins.android.library) - alias(libs.plugins.jetbrains.kotlin.android) + alias(libs.plugins.kotlin.android) } android { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b00b7fde4..bb80ee841 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -45,7 +45,6 @@ coroutine = "1.8.1" timber = "5.0.1" ## Test -# https://github.com/junit-team/junit4 junit = "4.13.2" junitVersion = "1.1.5" espressoCore = "3.5.1" @@ -54,9 +53,6 @@ espressoCoreVersion = "3.5.1" material = "1.10.0" lifecycleRuntimeKtx = "2.6.1" -## etc -jetbrainsKotlinJvm = "1.9.0" - [libraries] androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCore" } androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidxAppCompat" } @@ -64,7 +60,6 @@ junit = { group = "junit", name = "junit", version.ref = "junit" } androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "androidxActivity" } androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" } - androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" } @@ -97,7 +92,6 @@ androidx-datastore = { group = "androidx.datastore", name = "datastore-preferenc hilt-core = { group = "com.google.dagger", name = "hilt-core", version.ref = "hilt" } hilt-compiler = { group = "com.google.dagger", name = "hilt-compiler", version.ref = "hilt" } - hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" } hilt-android-testing = { group = "com.google.dagger", name = "hilt-android-testing", version.ref = "hilt" } hilt-android-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" } @@ -110,7 +104,6 @@ retrofit-kotlin-serialization = { module = "com.squareup.retrofit2:converter-kot kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" } kotlinx-immutable = { group = "org.jetbrains.kotlinx", name = "kotlinx-collections-immutable", version.ref = "kotlinxImmutable" } - coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutine" } coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "coroutine" } coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutine" } @@ -123,11 +116,8 @@ androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espres [plugins] android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } -jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } -android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" } -jetbrains-kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "jetbrainsKotlinJvm" } - kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } From 96ada34c54ddb026993d5fde1ef1acc4e273cb70 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Wed, 26 Jun 2024 23:08:31 +0900 Subject: [PATCH 04/35] =?UTF-8?q?[FEAT/#1]=20core-ui=20=EA=B7=B8=EB=9E=98?= =?UTF-8?q?=EB=93=A4=20=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core-ui/build.gradle.kts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/core-ui/build.gradle.kts b/core-ui/build.gradle.kts index 5b346eaf6..9b49e39cf 100644 --- a/core-ui/build.gradle.kts +++ b/core-ui/build.gradle.kts @@ -33,10 +33,22 @@ android { } dependencies { - implementation(libs.androidx.core.ktx) - implementation(libs.androidx.appcompat) + // <1> KotlinDependencies + // kotlin + + // <2> AndroidXDependencies + implementation(libs.androidx.lifecycle.runtime.ktx) + implementation(libs.hilt.android) + + // <3> material implementation(libs.material) + + // <4> test testImplementation(libs.junit) androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) + + // original +// implementation(libs.androidx.core.ktx) +// implementation(libs.androidx.appcompat) } \ No newline at end of file From 736c2ad74f593c158e4e880a778aaf3016437d48 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 27 Jun 2024 03:18:41 +0900 Subject: [PATCH 05/35] =?UTF-8?q?[MOD/#1]=20core-ui=20->=20core=20?= =?UTF-8?q?=EB=AA=A8=EB=93=88=20=EC=9D=B4=EB=A6=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 2 +- {core-ui => core}/.gitignore | 0 {core-ui => core}/build.gradle.kts | 0 {core-ui => core}/consumer-rules.pro | 0 {core-ui => core}/proguard-rules.pro | 0 .../java/com/terning/core/ExampleInstrumentedTest.kt | 0 {core-ui => core}/src/main/AndroidManifest.xml | 0 .../src/test/java/com/terning/core/ExampleUnitTest.kt | 0 feature/build.gradle.kts | 2 +- settings.gradle.kts | 2 +- 10 files changed, 3 insertions(+), 3 deletions(-) rename {core-ui => core}/.gitignore (100%) rename {core-ui => core}/build.gradle.kts (100%) rename {core-ui => core}/consumer-rules.pro (100%) rename {core-ui => core}/proguard-rules.pro (100%) rename {core-ui => core}/src/androidTest/java/com/terning/core/ExampleInstrumentedTest.kt (100%) rename {core-ui => core}/src/main/AndroidManifest.xml (100%) rename {core-ui => core}/src/test/java/com/terning/core/ExampleUnitTest.kt (100%) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index f3c5e53c4..d9483bc84 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -51,7 +51,7 @@ android { } dependencies { - implementation(project(":core-ui")) + implementation(project(":core")) implementation(project(":data")) implementation(project(":domain")) implementation(project(":feature")) diff --git a/core-ui/.gitignore b/core/.gitignore similarity index 100% rename from core-ui/.gitignore rename to core/.gitignore diff --git a/core-ui/build.gradle.kts b/core/build.gradle.kts similarity index 100% rename from core-ui/build.gradle.kts rename to core/build.gradle.kts diff --git a/core-ui/consumer-rules.pro b/core/consumer-rules.pro similarity index 100% rename from core-ui/consumer-rules.pro rename to core/consumer-rules.pro diff --git a/core-ui/proguard-rules.pro b/core/proguard-rules.pro similarity index 100% rename from core-ui/proguard-rules.pro rename to core/proguard-rules.pro diff --git a/core-ui/src/androidTest/java/com/terning/core/ExampleInstrumentedTest.kt b/core/src/androidTest/java/com/terning/core/ExampleInstrumentedTest.kt similarity index 100% rename from core-ui/src/androidTest/java/com/terning/core/ExampleInstrumentedTest.kt rename to core/src/androidTest/java/com/terning/core/ExampleInstrumentedTest.kt diff --git a/core-ui/src/main/AndroidManifest.xml b/core/src/main/AndroidManifest.xml similarity index 100% rename from core-ui/src/main/AndroidManifest.xml rename to core/src/main/AndroidManifest.xml diff --git a/core-ui/src/test/java/com/terning/core/ExampleUnitTest.kt b/core/src/test/java/com/terning/core/ExampleUnitTest.kt similarity index 100% rename from core-ui/src/test/java/com/terning/core/ExampleUnitTest.kt rename to core/src/test/java/com/terning/core/ExampleUnitTest.kt diff --git a/feature/build.gradle.kts b/feature/build.gradle.kts index 1ca021a40..b8a7b2f4d 100644 --- a/feature/build.gradle.kts +++ b/feature/build.gradle.kts @@ -33,7 +33,7 @@ android { } dependencies { - implementation(project(":core-ui")) + implementation(project(":core")) implementation(project(":domain")) implementation(libs.androidx.core.ktx) diff --git a/settings.gradle.kts b/settings.gradle.kts index d222842ec..8a2c140ec 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -24,4 +24,4 @@ include(":app") include(":feature") include(":data") include(":domain") -include(":core-ui") +include(":core") From 1f869c4e9c4922afd4cb8cd1634e6a4e9d89c508 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 27 Jun 2024 04:48:20 +0900 Subject: [PATCH 06/35] =?UTF-8?q?[FIX/#1]=20resources.excludes=20=EC=98=B5?= =?UTF-8?q?=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 5 +++-- build.gradle.kts | 4 ++++ data/build.gradle.kts | 27 +++++++++++++++++++++++++-- gradle/libs.versions.toml | 5 ++++- 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d9483bc84..f782b7a16 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -46,6 +46,7 @@ android { packaging { resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" + excludes += "/META-INF/gradle/incremental.annotation.processors" } } } @@ -77,6 +78,7 @@ dependencies { androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) androidTestImplementation(platform(libs.androidx.compose.bom)) + androidTestImplementation(libs.androidx.ui.test.junit4) // <5> ThirdPartyDependencies // okHttpBom @@ -96,8 +98,7 @@ dependencies { implementation(libs.androidx.ui.tooling.preview) implementation(libs.androidx.material3) - androidTestImplementation(libs.androidx.ui.test.junit4) - + // debug debugImplementation(libs.androidx.ui.tooling) debugImplementation(libs.androidx.ui.test.manifest) } \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index dac7b3438..c55260d2c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,4 +16,8 @@ buildscript { google() mavenCentral() } + +// dependencies { +// classpath "com.android.tools.build:gradle:7.0.4" +// } } diff --git a/data/build.gradle.kts b/data/build.gradle.kts index 246be57e1..c96ccf374 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -35,10 +35,33 @@ android { dependencies { implementation(project(":domain")) + // <1> AndroidXDependencies + implementation(libs.hilt.android) + // security implementation(libs.androidx.core.ktx) - implementation(libs.androidx.appcompat) - implementation(libs.material) + + // <2> KotlinDependencies + // kotlin + implementation(libs.kotlinx.serialization.json) + implementation(libs.coroutines.android) + // datetime + + // <3> ThirdPartyDependencies + implementation(libs.retrofit.core) + // okhttp + // okHttpBom + implementation(libs.okhttp.logging) + implementation(libs.retrofit2.kotlinx.serialization.converter) + implementation(libs.timber) + + // <4> TestDependencies testImplementation(libs.junit) androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) + + // original +// implementation(libs.androidx.core.ktx) +// implementation(libs.androidx.appcompat) +// implementation(libs.material) + } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index bb80ee841..195c70f06 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -26,12 +26,13 @@ androidxComposeMaterial3 = "1.2.1" ksp = "2.0.0-1.0.21" ## Hilt -hilt = "2.51.1" +hilt = "2.48.1" hiltNavigationCompose = "1.2.0" ## Network okhttp = "4.12.0" retrofit = "2.11.0" +retrofitJsonConverter = "1.0.0" ## Kotlin kotlin = "1.9.0" @@ -102,6 +103,8 @@ okhttp-logging = { group = "com.squareup.okhttp3", name = "logging-interceptor", retrofit-core = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" } retrofit-kotlin-serialization = { module = "com.squareup.retrofit2:converter-kotlinx-serialization", version.ref = "retrofit" } +retrofit2-kotlinx-serialization-converter = { module = "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter", version.ref = "retrofitJsonConverter" } + kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" } kotlinx-immutable = { group = "org.jetbrains.kotlinx", name = "kotlinx-collections-immutable", version.ref = "kotlinxImmutable" } coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutine" } From da72b0e58a80808cd23454f95038dc362d7588bb Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 27 Jun 2024 04:54:54 +0900 Subject: [PATCH 07/35] =?UTF-8?q?[FEAT/#1]=20domain=20=EA=B7=B8=EB=9E=98?= =?UTF-8?q?=EB=93=A4=20=EB=9D=BC=EC=9D=B4=EB=B8=8C=EB=9F=AC=EB=A6=AC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 8 ++++---- build.gradle.kts | 4 ---- domain/build.gradle.kts | 7 +++++++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index f782b7a16..b61007798 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -89,6 +89,10 @@ dependencies { implementation(libs.timber) // ossLicense + // debug + debugImplementation(libs.androidx.ui.tooling) + debugImplementation(libs.androidx.ui.test.manifest) + // original implementation(libs.androidx.lifecycle.runtime.ktx) implementation(libs.androidx.activity.compose) @@ -97,8 +101,4 @@ dependencies { implementation(libs.androidx.ui.graphics) implementation(libs.androidx.ui.tooling.preview) implementation(libs.androidx.material3) - - // debug - debugImplementation(libs.androidx.ui.tooling) - debugImplementation(libs.androidx.ui.test.manifest) } \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index c55260d2c..dac7b3438 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,8 +16,4 @@ buildscript { google() mavenCentral() } - -// dependencies { -// classpath "com.android.tools.build:gradle:7.0.4" -// } } diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts index 83b4de090..82c6d0704 100644 --- a/domain/build.gradle.kts +++ b/domain/build.gradle.kts @@ -6,4 +6,11 @@ plugins { java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 +} + +dependencies{ + // <1> KotlinDependencies + // kotlin + implementation(libs.coroutines.android) + // datetime } \ No newline at end of file From c6c3e955727c9d77d1d1a6dbc673636e2a691c9e Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 27 Jun 2024 05:15:07 +0900 Subject: [PATCH 08/35] =?UTF-8?q?[FEAT/#1]=20feature=20=EA=B7=B8=EB=9E=98?= =?UTF-8?q?=EB=93=A4=20=EB=9D=BC=EC=9D=B4=EB=B8=8C=EB=9F=AC=EB=A6=AC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- feature/build.gradle.kts | 40 +++++++++++++++++++++++++++++++++++++++ gradle/libs.versions.toml | 5 +++++ 2 files changed, 45 insertions(+) diff --git a/feature/build.gradle.kts b/feature/build.gradle.kts index b8a7b2f4d..976cdff1e 100644 --- a/feature/build.gradle.kts +++ b/feature/build.gradle.kts @@ -36,10 +36,50 @@ dependencies { implementation(project(":core")) implementation(project(":domain")) + // <1> KotlinDependencies + // kotlin + implementation(libs.coroutines.android) + implementation(libs.kotlinx.serialization.json) + // datetime + + // <2> AndroidXDependencies implementation(libs.androidx.core.ktx) implementation(libs.androidx.appcompat) + // constraintLayout + // startup + // legacy + // security + implementation(libs.hilt.android) + implementation(libs.androidx.lifecycle.runtime.ktx) + // lifecycleJava8 + // splashScreen + // pagingRuntime + // workManager + // hiltWorkManager + + // <3> KaptDependencies + implementation(libs.hilt.compiler) + // hiltWorkManagerCompiler + + // <4> implementation(libs.material) + implementation(libs.androidx.material3) + + // <5> TestDependencies testImplementation(libs.junit) androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) + + // <6> ThirdPartyDependencies + implementation(libs.compose.coil) + implementation(libs.timber) + // ossLicense + // progressView + // balloon + // lottie + // circularProgressBar + // circleIndicator + // flexbox + // circleImageView + } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 195c70f06..5ebdb9f91 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -45,6 +45,9 @@ coroutine = "1.8.1" ## Timber timber = "5.0.1" +## Coil +coil = "1.4.0" + ## Test junit = "4.13.2" junitVersion = "1.1.5" @@ -117,6 +120,8 @@ kotest-runner = { group = "io.kotest", name = "kotest-runner-junit5", version.re kotest-assertions = { group = "io.kotest", name = "kotest-assertions-core", version.ref = "kotest" } androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCoreVersion" } +compose-coil = {group = "io.coil-kt", name = "coil-compose", version.ref = "coil"} + [plugins] android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } From 16090adaa23e132372b45cea8b3642fbe4aacede Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 27 Jun 2024 07:31:20 +0900 Subject: [PATCH 09/35] =?UTF-8?q?[FEAT/#1]=20ui>theme=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 7 +--- .../java/com/terning/point/MainActivity.kt | 34 +---------------- build.gradle.kts | 5 +++ core/build.gradle.kts | 11 ++++++ .../java/com/terning/core}/ui/theme/Color.kt | 2 +- .../java/com/terning/core}/ui/theme/Theme.kt | 3 +- .../java/com/terning/core}/ui/theme/Type.kt | 2 +- feature/build.gradle.kts | 9 ++++- .../src/main/java/com/terning/feature/main.kt | 38 +++++++++++++++++++ gradle/libs.versions.toml | 5 ++- 10 files changed, 73 insertions(+), 43 deletions(-) rename {app/src/main/java/com/terning/point => core/src/main/java/com/terning/core}/ui/theme/Color.kt (87%) rename {app/src/main/java/com/terning/point => core/src/main/java/com/terning/core}/ui/theme/Theme.kt (96%) rename {app/src/main/java/com/terning/point => core/src/main/java/com/terning/core}/ui/theme/Type.kt (96%) create mode 100644 feature/src/main/java/com/terning/feature/main.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index b61007798..c7abecbae 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -41,7 +41,7 @@ android { compose = true } composeOptions { - kotlinCompilerExtensionVersion = "1.5.1" + kotlinCompilerExtensionVersion = "1.5.0" } packaging { resources { @@ -97,8 +97,5 @@ dependencies { implementation(libs.androidx.lifecycle.runtime.ktx) implementation(libs.androidx.activity.compose) implementation(platform(libs.androidx.compose.bom)) - implementation(libs.androidx.ui) - implementation(libs.androidx.ui.graphics) - implementation(libs.androidx.ui.tooling.preview) - implementation(libs.androidx.material3) + } \ No newline at end of file diff --git a/app/src/main/java/com/terning/point/MainActivity.kt b/app/src/main/java/com/terning/point/MainActivity.kt index 044df2a91..29d0d04d6 100644 --- a/app/src/main/java/com/terning/point/MainActivity.kt +++ b/app/src/main/java/com/terning/point/MainActivity.kt @@ -4,44 +4,14 @@ import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.padding -import androidx.compose.material3.Scaffold -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview -import com.terning.point.ui.theme.TerningAndroidTheme +import com.terning.feature.MainScreen class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) enableEdgeToEdge() setContent { - TerningAndroidTheme { - Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> - Greeting( - name = "Android", - modifier = Modifier.padding(innerPadding) - ) - } - } + MainScreen() } } -} - -@Composable -fun Greeting(name: String, modifier: Modifier = Modifier) { - Text( - text = "Hello $name!", - modifier = modifier - ) -} - -@Preview(showBackground = true) -@Composable -fun GreetingPreview() { - TerningAndroidTheme { - Greeting("Android") - } } \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index dac7b3438..a83fadb1a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,3 +17,8 @@ buildscript { mavenCentral() } } +// +//ext { +// compose_version = '1.5.0' +//} +// diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 9b49e39cf..9716378ea 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -26,10 +26,17 @@ android { compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 + } kotlinOptions { jvmTarget = "1.8" } + buildFeatures { + compose = true + } + composeOptions { + kotlinCompilerExtensionVersion = "1.5.0" + } } dependencies { @@ -42,6 +49,10 @@ dependencies { // <3> material implementation(libs.material) + implementation(libs.androidx.ui) + implementation(libs.androidx.ui.graphics) + implementation(libs.androidx.foundation.android) + implementation(libs.androidx.material3.android) // <4> test testImplementation(libs.junit) diff --git a/app/src/main/java/com/terning/point/ui/theme/Color.kt b/core/src/main/java/com/terning/core/ui/theme/Color.kt similarity index 87% rename from app/src/main/java/com/terning/point/ui/theme/Color.kt rename to core/src/main/java/com/terning/core/ui/theme/Color.kt index 8b4754781..847dcc821 100644 --- a/app/src/main/java/com/terning/point/ui/theme/Color.kt +++ b/core/src/main/java/com/terning/core/ui/theme/Color.kt @@ -1,4 +1,4 @@ -package com.terning.point.ui.theme +package com.terning.core.ui.theme import androidx.compose.ui.graphics.Color diff --git a/app/src/main/java/com/terning/point/ui/theme/Theme.kt b/core/src/main/java/com/terning/core/ui/theme/Theme.kt similarity index 96% rename from app/src/main/java/com/terning/point/ui/theme/Theme.kt rename to core/src/main/java/com/terning/core/ui/theme/Theme.kt index 600ba77a1..f826a9f05 100644 --- a/app/src/main/java/com/terning/point/ui/theme/Theme.kt +++ b/core/src/main/java/com/terning/core/ui/theme/Theme.kt @@ -1,6 +1,5 @@ -package com.terning.point.ui.theme +package com.terning.core.ui.theme -import android.app.Activity import android.os.Build import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material3.MaterialTheme diff --git a/app/src/main/java/com/terning/point/ui/theme/Type.kt b/core/src/main/java/com/terning/core/ui/theme/Type.kt similarity index 96% rename from app/src/main/java/com/terning/point/ui/theme/Type.kt rename to core/src/main/java/com/terning/core/ui/theme/Type.kt index afc585a0e..bb904414b 100644 --- a/app/src/main/java/com/terning/point/ui/theme/Type.kt +++ b/core/src/main/java/com/terning/core/ui/theme/Type.kt @@ -1,4 +1,4 @@ -package com.terning.point.ui.theme +package com.terning.core.ui.theme import androidx.compose.material3.Typography import androidx.compose.ui.text.TextStyle diff --git a/feature/build.gradle.kts b/feature/build.gradle.kts index 976cdff1e..0e5577358 100644 --- a/feature/build.gradle.kts +++ b/feature/build.gradle.kts @@ -30,6 +30,12 @@ android { kotlinOptions { jvmTarget = "1.8" } + buildFeatures { + compose = true + } + composeOptions { + kotlinCompilerExtensionVersion = "1.5.0" + } } dependencies { @@ -63,7 +69,8 @@ dependencies { // <4> implementation(libs.material) - implementation(libs.androidx.material3) + implementation(libs.androidx.material3.android) + implementation(libs.androidx.ui.tooling.preview) // <5> TestDependencies testImplementation(libs.junit) diff --git a/feature/src/main/java/com/terning/feature/main.kt b/feature/src/main/java/com/terning/feature/main.kt new file mode 100644 index 000000000..f814e3eeb --- /dev/null +++ b/feature/src/main/java/com/terning/feature/main.kt @@ -0,0 +1,38 @@ +package com.terning.feature + +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import com.terning.core.ui.theme.TerningAndroidTheme + +@Composable +fun MainScreen() { + TerningAndroidTheme { + Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> + Greeting( + name = "Android", + modifier = Modifier.padding(innerPadding) + ) + } + } +} + +@Composable +fun Greeting(name: String, modifier: Modifier = Modifier) { + Text( + text = "Hello $name!", + modifier = modifier + ) +} + +@Preview(showBackground = true) +@Composable +fun GreetingPreview() { + TerningAndroidTheme { + Greeting("Android") + } +} \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5ebdb9f91..c60d6244f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -56,6 +56,8 @@ kotest = "5.9.0" espressoCoreVersion = "3.5.1" material = "1.10.0" lifecycleRuntimeKtx = "2.6.1" +foundationAndroid = "1.6.8" +material3Android = "1.2.1" [libraries] androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCore" } @@ -83,8 +85,9 @@ androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" } -androidx-material3 = { group = "androidx.compose.material3", name = "material3" } material = { group = "com.google.android.material", name = "material", version.ref = "material" } +androidx-foundation-android = { group = "androidx.compose.foundation", name = "foundation-android", version.ref = "foundationAndroid" } +androidx-material3-android = { group = "androidx.compose.material3", name = "material3-android", version.ref = "material3Android" } android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" } android-desugarJdkLibs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "androidDesugarJdkLibs" } From e351bb20e53c9ed4bf9dc3d6c8bd024fea3693f5 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 27 Jun 2024 13:36:51 +0900 Subject: [PATCH 10/35] =?UTF-8?q?[FEAT/#1]=20buildConfig=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 17 ++++++++++++++++- app/src/main/java/com/terning/point/MyApp.kt | 19 +++++++++++++++++++ build.gradle.kts | 5 ----- core/build.gradle.kts | 1 + data/build.gradle.kts | 4 +++- feature/build.gradle.kts | 7 +++++++ 6 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 app/src/main/java/com/terning/point/MyApp.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index c7abecbae..dd11dd2b5 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,3 +1,5 @@ +import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties + plugins { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.android) @@ -19,9 +21,21 @@ android { vectorDrawables { useSupportLibrary = true } + buildConfigField( + "String", + "OPEN_BASE_URL", + gradleLocalProperties(rootDir, providers).getProperty("open.base.url") + ) } buildTypes { +// debug { +// buildConfigField( +// "String", +// "OPEN_BASE_URL", +// gradleLocalProperties(rootDir, providers).getProperty("open.base.url") +// ) +// } release { isMinifyEnabled = false proguardFiles( @@ -39,6 +53,7 @@ android { } buildFeatures { compose = true + buildConfig = true } composeOptions { kotlinCompilerExtensionVersion = "1.5.0" @@ -98,4 +113,4 @@ dependencies { implementation(libs.androidx.activity.compose) implementation(platform(libs.androidx.compose.bom)) -} \ No newline at end of file +} diff --git a/app/src/main/java/com/terning/point/MyApp.kt b/app/src/main/java/com/terning/point/MyApp.kt new file mode 100644 index 000000000..07eff05c1 --- /dev/null +++ b/app/src/main/java/com/terning/point/MyApp.kt @@ -0,0 +1,19 @@ +package com.terning.point + +import android.app.Application +import dagger.hilt.android.HiltAndroidApp +import timber.log.Timber +// +//@HiltAndroidApp +class MyApp : Application() { + + override fun onCreate() { + super.onCreate() + + initTimber() + } + + private fun initTimber(){ + if (BuildConfig.DEBUG) Timber.plant(Timber.DebugTree()) + } +} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index a83fadb1a..dac7b3438 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,8 +17,3 @@ buildscript { mavenCentral() } } -// -//ext { -// compose_version = '1.5.0' -//} -// diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 9716378ea..122a015f3 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -33,6 +33,7 @@ android { } buildFeatures { compose = true + buildConfig = true } composeOptions { kotlinCompilerExtensionVersion = "1.5.0" diff --git a/data/build.gradle.kts b/data/build.gradle.kts index c96ccf374..a5fedbd15 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -30,6 +30,9 @@ android { kotlinOptions { jvmTarget = "1.8" } + buildFeatures{ + buildConfig = true + } } dependencies { @@ -62,6 +65,5 @@ dependencies { // original // implementation(libs.androidx.core.ktx) // implementation(libs.androidx.appcompat) -// implementation(libs.material) } \ No newline at end of file diff --git a/feature/build.gradle.kts b/feature/build.gradle.kts index 0e5577358..fa7cb5560 100644 --- a/feature/build.gradle.kts +++ b/feature/build.gradle.kts @@ -32,10 +32,17 @@ android { } buildFeatures { compose = true + buildConfig = true } composeOptions { kotlinCompilerExtensionVersion = "1.5.0" } + packaging { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + excludes += "/META-INF/gradle/incremental.annotation.processors" + } + } } dependencies { From 5e1e30dee0046e236962fa4bd6bab9dbcfb9b567 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 27 Jun 2024 16:42:19 +0900 Subject: [PATCH 11/35] =?UTF-8?q?[FEAT/#1]=20OPEN=20API=20=EC=97=B0?= =?UTF-8?q?=EA=B2=B0=20=EB=A1=9C=EC=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 14 ++- app/src/main/AndroidManifest.xml | 1 + .../java/com/terning/point/MainActivity.kt | 6 +- app/src/main/java/com/terning/point/MyApp.kt | 12 ++- .../com/terning/point/di/DataSourceModule.kt | 18 ++++ .../com/terning/point/di/RepositoryModule.kt | 20 +++++ .../com/terning/point/di/RetrofitModule.kt | 79 +++++++++++++++++ .../com/terning/point/di/ServiceModule.kt | 21 +++++ .../point/di/qualifier/RetrofitQualifier.kt | 8 ++ build.gradle.kts | 3 +- .../com/terning/core/extension/ContextExt.kt | 13 +++ .../com/terning/core/extension/retrofit.kt | 6 ++ .../terning/data/datasource/MockDataSource.kt | 7 ++ .../data/datasourceimpl/MockDataSourceImpl.kt | 13 +++ .../data/dto/response/MockResponseDto.kt | 53 +++++++++++ .../data/repositoryimpl/MockRepositoryImpl.kt | 14 +++ .../com/terning/data/service/MockService.kt | 12 +++ .../main/java/com/terning/domain/MyClass.kt | 4 - .../entity/response/MockResponseModel.kt | 8 ++ .../domain/repository/MockRepository.kt | 7 ++ feature/build.gradle.kts | 8 +- .../src/main/java/com/terning/feature/main.kt | 38 -------- .../java/com/terning/feature/main/Main.kt | 87 +++++++++++++++++++ .../java/com/terning/feature/main/MockItem.kt | 52 +++++++++++ .../terning/feature/main/MockSideEffect.kt | 7 ++ .../com/terning/feature/main/MockState.kt | 10 +++ .../com/terning/feature/main/MockViewModel.kt | 48 ++++++++++ feature/src/main/res/values/strings.xml | 6 ++ gradle/libs.versions.toml | 7 ++ 29 files changed, 528 insertions(+), 54 deletions(-) create mode 100644 app/src/main/java/com/terning/point/di/DataSourceModule.kt create mode 100644 app/src/main/java/com/terning/point/di/RepositoryModule.kt create mode 100644 app/src/main/java/com/terning/point/di/RetrofitModule.kt create mode 100644 app/src/main/java/com/terning/point/di/ServiceModule.kt create mode 100644 app/src/main/java/com/terning/point/di/qualifier/RetrofitQualifier.kt create mode 100644 core/src/main/java/com/terning/core/extension/ContextExt.kt create mode 100644 core/src/main/java/com/terning/core/extension/retrofit.kt create mode 100644 data/src/main/java/com/terning/data/datasource/MockDataSource.kt create mode 100644 data/src/main/java/com/terning/data/datasourceimpl/MockDataSourceImpl.kt create mode 100644 data/src/main/java/com/terning/data/dto/response/MockResponseDto.kt create mode 100644 data/src/main/java/com/terning/data/repositoryimpl/MockRepositoryImpl.kt create mode 100644 data/src/main/java/com/terning/data/service/MockService.kt delete mode 100644 domain/src/main/java/com/terning/domain/MyClass.kt create mode 100644 domain/src/main/java/com/terning/domain/entity/response/MockResponseModel.kt create mode 100644 domain/src/main/java/com/terning/domain/repository/MockRepository.kt delete mode 100644 feature/src/main/java/com/terning/feature/main.kt create mode 100644 feature/src/main/java/com/terning/feature/main/Main.kt create mode 100644 feature/src/main/java/com/terning/feature/main/MockItem.kt create mode 100644 feature/src/main/java/com/terning/feature/main/MockSideEffect.kt create mode 100644 feature/src/main/java/com/terning/feature/main/MockState.kt create mode 100644 feature/src/main/java/com/terning/feature/main/MockViewModel.kt create mode 100644 feature/src/main/res/values/strings.xml diff --git a/app/build.gradle.kts b/app/build.gradle.kts index dd11dd2b5..2fcf1378a 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -3,7 +3,10 @@ import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties plugins { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.android) - // add more + + alias(libs.plugins.hilt) +// id("com.google.devtools.ksp") + id("kotlin-kapt") } android { @@ -81,6 +84,8 @@ dependencies { implementation(libs.androidx.core.ktx) implementation(libs.androidx.appcompat) implementation(libs.hilt.android) + kapt(libs.hilt.android.compiler) + kapt(libs.hilt.manager) // workManager // hiltWorkManager @@ -96,11 +101,12 @@ dependencies { androidTestImplementation(libs.androidx.ui.test.junit4) // <5> ThirdPartyDependencies - // okHttpBom - // okHttp + implementation(platform(libs.okhttp.bom)) + implementation(libs.okhttp) implementation(libs.okhttp.logging) implementation(libs.retrofit.core) - // retrofitJsonConverter + implementation(libs.retrofit.kotlin.serialization) + implementation(libs.retrofit2.kotlinx.serialization.converter) implementation(libs.timber) // ossLicense diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 776ed2b80..5e47f8302 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -3,6 +3,7 @@ xmlns:tools="http://schemas.android.com/tools"> + when { + message.isJsonObject() -> + Timber.tag("okhttp").d(JSONObject(message).toString(4)) + + message.isJsonArray() -> + Timber.tag("okhttp").d(JSONObject(message).toString(4)) + + else -> { + Timber.tag("okhttp").d("CONNECTION INFO -> $message") + } + } + }.apply { + level = HttpLoggingInterceptor.Level.BODY + } + + @Provides + @Singleton + fun provideOkHttpClient( + loggingInterceptor: Interceptor + ): OkHttpClient = OkHttpClient.Builder() + .addInterceptor(loggingInterceptor) + .build() + + @Provides + @Singleton + @OPEN + fun provideOpenRetrofit( + client: OkHttpClient, + factory: Converter.Factory + ): Retrofit = Retrofit.Builder() + .baseUrl(BuildConfig.OPEN_BASE_URL) + .addConverterFactory(factory) + .client(client) + .build() + +} \ No newline at end of file diff --git a/app/src/main/java/com/terning/point/di/ServiceModule.kt b/app/src/main/java/com/terning/point/di/ServiceModule.kt new file mode 100644 index 000000000..f5b745b70 --- /dev/null +++ b/app/src/main/java/com/terning/point/di/ServiceModule.kt @@ -0,0 +1,21 @@ +package com.terning.point.di + +import com.terning.data.service.MockService +import com.terning.point.di.qualifier.OPEN +import dagger.Module +import dagger.Provides +import dagger.hilt.InstallIn +import dagger.hilt.components.SingletonComponent +import retrofit2.Retrofit +import javax.inject.Singleton + +@Module +@InstallIn(SingletonComponent::class) +object ServiceModule { + + @Provides + @Singleton + fun provideFollowerService(@OPEN retrofit: Retrofit): MockService = + retrofit.create(MockService::class.java) + +} \ No newline at end of file diff --git a/app/src/main/java/com/terning/point/di/qualifier/RetrofitQualifier.kt b/app/src/main/java/com/terning/point/di/qualifier/RetrofitQualifier.kt new file mode 100644 index 000000000..fe7176d0b --- /dev/null +++ b/app/src/main/java/com/terning/point/di/qualifier/RetrofitQualifier.kt @@ -0,0 +1,8 @@ +package com.terning.point.di.qualifier + + +import javax.inject.Qualifier + +@Qualifier +@Retention(AnnotationRetention.BINARY) +annotation class OPEN \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index dac7b3438..166c23cd5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,7 +6,8 @@ plugins { alias(libs.plugins.android.library) apply false alias(libs.plugins.kotlin.serialization) apply false alias(libs.plugins.hilt) apply false - alias(libs.plugins.ksp) apply false +// alias(libs.plugins.ksp) apply false + // alias(libs.plugins.compose.compiler) apply false alias(libs.plugins.android.test) apply false } diff --git a/core/src/main/java/com/terning/core/extension/ContextExt.kt b/core/src/main/java/com/terning/core/extension/ContextExt.kt new file mode 100644 index 000000000..180e7ebb4 --- /dev/null +++ b/core/src/main/java/com/terning/core/extension/ContextExt.kt @@ -0,0 +1,13 @@ +package com.terning.core.extension + +import android.content.Context +import android.widget.Toast +import androidx.annotation.StringRes + +fun Context.shortToast(@StringRes message: Int) { + Toast.makeText(this, getString(message), Toast.LENGTH_SHORT).show() +} + +fun Context.toast(message: String) { + Toast.makeText(this, message, Toast.LENGTH_SHORT).show() +} \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/extension/retrofit.kt b/core/src/main/java/com/terning/core/extension/retrofit.kt new file mode 100644 index 000000000..27dd9c5ca --- /dev/null +++ b/core/src/main/java/com/terning/core/extension/retrofit.kt @@ -0,0 +1,6 @@ +package com.terning.core.extension + + +fun String?.isJsonObject(): Boolean = this?.startsWith("{") == true && this.endsWith("}") + +fun String?.isJsonArray(): Boolean = this?.startsWith("[") == true && this.endsWith("]") \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/datasource/MockDataSource.kt b/data/src/main/java/com/terning/data/datasource/MockDataSource.kt new file mode 100644 index 000000000..468b21bca --- /dev/null +++ b/data/src/main/java/com/terning/data/datasource/MockDataSource.kt @@ -0,0 +1,7 @@ +package com.terning.data.datasource + +import com.terning.data.dto.response.MockResponseDto + +interface MockDataSource { + suspend fun getMock(page: Int): MockResponseDto +} \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/datasourceimpl/MockDataSourceImpl.kt b/data/src/main/java/com/terning/data/datasourceimpl/MockDataSourceImpl.kt new file mode 100644 index 000000000..12aa9731f --- /dev/null +++ b/data/src/main/java/com/terning/data/datasourceimpl/MockDataSourceImpl.kt @@ -0,0 +1,13 @@ +package com.terning.data.datasourceimpl + +import com.terning.data.datasource.MockDataSource +import com.terning.data.dto.response.MockResponseDto +import com.terning.data.service.MockService +import javax.inject.Inject + +class MockDataSourceImpl @Inject constructor( + private val mockService: MockService +) : MockDataSource { + override suspend fun getMock(page: Int): MockResponseDto = + mockService.getMockListFromServer(page) +} \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/dto/response/MockResponseDto.kt b/data/src/main/java/com/terning/data/dto/response/MockResponseDto.kt new file mode 100644 index 000000000..6163bd8bd --- /dev/null +++ b/data/src/main/java/com/terning/data/dto/response/MockResponseDto.kt @@ -0,0 +1,53 @@ +package com.terning.data.dto.response + +import com.terning.domain.entity.response.MockResponseModel +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class MockResponseDto( + @SerialName("page") + val page: Int, + @SerialName("per_page") + val per_page: Int, + @SerialName("total") + val total: Int, + @SerialName("total_pages") + val total_pages: Int, + @SerialName("data") + val data: List, + @SerialName("support") + val support: Support, +) { + @Serializable + data class MockData( + @SerialName("id") + val id: Int, + @SerialName("email") + val email: String, + @SerialName("first_name") + val first_name: String, + @SerialName("last_name") + val last_name: String, + @SerialName("avatar") + val avatar: String + ) + + @Serializable + data class Support( + @SerialName("url") + val url: String, + @SerialName("text") + val text: String, + ) + + fun toMockEntity(): List = data.map { + MockResponseModel( + avatar = it.avatar, + email = it.email, + firstName = it.first_name, + lastName = it.last_name + ) + } + +} \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/repositoryimpl/MockRepositoryImpl.kt b/data/src/main/java/com/terning/data/repositoryimpl/MockRepositoryImpl.kt new file mode 100644 index 000000000..d8cd7b4fa --- /dev/null +++ b/data/src/main/java/com/terning/data/repositoryimpl/MockRepositoryImpl.kt @@ -0,0 +1,14 @@ +package com.terning.data.repositoryimpl + +import com.terning.data.datasource.MockDataSource +import com.terning.domain.entity.response.MockResponseModel +import com.terning.domain.repository.MockRepository +import javax.inject.Inject + +class MockRepositoryImpl @Inject constructor(private val mockDataSource: MockDataSource) : + MockRepository { + override suspend fun getMockList(page: Int): Result> = + runCatching { + mockDataSource.getMock(page).toMockEntity() + } +} \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/service/MockService.kt b/data/src/main/java/com/terning/data/service/MockService.kt new file mode 100644 index 000000000..fddfe0b4b --- /dev/null +++ b/data/src/main/java/com/terning/data/service/MockService.kt @@ -0,0 +1,12 @@ +package com.terning.data.service + +import com.terning.data.dto.response.MockResponseDto +import retrofit2.http.GET +import retrofit2.http.Query + +interface MockService { + @GET("api/users") + suspend fun getMockListFromServer( + @Query("page") page: Int, + ): MockResponseDto +} \ No newline at end of file diff --git a/domain/src/main/java/com/terning/domain/MyClass.kt b/domain/src/main/java/com/terning/domain/MyClass.kt deleted file mode 100644 index c43197669..000000000 --- a/domain/src/main/java/com/terning/domain/MyClass.kt +++ /dev/null @@ -1,4 +0,0 @@ -package com.terning.domain - -class MyClass { -} \ No newline at end of file diff --git a/domain/src/main/java/com/terning/domain/entity/response/MockResponseModel.kt b/domain/src/main/java/com/terning/domain/entity/response/MockResponseModel.kt new file mode 100644 index 000000000..5b272ff6b --- /dev/null +++ b/domain/src/main/java/com/terning/domain/entity/response/MockResponseModel.kt @@ -0,0 +1,8 @@ +package com.terning.domain.entity.response + +data class MockResponseModel( + val avatar: String, + val email: String, + val firstName: String, + val lastName: String, +) \ No newline at end of file diff --git a/domain/src/main/java/com/terning/domain/repository/MockRepository.kt b/domain/src/main/java/com/terning/domain/repository/MockRepository.kt new file mode 100644 index 000000000..ca5e06da8 --- /dev/null +++ b/domain/src/main/java/com/terning/domain/repository/MockRepository.kt @@ -0,0 +1,7 @@ +package com.terning.domain.repository + +import com.terning.domain.entity.response.MockResponseModel + +interface MockRepository { + suspend fun getMockList(page: Int): Result> +} \ No newline at end of file diff --git a/feature/build.gradle.kts b/feature/build.gradle.kts index fa7cb5560..b4f659e84 100644 --- a/feature/build.gradle.kts +++ b/feature/build.gradle.kts @@ -1,6 +1,7 @@ plugins { alias(libs.plugins.android.library) alias(libs.plugins.kotlin.android) + id("kotlin-kapt") } android { @@ -63,16 +64,19 @@ dependencies { // legacy // security implementation(libs.hilt.android) + implementation(libs.hilt.navigation.compose) implementation(libs.androidx.lifecycle.runtime.ktx) + implementation(libs.androidx.lifecycle.viewModelCompose ) // lifecycleJava8 // splashScreen // pagingRuntime // workManager - // hiltWorkManager // <3> KaptDependencies implementation(libs.hilt.compiler) - // hiltWorkManagerCompiler + implementation(libs.androidx.lifecycle.runtime.compose.android) + kapt(libs.hilt.android.compiler) + kapt(libs.hilt.manager) // <4> implementation(libs.material) diff --git a/feature/src/main/java/com/terning/feature/main.kt b/feature/src/main/java/com/terning/feature/main.kt deleted file mode 100644 index f814e3eeb..000000000 --- a/feature/src/main/java/com/terning/feature/main.kt +++ /dev/null @@ -1,38 +0,0 @@ -package com.terning.feature - -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.padding -import androidx.compose.material3.Scaffold -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview -import com.terning.core.ui.theme.TerningAndroidTheme - -@Composable -fun MainScreen() { - TerningAndroidTheme { - Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> - Greeting( - name = "Android", - modifier = Modifier.padding(innerPadding) - ) - } - } -} - -@Composable -fun Greeting(name: String, modifier: Modifier = Modifier) { - Text( - text = "Hello $name!", - modifier = modifier - ) -} - -@Preview(showBackground = true) -@Composable -fun GreetingPreview() { - TerningAndroidTheme { - Greeting("Android") - } -} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/main/Main.kt b/feature/src/main/java/com/terning/feature/main/Main.kt new file mode 100644 index 000000000..a403ff92e --- /dev/null +++ b/feature/src/main/java/com/terning/feature/main/Main.kt @@ -0,0 +1,87 @@ +package com.terning.feature.main + +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalLifecycleOwner +import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import androidx.lifecycle.flowWithLifecycle +import com.terning.core.extension.shortToast +import com.terning.core.ui.theme.TerningAndroidTheme +import com.terning.domain.entity.response.MockResponseModel + +@Composable +fun MainScreen( + +) { + TerningAndroidTheme { + Surface( + modifier = Modifier.fillMaxSize(), + color = MaterialTheme.colorScheme.background + ) { + MainRoute() + } + } +} + +@Composable +fun MainRoute( + viewModel: MockViewModel = hiltViewModel() +) { + + val context = LocalContext.current + val lifecycleOwner = LocalLifecycleOwner.current + + val state by viewModel.state.collectAsStateWithLifecycle(lifecycleOwner = LocalLifecycleOwner.current) + + LaunchedEffect(key1 = true) { + viewModel.getFriendsInfo(2) + } + + LaunchedEffect(viewModel.sideEffect, lifecycleOwner) { + viewModel.sideEffect.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle) + .collect { sideEffect -> + when (sideEffect) { + is MockSideEffect.Toast -> context.shortToast(sideEffect.message) + } + } + } + + when (state) { + is MockState.Empty -> {} + is MockState.Loading -> {} + is MockState.Success -> { + SearchScreen(mockList = (state as MockState.Success).mockList) + } + } +} + + +@Composable +fun SearchScreen( + mockList: List +) { + LazyColumn( + modifier = Modifier + .fillMaxSize() + .padding(20.dp) + ) { + items(mockList) { friend -> + MockItem( + name = friend.firstName, + profileImage = friend.avatar, + email = friend.email + ) + } + } +} diff --git a/feature/src/main/java/com/terning/feature/main/MockItem.kt b/feature/src/main/java/com/terning/feature/main/MockItem.kt new file mode 100644 index 000000000..4c87530f3 --- /dev/null +++ b/feature/src/main/java/com/terning/feature/main/MockItem.kt @@ -0,0 +1,52 @@ +package com.terning.feature.main + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.aspectRatio +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.width +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import coil.compose.rememberImagePainter + +@Composable +fun MockItem( + name: String, + profileImage: String, + email: String, + modifier: Modifier = Modifier +) { + Row( + modifier = modifier + .fillMaxWidth() + .padding(vertical = 10.dp), + verticalAlignment = Alignment.CenterVertically + ) { + Image( + painter = rememberImagePainter(data = profileImage), + contentDescription = "img_profile", + modifier = modifier + .size(60.dp) + .aspectRatio(1f), + ) + Spacer(modifier = modifier.width(10.dp)) + Text( + text = name, + fontSize = 18.sp, + fontWeight = FontWeight.Bold + ) + Spacer(modifier = modifier.weight(1f)) + Text( + text = email, + fontSize = 14.sp, + ) + } +} diff --git a/feature/src/main/java/com/terning/feature/main/MockSideEffect.kt b/feature/src/main/java/com/terning/feature/main/MockSideEffect.kt new file mode 100644 index 000000000..3593816aa --- /dev/null +++ b/feature/src/main/java/com/terning/feature/main/MockSideEffect.kt @@ -0,0 +1,7 @@ +package com.terning.feature.main + +import androidx.annotation.StringRes + +sealed class MockSideEffect { + data class Toast(@StringRes val message: Int) : MockSideEffect() +} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/main/MockState.kt b/feature/src/main/java/com/terning/feature/main/MockState.kt new file mode 100644 index 000000000..17fc5d4f1 --- /dev/null +++ b/feature/src/main/java/com/terning/feature/main/MockState.kt @@ -0,0 +1,10 @@ +package com.terning.feature.main + +import com.terning.domain.entity.response.MockResponseModel + + +sealed class MockState { + data object Empty : MockState() + data object Loading : MockState() + data class Success(val mockList: List) : MockState() +} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/main/MockViewModel.kt b/feature/src/main/java/com/terning/feature/main/MockViewModel.kt new file mode 100644 index 000000000..0a7cddc2c --- /dev/null +++ b/feature/src/main/java/com/terning/feature/main/MockViewModel.kt @@ -0,0 +1,48 @@ +package com.terning.feature.main + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import com.terning.domain.entity.response.MockResponseModel +import com.terning.domain.repository.MockRepository +import com.terning.feature.R +import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.SharedFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.launch +import javax.inject.Inject + +@HiltViewModel +class MockViewModel @Inject constructor(private val repository: MockRepository) : ViewModel() { + + private val _state: MutableStateFlow = + MutableStateFlow(MockState.Empty) + val state: StateFlow get() = _state.asStateFlow() + + private val _sideEffect: MutableSharedFlow = MutableSharedFlow() + val sideEffect: SharedFlow get() = _sideEffect + + fun getFriendsInfo(page: Int) { + viewModelScope.launch { + _state.value = MockState.Loading + repository.getMockList( + page + ).onSuccess { response -> + val mockDataList = response.map { entity -> + MockResponseModel( + avatar = entity.avatar, + email = entity.email, + firstName = entity.firstName, + lastName = entity.lastName + ) + } + _state.value = MockState.Success(mockDataList) + _sideEffect.emit(MockSideEffect.Toast(R.string.server_success)) + }.onFailure { + _sideEffect.emit(MockSideEffect.Toast(R.string.server_failure)) + } + } + } +} \ No newline at end of file diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml new file mode 100644 index 000000000..58c8bc6fa --- /dev/null +++ b/feature/src/main/res/values/strings.xml @@ -0,0 +1,6 @@ + + + 서버통신 성공 + 서버통신 실패 + + \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c60d6244f..024edc5cf 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -28,6 +28,7 @@ ksp = "2.0.0-1.0.21" ## Hilt hilt = "2.48.1" hiltNavigationCompose = "1.2.0" +hiltManager = "1.0.0" ## Network okhttp = "4.12.0" @@ -58,6 +59,7 @@ material = "1.10.0" lifecycleRuntimeKtx = "2.6.1" foundationAndroid = "1.6.8" material3Android = "1.2.1" +lifecycleRuntimeComposeAndroid = "2.8.2" [libraries] androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCore" } @@ -104,7 +106,10 @@ hilt-android-testing = { group = "com.google.dagger", name = "hilt-android-testi hilt-android-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" } hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "hiltNavigationCompose" } +hilt-manager = {group = "androidx.hilt" , name = "hilt-compiler", version.ref = "hiltManager"} +okhttp = {group = "com.squareup.okhttp3", name = "okhttp"} +okhttp-bom = {group = "com.squareup.okhttp3" , name = "okhttp-bom" , version.ref = "okhttp"} okhttp-logging = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okhttp" } retrofit-core = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" } retrofit-kotlin-serialization = { module = "com.squareup.retrofit2:converter-kotlinx-serialization", version.ref = "retrofit" } @@ -124,6 +129,7 @@ kotest-assertions = { group = "io.kotest", name = "kotest-assertions-core", vers androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCoreVersion" } compose-coil = {group = "io.coil-kt", name = "coil-compose", version.ref = "coil"} +androidx-lifecycle-runtime-compose-android = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose-android", version.ref = "lifecycleRuntimeComposeAndroid" } [plugins] android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } @@ -135,3 +141,4 @@ ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } android-test = { id = "com.android.test", version.ref = "androidGradlePlugin" } +#kapt = {id = " "androidx.hilt:hilt-compiler:1.0.0""} \ No newline at end of file From 8fd829442fb90ec92c198efb39eff4d3fac14001 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 27 Jun 2024 18:05:57 +0900 Subject: [PATCH 12/35] =?UTF-8?q?[FEAT/#1]=20=EC=84=9C=EB=B2=84=ED=86=B5?= =?UTF-8?q?=EC=8B=A0=20=EA=B5=AC=ED=98=84=20=EC=84=B1=EA=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 4 +++- app/src/main/AndroidManifest.xml | 2 ++ .../com/terning/point/di/ServiceModule.kt | 2 +- build.gradle.kts | 4 ++++ core/build.gradle.kts | 2 +- data/build.gradle.kts | 24 +++++++++++++++---- domain/build.gradle.kts | 3 ++- feature/build.gradle.kts | 24 ++++++++++++++++++- .../java/com/terning/feature/main/Main.kt | 2 ++ .../com/terning/feature/main/MockViewModel.kt | 5 ++-- gradle/libs.versions.toml | 3 ++- 11 files changed, 62 insertions(+), 13 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 2fcf1378a..75e8ee785 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -4,11 +4,13 @@ plugins { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.android) + id("kotlin-parcelize") alias(libs.plugins.hilt) // id("com.google.devtools.ksp") id("kotlin-kapt") } + android { namespace = "com.terning.point" compileSdk = 34 @@ -78,7 +80,7 @@ dependencies { // <1> KotlinDependencies implementation(libs.kotlinx.serialization.json) implementation(libs.coroutines.android) - //kotlin + implementation(libs.kotlin) // <2> AndroidXDependencies implementation(libs.androidx.core.ktx) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5e47f8302..2e512fa91 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,6 +2,8 @@ + + KotlinDependencies - // kotlin + implementation(libs.kotlin) // <2> AndroidXDependencies implementation(libs.androidx.lifecycle.runtime.ktx) diff --git a/data/build.gradle.kts b/data/build.gradle.kts index a5fedbd15..3c8e47d54 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -1,6 +1,13 @@ plugins { alias(libs.plugins.android.library) alias(libs.plugins.kotlin.android) + id("kotlin-parcelize") + id("kotlin-kapt") + +// id ("com.android.application") +// id ("kotlin-android") +// id ("dagger.hilt.android.plugin") + id ("kotlinx-serialization") } android { @@ -44,17 +51,17 @@ dependencies { implementation(libs.androidx.core.ktx) // <2> KotlinDependencies - // kotlin - implementation(libs.kotlinx.serialization.json) + implementation(libs.kotlin) +// implementation(libs.kotlinx.serialization.json) implementation(libs.coroutines.android) // datetime // <3> ThirdPartyDependencies implementation(libs.retrofit.core) - // okhttp - // okHttpBom + implementation(libs.okhttp) + implementation(platform(libs.okhttp.bom)) implementation(libs.okhttp.logging) - implementation(libs.retrofit2.kotlinx.serialization.converter) +// implementation(libs.retrofit2.kotlinx.serialization.converter) implementation(libs.timber) // <4> TestDependencies @@ -62,8 +69,15 @@ dependencies { androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) + implementation ("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1") +// implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0" + + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1") // 호환되는 최신 버전 사용 + implementation ("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0") + implementation ("com.squareup.retrofit2:retrofit:2.9.0") // original // implementation(libs.androidx.core.ktx) // implementation(libs.androidx.appcompat) + } \ No newline at end of file diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts index 82c6d0704..b7dc65189 100644 --- a/domain/build.gradle.kts +++ b/domain/build.gradle.kts @@ -1,6 +1,7 @@ plugins { id("java-library") alias(libs.plugins.kotlin.jvm) + id("kotlin-kapt") } java { @@ -10,7 +11,7 @@ java { dependencies{ // <1> KotlinDependencies - // kotlin + implementation(libs.kotlin) implementation(libs.coroutines.android) // datetime } \ No newline at end of file diff --git a/feature/build.gradle.kts b/feature/build.gradle.kts index b4f659e84..84c7ef626 100644 --- a/feature/build.gradle.kts +++ b/feature/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.android.library) alias(libs.plugins.kotlin.android) id("kotlin-kapt") + id("kotlin-parcelize") } android { @@ -51,7 +52,7 @@ dependencies { implementation(project(":domain")) // <1> KotlinDependencies - // kotlin + implementation(libs.kotlin) implementation(libs.coroutines.android) implementation(libs.kotlinx.serialization.json) // datetime @@ -100,4 +101,25 @@ dependencies { // flexbox // circleImageView +// implementation("androidx.core:core-ktx:1.12.0") +// implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.1") +// implementation("androidx.activity:activity-compose:1.9.0") +// implementation(platform("androidx.compose:compose-bom:2023.03.00")) +// implementation("androidx.compose.ui:ui") +// implementation ("androidx.compose.ui:ui-graphics") +// implementation ("androidx.compose.ui:ui-tooling-preview") +// implementation ("androidx.compose.material3:material3") +// implementation ("androidx.benchmark:benchmark-macro:1.2.3") +// implementation ("androidx.navigation:navigation-compose:2.7.7") +// implementation ("androidx.lifecycle:lifecycle-runtime-compose:2.8.1") +// implementation ("androidx.appcompat:appcompat:1.7.0") +// +// // hilt +// implementation("com.google.dagger:hilt-android:2.48.1") +// kapt("com.google.dagger:hilt-android-compiler:2.48.1") +// kapt("androidx.hilt:hilt-compiler:1.0.0") +// implementation("androidx.navigation:navigation-compose:2.5.3") +// implementation("androidx.hilt:hilt-navigation-compose:1.0.0") + + } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/main/Main.kt b/feature/src/main/java/com/terning/feature/main/Main.kt index a403ff92e..7a4c64588 100644 --- a/feature/src/main/java/com/terning/feature/main/Main.kt +++ b/feature/src/main/java/com/terning/feature/main/Main.kt @@ -6,6 +6,7 @@ import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue @@ -29,6 +30,7 @@ fun MainScreen( modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background ) { +// Text("hi") MainRoute() } } diff --git a/feature/src/main/java/com/terning/feature/main/MockViewModel.kt b/feature/src/main/java/com/terning/feature/main/MockViewModel.kt index 0a7cddc2c..0fd07b8fb 100644 --- a/feature/src/main/java/com/terning/feature/main/MockViewModel.kt +++ b/feature/src/main/java/com/terning/feature/main/MockViewModel.kt @@ -1,5 +1,6 @@ package com.terning.feature.main +import android.util.Log import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.terning.domain.entity.response.MockResponseModel @@ -40,9 +41,9 @@ class MockViewModel @Inject constructor(private val repository: MockRepository) } _state.value = MockState.Success(mockDataList) _sideEffect.emit(MockSideEffect.Toast(R.string.server_success)) - }.onFailure { + }.onFailure {throwable -> _sideEffect.emit(MockSideEffect.Toast(R.string.server_failure)) - } + Log.e("LYB", "Error fetching mock data", throwable) } } } } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 024edc5cf..be4ecefb4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -121,7 +121,7 @@ kotlinx-immutable = { group = "org.jetbrains.kotlinx", name = "kotlinx-collectio coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutine" } coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "coroutine" } coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutine" } - +kotlin = {group = "org.jetbrains.kotlin" , name = "kotlin-stdlib", version.ref = "kotlin"} timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" } kotest-runner = { group = "io.kotest", name = "kotest-runner-junit5", version.ref = "kotest" } @@ -131,6 +131,7 @@ androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espres compose-coil = {group = "io.coil-kt", name = "coil-compose", version.ref = "coil"} androidx-lifecycle-runtime-compose-android = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose-android", version.ref = "lifecycleRuntimeComposeAndroid" } + [plugins] android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } From 7b74e19e3e60c50f1d49361139e28ab223193dc2 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Fri, 28 Jun 2024 00:46:15 +0900 Subject: [PATCH 13/35] =?UTF-8?q?[CHORE/#1]=20data=20=EB=AA=A8=EB=93=88=20?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=A0=95?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/build.gradle.kts | 35 ++++++++--------------------------- gradle/libs.versions.toml | 22 ++++++++++++---------- 2 files changed, 20 insertions(+), 37 deletions(-) diff --git a/data/build.gradle.kts b/data/build.gradle.kts index 3c8e47d54..c34b76e38 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -1,13 +1,7 @@ plugins { alias(libs.plugins.android.library) alias(libs.plugins.kotlin.android) - id("kotlin-parcelize") - id("kotlin-kapt") - -// id ("com.android.application") -// id ("kotlin-android") -// id ("dagger.hilt.android.plugin") - id ("kotlinx-serialization") + alias(libs.plugins.kotlin.serialization ) } android { @@ -45,39 +39,26 @@ android { dependencies { implementation(project(":domain")) - // <1> AndroidXDependencies + // AndroidXDependencies implementation(libs.hilt.android) - // security + implementation(libs.androidx.security) implementation(libs.androidx.core.ktx) - // <2> KotlinDependencies + // KotlinDependencies implementation(libs.kotlin) -// implementation(libs.kotlinx.serialization.json) + implementation(libs.kotlinx.serialization.json.v151) implementation(libs.coroutines.android) - // datetime - // <3> ThirdPartyDependencies + // ThirdPartyDependencies implementation(libs.retrofit.core) implementation(libs.okhttp) implementation(platform(libs.okhttp.bom)) implementation(libs.okhttp.logging) -// implementation(libs.retrofit2.kotlinx.serialization.converter) + implementation (libs.retrofit2.kotlinx.serialization.converter.v080) implementation(libs.timber) - // <4> TestDependencies + // TestDependencies testImplementation(libs.junit) androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) - - implementation ("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1") -// implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0" - - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1") // 호환되는 최신 버전 사용 - implementation ("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0") - implementation ("com.squareup.retrofit2:retrofit:2.9.0") - // original -// implementation(libs.androidx.core.ktx) -// implementation(libs.androidx.appcompat) - - } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index be4ecefb4..a43606ab6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -34,11 +34,13 @@ hiltManager = "1.0.0" okhttp = "4.12.0" retrofit = "2.11.0" retrofitJsonConverter = "1.0.0" +retrofit2KotlinxSerializationConverter = "0.8.0" ## Kotlin kotlin = "1.9.0" kotlinxSerializationJson = "1.7.0-RC" kotlinxImmutable = "0.3.7" +kotlinxSerializationJsonVersion = "1.5.1" ## Coroutine coroutine = "1.8.1" @@ -49,6 +51,9 @@ timber = "5.0.1" ## Coil coil = "1.4.0" +## Security +securityVersion = "1.1.0-alpha06" + ## Test junit = "4.13.2" junitVersion = "1.1.5" @@ -87,14 +92,12 @@ androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" } -material = { group = "com.google.android.material", name = "material", version.ref = "material" } androidx-foundation-android = { group = "androidx.compose.foundation", name = "foundation-android", version.ref = "foundationAndroid" } androidx-material3-android = { group = "androidx.compose.material3", name = "material3-android", version.ref = "material3Android" } - +androidx-lifecycle-runtime-compose-android = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose-android", version.ref = "lifecycleRuntimeComposeAndroid" } +androidx-security = {group = "androidx.security", name = "security-crypto" , version.ref = "securityVersion"} android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" } android-desugarJdkLibs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "androidDesugarJdkLibs" } -kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } - androidx-lifecycle-runtimeCompose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "androidxLifecycle" } androidx-lifecycle-viewModelCompose = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "androidxLifecycle" } androidx-datastore = { group = "androidx.datastore", name = "datastore-preferences", version.ref = "androidxDatastore" } @@ -104,7 +107,6 @@ hilt-compiler = { group = "com.google.dagger", name = "hilt-compiler", version.r hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" } hilt-android-testing = { group = "com.google.dagger", name = "hilt-android-testing", version.ref = "hilt" } hilt-android-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" } - hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "hiltNavigationCompose" } hilt-manager = {group = "androidx.hilt" , name = "hilt-compiler", version.ref = "hiltManager"} @@ -113,24 +115,25 @@ okhttp-bom = {group = "com.squareup.okhttp3" , name = "okhttp-bom" , version.ref okhttp-logging = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okhttp" } retrofit-core = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" } retrofit-kotlin-serialization = { module = "com.squareup.retrofit2:converter-kotlinx-serialization", version.ref = "retrofit" } - retrofit2-kotlinx-serialization-converter = { module = "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter", version.ref = "retrofitJsonConverter" } +retrofit2-kotlinx-serialization-converter-v080 = { module = "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter", version.ref = "retrofit2KotlinxSerializationConverter" } +kotlinx-serialization-json-v151 = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJsonVersion" } kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" } kotlinx-immutable = { group = "org.jetbrains.kotlinx", name = "kotlinx-collections-immutable", version.ref = "kotlinxImmutable" } coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutine" } coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "coroutine" } coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutine" } kotlin = {group = "org.jetbrains.kotlin" , name = "kotlin-stdlib", version.ref = "kotlin"} -timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" } +kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } kotest-runner = { group = "io.kotest", name = "kotest-runner-junit5", version.ref = "kotest" } kotest-assertions = { group = "io.kotest", name = "kotest-assertions-core", version.ref = "kotest" } androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCoreVersion" } compose-coil = {group = "io.coil-kt", name = "coil-compose", version.ref = "coil"} -androidx-lifecycle-runtime-compose-android = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose-android", version.ref = "lifecycleRuntimeComposeAndroid" } - +material = { group = "com.google.android.material", name = "material", version.ref = "material" } +timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" } [plugins] android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } @@ -142,4 +145,3 @@ ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } android-test = { id = "com.android.test", version.ref = "androidGradlePlugin" } -#kapt = {id = " "androidx.hilt:hilt-compiler:1.0.0""} \ No newline at end of file From e76710b950712e00259c35b02acb09d628813cb3 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Fri, 28 Jun 2024 01:12:26 +0900 Subject: [PATCH 14/35] =?UTF-8?q?[CHORE/#1]=20domain=20=EB=AA=A8=EB=93=88?= =?UTF-8?q?=20=EB=9D=BC=EC=9D=B4=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=A0=95?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 2 -- build.gradle.kts | 7 ------- data/build.gradle.kts | 2 +- domain/build.gradle.kts | 4 +--- gradle/libs.versions.toml | 2 -- 5 files changed, 2 insertions(+), 15 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 75e8ee785..3e39f8f0d 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -6,7 +6,6 @@ plugins { id("kotlin-parcelize") alias(libs.plugins.hilt) -// id("com.google.devtools.ksp") id("kotlin-kapt") } @@ -120,5 +119,4 @@ dependencies { implementation(libs.androidx.lifecycle.runtime.ktx) implementation(libs.androidx.activity.compose) implementation(platform(libs.androidx.compose.bom)) - } diff --git a/build.gradle.kts b/build.gradle.kts index faae3b256..70af31f0a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,9 +6,6 @@ plugins { alias(libs.plugins.android.library) apply false alias(libs.plugins.kotlin.serialization) apply false alias(libs.plugins.hilt) apply false -// alias(libs.plugins.ksp) apply false - -// alias(libs.plugins.compose.compiler) apply false alias(libs.plugins.android.test) apply false } @@ -17,8 +14,4 @@ buildscript { google() mavenCentral() } - dependencies { - classpath("com.android.tools.build:gradle:8.5.0") - classpath("com.google.dagger:hilt-android-gradle-plugin:2.48.1") - } } diff --git a/data/build.gradle.kts b/data/build.gradle.kts index c34b76e38..0ac25031d 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -1,7 +1,7 @@ plugins { alias(libs.plugins.android.library) alias(libs.plugins.kotlin.android) - alias(libs.plugins.kotlin.serialization ) + alias(libs.plugins.kotlin.serialization) } android { diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts index b7dc65189..15b31b140 100644 --- a/domain/build.gradle.kts +++ b/domain/build.gradle.kts @@ -1,7 +1,7 @@ plugins { id("java-library") - alias(libs.plugins.kotlin.jvm) id("kotlin-kapt") + alias(libs.plugins.kotlin.jvm) } java { @@ -10,8 +10,6 @@ java { } dependencies{ - // <1> KotlinDependencies implementation(libs.kotlin) implementation(libs.coroutines.android) - // datetime } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a43606ab6..fc3c19c5e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -141,7 +141,5 @@ kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } -ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } -compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } android-test = { id = "com.android.test", version.ref = "androidGradlePlugin" } From 5ff50fbea695cd5e88c1aceed53b2f2aa01839f6 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Fri, 28 Jun 2024 01:26:50 +0900 Subject: [PATCH 15/35] =?UTF-8?q?[CHORE/#1]=20=EB=A7=A4=EB=8B=88=ED=8E=98?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2e512fa91..eae3138ec 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -18,6 +18,7 @@ From 17c9f777cfdf74c8a776bc4b9a061c12b6a3caaf Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Fri, 28 Jun 2024 01:28:12 +0900 Subject: [PATCH 16/35] =?UTF-8?q?[CHORE/#1]=20core=20=EB=AA=A8=EB=93=88=20?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=A0=95?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/build.gradle.kts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/core/build.gradle.kts b/core/build.gradle.kts index fe8384a17..8e6aa1c91 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -41,26 +41,22 @@ android { } dependencies { - // <1> KotlinDependencies + // KotlinDependencies implementation(libs.kotlin) - // <2> AndroidXDependencies + // AndroidXDependencies implementation(libs.androidx.lifecycle.runtime.ktx) implementation(libs.hilt.android) - // <3> material + // material implementation(libs.material) implementation(libs.androidx.ui) implementation(libs.androidx.ui.graphics) implementation(libs.androidx.foundation.android) implementation(libs.androidx.material3.android) - // <4> test + // test testImplementation(libs.junit) androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) - - // original -// implementation(libs.androidx.core.ktx) -// implementation(libs.androidx.appcompat) } \ No newline at end of file From e2ad5b4043fb812bf7e00ee2fef1517bcaa9e895 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Fri, 28 Jun 2024 02:07:55 +0900 Subject: [PATCH 17/35] =?UTF-8?q?[CHORE/#1]=20app=20=EB=AA=A8=EB=93=88=20?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=A0=95?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 45 +++++++++++++-------------------------- core/build.gradle.kts | 4 ---- data/build.gradle.kts | 4 ---- feature/build.gradle.kts | 21 ------------------ gradle/libs.versions.toml | 9 +++++--- 5 files changed, 21 insertions(+), 62 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 3e39f8f0d..501635d01 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -3,13 +3,11 @@ import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties plugins { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.android) - - id("kotlin-parcelize") alias(libs.plugins.hilt) + id("kotlin-parcelize") id("kotlin-kapt") } - android { namespace = "com.terning.point" compileSdk = 34 @@ -25,21 +23,16 @@ android { vectorDrawables { useSupportLibrary = true } - buildConfigField( - "String", - "OPEN_BASE_URL", - gradleLocalProperties(rootDir, providers).getProperty("open.base.url") - ) } buildTypes { -// debug { -// buildConfigField( -// "String", -// "OPEN_BASE_URL", -// gradleLocalProperties(rootDir, providers).getProperty("open.base.url") -// ) -// } + debug { + buildConfigField( + "String", + "OPEN_BASE_URL", + gradleLocalProperties(rootDir, providers).getProperty("open.base.url") + ) + } release { isMinifyEnabled = false proguardFiles( @@ -76,32 +69,30 @@ dependencies { implementation(project(":domain")) implementation(project(":feature")) - // <1> KotlinDependencies implementation(libs.kotlinx.serialization.json) implementation(libs.coroutines.android) implementation(libs.kotlin) - // <2> AndroidXDependencies implementation(libs.androidx.core.ktx) implementation(libs.androidx.appcompat) implementation(libs.hilt.android) kapt(libs.hilt.android.compiler) kapt(libs.hilt.manager) - // workManager - // hiltWorkManager + implementation(libs.androidx.lifecycle.runtime.ktx) + implementation(libs.androidx.activity.compose) + implementation(platform(libs.androidx.compose.bom)) + implementation(libs.androidx.workManager) + implementation(libs.androidx.hiltWorkManager) - // <3> KaptDependencies implementation(libs.hilt.compiler) - // hiltWorkManagerCompiler + implementation(libs.androidx.hiltWorkManagerCompiler) - // <4> TestDependencies testImplementation(libs.junit) androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) androidTestImplementation(platform(libs.androidx.compose.bom)) androidTestImplementation(libs.androidx.ui.test.junit4) - // <5> ThirdPartyDependencies implementation(platform(libs.okhttp.bom)) implementation(libs.okhttp) implementation(libs.okhttp.logging) @@ -109,14 +100,8 @@ dependencies { implementation(libs.retrofit.kotlin.serialization) implementation(libs.retrofit2.kotlinx.serialization.converter) implementation(libs.timber) - // ossLicense + implementation(libs.ossLicense) - // debug debugImplementation(libs.androidx.ui.tooling) debugImplementation(libs.androidx.ui.test.manifest) - - // original - implementation(libs.androidx.lifecycle.runtime.ktx) - implementation(libs.androidx.activity.compose) - implementation(platform(libs.androidx.compose.bom)) } diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 8e6aa1c91..859a58488 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -41,21 +41,17 @@ android { } dependencies { - // KotlinDependencies implementation(libs.kotlin) - // AndroidXDependencies implementation(libs.androidx.lifecycle.runtime.ktx) implementation(libs.hilt.android) - // material implementation(libs.material) implementation(libs.androidx.ui) implementation(libs.androidx.ui.graphics) implementation(libs.androidx.foundation.android) implementation(libs.androidx.material3.android) - // test testImplementation(libs.junit) androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) diff --git a/data/build.gradle.kts b/data/build.gradle.kts index 0ac25031d..cd10cb9f2 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -39,17 +39,14 @@ android { dependencies { implementation(project(":domain")) - // AndroidXDependencies implementation(libs.hilt.android) implementation(libs.androidx.security) implementation(libs.androidx.core.ktx) - // KotlinDependencies implementation(libs.kotlin) implementation(libs.kotlinx.serialization.json.v151) implementation(libs.coroutines.android) - // ThirdPartyDependencies implementation(libs.retrofit.core) implementation(libs.okhttp) implementation(platform(libs.okhttp.bom)) @@ -57,7 +54,6 @@ dependencies { implementation (libs.retrofit2.kotlinx.serialization.converter.v080) implementation(libs.timber) - // TestDependencies testImplementation(libs.junit) androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) diff --git a/feature/build.gradle.kts b/feature/build.gradle.kts index 84c7ef626..3a21ce306 100644 --- a/feature/build.gradle.kts +++ b/feature/build.gradle.kts @@ -101,25 +101,4 @@ dependencies { // flexbox // circleImageView -// implementation("androidx.core:core-ktx:1.12.0") -// implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.1") -// implementation("androidx.activity:activity-compose:1.9.0") -// implementation(platform("androidx.compose:compose-bom:2023.03.00")) -// implementation("androidx.compose.ui:ui") -// implementation ("androidx.compose.ui:ui-graphics") -// implementation ("androidx.compose.ui:ui-tooling-preview") -// implementation ("androidx.compose.material3:material3") -// implementation ("androidx.benchmark:benchmark-macro:1.2.3") -// implementation ("androidx.navigation:navigation-compose:2.7.7") -// implementation ("androidx.lifecycle:lifecycle-runtime-compose:2.8.1") -// implementation ("androidx.appcompat:appcompat:1.7.0") -// -// // hilt -// implementation("com.google.dagger:hilt-android:2.48.1") -// kapt("com.google.dagger:hilt-android-compiler:2.48.1") -// kapt("androidx.hilt:hilt-compiler:1.0.0") -// implementation("androidx.navigation:navigation-compose:2.5.3") -// implementation("androidx.hilt:hilt-navigation-compose:1.0.0") - - } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fc3c19c5e..2368fc26d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -22,9 +22,6 @@ androidxComposeCompiler = "1.5.14" androidxComposeNavigation = "2.8.0-beta02" androidxComposeMaterial3 = "1.2.1" -## Kotlin Symbol Processing -ksp = "2.0.0-1.0.21" - ## Hilt hilt = "2.48.1" hiltNavigationCompose = "1.2.0" @@ -35,6 +32,8 @@ okhttp = "4.12.0" retrofit = "2.11.0" retrofitJsonConverter = "1.0.0" retrofit2KotlinxSerializationConverter = "0.8.0" +workManagerVersion = "2.8.1" +ossVersion = "17.0.0" ## Kotlin kotlin = "1.9.0" @@ -74,6 +73,9 @@ androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "j androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "androidxActivity" } androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" } androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } +androidx-workManager = {group = "androidx.work", name = "work-runtime-ktx", version.ref = "workManagerVersion"} +androidx-hiltWorkManager = {group = "androidx.hilt", name = "hilt-work", version.ref = "hiltManager"} +androidx-hiltWorkManagerCompiler = {group = "androidx.hilt", name = "hilt-compiler" , version.ref = "hiltManager"} androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" } androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "androidxComposeMaterial3" } @@ -134,6 +136,7 @@ androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espres compose-coil = {group = "io.coil-kt", name = "coil-compose", version.ref = "coil"} material = { group = "com.google.android.material", name = "material", version.ref = "material" } timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" } +ossLicense = {group = "com.google.android.gms", name = "play-services-oss-licenses", version.ref = "ossVersion"} [plugins] android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } From e30af37fb42e06781fcc48f34ff8243c22e204e3 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Fri, 28 Jun 2024 03:00:02 +0900 Subject: [PATCH 18/35] =?UTF-8?q?[CHORE/#1]=20feature=20=EB=AA=A8=EB=93=88?= =?UTF-8?q?=20=EB=9D=BC=EC=9D=B4=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=A0=95?= =?UTF-8?q?=EB=A6=AC=20=EB=B0=8F=20=ED=8C=8C=EC=9D=BC=20=EC=9D=B4=EB=A6=84?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/terning/point/MainActivity.kt | 6 ++-- .../com/terning/core/extension/ContextExt.kt | 6 ++-- feature/build.gradle.kts | 28 +++---------------- .../feature/{main => mock}/MockItem.kt | 2 +- .../{main/Main.kt => mock/MockScreen.kt} | 14 ++++------ .../feature/{main => mock}/MockSideEffect.kt | 2 +- .../feature/{main => mock}/MockState.kt | 2 +- .../feature/{main => mock}/MockViewModel.kt | 7 ++--- gradle/libs.versions.toml | 2 ++ 9 files changed, 24 insertions(+), 45 deletions(-) rename feature/src/main/java/com/terning/feature/{main => mock}/MockItem.kt (97%) rename feature/src/main/java/com/terning/feature/{main/Main.kt => mock/MockScreen.kt} (88%) rename feature/src/main/java/com/terning/feature/{main => mock}/MockSideEffect.kt (80%) rename feature/src/main/java/com/terning/feature/{main => mock}/MockState.kt (87%) rename feature/src/main/java/com/terning/feature/{main => mock}/MockViewModel.kt (90%) diff --git a/app/src/main/java/com/terning/point/MainActivity.kt b/app/src/main/java/com/terning/point/MainActivity.kt index 33fd98091..ede48a0b4 100644 --- a/app/src/main/java/com/terning/point/MainActivity.kt +++ b/app/src/main/java/com/terning/point/MainActivity.kt @@ -4,16 +4,16 @@ import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge -import com.terning.feature.main.MainScreen +import com.terning.feature.mock.MockScreen import dagger.hilt.android.AndroidEntryPoint @AndroidEntryPoint class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) -// enableEdgeToEdge() + enableEdgeToEdge() setContent { - MainScreen() + MockScreen() } } } \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/extension/ContextExt.kt b/core/src/main/java/com/terning/core/extension/ContextExt.kt index 180e7ebb4..370fb9f06 100644 --- a/core/src/main/java/com/terning/core/extension/ContextExt.kt +++ b/core/src/main/java/com/terning/core/extension/ContextExt.kt @@ -4,10 +4,10 @@ import android.content.Context import android.widget.Toast import androidx.annotation.StringRes -fun Context.shortToast(@StringRes message: Int) { +fun Context.toast(@StringRes message: Int) { Toast.makeText(this, getString(message), Toast.LENGTH_SHORT).show() } -fun Context.toast(message: String) { - Toast.makeText(this, message, Toast.LENGTH_SHORT).show() +fun Context.longToast(@StringRes message: Int) { + Toast.makeText(this, getString(message), Toast.LENGTH_SHORT).show() } \ No newline at end of file diff --git a/feature/build.gradle.kts b/feature/build.gradle.kts index 3a21ce306..4ea2ab83d 100644 --- a/feature/build.gradle.kts +++ b/feature/build.gradle.kts @@ -51,54 +51,34 @@ dependencies { implementation(project(":core")) implementation(project(":domain")) - // <1> KotlinDependencies implementation(libs.kotlin) implementation(libs.coroutines.android) implementation(libs.kotlinx.serialization.json) - // datetime - // <2> AndroidXDependencies implementation(libs.androidx.core.ktx) implementation(libs.androidx.appcompat) - // constraintLayout - // startup - // legacy - // security implementation(libs.hilt.android) implementation(libs.hilt.navigation.compose) implementation(libs.androidx.lifecycle.runtime.ktx) - implementation(libs.androidx.lifecycle.viewModelCompose ) - // lifecycleJava8 - // splashScreen - // pagingRuntime - // workManager + implementation(libs.androidx.lifecycle.viewModelCompose) + implementation(libs.androidx.workManager) - // <3> KaptDependencies implementation(libs.hilt.compiler) implementation(libs.androidx.lifecycle.runtime.compose.android) kapt(libs.hilt.android.compiler) kapt(libs.hilt.manager) - // <4> implementation(libs.material) implementation(libs.androidx.material3.android) implementation(libs.androidx.ui.tooling.preview) - // <5> TestDependencies testImplementation(libs.junit) androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) - // <6> ThirdPartyDependencies implementation(libs.compose.coil) implementation(libs.timber) - // ossLicense - // progressView - // balloon - // lottie - // circularProgressBar - // circleIndicator - // flexbox - // circleImageView + implementation(libs.ossLicense) + implementation(libs.lottie) } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/main/MockItem.kt b/feature/src/main/java/com/terning/feature/mock/MockItem.kt similarity index 97% rename from feature/src/main/java/com/terning/feature/main/MockItem.kt rename to feature/src/main/java/com/terning/feature/mock/MockItem.kt index 4c87530f3..2cd3c9135 100644 --- a/feature/src/main/java/com/terning/feature/main/MockItem.kt +++ b/feature/src/main/java/com/terning/feature/mock/MockItem.kt @@ -1,4 +1,4 @@ -package com.terning.feature.main +package com.terning.feature.mock import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Row diff --git a/feature/src/main/java/com/terning/feature/main/Main.kt b/feature/src/main/java/com/terning/feature/mock/MockScreen.kt similarity index 88% rename from feature/src/main/java/com/terning/feature/main/Main.kt rename to feature/src/main/java/com/terning/feature/mock/MockScreen.kt index 7a4c64588..f9eceebc4 100644 --- a/feature/src/main/java/com/terning/feature/main/Main.kt +++ b/feature/src/main/java/com/terning/feature/mock/MockScreen.kt @@ -1,4 +1,4 @@ -package com.terning.feature.main +package com.terning.feature.mock import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding @@ -6,7 +6,6 @@ import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface -import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue @@ -17,12 +16,12 @@ import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle -import com.terning.core.extension.shortToast +import com.terning.core.extension.toast import com.terning.core.ui.theme.TerningAndroidTheme import com.terning.domain.entity.response.MockResponseModel @Composable -fun MainScreen( +fun MockScreen( ) { TerningAndroidTheme { @@ -30,14 +29,13 @@ fun MainScreen( modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background ) { -// Text("hi") - MainRoute() + MockRoute() } } } @Composable -fun MainRoute( +fun MockRoute( viewModel: MockViewModel = hiltViewModel() ) { @@ -54,7 +52,7 @@ fun MainRoute( viewModel.sideEffect.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle) .collect { sideEffect -> when (sideEffect) { - is MockSideEffect.Toast -> context.shortToast(sideEffect.message) + is MockSideEffect.Toast -> context.toast(sideEffect.message) } } } diff --git a/feature/src/main/java/com/terning/feature/main/MockSideEffect.kt b/feature/src/main/java/com/terning/feature/mock/MockSideEffect.kt similarity index 80% rename from feature/src/main/java/com/terning/feature/main/MockSideEffect.kt rename to feature/src/main/java/com/terning/feature/mock/MockSideEffect.kt index 3593816aa..faf43e51f 100644 --- a/feature/src/main/java/com/terning/feature/main/MockSideEffect.kt +++ b/feature/src/main/java/com/terning/feature/mock/MockSideEffect.kt @@ -1,4 +1,4 @@ -package com.terning.feature.main +package com.terning.feature.mock import androidx.annotation.StringRes diff --git a/feature/src/main/java/com/terning/feature/main/MockState.kt b/feature/src/main/java/com/terning/feature/mock/MockState.kt similarity index 87% rename from feature/src/main/java/com/terning/feature/main/MockState.kt rename to feature/src/main/java/com/terning/feature/mock/MockState.kt index 17fc5d4f1..43fd71de7 100644 --- a/feature/src/main/java/com/terning/feature/main/MockState.kt +++ b/feature/src/main/java/com/terning/feature/mock/MockState.kt @@ -1,4 +1,4 @@ -package com.terning.feature.main +package com.terning.feature.mock import com.terning.domain.entity.response.MockResponseModel diff --git a/feature/src/main/java/com/terning/feature/main/MockViewModel.kt b/feature/src/main/java/com/terning/feature/mock/MockViewModel.kt similarity index 90% rename from feature/src/main/java/com/terning/feature/main/MockViewModel.kt rename to feature/src/main/java/com/terning/feature/mock/MockViewModel.kt index 0fd07b8fb..264b7cb7d 100644 --- a/feature/src/main/java/com/terning/feature/main/MockViewModel.kt +++ b/feature/src/main/java/com/terning/feature/mock/MockViewModel.kt @@ -1,6 +1,5 @@ -package com.terning.feature.main +package com.terning.feature.mock -import android.util.Log import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.terning.domain.entity.response.MockResponseModel @@ -41,9 +40,9 @@ class MockViewModel @Inject constructor(private val repository: MockRepository) } _state.value = MockState.Success(mockDataList) _sideEffect.emit(MockSideEffect.Toast(R.string.server_success)) - }.onFailure {throwable -> + }.onFailure { _sideEffect.emit(MockSideEffect.Toast(R.string.server_failure)) - Log.e("LYB", "Error fetching mock data", throwable) } + } } } } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2368fc26d..7542787de 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -64,6 +64,7 @@ lifecycleRuntimeKtx = "2.6.1" foundationAndroid = "1.6.8" material3Android = "1.2.1" lifecycleRuntimeComposeAndroid = "2.8.2" +lottieVersion = "6.0.0" [libraries] androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCore" } @@ -137,6 +138,7 @@ compose-coil = {group = "io.coil-kt", name = "coil-compose", version.ref = "coil material = { group = "com.google.android.material", name = "material", version.ref = "material" } timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" } ossLicense = {group = "com.google.android.gms", name = "play-services-oss-licenses", version.ref = "ossVersion"} +lottie = {group = "com.airbnb.android", name = "lottie", version.ref = "lottieVersion"} [plugins] android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } From 4649217bb59c223f47858f1eedca9f96f3b0caf0 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Fri, 28 Jun 2024 03:13:03 +0900 Subject: [PATCH 19/35] =?UTF-8?q?[ADD/#1]=20util=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/core/extension/ContextExt.kt | 11 ++++++++++- .../java/com/terning/core/extension/Modifier.kt | 16 ++++++++++++++++ .../core/extension/{retrofit.kt => Retrofit.kt} | 0 .../main/java/com/terning/core/state/UiState.kt | 15 +++++++++++++++ .../java/com/terning/data/dto/BaseResponse.kt | 16 ++++++++++++++++ .../com/terning/data/dto/NonDataBaseResponse.kt | 14 ++++++++++++++ 6 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 core/src/main/java/com/terning/core/extension/Modifier.kt rename core/src/main/java/com/terning/core/extension/{retrofit.kt => Retrofit.kt} (100%) create mode 100644 core/src/main/java/com/terning/core/state/UiState.kt create mode 100644 data/src/main/java/com/terning/data/dto/BaseResponse.kt create mode 100644 data/src/main/java/com/terning/data/dto/NonDataBaseResponse.kt diff --git a/core/src/main/java/com/terning/core/extension/ContextExt.kt b/core/src/main/java/com/terning/core/extension/ContextExt.kt index 370fb9f06..9981be3b2 100644 --- a/core/src/main/java/com/terning/core/extension/ContextExt.kt +++ b/core/src/main/java/com/terning/core/extension/ContextExt.kt @@ -1,6 +1,9 @@ package com.terning.core.extension +import android.app.Activity import android.content.Context +import android.view.View +import android.view.inputmethod.InputMethodManager import android.widget.Toast import androidx.annotation.StringRes @@ -10,4 +13,10 @@ fun Context.toast(@StringRes message: Int) { fun Context.longToast(@StringRes message: Int) { Toast.makeText(this, getString(message), Toast.LENGTH_SHORT).show() -} \ No newline at end of file +} + +fun Context.hideKeyboard(view: View) { + val inputMethodManager = getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager + inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0) + view.clearFocus() +} diff --git a/core/src/main/java/com/terning/core/extension/Modifier.kt b/core/src/main/java/com/terning/core/extension/Modifier.kt new file mode 100644 index 000000000..bb138e194 --- /dev/null +++ b/core/src/main/java/com/terning/core/extension/Modifier.kt @@ -0,0 +1,16 @@ +package com.terning.core.extension + +import android.annotation.SuppressLint +import androidx.compose.foundation.clickable +import androidx.compose.foundation.interaction.MutableInteractionSource +import androidx.compose.runtime.remember +import androidx.compose.ui.Modifier +import androidx.compose.ui.composed + +@SuppressLint("ModifierFactoryUnreferencedReceiver") +inline fun Modifier.noRippleClickable(crossinline onClick: () -> Unit): Modifier = composed { + clickable(indication = null, + interactionSource = remember { MutableInteractionSource() }) { + onClick() + } +} \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/extension/retrofit.kt b/core/src/main/java/com/terning/core/extension/Retrofit.kt similarity index 100% rename from core/src/main/java/com/terning/core/extension/retrofit.kt rename to core/src/main/java/com/terning/core/extension/Retrofit.kt diff --git a/core/src/main/java/com/terning/core/state/UiState.kt b/core/src/main/java/com/terning/core/state/UiState.kt new file mode 100644 index 000000000..0c78263a2 --- /dev/null +++ b/core/src/main/java/com/terning/core/state/UiState.kt @@ -0,0 +1,15 @@ +package com.terning.core.state + +sealed interface UiState { + data object Empty : UiState + + data object Loading : UiState + + data class Success( + val data: T, + ) : UiState + + data class Failure( + val msg: String, + ) : UiState +} diff --git a/data/src/main/java/com/terning/data/dto/BaseResponse.kt b/data/src/main/java/com/terning/data/dto/BaseResponse.kt new file mode 100644 index 000000000..0de489ff1 --- /dev/null +++ b/data/src/main/java/com/terning/data/dto/BaseResponse.kt @@ -0,0 +1,16 @@ +package com.terning.data.dto + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class BaseResponse( + @SerialName("status") + val status: Int, + @SerialName("code") + val code: String, + @SerialName("message") + val message: String, + @SerialName("data") + val data: T, +) diff --git a/data/src/main/java/com/terning/data/dto/NonDataBaseResponse.kt b/data/src/main/java/com/terning/data/dto/NonDataBaseResponse.kt new file mode 100644 index 000000000..34db1f722 --- /dev/null +++ b/data/src/main/java/com/terning/data/dto/NonDataBaseResponse.kt @@ -0,0 +1,14 @@ +package com.terning.data.dto + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class NonDataBaseResponse( + @SerialName("status") + val status: Int, + @SerialName("code") + val code: String, + @SerialName("message") + val message: String, +) From 4d3c7b0023ce4f90d6bbf0f8b0964245d5a57135 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 29 Jun 2024 00:02:45 +0900 Subject: [PATCH 20/35] =?UTF-8?q?[ADD/#1]=20=ED=99=95=EC=9E=A5=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EB=B0=8F=20=EB=84=A4=EB=B9=84=EA=B2=8C=EC=9D=B4?= =?UTF-8?q?=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/terning/core/extension/ContextExt.kt | 8 +------- .../java/com/terning/core/extension/Modifier.kt | 13 ++++++++++++- .../com/terning/core/navigation/MainTabRoute.kt | 3 +++ .../main/java/com/terning/core/navigation/Route.kt | 3 +++ 4 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 core/src/main/java/com/terning/core/navigation/MainTabRoute.kt create mode 100644 core/src/main/java/com/terning/core/navigation/Route.kt diff --git a/core/src/main/java/com/terning/core/extension/ContextExt.kt b/core/src/main/java/com/terning/core/extension/ContextExt.kt index 9981be3b2..7deeaaec9 100644 --- a/core/src/main/java/com/terning/core/extension/ContextExt.kt +++ b/core/src/main/java/com/terning/core/extension/ContextExt.kt @@ -13,10 +13,4 @@ fun Context.toast(@StringRes message: Int) { fun Context.longToast(@StringRes message: Int) { Toast.makeText(this, getString(message), Toast.LENGTH_SHORT).show() -} - -fun Context.hideKeyboard(view: View) { - val inputMethodManager = getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager - inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0) - view.clearFocus() -} +} \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/extension/Modifier.kt b/core/src/main/java/com/terning/core/extension/Modifier.kt index bb138e194..57cca1101 100644 --- a/core/src/main/java/com/terning/core/extension/Modifier.kt +++ b/core/src/main/java/com/terning/core/extension/Modifier.kt @@ -2,10 +2,13 @@ package com.terning.core.extension import android.annotation.SuppressLint import androidx.compose.foundation.clickable +import androidx.compose.foundation.gestures.detectTapGestures import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.composed +import androidx.compose.ui.focus.FocusManager +import androidx.compose.ui.input.pointer.pointerInput @SuppressLint("ModifierFactoryUnreferencedReceiver") inline fun Modifier.noRippleClickable(crossinline onClick: () -> Unit): Modifier = composed { @@ -13,4 +16,12 @@ inline fun Modifier.noRippleClickable(crossinline onClick: () -> Unit): Modifier interactionSource = remember { MutableInteractionSource() }) { onClick() } -} \ No newline at end of file +} + +fun Modifier.addFocusCleaner(focusManager: FocusManager): Modifier { + return this.pointerInput(Unit) { + detectTapGestures(onTap = { + focusManager.clearFocus() + }) + } +} diff --git a/core/src/main/java/com/terning/core/navigation/MainTabRoute.kt b/core/src/main/java/com/terning/core/navigation/MainTabRoute.kt new file mode 100644 index 000000000..6e85354da --- /dev/null +++ b/core/src/main/java/com/terning/core/navigation/MainTabRoute.kt @@ -0,0 +1,3 @@ +package com.terning.core.navigation + +interface MainTabRoute : Route \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/navigation/Route.kt b/core/src/main/java/com/terning/core/navigation/Route.kt new file mode 100644 index 000000000..fe968eb16 --- /dev/null +++ b/core/src/main/java/com/terning/core/navigation/Route.kt @@ -0,0 +1,3 @@ +package com.terning.core.navigation + +interface Route \ No newline at end of file From c1eab34d94c1974dd4363329dcda7634c2b55a6e Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 29 Jun 2024 00:09:31 +0900 Subject: [PATCH 21/35] =?UTF-8?q?[FEAT/#1]=20=EB=A0=88=ED=8F=AC=EC=A7=80?= =?UTF-8?q?=ED=86=A0=EB=A6=AC=20=EB=AA=A8=EB=93=88=20Provides=20->=20Binds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/terning/point/di/DataSourceModule.kt | 2 +- .../main/java/com/terning/point/di/RepositoryModule.kt | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/terning/point/di/DataSourceModule.kt b/app/src/main/java/com/terning/point/di/DataSourceModule.kt index be871e21f..c1541df6a 100644 --- a/app/src/main/java/com/terning/point/di/DataSourceModule.kt +++ b/app/src/main/java/com/terning/point/di/DataSourceModule.kt @@ -8,10 +8,10 @@ import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent import javax.inject.Singleton - @Module @InstallIn(SingletonComponent::class) abstract class DataSourceModule { + @Binds @Singleton abstract fun bindMockDataSource(mockDataSourceImpl: MockDataSourceImpl): MockDataSource diff --git a/app/src/main/java/com/terning/point/di/RepositoryModule.kt b/app/src/main/java/com/terning/point/di/RepositoryModule.kt index dcde16c66..9de02a07a 100644 --- a/app/src/main/java/com/terning/point/di/RepositoryModule.kt +++ b/app/src/main/java/com/terning/point/di/RepositoryModule.kt @@ -2,19 +2,17 @@ package com.terning.point.di import com.terning.data.repositoryimpl.MockRepositoryImpl import com.terning.domain.repository.MockRepository +import dagger.Binds import dagger.Module -import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent import javax.inject.Singleton @Module @InstallIn(SingletonComponent::class) -object RepositoryModule { +abstract class RepositoryModule { - @Provides + @Binds @Singleton - fun provideMockRepository(mockRepositoryImpl: MockRepositoryImpl): MockRepository = - mockRepositoryImpl - + abstract fun bindMockRepository(mockRepositoryImpl: MockRepositoryImpl): MockRepository } \ No newline at end of file From bf379b5b7209b6e7dec08844983070f8f1a556eb Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 29 Jun 2024 00:37:07 +0900 Subject: [PATCH 22/35] =?UTF-8?q?[MOVE/#1]=20MainActivity=20=EC=9C=84?= =?UTF-8?q?=EC=B9=98=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 3 --- app/src/main/AndroidManifest.xml | 11 ----------- feature/build.gradle.kts | 1 + feature/src/main/AndroidManifest.xml | 14 ++++++++++++++ .../java/com/terning/feature/main}/MainActivity.kt | 2 +- feature/src/main/res/values/strings.xml | 2 ++ feature/src/main/res/values/themes.xml | 4 ++++ 7 files changed, 22 insertions(+), 15 deletions(-) rename {app/src/main/java/com/terning/point => feature/src/main/java/com/terning/feature/main}/MainActivity.kt (93%) create mode 100644 feature/src/main/res/values/themes.xml diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 501635d01..6250ef286 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -78,9 +78,6 @@ dependencies { implementation(libs.hilt.android) kapt(libs.hilt.android.compiler) kapt(libs.hilt.manager) - implementation(libs.androidx.lifecycle.runtime.ktx) - implementation(libs.androidx.activity.compose) - implementation(platform(libs.androidx.compose.bom)) implementation(libs.androidx.workManager) implementation(libs.androidx.hiltWorkManager) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index eae3138ec..681c14bfa 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,18 +15,7 @@ android:supportsRtl="true" android:theme="@style/Theme.TerningAndroid" tools:targetApi="31"> - - - - - - \ No newline at end of file diff --git a/feature/build.gradle.kts b/feature/build.gradle.kts index 4ea2ab83d..0232c868e 100644 --- a/feature/build.gradle.kts +++ b/feature/build.gradle.kts @@ -1,6 +1,7 @@ plugins { alias(libs.plugins.android.library) alias(libs.plugins.kotlin.android) + alias(libs.plugins.hilt) id("kotlin-kapt") id("kotlin-parcelize") } diff --git a/feature/src/main/AndroidManifest.xml b/feature/src/main/AndroidManifest.xml index a5918e68a..f2df3a230 100644 --- a/feature/src/main/AndroidManifest.xml +++ b/feature/src/main/AndroidManifest.xml @@ -1,4 +1,18 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/terning/point/MainActivity.kt b/feature/src/main/java/com/terning/feature/main/MainActivity.kt similarity index 93% rename from app/src/main/java/com/terning/point/MainActivity.kt rename to feature/src/main/java/com/terning/feature/main/MainActivity.kt index ede48a0b4..c94d7eb66 100644 --- a/app/src/main/java/com/terning/point/MainActivity.kt +++ b/feature/src/main/java/com/terning/feature/main/MainActivity.kt @@ -1,4 +1,4 @@ -package com.terning.point +package com.terning.feature.main import android.os.Bundle import androidx.activity.ComponentActivity diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 58c8bc6fa..398314a61 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -1,5 +1,7 @@ + Terning-Android + 서버통신 성공 서버통신 실패 diff --git a/feature/src/main/res/values/themes.xml b/feature/src/main/res/values/themes.xml new file mode 100644 index 000000000..65770c519 --- /dev/null +++ b/feature/src/main/res/values/themes.xml @@ -0,0 +1,4 @@ + + +