-
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
Week7 #12
base: develop
Are you sure you want to change the base?
Conversation
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.
์ธ๋ฏธ๋ ๋ฌ๋ ค์ค์๋๋ผ ๊ณ ์๋ง์ผ์
จ์ต๋๋ค!!
์ง์๋์ด ์ด์ฌํ ๊ณผ์ ํด์ฃผ์
์ ๋๋ถ์ ์ ๋ ์ฌ๋ฏธ์๊ฒ ์ฝ๋๋ฆฌ๋ทฐ ํ์ต๋๋ค.
์ฑ์ผ ํ์ดํ ์ ๋๋ค ๐
|
||
import org.sopt.and.data.dataremote.model.response.ResponseGetUserHobbyDto | ||
import org.sopt.and.domain.repository.UserRepository | ||
import retrofit2.Response |
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.
domain์์๋ kotlin/java๋ฅผ ์ ์ธํ ์์กด์ฑ์ด ์์ผ๋ฉด ์๋ผ์. ํ์ฌ๋ retrofit๊ณผ data ๋ ์ด์ด์ ์ ๋ณด๊ฐ ๋ค์ด์๋ค์
domain์ ์กด์ฌ ์์์ ๋ํด์ ์๊ฐํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค!
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.
์ฌ์ฉํ์ง ์๋ ์ํฌํธ๋ฌธ์์ ํ์ธํ์ฌ ์ ๊ฑฐํ์ต๋๋ค. ๊ผผ๊ผผํ ํ์ธ๊ณผ ์กฐ์ธ ๊ฐ์ฌํฉ๋๋ค!
@Singleton | ||
class ValidateUserInputUseCase @Inject constructor() { | ||
fun stringInputValidCheck(userInput: String) : Boolean { | ||
return userInput.length <= 7 | ||
} | ||
|
||
fun passwordValidCheck(password: String) : Boolean { | ||
val pattern = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[!@#\$%^&*]).{8,20}$".toRegex() | ||
return password.matches(pattern) | ||
} | ||
} |
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.
- ๊ธธ์ด๋ฅผ ๋ํ๋ด๋ 7๊ณผ ๊ฐ์ ๊ฐ์ ์์๋ก ๋นผ๋๋๊ฒ ๊ฐ๋ ์ฑ ์ธก๋ฉด์์ ์ข์์. ์ถํ ์ด ์ฝ๋๋ฅผ ๋ค๋ฅธ ์ฌ๋์ด ๋ณธ๋ค๋ฉด 7์ด๋ผ๋ ์ซ์๊ฐ ์ด๋ค ์๋ฏธ์ธ์ง ์๊ฐํ๊ธฐ ํ๋ค ์ ์์ด์.
- ํด๋น useCase์์ 2๊ฐ์ ํจ์๋ฅผ ์ฌ์ฉํ๊ณ ,
operator fun invoke
์ ํ์์ ์ฌ์ฉํ์ง ์์ ์ด์ ๊ฐ ์๋์?? ์ด๋ ๊ฒ ์์ฑํ ์ด์ ๋ฅผ ํ๋ฒ ์๊ฐํด๋ณด์ ํ ๋ธ๋ก๊ทธ๊ธ ํ๋ฒ ์ฝ์ด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์์ :)
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.
๋๋ถ์ operator fun invoke๋ฅผ ์ฌ์ฉํ๋ฉด ๊ฐ์ฒด๋ฅผ ํจ์์ฒ๋ผ, ์ด๋ฆ ์์ด ๋ฐ๋ก ํธ์ถํ ์ ์๋ค๋ ์ฌ์ค์ ์ ๋๋ก ์์๊ฐ๋๋ค!
๊ณ ๋ฏผํด๋ดค๋๋ฐ UserInput์ ๊ฒ์ฆํ๋ ๊ฒฝ์ฐ๊ฐ 1)์ ์ ์ด๋ฆ 2)์ ์ ๋น๋ฐ๋ฒํธ ๋ก ๋ ๊ฐ์ง๋ผ, invoke๋ฅผ ์ฌ์ฉํ๋ฉด ์คํ๋ ค ์ด๋ ๊ฒฝ์ฐ์ ๋ํ ํจ์ ์ฒ๋ฆฌ์ธ์ง ํท๊ฐ๋ฆด ๊ฒ ๊ฐ์ ์ด๋ ๊ฒ 2๊ฐ์ ํจ์๋ช
์ ๊ทธ๋๋ก ์ฌ์ฉํ๋ ค๊ณ ํฉ๋๋ค. ๋์ ๋๋ถ์ ์์ผ๋ก๋ PostSignUpUseCase๋ฑ ํ๋์ ํจ์๋ง ํฌํจ๋ usecase์์ invoke๋ฅผ ์ ๋๋ก ์ดํดํ๊ณ ์ ์ ํ ํ์ฉํ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค!
class HomeContract { | ||
|
||
data class HomeUiState( | ||
val pagerImages: List<Int> = listOf(), |
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.
List๋ ๋ถ๋ณ ๊ฐ์ฒด๊ฐ ์๋ ์ฝ๊ธฐ์ ์ฉ ๊ฐ์ฒด์ ๋๋ค. ๊ทธ๋ ๊ธฐ ๋๋ฌธ์ ๋ฆฌ์ปดํฌ์ง์ ์ ๋์์ด ๋ผ์.
๋ถํ์ํ ๋ฆฌ์ปดํฌ์ง์ ์ ์ค์ด๊ณ ์ฑ๋ฅ์ ๋์ฑ ๋์ด๊ณ ์ถ๋ค๋ฉด @stable, @immutable๊ณผ ๊ฐ์ ์ด๋ ธํ ์ด์ ํน์ ImmutableList ๋ฑ์ ์ฌ์ฉํ๋ฉด ์ข์ ๊ฒ ๊ฐ์์
HomeLazyRow( | ||
title = "๋ฏฟ๊ณ ๋ณด๋ ์จ์ด๋ธ ์๋ํฐ ์ถ์ฒ์", | ||
images = images, | ||
images = uiState.pagerImages, | ||
height = 230, | ||
width = 140, | ||
onItemClick = { index -> | ||
homeViewModel.setEvent(HomeContract.HomeEvent.OnImageClicked(index)) | ||
} | ||
) |
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.
key๋ผ๋ ๊ฒ์ ๋ํด์ ์๊ณ ์์ผ์ ๊ฐ์??
key๋ฅผ ์ฌ์ฉํ๊ฒ ๋๋ฉด ๋ถํ์ํ ๋ฆฌ์ปดํฌ์ง์
์ ์ค์ผ ์ ์์ด์. ํ๋ฒ ์ฐพ์๋ณด์๊ณ ์ ์ฉํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค :)
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.
๊ฐ ํญ๋ชฉ์ ๊ฐ์ ๊ณ ์ ํ๊ฒ ์๋ณํ๋ key๋ฅผ LazyRow์ ์ถ๊ฐํ๊ธฐ๋ง ํด๋ ๋ถํ์ํ ๋ฆฌ์ปดํฌ์ง์ ์ ์ค์ผ ์ ์๊ตฐ์..! ์ข์ ์ง์ ์์๊ฐ๋๋ค!
horizontalAlignment = Alignment.CenterHorizontally | ||
) { | ||
Image( | ||
painter = painterResource(id = R.drawable.wavve_logo), |
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.
painter
๋ด๋ถ ์ฝ๋๋ฅผ ๋ณด๋ฉด UnStableํ๋ค๊ณ ๋์์์ด์. ๋ฐ๋ฉด imageVector
๋ฅผ ๋ณธ๋ค๋ฉด Stableํ๋ค๊ณ ๋์ด์์ด์.
๊ทธ๋ ๊ธฐ ๋๋ฌธ์ R์ ์๋ ํ์ผ์ ์ฌ์ฉํ์ ๋ค๋ฉด imageVector๋ก ์ฌ์ฉํ์๋ ๊ฒ์ด ๋ฆฌ์ปดํฌ์ง์
์ ์ค์ด๊ณ ์ฑ๋ฅ์ ๋์ผ ์ ์์ด์.
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.
๋น์ทํ ๊ธฐ๋ฅ์ฒ๋ผ ๋ณด์ฌ๋ painterResource์ imageVector๋ฅผ ๋ค๋ฅด๊ฒ ํ์ฉํ ์ ์๊ตฐ์! ๋ํ ์ผํ ๋ด์ฉ๊น์ง ์ ์ํด ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค!
is LoginContract.LoginEvent.OnUserNameChanged -> { | ||
setState { copy(userName = event.userName, isUserNameValid = event.userName.length <= 7) } | ||
} | ||
is LoginContract.LoginEvent.OnPasswordChanged -> { | ||
setState { copy(password = event.password, isPasswordValid = event.password.length <= 8) } | ||
} |
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.
- ์ฌ๊ธฐ์๋ ๊ธธ์ด์ ํด๋นํ๋ ๋ถ๋ถ์ ์์๋ก ๋นผ์ ๊ด๋ฆฌํ๋ฉด ์ข์ ๊ฒ ๊ฐ์์.
- ์ฌ๊ธฐ์๋ ๊ธธ์ด์ ๋ํ ๊ฒ์ฆ์ ์งํํ๊ณ , ์์์๋ useCase์์๋ ๊ธธ์ด์ ๋ํ ๊ฒ์ฆ์ ์ํํ๊ณ ์๋ ๊ฒ ๊ฐ์์. ๋ง์ฝ ๊ธธ์ด๊ฐ 7์์ 9๋ก ๋ณ๊ฒฝ๋์๋ค๋ฉด 2๊ฐ์ ์ฝ๋๋ฅผ ์์ ํด์ผํ ๊ฒ ๊ฐ๋ค์. ์ด๋ป๊ฒ ํ๋ฉด ์ข์๊น์?
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.
ํ์๊ฐ์ ์๋ ๋ก๊ทธ์ธ ์๋ ์ฌ์ฉ์๊ฐ ์ ๋ ฅํ username/password์ ๋ํ ๊ธธ์ด ์ ํ ์กฐ๊ฑด์ ๋๊ฐ์์, ๋์ผํ usecase๋ฅผ ๋ถ๋ฌ์์ ๊ฐ์ ํจ์๋ก isValid ๋ฅผ ์ฒ๋ฆฌํ ํ setState ํด์ฃผ๋ ๋ฐฉ์์ผ๋ก ์์ ํ์ต๋๋ค!
์ด์ ์๋ ViewModel์์ ๋ฐ๋ก Contract์ setEvent๋ฅผ ๋ถ๋ฌ์ ์ํ๋ฅผ ๋ฐ๊ฟ์ฃผ๋ ๋ฐฉ๋ฒ๊ณผ, Usecase๋ฅผ ํ์ฉํ๋ ๋ฐฉ๋ฒ ๋ ๊ฐ๊ฐ ์ด๋จ ๋ ๋ค๋ฅด๊ฒ ํ์ฉํ ์ ์๋ ๊ฑด์ง ๋ถ๊ฐ์ด ์ ์ ๊ฐ๋๋ฐ ์กฐ๊ธ ๊ณ ๋ฏผํด๋ณด๋ UI์ ๋์ฐ๋ ์ํ (ํ๋ฉด์ ์ฌ๋ผ๊ฐ๋ ๋ฐ์ดํฐ ๊ฐ๋ค)์ ๊ฐ๋จํ๊ฒ ๋ฐ๊พธ๋ ์์ ์ธ์ง vs ํน์ ์กฐ๊ธ ๋ ๋ณต์กํ ๋น์ฆ๋์ค ๋ก์ง์ธ์ง ๋ฅผ ๊ณ ๋ฏผํ๋ฉด ๊ตฌ๋ถ์ด ์กฐ๊ธ ๋ ์์ํ ๊ฒ ๊ฐ์ต๋๋ค! ์ข์ ์กฐ์ธ ๊ฐ์ฌํฉ๋๋ค :)
} catch (e: Exception) { | ||
sendSideEffect(LoginContract.LoginSideEffect.ShowSnackbar("๋ก๊ทธ์ธ ์์ฒญ ์ค ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.")) |
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.
tryCatch๋ ์ ๋ง ์ข์ ๋ฐฉ๋ฒ์ด์ฃ !
ํ์ง๋ง ํด๋น ๋ฐฉ๋ฒ์ ์ฌ์ฉํ ๋์๋ catch๋ฅผ ํ๋ Exception์ ๋ํด์ ๋ช
์์ ์ผ๋ก ํ์ํด์ค์ผ ํฉ๋๋ค.
๋ค๋ฅธ ์ฌ๋์ด ์ด ์ฝ๋๋ฅผ ๋ณด์์ ๋์ ์ด๋ค ์ด์ ๋ก ์ค๋ฅ๊ฐ ๋ฐ์ํ ๊ฐ๋ฅ์ฑ์ด ์๋์ง ์์ง ๋ชปํ๊ณ , ๊ฐ๊ฐ ์ํฉ์ ๋ง๋ ๋์ฒ๋ฅผ ํด์ผํ ์ ๋ ์์ผ๋๊น์.
catch๋ฅผ ์ฌ๋ฌ๊ฐ ์ฌ์ฉํ๋๋ผ๋ Exception์ ๊ฐ๊ฐ ๋ํ๋ด์ฃผ๋๊ฒ ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค
"profile" -> { | ||
navController.navigate(Route.MypageScreen(userName = "")) /*username์ ์ฌ๊ธฐ๋ค ์ด๋ป๊ฒ ๋ฃ์ด์ฃผ์ง?*/ | ||
} |
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.
์ ๊ตณ์ด ๋๊ฒจ์ค ํ์๊ฐ ์์๊น์??
์๋ฒํต์ ์ ํตํด ๋ฐ์์ค๊ฑฐ๋, ๋ก์ปฌ์ ์ ์ฅํด๋์๋ค๊ฐ ๋ถ๋ฌ์ค๋ ๋ฐฉ๋ฒ์ด ๋์ฑ ์ ํฉํด๋ณด์ด๋ค์.
๋ฐํ
๋ค๋น๋ฅผ ํตํด ์์ง์ด๋ ํน์ฑ์ home์์ profile๋ก, search์์ profile๋ก ์ด๋ํ๋ ๋๊ฐ์ง ๊ฒฝ์ฐ ๋ชจ๋ ์์ด์.
๊ทธ๋ ๊ธฐ ๋๋ฌธ์ ์ด์ ํ๋ฉด์์ profie๋ก ์ด๋ํ๋ผ ๋ ์ฌ์ฉ์ ์ด๋ฆ์ ๋ฐ์์ค๋๊ฑด ์กฐ๊ธ ์ํํ ๋ฐฉ๋ฒ์ด ๋ ์ ์์ ๊ฒ ๊ฐ์์
@@ -52,7 +52,7 @@ fun MyPageProfileSection( | |||
) | |||
Spacer(modifier = Modifier.width(10.dp)) | |||
Text( | |||
"${deliveredEmail}๋", | |||
"${deliveredUserHobby}๋ฅผ ์ฆ๊ธฐ๋\n${deliveredUserName}๋", |
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.
์ ๋ง ์ฌ์ํ๊ธด ํ์ง๋ง deliverdUserHobby
๊ฐ null์ด๋ผ๋ฉด "null๋ฅผ ์ฆ๊ธฐ๋ ~" ์ด๋ ๊ฒ ๋ ๊ฑฐ์์.
์ด๋ฐ ์ํฉ๋ ๊ณ ๋ คํด์ ์ฝ๋๋ฅผ ์์ฑํ์ ๋ค๋ฉด ๋์ฑ ์ฌ์ฉ์ ์นํ์ ์ธ ๊ฐ๋ฐ์๊ฐ ๋ ์ ์์ ๊ฒ ๊ฐ์์ :)
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.
๊ณ ์ํ์ จ์ต๋๋ค
hilt { | ||
enableAggregatingTask = false | ||
} |
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.
์ด ๋ถ๋ถ์ ์ ์ถ๊ฐํด์ผ ํ๋์ง, ์ด๋ป๊ฒ ํ๋ฉด ์ ๊ฑฐํ ์ ์์์ง ์ฐพ์๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์์
|
||
object ApiFactory { | ||
// private const val BASE_URL: String = BuildConfig.BASE_URL | ||
private const val BASE_URL: String = "http://223.130.135.50:8085" |
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.
BASE_URL ์จ๊ฒจ์ฃผ์ธ์
val request = chain.request().newBuilder() | ||
.addHeader("Accept", "*/*") | ||
.build() | ||
chain.proceed(request) | ||
} |
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.
์ ์ด๋ฐ Interceptor๋ฅผ ์ถ๊ฐํ์ จ๋์?
Related issue ๐
Work Description โ๏ธ
Screenshot ๐ธ
์ง๋ ์ฃผ์ฐจ์ ๋์ผํจ
Uncompleted Tasks ๐
To Reviewers ๐ข
์ ๋๋ค! ๋ ์ฑ์ฌ์ฑ์๊ป ๋ฆฌ๋ทฐ ๋ฌ์์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋น