Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/#21 앱잼 대비 코드 리팩토링 #22

Open
wants to merge 31 commits into
base: develop-compose
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
fb985fd
CHORE/#19: 저장소 관련 파일추가, 코드수정, 패키지구조변경
boiledEgg-s Jun 7, 2024
812a7db
MOD/#19: 사용자저장소 관련 코드 수정
boiledEgg-s Jun 7, 2024
f36823d
ADD/#19: collectAsStateWithLifecyle 마이그레이션
boiledEgg-s Jun 7, 2024
8d3d47f
REFACTOR/#19: week4 리뷰기반 코드 수정
boiledEgg-s Jun 7, 2024
5cda495
REFACTOR/#19: import 정리
boiledEgg-s Jun 7, 2024
3066e97
CHORE/#19: lifecycleowner 추가
boiledEgg-s Jun 7, 2024
26fdc3a
ADD/#21: Hilt 라이브러리 추가
boiledEgg-s Jun 25, 2024
f006e2e
CHORE/#21
boiledEgg-s Jun 26, 2024
56e4345
FEAT/#21: Hilt Module 추가
boiledEgg-s Jun 26, 2024
5f09291
DEL/#21: Import 정리
boiledEgg-s Jun 26, 2024
66b0760
ADD/#21: Hilt 라이브러리 추가
boiledEgg-s Jun 26, 2024
02cb1ae
CHORE/#21: 로컬데이터베이스 모듈 수정
boiledEgg-s Jun 26, 2024
7189461
FEAT/#21: 레포지토리 생성자 주입 적용
boiledEgg-s Jun 26, 2024
ccb9c47
FEAT/#21: 뷰모델 자동 생성자 주입 적용
boiledEgg-s Jun 26, 2024
6289d4d
FEAT/#21: hiltViewModel() 적용
boiledEgg-s Jun 26, 2024
6bf7c5e
REFACTOR/#21: 전체 import 정리
boiledEgg-s Jun 26, 2024
c828b5c
REFACTOR/#21: 코드 정리
boiledEgg-s Jun 26, 2024
6f4fe22
ADD/#21: 멀티 모듈 환경 구축
boiledEgg-s Jun 26, 2024
8413a0a
ADD/#21: 버전 카탈로그 생성
boiledEgg-s Jun 26, 2024
b512f94
FEAT/#21: Domain 모듈 추가, Repository 및 Entity 추가
boiledEgg-s Jun 27, 2024
e4f50d9
FEAT/#21: Data 모듈 추가, Service 추가
boiledEgg-s Jun 27, 2024
05287d1
FEAT/#21: DTO 추가
boiledEgg-s Jun 27, 2024
b433838
FEAT/#21: DataSource 추가
boiledEgg-s Jun 27, 2024
e15b56a
FEAT/#21: Repository 구현체 추가
boiledEgg-s Jun 27, 2024
f0b6d43
FEAT/#21: 버전 카탈로그 추가
boiledEgg-s Jun 27, 2024
23e78de
CHORE/#21: Gradle 수정
boiledEgg-s Jun 30, 2024
7dda32f
FEAT/#21: Presentation 레이어 추가
boiledEgg-s Jun 30, 2024
abe3807
FEAT/#21: PreferenceDataSource 추가
boiledEgg-s Jun 30, 2024
f7d5780
MOD/#21: Repository 코드 수정
boiledEgg-s Jun 30, 2024
f5451d0
REFACTOR/#21: app 모듈 수정
boiledEgg-s Jun 30, 2024
3ba3a50
CHORE/#21: ui.theme 디렉토리 이동
boiledEgg-s Jun 30, 2024
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
73 changes: 37 additions & 36 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.0'
alias(libs.plugins.android.application)
alias(libs.plugins.jetbrains.kotlin.android)
alias(libs.plugins.jetbrains.kotlin.serialization)
alias(libs.plugins.google.dagger.hilt.android)
id 'kotlin-android'
id 'kotlin-kapt'
}

Properties properties = new Properties()
Expand All @@ -24,6 +27,8 @@ android {
}

buildConfigField "String", "AUTH_BASE_URL", properties["base.url"]
buildConfigField "String", "REQRES_URL", properties["reqres.url"]

}

buildTypes {
Expand All @@ -48,44 +53,40 @@ android {
}
packaging {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
it.excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}

}

dependencies {
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.7.0'
implementation 'androidx.activity:activity-compose:1.8.2'
implementation platform('androidx.compose:compose-bom:2024.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'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation platform('androidx.compose:compose-bom:2024.03.00')
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
debugImplementation 'androidx.compose.ui:ui-tooling'
debugImplementation 'androidx.compose.ui:ui-test-manifest'

//navigation dependency
implementation("androidx.navigation:navigation-compose:2.7.7")

//Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1'
implementation 'com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0'

// define a BOM and its version
implementation(platform("com.squareup.okhttp3:okhttp-bom:4.10.0"))

// define any required OkHttp artifacts without version
implementation("com.squareup.okhttp3:okhttp")
implementation("com.squareup.okhttp3:logging-interceptor")
implementation(libs.core.ktx)
implementation(libs.lifecycle.runtime.ktx)
implementation(libs.activity.compose)
implementation(platform(libs.compose.bom))
implementation(libs.compose.ui)
implementation(libs.compose.ui.graphics)
implementation(libs.compose.ui.tooling)
implementation(libs.compose.material3)
testImplementation(libs.junit)
androidTestImplementation(libs.test.ext.junit)
androidTestImplementation(libs.test.espresso.eore)
androidTestImplementation(platform(libs.compose.bom))
androidTestImplementation(libs.compose.ui.test.junit4)
androidTestImplementation(libs.compose.ui.tooling)
debugImplementation(libs.compose.ui.test.manifest)
implementation(libs.navigation.compose)
implementation(libs.retrofit2.retrofit)
implementation(libs.serialization.json)
implementation(libs.retrofit2.serialization.converter)
implementation(platform(libs.okhttp.bom))
implementation(libs.okhttp)
implementation(libs.coil.compose)
implementation(libs.hiltAndroid)
kapt(libs.hiltCompiler)
implementation(libs.hiltNavigation)

// Coil
implementation("io.coil-kt:coil-compose:2.4.0")
implementation project(path: ':data')
implementation project(path: ':domain')
implementation project(path: ':presentation')
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.sopt.now.compose

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
Expand Down
49 changes: 4 additions & 45 deletions app/src/main/java/com/sopt/now/compose/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,58 +1,17 @@
package com.sopt.now.compose

import android.content.Context
import android.os.Build
import android.os.Bundle
import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.sopt.now.compose.models.User
import com.sopt.now.compose.ui.SoptApp
import com.sopt.now.compose.ui.composables.TitleAndContentTextComposable
import com.sopt.now.compose.ui.theme.NOWSOPTAndroidTheme
import com.sopt.now.compose.presentation.SoptApp
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
NOWSOPTAndroidTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
SoptApp()
}
}
SoptApp()
}
}
companion object {
const val NAVIGATE_SIGNUP_KEY = "user"
const val NAVIGATE_LOGIN_KEY = "login"

const val NAVIGATE_BACK_PRESSED_KEY = "back"

fun printToastMessage(context: Context, messageRes: Int) {
Toast.makeText(context, messageRes, Toast.LENGTH_SHORT).show()
}

}
}
9 changes: 2 additions & 7 deletions app/src/main/java/com/sopt/now/compose/SoptApplication.kt
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
package com.sopt.now.compose

import android.app.Application
import android.content.Context
import android.widget.Toast
import com.sopt.now.compose.container.AppContainer
import com.sopt.now.compose.container.SoptAppContainer
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class SoptApplication: Application() {
lateinit var appContainer: AppContainer

override fun onCreate() {
super.onCreate()
appContainer = SoptAppContainer(applicationContext)
}

}
32 changes: 0 additions & 32 deletions app/src/main/java/com/sopt/now/compose/container/AuthRepository.kt

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading