Skip to content

Commit

Permalink
Merge pull request #21 from pknu-wap/featurejaino/#14
Browse files Browse the repository at this point in the history
Featurejaino/#14
  • Loading branch information
jeongjaino authored Oct 6, 2023
2 parents 0367abd + 9848ea2 commit 8def0ce
Show file tree
Hide file tree
Showing 37 changed files with 470 additions and 0 deletions.
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>
}
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

0 comments on commit 8def0ce

Please sign in to comment.