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

Feature/jaino/#14 #21

Merged
merged 21 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
43cfd51
[CHORE] #14 : ksp + hilt 종속성 및 플러그인 구현
jeongjaino Oct 5, 2023
77572e2
[CHORE] #14 : hilt 커스텀 플러그인 생성
jeongjaino Oct 5, 2023
250070c
[CHORE] #14 : domain 모듈 생성
jeongjaino Oct 5, 2023
0567f4f
[CHORE] #14 : domain model 모듈 생성
jeongjaino Oct 5, 2023
960fc93
[CHORE] #14 : network 모듈 생성
jeongjaino Oct 5, 2023
66e9386
[CHORE] #14 : build gradle hilt 플러그인 추가
jeongjaino Oct 5, 2023
604c77f
[CHORE] #14 : Hilt Application setup
jeongjaino Oct 5, 2023
1c9286f
[FEATURE] #14 : Network / Firebase DI Module 구현
jeongjaino Oct 5, 2023
11713b5
[FEATURE] #14 : Network / Firebase DI Module 구현
jeongjaino Oct 5, 2023
1990f96
[FEATURE] #14 : Auth DataSource 구현 및 로그인 로직 구현
jeongjaino Oct 5, 2023
01a6687
[FEATURE] #14 : Auth Repository 구현
jeongjaino Oct 5, 2023
9ef517d
[FEATURE] #14 : Repository DI Module 구현
jeongjaino Oct 5, 2023
a06cbb7
[FEATURE] #14 : Domain SignInUseCase 구현
jeongjaino Oct 5, 2023
fd443ca
[CHORE] #14 : feature Module model, domain 종속성 추가
jeongjaino Oct 5, 2023
9800c6c
[STYLE] #14 : 사용하지 않는 파라미터 삭제
jeongjaino Oct 5, 2023
96e69ce
[CHORE] #14 : Model Module Test Runner 삭제
jeongjaino Oct 5, 2023
117fe37
[STYLE] #14 : 잘못된 임포트 수정
jeongjaino Oct 5, 2023
ffcab56
[CHORE] #14 : Ktlint Plugin 임시 삭제
jeongjaino Oct 5, 2023
fe5ecea
[CHORE] #14 : app 모듈 Ktlint 적용
jeongjaino Oct 5, 2023
a9be0b0
[STYLE] #14 : signIn 함수 반환 값 기차충돌 개선
jeongjaino Oct 5, 2023
9848ea2
[FIX] #14 : Auth 관련 DI 모두 Activity Component로 수정
jeongjaino Oct 6, 2023
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
3 changes: 3 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id("com.wap.wapp.application")
id("com.wap.wapp.firebase")
id("com.wap.wapp.compose")
id("com.wap.wapp.hilt")
alias(libs.plugins.ktlint)
}

Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools">

<application
android:name=".WappApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/com/wap/wapp/WappApplication.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.wap.wapp

import android.app.Application
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class WappApplication : Application()
4 changes: 4 additions & 0 deletions build-logic/convention/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,9 @@ gradlePlugin {
id = "com.wap.wapp.compose"
implementationClass = "com.wap.wapp.plugin.AndroidComposePlugin"
}
create("androidHilt") {
id = "com.wap.wapp.hilt"
implementationClass = "com.wap.wapp.plugin.AndroidHiltPlugin"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class AndroidFeatureConventionPlugin: Plugin<Project>{
with(pluginManager){
apply("com.wap.wapp.library")
apply("com.wap.wapp.compose")
apply("com.wap.wapp.hilt")
}
configureBinding()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.wap.wapp.plugin

import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.getByType

class AndroidHiltPlugin: Plugin<Project> {
override fun apply(target: Project) {
with(target){
pluginManager.apply("com.google.dagger.hilt.android")
pluginManager.apply("com.google.devtools.ksp")

val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")

dependencies {
"implementation"(libs.findLibrary("hilt").get())
"ksp"(libs.findLibrary("hilt.ksp").get())
}
}
}
}
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ buildscript {
dependencies {
classpath(libs.android.build)
classpath(libs.kotlin.gradle)
classpath(libs.hilt.gradle)
classpath(libs.google.services.gradle)
classpath(libs.firebase.crashlytics.gradle)
}
Expand All @@ -15,7 +16,9 @@ plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.dagger.hilt) apply false
alias(libs.plugins.google.services) apply false
alias(libs.plugins.firebase.crashlytics) apply false
alias(libs.plugins.ktlint) apply false
alias(libs.plugins.ksp) apply false
}
3 changes: 3 additions & 0 deletions core/data/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id("com.wap.wapp.library")
id("com.wap.wapp.hilt")
}

android {
Expand All @@ -22,6 +23,8 @@ android {
}

dependencies {
implementation(project(":core:model"))
implementation(project(":core:network"))
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.junit)
androidTestImplementation(libs.androidx.test.espresso)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.wap.wapp.core.data.repository.auth

interface AuthRepository {
suspend fun hasPendingResult(): Boolean

suspend fun signIn(email: String): Result<String>
}
Comment on lines +4 to +7
Copy link
Member

Choose a reason for hiding this comment

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

함수명 좋네요.

signIn함수는 email만 있으면 되나요 ?.?

Copy link
Member Author

Choose a reason for hiding this comment

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

AuthDataSourceImpl에서 보실 수 있는데, Activity Context를 사용해, Github Login 웹으로 넘어가 비밀번호를 입력하는 것 같아요!

아마 보안상 이슈때문에, 이런것 같아요

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.wap.wapp.core.data.repository.auth

import com.wap.wapp.core.network.source.auth.AuthDataSource
import javax.inject.Inject

class AuthRepositoryImpl @Inject constructor(
private val authDataSource: AuthDataSource
): AuthRepository {
override suspend fun hasPendingResult(): Boolean {
return authDataSource.hasPendingResult()
}

override suspend fun signIn(email: String): Result<String> {
return authDataSource.signIn(email)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.wap.wapp.core.data.repository.di

import com.wap.wapp.core.data.repository.auth.AuthRepository
import com.wap.wapp.core.data.repository.auth.AuthRepositoryImpl
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ActivityComponent
import dagger.hilt.android.scopes.ActivityScoped

@Module
@InstallIn(ActivityComponent::class)
abstract class AuthRepositoryModule {
@Binds
@ActivityScoped
abstract fun providesAuthRepository(
authRepositoryImpl: AuthRepositoryImpl
): AuthRepository
}
1 change: 1 addition & 0 deletions core/domain/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
31 changes: 31 additions & 0 deletions core/domain/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
plugins {
id("com.wap.wapp.library")
id("com.wap.wapp.hilt")
}

android {
namespace = "com.wap.wapp.core.domain"

defaultConfig {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
}

dependencies {
implementation(project(":core:data"))
implementation(project(":core:model"))
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.junit)
androidTestImplementation(libs.androidx.test.espresso)
}
Empty file added core/domain/consumer-rules.pro
Empty file.
21 changes: 21 additions & 0 deletions core/domain/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 com.wap.wapp.core.domain

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.wap.wapp.core.domain.test", appContext.packageName)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.wap.wapp.core.domain.auth

import com.wap.wapp.core.data.repository.auth.AuthRepository
import dagger.hilt.android.scopes.ActivityScoped
import javax.inject.Inject

@ActivityScoped
class SignInUseCase @Inject constructor(
private val repository: AuthRepository
){
suspend operator fun invoke(email: String): Result<String> =
repository.signIn(email)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.wap.wapp.core.domain

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 core/model/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
21 changes: 21 additions & 0 deletions core/model/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
plugins {
id("com.wap.wapp.library")
}

android {
namespace = "com.wap.wapp.core.model"

defaultConfig {
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
}
Empty file added core/model/consumer-rules.pro
Empty file.
21 changes: 21 additions & 0 deletions core/model/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
1 change: 1 addition & 0 deletions core/network/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
33 changes: 33 additions & 0 deletions core/network/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
plugins {
id("com.wap.wapp.library")
id("com.wap.wapp.hilt")
}

android {
namespace = "com.wap.wapp.core.network"

defaultConfig {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
}

dependencies {
implementation(platform(libs.firebase.bom))
implementation(libs.firebase.auth)
implementation(libs.firebase.firestore)

testImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.junit)
androidTestImplementation(libs.androidx.test.espresso)
}
Empty file added core/network/consumer-rules.pro
Empty file.
21 changes: 21 additions & 0 deletions core/network/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
Loading