Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
charset = utf-8
indent_size = 4
indent_style = space
max_line_length = 150
insert_final_newline = true
trim_trailing_whitespace = true

[*.{kt,kts}]
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true
6 changes: 3 additions & 3 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ jobs:
# run: |
# echo '${{ secrets.GOOGLE_SERVICES }}' >> ./app/google-services.json

# - name: Code style checks
# run: |
# ./gradlew detekt --continue
- name: Code style checks
run: |
./gradlew detekt --continue

- name: Run build
run: ./gradlew buildDebug --stacktrace
2 changes: 1 addition & 1 deletion app/src/main/java/com/neki/android/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class MainActivity : ComponentActivity() {
currentKey = navigator.state.currentKey,
onTabSelected = { navigator.navigate(it.navKey) },
)
}
},
) { innerPadding ->
NavDisplay(
modifier = Modifier.padding(innerPadding),
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/java/com/neki/android/app/NekiApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ import dagger.hilt.android.HiltAndroidApp
import timber.log.Timber

@HiltAndroidApp
class NekiApplication: Application() {
class NekiApplication : Application() {
override fun onCreate() {
super.onCreate()

if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
} else {
Timber.plant(object : Timber.Tree() {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
// 여기는 Release일 때 로그를 남기지 않고 어딘가로 전송 ?

}
})
Timber.plant(
object : Timber.Tree() {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
// 여기는 Release일 때 로그를 남기지 않고 어딘가로 전송 ?
}
},
)
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ enum class TopLevelNavItem(
selectedIcon = R.drawable.ic_nav_archive_selected,
unselectedIcon = R.drawable.ic_nav_archive_unselected,
iconTextId = R.string.top_level_nav_archive,
navKey = ArchiveNavKey.Archive
navKey = ArchiveNavKey.Archive,
),
MAP(
selectedIcon = R.drawable.ic_nav_map_selected,
unselectedIcon = R.drawable.ic_nav_map_unselected,
iconTextId = R.string.top_level_nav_map,
navKey = MapNavKey.Map
);
navKey = MapNavKey.Map,
),
;

companion object {
val startTopLevelItem = ARCHIVE
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ internal interface AppModule {
fun bindsNavigator(
impl: NavigatorImpl,
): Navigator
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ internal object NavigationModule {
topLevelKeys = TOP_LEVEL_NAV_KEYS.toSet(),
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ fun BottomNavigationBar(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 20.dp),
horizontalArrangement = Arrangement.spacedBy(2.5.dp)
horizontalArrangement = Arrangement.spacedBy(2.5.dp),
) {
tabs.forEach { tab ->
BottomNavigationBarItem(
modifier = Modifier.weight(1f),
selected = tab.navKey == currentTab,
tab = tab,
onClick = { if (tab.navKey != currentKey) onTabSelected(tab) }
onClick = { if (tab.navKey != currentKey) onTabSelected(tab) },
)
}
}
Expand All @@ -78,7 +78,7 @@ fun BottomNavigationBarItem(

Surface(
modifier = modifier,
onClick = onClick
onClick = onClick,
) {
Column(
modifier = Modifier.padding(vertical = 8.dp),
Expand Down
17 changes: 0 additions & 17 deletions app/src/test/java/com/neki/android/ExampleUnitTest.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import com.neki.android.buildlogic.const.BuildConst
import com.android.build.api.dsl.CommonExtension
import org.gradle.api.Project
import org.gradle.api.plugins.ExtensionAware
import org.gradle.kotlin.dsl.dependencies
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
import kotlin.text.get
Comment on lines +7 to +9
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

잘못된 import를 수정하세요.

Line 9의 import kotlin.text.get은 잘못된 import입니다. Line 37의 libs.findLibrary("detekt.formatting").get()에서 사용되는 get()은 Gradle의 Provider API에서 제공하는 확장 함수이므로 별도의 import가 필요하지 않습니다. 이 import를 제거해주세요.

🔎 제안하는 수정
 import com.neki.android.buildlogic.const.BuildConst
 import com.android.build.api.dsl.CommonExtension
 import org.gradle.api.Project
 import org.gradle.api.plugins.ExtensionAware
 import org.gradle.kotlin.dsl.dependencies
 import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
-import kotlin.text.get
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import org.gradle.kotlin.dsl.dependencies
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
import kotlin.text.get
import com.neki.android.buildlogic.const.BuildConst
import com.android.build.api.dsl.CommonExtension
import org.gradle.api.Project
import org.gradle.api.plugins.ExtensionAware
import org.gradle.kotlin.dsl.dependencies
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
🤖 Prompt for AI Agents
In build-logic/src/main/java/com/neki/android/buildlogic/extensions/Android.kt
around lines 7 to 9, remove the incorrect import "import kotlin.text.get" (it is
not needed and conflicts with the Provider API extension used at line 37).
Simply delete that import line and keep the remaining imports unchanged so
libs.findLibrary("detekt.formatting").get() uses the Provider extension without
any extra imports.


internal fun Project.configureAndroid(
commonExtension: CommonExtension<*, *, *, *, *, *>
commonExtension: CommonExtension<*, *, *, *, *, *>,
) {
commonExtension.apply {
compileSdk = BuildConst.COMPILE_SDK
Expand All @@ -30,6 +32,10 @@ internal fun Project.configureAndroid(
)
}
}

dependencies {
add("detektPlugins", libs.findLibrary("detekt.formatting").get())
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import com.neki.android.buildlogic.const.BuildConst
import com.neki.android.buildlogic.extensions.libs
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension

class KotlinLibraryConventionPlugin: Plugin<Project> {
Expand All @@ -21,6 +23,10 @@ class KotlinLibraryConventionPlugin: Plugin<Project> {
extensions.configure<KotlinProjectExtension> {
jvmToolchain(BuildConst.JDK_VERSION)
}

dependencies {
add("detektPlugins", libs.findLibrary("detekt.formatting").get())
}
}
}
}
17 changes: 17 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.gradle.kotlin.dsl.configure

plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
Expand All @@ -7,4 +10,18 @@ plugins {
alias(libs.plugins.jetbrains.kotlin.jvm) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.hilt) apply false
alias(libs.plugins.detekt) apply false
}

subprojects {
apply {
plugin(rootProject.libs.plugins.detekt.get().pluginId)
}

configure<DetektExtension> {
parallel = true
buildUponDefaultConfig = true
toolVersion = rootProject.libs.versions.detekt.get()
config.setFrom(files("$rootDir/detekt-config.yml"))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ package com.neki.android.core.common.const

object Const {
const val TAG_REST_API = "TAG_REST_API"

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import com.neki.android.core.model.Post
interface SampleRepository {
suspend fun getPosts(): List<Post>
suspend fun getPost(
id: Int
id: Int,
): Post


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ internal object DataStoreModule {
@Singleton
@Provides
fun provideDataStore(
@ApplicationContext context: Context
@ApplicationContext context: Context,
): DataStore<Preferences> {
return PreferenceDataStoreFactory.create(
corruptionHandler = ReplaceFileCorruptionHandler(
Expand All @@ -31,6 +31,4 @@ internal object DataStoreModule {
produceFile = { context.preferencesDataStoreFile(DATASTORE_NAME) },
)
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import io.ktor.client.call.body
import io.ktor.client.request.get

class ApiService(
private val client: HttpClient
private val client: HttpClient,
) {
// 게시글 목록 조회
suspend fun getPosts(): List<PostResponse> {
Expand All @@ -15,10 +15,8 @@ class ApiService(

// 게시글 조회
suspend fun getPost(
id: Int
id: Int,
): PostResponse {
return client.get("/posts/$id").body()
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import io.ktor.serialization.kotlinx.json.json
import kotlinx.serialization.json.Json
import timber.log.Timber
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
internal object NetworkModule {
Expand All @@ -31,7 +32,7 @@ internal object NetworkModule {
@Provides
@Singleton
fun provideApiService(
client: HttpClient
client: HttpClient,
): ApiService = ApiService(client)

@Provides
Expand All @@ -44,11 +45,13 @@ internal object NetworkModule {
}

install(ContentNegotiation) {
json(Json {
prettyPrint = true
isLenient = true
ignoreUnknownKeys = true
})
json(
Json {
prettyPrint = true
isLenient = true
ignoreUnknownKeys = true
},
)
}

install(Logging) {
Expand All @@ -69,7 +72,4 @@ internal object NetworkModule {
expectSuccess = true
}
}


}

Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ data class PostResponse(
@SerialName("userId") val userId: Int,
@SerialName("id") val id: Int,
@SerialName("title") val title: String,
@SerialName("body") val body: String
@SerialName("body") val body: String,
) {
fun toModel(): Post {
return Post(
userId = this.userId,
id = this.id,
title = this.title,
body = this.body
body = this.body,
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ internal abstract class RepositoryModule {

@Binds
abstract fun bindSampleRepositoryImpl(
sampleRepositoryImpl: SampleRepositoryImpl
sampleRepositoryImpl: SampleRepositoryImpl,
): SampleRepository


}
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
package com.neki.android.core.data.repository.impl

import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import com.neki.android.core.data.remote.api.ApiService
import com.neki.android.core.dataapi.repository.SampleRepository
import com.neki.android.core.model.Post
import javax.inject.Inject

class SampleRepositoryImpl @Inject constructor(
private val apiService: ApiService,
private val dataStore: DataStore<Preferences>
): SampleRepository {
// private val dataStore: DataStore<Preferences>,
) : SampleRepository {
override suspend fun getPosts(): List<Post> {
return apiService.getPosts()
.map { it.toModel() }
}

override suspend fun getPost(
id: Int
id: Int,
): Post {
return apiService.getPost(id = id)
.toModel()
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ val Pink80 = Color(0xFFEFB8C8)

val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260)
val Pink40 = Color(0xFF7D5260)
Loading