Skip to content

Commit

Permalink
refactor/#8: hilt 적용(hiltAndroidApp, hiltViewmodel, AndroidEntryPoint…
Browse files Browse the repository at this point in the history
… 적용)
  • Loading branch information
kangyein9892 committed Nov 14, 2024
1 parent 2deea38 commit 319015d
Show file tree
Hide file tree
Showing 89 changed files with 622 additions and 304 deletions.
25 changes: 13 additions & 12 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.ksp)
alias(libs.plugins.hilt)
}

android {
Expand Down Expand Up @@ -41,25 +43,24 @@ android {
}

dependencies {
implementation(project(":data"))
implementation(project(":domain"))
implementation(project(":presentation"))

implementation(libs.androidx.core.ktx)
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)
implementation(libs.androidx.compose.navigation)

implementation(libs.hilt)
ksp(libs.hilt.compiler)
implementation(libs.kotlinx.serialization.json)
implementation (libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.lifecycle.runtime.compose.android)

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
testImplementation(libs.junit)
androidTestImplementation(platform(libs.androidx.compose.bom))
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)
}
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
android:theme="@style/Theme.ANDANDROID"
tools:targetApi="31">
<activity
android:name=".main.MainActivity"
android:name=".presentation.main.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/org/sopt/and/WavveApplication.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package org.sopt.and

import android.app.Application
import org.sopt.and.util.PreferenceUtil
import dagger.hilt.android.HiltAndroidApp
import org.sopt.and.presentation.util.PreferenceUtil

@HiltAndroidApp
class WavveApplication: Application() {

override fun onCreate() {
Expand Down
7 changes: 0 additions & 7 deletions app/src/main/java/org/sopt/and/my/model/MyState.kt

This file was deleted.

This file was deleted.

This file was deleted.

72 changes: 0 additions & 72 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,75 +1,3 @@
<resources>
<string name="app_name">AND-ANDROID</string>

<string name="text_field_hide">hide</string>
<string name="text_field_show">show</string>
<string name="icon_close">닫기</string>
<string name="icon_info">정보</string>
<string name="icon_arrow_right">이동</string>
<string name="icon_notification">알림</string>
<string name="icon_settings">설정</string>
<string name="logo_image">로고 이미지</string>
<string name="icon_naver">네이버</string>
<string name="icon_kakao">카카오</string>
<string name="icon_tworld">티월드</string>
<string name="icon_facebook">페이스북</string>
<string name="icon_apple">애플</string>
<string name="icon_cast">캐스트</string>
<string name="icon_live">라이브</string>

<string name="main_tab_home">홈</string>
<string name="main_tab_search">검색</string>
<string name="main_tab_my">MY</string>

<string name="home_tab_new_classic">뉴클래식</string>
<string name="home_tab_drama">드라마</string>
<string name="home_tab_entertain">예능</string>
<string name="home_tab_movie">영화</string>
<string name="home_tab_animation">애니메이션</string>
<string name="home_tab_global">해외시리즈</string>
<string name="home_tab_documentary">시사교양</string>
<string name="home_tab_kids">키즈</string>
<string name="home_banner_image">홈배너 이미지</string>
<string name="home_banner_indicator">%s | %s</string>

<string name="signup_top_bar_title">회원가입</string>
<string name="signup_intro_text">이메일과 비밀번호만으로\nWavve를 즐길 수 있어요!</string>
<string name="signup_login_hint">[email protected]</string>
<string name="signup_login_guide">로그인, 비밀번호 찾기, 알림에 사용되니 정확한 이메일을 입력해주세요.</string>
<string name="signup_password_hint">Wavve 비밀번호 설정</string>
<string name="signup_password_guide">비밀번호는 8~20자 이내로 영문 대소문자, 숫자, 특수문자 중 3가지 이상 혼용하여 입력해 주세요.</string>
<string name="signup_other_service_text">또는 다른 서비스 계정으로 가입</string>
<string name="signup_other_service_guide">"SNS계정을 간편하게 가입하여 서비스를 이용하실 수 있습니다. 기\n존 POOQ 계정 또는 Wavve 계정과는 연동되지 않으니 이용에 참고\n하세요."</string>
<string name="signup_button_text">wavve 회원가입</string>
<string name="signup_success_text">회원가입을 완료했습니다.</string>
<string name="signup_failure_email_text">이메일 형식이 올바르지 않습니다.</string>
<string name="signup_failure_password_text">비밀번호 형식이 올바르지 않습니다.</string>
<string name="signup_failure_text">회원가입이 실패했습니다.</string>

<string name="signin_login_hint">이메일 주소 또는 아이디</string>
<string name="signin_password_hint">비밀번호</string>
<string name="signin_login_text">로그인</string>
<string name="signin_find_id_text">아이디 찾기</string>
<string name="signin_reset_password_text">비밀번호 재설정</string>
<string name="signin_signup_text">회원가입</string>
<string name="signin_divider_text">|</string>
<string name="signin_other_service_text">또는 다른 서비스 계정으로 가입</string>
<string name="signin_other_service_guide">"SNS계정을 간편하게 가입하여 서비스를 이용하실 수 있습니다. 기\n존 POOQ 계정 또는 Wavve 계정과는 연동되지 않으니 이용에 참고하세요."</string>
<string name="signin_success_text">로그인에 성공했습니다.</string>
<string name="signin_failure_text">아이디 또는 비밀번호가 일치하지 않습니다.</string>
<string name="signin_text_sns_guide">"SNS계정을 간편하게 가입하여 서비스를 이용하실 수 있습니다.\n\t기존 POOQ 계정 또는 Wavve 계정과는 연동되지 않으니 이용에 참고하세요."</string>

<string name="my_profile_image">내 프로필 이미지</string>
<string name="my_buy_text">구매하기</string>
<string name="my_first_buy_text">첫 결제 시 첫 달 100원!</string>
<string name="my_ticket_text">현재 보유하신 이용권이 없습니다.</string>
<string name="my_watch_contents_text">전체 시청 내역</string>
<string name="my_watch_contents_empty_text">시청 내역이 없어요.</string>
<string name="my_like_contents_text">관심 프로그램</string>
<string name="my_like_contents_empty_text">관심 프로그램이 없어요.</string>
<string name="my_email_error_text">이메일을 불러올 수 없습니다.</string>
<string name="my_error_text">오류로 인해 데이터를 불러올 수 없습니다.</string>
<string name="my_logout_text">로그아웃</string>
<string name="logout_success_text">로그아웃을 성공했습니다</string>

</resources>
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ plugins {
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.compose) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.jetbrains.kotlin.jvm) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.hilt) apply false
alias(libs.plugins.ksp) apply false

}
1 change: 1 addition & 0 deletions data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
51 changes: 51 additions & 0 deletions data/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.ksp)
alias(libs.plugins.hilt)
}

android {
namespace = "org.sopt.and.data"
compileSdk = 34

defaultConfig {
minSdk = 24

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)

implementation(libs.hilt)
ksp(libs.hilt.compiler)
implementation(libs.kotlinx.serialization.json)

testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
}
Empty file added data/consumer-rules.pro
Empty file.
21 changes: 21 additions & 0 deletions data/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.sopt.and.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("org.sopt.and.data.test", appContext.packageName)
}
}
4 changes: 4 additions & 0 deletions data/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
17 changes: 17 additions & 0 deletions data/src/test/java/org/sopt/and/data/ExampleUnitTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.sopt.and.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)
}
}
1 change: 1 addition & 0 deletions domain/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
9 changes: 9 additions & 0 deletions domain/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plugins {
id("java-library")
alias(libs.plugins.jetbrains.kotlin.jvm)
}

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
4 changes: 4 additions & 0 deletions domain/src/main/java/org/sopt/and/domain/MyClass.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package org.sopt.and.domain

class MyClass {
}
19 changes: 18 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ composeBom = "2024.04.01"
androidxComposeNavigation = "2.8.2"
kotlinxSerializationJson = "1.7.3"
lifecycleRuntimeComposeAndroid = "2.8.2"
hilt = "2.52"
hiltCompose = "1.2.0"
hiltNavigationCompose = "1.2.0"
jetbrainsKotlinJvm = "2.0.0"
appcompat = "1.7.0"
material = "1.12.0"
ksp = "2.0.0-1.0.21"

[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
Expand All @@ -31,9 +38,19 @@ androidx-compose-navigation = { group = "androidx.navigation", name = "navigatio
kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" }
androidx-lifecycle-viewmodel-compose = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "lifecycleRuntimeKtx" }
androidx-lifecycle-runtime-compose-android = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose-android", version.ref = "lifecycleRuntimeComposeAndroid" }
hilt = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" }
hilt-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" }
hilt-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "hiltCompose" }
hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "hiltNavigationCompose" }
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" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
ksp = {id = "com.google.devtools.ksp", version.ref = "ksp"}
jetbrains-kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "jetbrainsKotlinJvm" }
android-library = { id = "com.android.library", version.ref = "agp" }
1 change: 1 addition & 0 deletions presentation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
Loading

0 comments on commit 319015d

Please sign in to comment.