-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #241 from mash-up-kr/feat/register
[Feat] 밈 등록 Register 모듈 추가
- Loading branch information
Showing
18 changed files
with
274 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
core/navigator/src/main/java/team/ppac/navigator/RegisterNavigator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package team.ppac.navigator | ||
|
||
import team.ppac.navigator.base.Navigator | ||
|
||
interface RegisterNavigator : Navigator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
plugins { | ||
alias(libs.plugins.android.library) | ||
alias(libs.plugins.kotlin.android) | ||
alias(libs.plugins.dagger.hilt) | ||
alias(libs.plugins.kotlin.kapt) | ||
} | ||
|
||
android { | ||
namespace = "team.ppac.feature.register" | ||
compileSdk = libs.versions.compileSdk.get().toInt() | ||
defaultConfig { | ||
minSdk = libs.versions.minSdk.get().toInt() | ||
} | ||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
buildFeatures { | ||
compose = true | ||
} | ||
composeOptions { | ||
kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(project(":core:analytics")) | ||
implementation(project(":core:common:android")) | ||
implementation(project(":core:common:kotlin")) | ||
implementation(project(":core:domain")) | ||
implementation(project(":core:designsystem")) | ||
implementation(project(":core:navigator")) | ||
implementation(project(":core:error-handling")) | ||
|
||
implementation(platform(libs.compose.bom)) | ||
implementation(libs.bundles.compose) | ||
implementation(libs.bundles.lifecycle) | ||
implementation(libs.appcompat) | ||
implementation(libs.core.ktx) | ||
implementation(libs.kotlin.coroutines.android) | ||
implementation(libs.timber) | ||
implementation(libs.hilt.android) | ||
implementation(libs.kotlinx.collections.immutable) | ||
implementation(libs.paging.runtime) | ||
implementation(libs.paging.compose) | ||
implementation(libs.compose.lottie) | ||
kapt(libs.hilt.compiler) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
23 changes: 23 additions & 0 deletions
23
feature/register/src/main/java/team/ppac/register/RegisterActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package team.ppac.register | ||
|
||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.core.view.WindowCompat | ||
import dagger.hilt.android.AndroidEntryPoint | ||
import team.ppac.common.android.util.noTransitionAnimation | ||
import team.ppac.designsystem.FarmemeTheme | ||
|
||
@AndroidEntryPoint | ||
class RegisterActivity : ComponentActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
WindowCompat.setDecorFitsSystemWindows(window, false) | ||
setContent { | ||
FarmemeTheme { | ||
RegisterRoute() | ||
} | ||
} | ||
noTransitionAnimation() | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
feature/register/src/main/java/team/ppac/register/RegisterRoute.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package team.ppac.register | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.hilt.navigation.compose.hiltViewModel | ||
import team.ppac.common.android.base.BaseComposable | ||
|
||
@Composable | ||
internal fun RegisterRoute( | ||
viewModel: RegisterViewModel = hiltViewModel(), | ||
) { | ||
BaseComposable(viewModel = viewModel) { uiState -> | ||
LaunchedEffect(key1 = viewModel) { | ||
viewModel.sideEffect.collect { sideEffect -> | ||
// when (sideEffect) { | ||
// | ||
// } | ||
} | ||
} | ||
|
||
RegisterScreen( | ||
uiState = uiState, | ||
) | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
feature/register/src/main/java/team/ppac/register/RegisterScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package team.ppac.register | ||
|
||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import team.ppac.designsystem.component.scaffold.FarmemeScaffold | ||
import team.ppac.register.mvi.RegisterUiState | ||
|
||
@Composable | ||
internal fun RegisterScreen( | ||
uiState: RegisterUiState, | ||
) { | ||
FarmemeScaffold( | ||
modifier = Modifier.fillMaxSize(), | ||
) { | ||
LazyColumn( | ||
modifier = Modifier.fillMaxSize(), | ||
) { | ||
item { | ||
Text(text = "RegisterScreen") | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun RegisterScreenPreview() { | ||
RegisterScreen( | ||
uiState = RegisterUiState.INITIAL_STATE, | ||
) | ||
} |
34 changes: 34 additions & 0 deletions
34
feature/register/src/main/java/team/ppac/register/RegisterViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package team.ppac.register | ||
|
||
import androidx.lifecycle.SavedStateHandle | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import team.ppac.common.android.base.BaseViewModel | ||
import team.ppac.errorhandling.FarmemeNetworkException | ||
import team.ppac.register.mvi.RegisterIntent | ||
import team.ppac.register.mvi.RegisterSideEffect | ||
import team.ppac.register.mvi.RegisterUiState | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class RegisterViewModel @Inject constructor( | ||
savedStateHandle: SavedStateHandle, | ||
) : BaseViewModel<RegisterUiState, RegisterSideEffect, RegisterIntent>(savedStateHandle) { | ||
|
||
override fun createInitialState(savedStateHandle: SavedStateHandle): RegisterUiState { | ||
return RegisterUiState.INITIAL_STATE | ||
} | ||
|
||
override fun handleClientException(throwable: Throwable) { | ||
if (throwable is FarmemeNetworkException) { | ||
reduce { | ||
copy(isError = true) | ||
} | ||
} | ||
} | ||
|
||
override suspend fun handleIntent(intent: RegisterIntent) { | ||
// when (intent) { | ||
// | ||
// } | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
feature/register/src/main/java/team/ppac/register/di/RegisterNavigatorModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package team.ppac.register.di | ||
|
||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.components.ActivityComponent | ||
import dagger.hilt.android.scopes.ActivityScoped | ||
import team.ppac.navigator.RegisterNavigator | ||
import team.ppac.register.navigator.RegisterNavigatorImpl | ||
|
||
@Module | ||
@InstallIn(ActivityComponent::class) | ||
internal abstract class RegisterNavigatorModule { | ||
@Binds | ||
@ActivityScoped | ||
abstract fun bindRegisterNavigator(impl: RegisterNavigatorImpl): RegisterNavigator | ||
} |
7 changes: 7 additions & 0 deletions
7
feature/register/src/main/java/team/ppac/register/mvi/RegisterIntent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package team.ppac.register.mvi | ||
|
||
import team.ppac.common.android.base.UiIntent | ||
|
||
sealed interface RegisterIntent : UiIntent { | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
feature/register/src/main/java/team/ppac/register/mvi/RegisterSideEffect.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package team.ppac.register.mvi | ||
|
||
import team.ppac.common.android.base.UiSideEffect | ||
|
||
sealed class RegisterSideEffect : UiSideEffect { | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
feature/register/src/main/java/team/ppac/register/mvi/RegisterUiState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package team.ppac.register.mvi | ||
|
||
import team.ppac.common.android.base.UiState | ||
|
||
data class RegisterUiState( | ||
val isLoading: Boolean, | ||
val isError: Boolean, | ||
) : UiState { | ||
|
||
companion object { | ||
val INITIAL_STATE = RegisterUiState( | ||
isLoading = false, | ||
isError = false, | ||
) | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
feature/register/src/main/java/team/ppac/register/navigator/RegisterNavigatorImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package team.ppac.register.navigator | ||
|
||
import android.app.Activity | ||
import android.content.Context | ||
import android.content.Intent | ||
import androidx.activity.result.ActivityResultLauncher | ||
import team.ppac.common.android.extension.getIntent | ||
import team.ppac.navigator.RegisterNavigator | ||
import team.ppac.register.RegisterActivity | ||
import javax.inject.Inject | ||
|
||
class RegisterNavigatorImpl @Inject constructor() : RegisterNavigator { | ||
override fun navigateFrom( | ||
activity: Activity, | ||
intentBuilder: Intent.() -> Intent, | ||
withFinish: Boolean | ||
) { | ||
activity.startActivity(activity.getIntent<RegisterActivity>(intentBuilder)) | ||
if (withFinish) activity.finish() | ||
} | ||
|
||
override fun navigateResultLauncher( | ||
launcher: ActivityResultLauncher<Intent>, | ||
activity: Activity, | ||
intentBuilder: Intent.() -> Intent | ||
) { | ||
launcher.launch(activity.getIntent<RegisterActivity>(intentBuilder)) | ||
} | ||
|
||
override fun navigateResultLauncher( | ||
launcher: ActivityResultLauncher<Intent>, | ||
context: Context, | ||
intentBuilder: Intent.() -> Intent | ||
) { | ||
launcher.launch(context.getIntent<RegisterActivity>(intentBuilder)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters