-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
#29: AuthActivity를 만들어 회원가입을 진행해요
- Loading branch information
Showing
24 changed files
with
294 additions
and
104 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.bff.wespot | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import com.danggeun.navigation.Navigator | ||
import com.danggeun.navigation.util.buildIntent | ||
|
||
class NavigatorImpl : Navigator { | ||
override fun navigateToMain( | ||
context: Context, | ||
): Intent { | ||
val intent = context.buildIntent<MainActivity>() | ||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK | ||
return intent | ||
} | ||
} |
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 com.bff.wespot.di | ||
|
||
import com.bff.wespot.NavigatorImpl | ||
import com.danggeun.navigation.Navigator | ||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
interface NavigationModule { | ||
@Binds | ||
@Singleton | ||
fun provideNavigator(navigator: NavigatorImpl): 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,9 @@ | ||
plugins { | ||
alias(libs.plugins.wespot.android.library) | ||
alias(libs.plugins.wespot.android.hilt) | ||
} | ||
|
||
|
||
android { | ||
namespace = "com.bff.wespot.navigation" | ||
} |
Empty file.
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,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 |
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> |
10 changes: 10 additions & 0 deletions
10
core/navigation/src/main/java/com/danggeun/navigation/Navigator.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,10 @@ | ||
package com.danggeun.navigation | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
|
||
interface Navigator { | ||
fun navigateToMain( | ||
context: Context | ||
) : Intent | ||
} |
12 changes: 12 additions & 0 deletions
12
core/navigation/src/main/java/com/danggeun/navigation/util/Extension.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,12 @@ | ||
package com.danggeun.navigation.util | ||
|
||
import android.app.Activity | ||
import android.content.Context | ||
import android.content.Intent | ||
import androidx.core.os.bundleOf | ||
|
||
inline fun <reified T : Activity> Context.buildIntent( | ||
vararg argument: Pair<String, Any?>, | ||
) = Intent(this, T::class.java).apply { | ||
putExtras(bundleOf(*argument)) | ||
} |
2 changes: 1 addition & 1 deletion
2
...n/repository/usecase/KakaoLoginUseCase.kt → ...espot/domain/usecase/KakaoLoginUseCase.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
87 changes: 87 additions & 0 deletions
87
feature/auth/src/main/kotlin/com/bff/wespot/auth/AuthActivity.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,87 @@ | ||
package com.bff.wespot.auth | ||
|
||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.material3.Surface | ||
import androidx.compose.ui.Modifier | ||
import androidx.lifecycle.viewmodel.compose.viewModel | ||
import androidx.navigation.compose.rememberNavController | ||
import com.bff.wespot.auth.screen.NavGraphs | ||
import com.bff.wespot.auth.screen.destinations.ClassScreenDestination | ||
import com.bff.wespot.auth.screen.destinations.CompleteScreenDestination | ||
import com.bff.wespot.auth.screen.destinations.EditScreenDestination | ||
import com.bff.wespot.auth.screen.destinations.GenderScreenDestination | ||
import com.bff.wespot.auth.screen.destinations.GradeScreenDestination | ||
import com.bff.wespot.auth.screen.destinations.NameScreenDestination | ||
import com.bff.wespot.auth.screen.destinations.SchoolScreenDestination | ||
import com.bff.wespot.auth.state.AuthSideEffect | ||
import com.bff.wespot.auth.viewmodel.AuthViewModel | ||
import com.bff.wespot.designsystem.theme.WeSpotTheme | ||
import com.ramcosta.composedestinations.DestinationsNavHost | ||
import com.ramcosta.composedestinations.navigation.dependency | ||
import com.ramcosta.composedestinations.navigation.navigate | ||
import com.ramcosta.composedestinations.rememberNavHostEngine | ||
import org.orbitmvi.orbit.compose.collectSideEffect | ||
|
||
class AuthActivity : ComponentActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContent { | ||
val navController = rememberNavController() | ||
val engine = rememberNavHostEngine() | ||
val viewModel: AuthViewModel = viewModel() | ||
|
||
viewModel.collectSideEffect { | ||
when (it) { | ||
AuthSideEffect.PopBackStack -> navController.popBackStack() | ||
is AuthSideEffect.NavigateToGradeScreen -> { | ||
navController.navigate(GradeScreenDestination(it.edit)) | ||
} | ||
|
||
is AuthSideEffect.NavigateToSchoolScreen -> { | ||
navController.navigate(SchoolScreenDestination(it.edit)) | ||
} | ||
|
||
is AuthSideEffect.NavigateToClassScreen -> { | ||
navController.navigate(ClassScreenDestination(it.edit)) | ||
} | ||
|
||
is AuthSideEffect.NavigateToGenderScreen -> { | ||
navController.navigate(GenderScreenDestination(it.edit)) | ||
} | ||
|
||
is AuthSideEffect.NavigateToNameScreen -> { | ||
navController.navigate(NameScreenDestination(it.edit)) | ||
} | ||
|
||
AuthSideEffect.NavigateToEditScreen -> { | ||
navController.navigate(EditScreenDestination) | ||
} | ||
|
||
AuthSideEffect.NavigateToCompleteScreen -> { | ||
navController.navigate(CompleteScreenDestination, navOptionsBuilder = { | ||
popUpTo(SchoolScreenDestination.route) { inclusive = true } | ||
}) | ||
} | ||
} | ||
} | ||
|
||
WeSpotTheme { | ||
Surface( | ||
modifier = Modifier.fillMaxSize(), | ||
) { | ||
DestinationsNavHost( | ||
navGraph = NavGraphs.root, | ||
navController = navController, | ||
engine = engine, | ||
dependenciesContainerBuilder = { | ||
dependency(viewModel) | ||
}, | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.