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/mz 150 kakao login #19

Merged
merged 60 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
d7cf053
chore: Timber Tree ์‹ฌ๊ธฐ
yangsooplus Dec 20, 2023
9e628a0
feat: kakao user sdk ์„ค์ •
yangsooplus Dec 20, 2023
c7fabab
feat: SplashContract ์ •์˜ ํ›„ SplashViewModel ๊ตฌํ˜„
yangsooplus Dec 20, 2023
136f96f
feat: kakao login ๊ตฌํ˜„
yangsooplus Dec 21, 2023
2570023
feat: ์ˆ˜์ˆ˜ auth api ์ธ์ฆ
yangsooplus Dec 21, 2023
7001066
refactor: domain์— KakaoLoginProvider ์ธํ„ฐํŽ˜์ด์Šค ์ถ”๊ฐ€
yangsooplus Dec 21, 2023
10497e5
fix: ์ˆ˜์ˆ˜ auth ๊ด€๋ จ ๋ˆ„๋ฝ ํŒŒ์ผ ์ถ”๊ฐ€
yangsooplus Dec 21, 2023
2f08e65
fix: ์ž˜๋ชป ์ž…๋ ฅํ•œ api ๋ช…์„ธ ์ˆ˜์ •
yangsooplus Dec 21, 2023
1af5735
fix: api ๋ณ€๊ฒฝ์— ๋”ฐ๋ฅธ user ํ”„๋กœํผํ‹ฐ ๋ณ€๊ฒฝ
yangsooplus Dec 21, 2023
5c04416
feat: SplashViewModel ์ˆ˜์ˆ˜ ํ† ํฐ ๋กœ์ง ์ถ”๊ฐ€
yangsooplus Dec 21, 2023
f7cdfbd
refactor: TokenRepository ์ €์žฅ ์‹œ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ Token ์‚ฌ์šฉ
yangsooplus Dec 21, 2023
a08f9d7
chore: AuthRepository.kt -> AuthRepositoryImpl.kt rename
yangsooplus Dec 21, 2023
323935e
chore: KakaoLoginProvider.kt -> KakaoLoginProviderImpl.kt rename
yangsooplus Dec 21, 2023
732dba5
feat: LoginContract, LoginViewModel ์ถ”๊ฐ€
yangsooplus Dec 21, 2023
e6ae3c3
feat: Kakao di Module ์ถ”๊ฐ€
yangsooplus Dec 21, 2023
0a42e76
chore: feature plugin์— hilt.navigation.compose ์˜์กด์„ฑ ์ถ”๊ฐ€
yangsooplus Dec 21, 2023
230df72
fix: Repository di ๋ถˆ๊ฐ€ ์˜ค๋ฅ˜ ํ•ด๊ฒฐ
yangsooplus Dec 22, 2023
2b9d07e
feat: ์นด์นด์˜ค accessToken ์ ‘๊ทผ ์ฝ”๋“œ ์ถ”๊ฐ€
yangsooplus Dec 22, 2023
2972865
refactor: Splash์™€ Login์„ Login์— ํ†ตํ•ฉ
yangsooplus Dec 22, 2023
765bc7f
fix: Authenticator๋ฅผ token ์žฌ๋ฐœํ–‰์„ authRepository๋กœ ์ด๋™ํ•จ์— ๋”ฐ๋ผ ์ˆ˜์ •
yangsooplus Dec 22, 2023
9e17f10
feat: ๊ธฐ๋Šฅ ํ…Œ์ŠคํŠธ UI ์ถ”๊ฐ€
yangsooplus Dec 22, 2023
5f72d06
fix: hilt ์ˆœํ™˜ ์ฐธ์กฐ ์ œ๊ฑฐ
yangsooplus Dec 22, 2023
6960045
chore: ์นด์นด์˜ค ๋กœ๊ทธ์ธ ํ…Œ์ŠคํŠธ์šฉ ๋กœ๊ทธ ์ถ”๊ฐ€
yangsooplus Dec 22, 2023
7a2867e
fix: api ๋ช…์„ธ ํ˜•์‹ ํ‹€๋ฆฐ ๋ถ€๋ถ„ ์ˆ˜์ •
yangsooplus Dec 22, 2023
5bcd5dd
fix: ActivityContext๊ฐ€ ํ•„์š”ํ•œ ๋กœ๊ทธ์ธ ๋™์ž‘์„ ๋ถ„๋ฆฌ
yangsooplus Dec 22, 2023
cebb823
fix: token ์ €์žฅ์„ ์™„๋ฃŒํ•  ๋•Œ๊นŒ์ง€ ๋Œ€๊ธฐ
yangsooplus Dec 26, 2023
7f09a87
refactor: encrpted-datastore๋กœ ๊ต์ฒด
yangsooplus Dec 26, 2023
2cc691a
fix: kakao token ๋งŒ๋ฃŒ ์ฒดํฌ ํ›„ ์ˆ˜์ˆ˜ ๋กœ๊ทธ์ธ ์‹œ๋„ํ•˜๋„๋ก ์ˆ˜์ •
yangsooplus Dec 26, 2023
5d533b9
feat: ApiService์— ์ˆ˜์ˆ˜ ํšŒ์› ํƒˆํ‡ด ์ถ”๊ฐ€
yangsooplus Dec 26, 2023
ca2e3f5
feat: login, signup nested navigation ์ง€์ •
yangsooplus Dec 26, 2023
286ac14
fix: ์ˆ˜์ˆ˜ ํ† ํฐ ํ—ค๋” ํ˜•์‹ ์ˆ˜์ •
yangsooplus Dec 26, 2023
2c8aad0
feat: ๊ธฐ๋Šฅ ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•œ ์ž„์‹œ UI ์ฝ”๋“œ
yangsooplus Dec 26, 2023
04d9e01
chore: hilt-navigation-compose ์˜์กด์„ฑ ์œ„์น˜ ๋ณ€๊ฒฝ
yangsooplus Dec 26, 2023
1a7748d
chore: kakao sdk ๊ด€๋ จ ํŒŒ์ผ social ํŒจํ‚ค์ง€๋กœ ์ด๋™
yangsooplus Dec 26, 2023
08dde4e
chore: ๊ธฐ์กด ์•”ํ˜ธํ™” DataStore ์ฝ”๋“œ ์‚ญ์ œ
yangsooplus Dec 26, 2023
076999a
chore: detekt ํ˜•์‹ ๋งž์ถค
yangsooplus Dec 26, 2023
98c82af
chore: gitignore์— report, google-service.json ์ถ”๊ฐ€
yangsooplus Dec 26, 2023
3d4db6c
chore: ktlint trailing comma check
yangsooplus Dec 26, 2023
66a84c9
chore: ktlint Import order check
yangsooplus Dec 26, 2023
3a3a014
chore: local.properties๋กœ ์นด์นด์˜ค ์•ฑ ํ‚ค ์ด๋™
yangsooplus Dec 31, 2023
74f23eb
fix: mergeํ•˜๋ฉฐ ๋ˆ„๋ฝ๋œ plugin ๋ณต๊ตฌ
yangsooplus Dec 31, 2023
1dc7860
feat: LoggingInterceptor level ์„ค์ • ๋ฐ di
yangsooplus Dec 31, 2023
84df3e7
refactor: kakao sdk ์‹ฑ๊ธ€ํ†ค ๊ต์ฒด ๋ฐ di ์ฝ”๋“œ ์‚ญ์ œ
yangsooplus Dec 31, 2023
2e18684
refactor: NetworkModule์—์„œ service ๋ถ„๋ฆฌ
yangsooplus Dec 31, 2023
af6d54f
refactor: Service ๋„ค์ด๋ฐ ์ˆ˜์ •
yangsooplus Dec 31, 2023
5d585ab
chore: Contract ํƒ€์ž… class -> sealed interface
yangsooplus Dec 31, 2023
6128d67
chore: sns -> oauth ๋„ค์ด๋ฐ ๋ณ€๊ฒฝ
yangsooplus Dec 31, 2023
9f16e97
chore: gitignore์— idea ํด๋” ์ถ”๊ฐ€
yangsooplus Dec 31, 2023
67a4348
refactor: TokenEntity -> TokenResponse ๋„ค์ด๋ฐ ๋ณ€๊ฒฝ๊ณผ ์œ ํšจ๊ธฐ๊ฐ„ ํ”„๋กœํผํ‹ฐ ์ œ๊ฑฐ
yangsooplus Jan 2, 2024
449c04c
refactor: UserEntity -> UserRequest
yangsooplus Jan 2, 2024
4ad776b
refactor: AuthRepository๋ฅผ Login๊ณผ SignUp์œผ๋กœ ๋ถ„๋ฆฌ
yangsooplus Jan 2, 2024
722b085
refactor: ๋กœ๊ทธ์ธ/ํšŒ์›๊ฐ€์ž… ๋™์ž‘ ๊ด€๋ จ Usecase ์ถ”๊ฐ€
yangsooplus Jan 2, 2024
60675d5
feat: SplashScreen Api ์ ์šฉ
yangsooplus Jan 2, 2024
5f5b40e
feat: ์•ฑ ์‹คํ–‰ ๋ฐ์ดํ„ฐ ์ž‘์—… ์ค‘์— SplashScreen์„ ๊ณ„์† ๋ณด์ด๋„๋ก ์„ค์ •
yangsooplus Jan 2, 2024
e21b8a0
feat: Splash๋ฅผ ๋ณด์—ฌ์ฃผ๊ณ  ๋‚œ ๋’ค, ์œ ์ € ๋ฐ์ดํ„ฐ์— ๋”ฐ๋ผ ํ™”๋ฉด ์ด๋™
yangsooplus Jan 2, 2024
8928f59
refactor: TestScreen์˜ ๋™์ž‘์„ MyPage๋กœ ์˜ฎ๊น€
yangsooplus Jan 2, 2024
846ade5
feat: ์นด์นด์˜ค ๋กœ๊ทธ์ธ ํ›„ ํšŒ์›๊ฐ€์ž… ์ดํƒˆ ์œ ์ €๋Š” ํšŒ์›๊ฐ€์ž… ํ™”๋ฉด์œผ๋กœ ์ด๋™
yangsooplus Jan 2, 2024
d4e1d00
chore: detekt๊ฐ€ apiKey๋ฅผ ๋ถˆ๋Ÿฌ์˜ฌ ๋•Œ null check ๋ฌด์‹œ
yangsooplus Jan 2, 2024
d0c87bb
fix: ์นด์นด์˜ค๊ณ„์ • ๋กœ๊ทธ์ธ ํ›„ ์ง„ํ–‰ ์•ˆ๋˜๋Š” ๋ฌธ์ œ ์ˆ˜์ •
yangsooplus Jan 2, 2024
d6f69ac
chore: detekt ์ˆ˜์ •์‚ฌํ•ญ ๋ฐ˜์˜
yangsooplus Jan 3, 2024
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
1 change: 0 additions & 1 deletion data/src/main/java/com/susu/data/di/NetworkModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ object NetworkModule {
@AuthOkHttpClient
fun provideAuthOkHttpClient(
loggingInterceptor: HttpLoggingInterceptor,
json: Json,
): OkHttpClient = OkHttpClient.Builder()
.addInterceptor(loggingInterceptor)
.build()
Expand Down
16 changes: 16 additions & 0 deletions domain/src/main/java/com/susu/domain/usecase/LogoutUseCase.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.susu.domain.usecase

import com.susu.core.common.runCatchingIgnoreCancelled
import com.susu.domain.repository.LoginRepository
import com.susu.domain.repository.TokenRepository
import javax.inject.Inject

class LogoutUseCase @Inject constructor(
private val loginRepository: LoginRepository,
private val tokenRepository: TokenRepository,
) {
suspend operator fun invoke() = runCatchingIgnoreCancelled {
loginRepository.logout()
tokenRepository.deleteTokens()
}
}
16 changes: 16 additions & 0 deletions domain/src/main/java/com/susu/domain/usecase/WithdrawUseCase.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.susu.domain.usecase

import com.susu.core.common.runCatchingIgnoreCancelled
import com.susu.domain.repository.LoginRepository
import com.susu.domain.repository.TokenRepository
import javax.inject.Inject

class WithdrawUseCase @Inject constructor(
private val loginRepository: LoginRepository,
private val tokenRepository: TokenRepository,
) {
suspend operator fun invoke() = runCatchingIgnoreCancelled {
loginRepository.withdraw()
tokenRepository.deleteTokens()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.susu.feature.loginsignup

import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable

@Composable
fun VoteScreen(
navigateToLogin: () -> Unit
) {
Button(onClick = navigateToLogin) {
Text("๋Œ€์ถฉ ํšŒ์›๊ฐ€์ž… ํˆฌํ‘œ")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,41 @@ import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
import androidx.navigation.compose.composable
import androidx.navigation.navigation
import com.susu.feature.loginsignup.VoteScreen
import com.susu.feature.loginsignup.login.LoginScreen
import com.susu.feature.loginsignup.signup.SignUpScreen
import com.susu.feature.loginsignup.test.TestScreen

@Suppress("unused")
fun NavController.navigateLoginSignup(navOptions: NavOptions) {
navigate(LoginSignupRoute.Parent.route, navOptions)
}

fun NavGraphBuilder.loginSignupNavGraph(navController: NavController) {
navigation(startDestination = LoginSignupRoute.Parent.Login.route, route = LoginSignupRoute.Parent.route) {
composable(route = LoginSignupRoute.Parent.Login.route) {
LoginScreen(
navigateToReceived = { navController.navigate(LoginSignupRoute.Parent.Test.route) },
navigateToSignUp = { navController.navigate(LoginSignupRoute.Parent.SignUp.route) },
)
}
composable(route = LoginSignupRoute.Parent.SignUp.route) {
SignUpScreen(
navigateToReceived = { navController.navigate(LoginSignupRoute.Parent.Test.route) },
)
}
composable(route = LoginSignupRoute.Parent.Test.route) {
TestScreen(
navigateToLogin = { navController.popBackStack() },
)
}
fun NavGraphBuilder.loginSignupNavGraph(
navController: NavController,
navigateToReceived: () -> Unit,
) {
composable(route = LoginSignupRoute.Parent.Vote.route) {
VoteScreen(
navigateToLogin = { navController.navigate(LoginSignupRoute.Parent.Login.route) },
)
}
composable(route = LoginSignupRoute.Parent.Login.route) {
LoginScreen(
navigateToReceived = navigateToReceived,
navigateToSignUp = { navController.navigate(LoginSignupRoute.Parent.SignUp.route) },
)
}
composable(route = LoginSignupRoute.Parent.SignUp.route) {
SignUpScreen(
navigateToReceived = navigateToReceived,
)
}
}

sealed class LoginSignupRoute(val route: String) {
data object Parent : LoginSignupRoute("login-signup") {
data object Vote : LoginSignupRoute("vote")
data object Login : LoginSignupRoute("login")
data object SignUp : LoginSignupRoute("signup")
data object Test : LoginSignupRoute("test")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object KakaoLoginHelper {
loginWithKakaoAccount(
onSuccess = onSuccess,
onFailed = onFailed,
context = context
context = context,
)
}
},
Expand Down Expand Up @@ -87,21 +87,4 @@ object KakaoLoginHelper {
}
}
}

// ๊ธฐ๋Šฅ ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•จ.
fun logout() = runCatching {
UserApiClient.instance.logout { error ->
if (error != null) {
throw error
}
}
}

fun unlink() = runCatching {
UserApiClient.instance.unlink { error ->
if (error != null) {
throw error
}
}
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.susu.feature.mypage

import com.susu.core.ui.base.SideEffect
import com.susu.core.ui.base.UiState

interface MyPageContract {
sealed class MyPageEffect : SideEffect {
data object NavigateToLogin : MyPageEffect()
data class ShowToast(val msg: String) : MyPageEffect()
}

object MyPageState : UiState
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,52 @@
package com.susu.feature.mypage

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import com.susu.core.designsystem.theme.SusuTheme

@Composable
fun MyPageScreen(
padding: PaddingValues,
viewModel: MyPageViewModel = hiltViewModel(),
navigateToLogin: () -> Unit,
) {
Text(
modifier = Modifier.padding(padding),
text = "๋งˆ์ด ํŽ˜์ด์ง€",
)
LaunchedEffect(key1 = viewModel.sideEffect) {
viewModel.sideEffect.collect { sideEffect ->
when (sideEffect) {
MyPageContract.MyPageEffect.NavigateToLogin -> navigateToLogin()
is MyPageContract.MyPageEffect.ShowToast -> {
//TODO: UI ์ž‘์—… ์‹œ ์—๋Ÿฌ ๋ฉ”์„ธ์ง€ ํ‘œ์‹œ
navigateToLogin()
}
}
}
}

Column {
Button(onClick = viewModel::logout) {
Text(text = "๋กœ๊ทธ์•„์›ƒ")
}
Button(
onClick = viewModel::withdraw,
) {
Text(text = "ํƒˆํ‡ด")
}
}
}

@Preview
@Composable
fun MyPageScreenPreview() {
SusuTheme {
MyPageScreen(padding = PaddingValues(0.dp))
MyPageScreen(padding = PaddingValues(0.dp)) {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.susu.feature.mypage

import androidx.lifecycle.viewModelScope
import com.kakao.sdk.user.UserApiClient
Copy link
Member

Choose a reason for hiding this comment

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

์กฐ๊ธˆ ๋ณต์žกํ•˜์ง€๋งŒ callback ํ˜•์‹์œผ๋กœ ๋งŒ๋“ค๋ฉด kakao sdk ์˜์กด์„ฑ ์ œ๊ฑฐ ๊ฐ€๋Šฅํ•˜์ง€ ์•Š์„๋ ค๋‚˜์š”?
์นด์นด์˜ค sdk ์˜์กด์„ฑ์ด viewmodel์— ์žˆ์œผ๋ฉด ๋‚˜์ค‘์— ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์งœ๊ธฐ๊ฐ€ ์–ด๋ ค์šธ ๊ฒƒ ๊ฐ™์•„์š”. ๋ฌผ๋ก  ์ด ํ”„๋กœ์ ํŠธ์—์„œ ํ…Œ์ŠคํŠธ์ฝ”๋“œ๋ฅผ ์งœ์ง„ ์•Š์„ํ…Œ์ง€๋งŒ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ž‘์„ฑ์ด ์œ ๋ฆฌํ•˜๊ฒŒ ViewModel์„ ๋งŒ๋“œ๋Š” ์—ฐ์Šต์„ ํ•ด๋ณด๋ฉด ์–ด๋–จ๊นŒ ํ•˜๋Š” ์ƒ๊ฐ์ž…๋‹ˆ๋‹ค!

import com.susu.core.ui.base.BaseViewModel
import com.susu.domain.usecase.LogoutUseCase
import com.susu.domain.usecase.WithdrawUseCase
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import javax.inject.Inject

@HiltViewModel
class MyPageViewModel @Inject constructor(
private val logoutUseCase: LogoutUseCase,
private val withdrawUseCase: WithdrawUseCase,
) : BaseViewModel<MyPageContract.MyPageState, MyPageContract.MyPageEffect>(MyPageContract.MyPageState) {

fun logout() {
UserApiClient.instance.logout { error ->
Copy link
Member

Choose a reason for hiding this comment

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

์•— ๋‹ค์‹œ ๋ณด๋‹ˆ UserApiClient ๊ด€๋ จ ์ฝ”๋“œ๋งŒ Screen ์ชฝ์—์„œ ์‹คํ–‰ํ•œ๋‹ค๋ฉด ์˜์กด์„ฑ ์ œ๊ฑฐ ๊ฐ€๋Šฅํ• ๊ฑฐ๊ฐ™์•„์š”

if (error != null) {
postSideEffect(MyPageContract.MyPageEffect.ShowToast(error.message ?: "์—๋Ÿฌ ๋ฐœ์ƒํ–ˆ์ง€๋งŒ ํ† ํฐ์€ ์‚ญ์ œ๋จ"))
} else {
viewModelScope.launch {
logoutUseCase().onSuccess {
postSideEffect(MyPageContract.MyPageEffect.NavigateToLogin)
}
}
}
}
}

fun withdraw() {
UserApiClient.instance.unlink { error ->
if (error != null) {
postSideEffect(MyPageContract.MyPageEffect.ShowToast(error.message ?: "์—๋Ÿฌ ๋ฐœ์ƒํ–ˆ์ง€๋งŒ ํ† ํฐ์€ ์‚ญ์ œ๋จ"))
} else {
viewModelScope.launch {
withdrawUseCase().onSuccess {
postSideEffect(MyPageContract.MyPageEffect.NavigateToLogin)
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ fun NavController.navigateMyPage(navOptions: NavOptions) {

fun NavGraphBuilder.myPageNavGraph(
padding: PaddingValues,
navigateToLogin: () -> Unit
) {
composable(route = MyPageRoute.route) {
MyPageScreen(padding)
MyPageScreen(padding, navigateToLogin = navigateToLogin)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class MainActivity : ComponentActivity() {
),
),
startDestination = when (uiState.initialRoute) {
InitialRoute.SIGNUP_VOTE -> LoginSignupRoute.Parent.route
InitialRoute.LOGIN -> LoginSignupRoute.Parent.route
InitialRoute.SIGNUP_VOTE -> LoginSignupRoute.Parent.Vote.route
InitialRoute.LOGIN -> LoginSignupRoute.Parent.Login.route
InitialRoute.RECEIVED -> ReceivedRoute.route
InitialRoute.NONE -> LoginSignupRoute.Parent.route
},
Expand Down
Loading
Loading