-
Notifications
You must be signed in to change notification settings - Fork 0
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
#29: AuthActivity를 만들어 회원가입을 진행해요 #34
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bf662b2
[CHORE]#29: AuthActivity 생성
flash159483 497f69c
[CHORE]#29: SideEffect으로 대체
flash159483 0e1acfe
[CHORE]#29: Navigation logic을 추가
flash159483 070a04b
[CHORE]#29: Test 삭제
flash159483 614d0a7
[CHORE]#29: rebase 해요
flash159483 4c118b0
[CHORE]#29: extension 옴겨요
flash159483 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 } | ||
}) | ||
flash159483 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
} | ||
|
||
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오호~ 이거 동작하는거죠 ?
제가 알기로 abstract class만 @BINDS 지원해주는 줄 알았는데, interface도 가능하군요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
binds는 interface 아니면 abstract class에 동작해요