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

Feat/week04 compose #6

Open
wants to merge 22 commits into
base: develop-compose
Choose a base branch
from
Open

Conversation

t1nm1ksun
Copy link
Member

๐Ÿ“Œ PR ์š”์•ฝ

๐ŸŒฑ ์ž‘์—…ํ•œ ๋‚ด์šฉ

4์ฃผ์ฐจ compose ํ•„์ˆ˜๊ณผ์ œ

๐ŸŒฑ PR ํฌ์ธํŠธ

API๋ฅผ ํ†ตํ•ด ํšŒ์›๊ฐ€์ž…, ๋กœ๊ทธ์ธ , ๋น„๋ฐ€๋ฒˆํ˜ธ ๋ณ€๊ฒฝ ๊ตฌํ˜„
๋กœ๊ทธ์ธ์ด ๋˜๊ณ ๋‚˜๋ฉด ์ด์ „ ์Šคํƒ์„ ์ง€์›Œ ๋’ค๋กœ๊ฐ€๊ธฐ ๋ฒ„ํŠผ ํด๋ฆญ์‹œ ๋กœ๊ทธ์ธ์œผ๋กœ ๋Œ์•„๊ฐ€์ง€ ์•Š๋„๋ก ํ•จ

week04_compose.mp4

@t1nm1ksun t1nm1ksun requested a review from a team May 3, 2024 09:52
Copy link
Member

@0se0 0se0 left a comment

Choose a reason for hiding this comment

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

์ˆ˜๊ณ ํ•˜์…จ์Šต๋‹ˆ๋‹ค!

popUpTo(Routes.Password.route) {
inclusive = true
}
launchSingleTop = true
Copy link
Member

@0se0 0se0 May 5, 2024

Choose a reason for hiding this comment

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

launchSingleTop = true ์ด ์ฝ”๋“œ๋Š” ์–ด๋–ค ์ผ์„ ํ•˜๋Š” ๊ฒƒ์ธ์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค!

Copy link
Member Author

Choose a reason for hiding this comment

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

์ด๊ฑฐ ํ•ด๋‹น ํŽ˜์ด์ง€๋ฅผ ์Šคํƒ ๋งจ์œ„๋กœ ์˜ฌ๋ ค์ฃผ๋Š”๊ฑฐ์—์š”!

response: Response<ResponseLogInDto>
) {
if (response.isSuccessful) {
val memberId = response.headers()["Location"]!!.toInt()
Copy link
Member

Choose a reason for hiding this comment

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

์—ฌ๊ธฐ์„œ non-null ์—ฐ์‚ฐ์ž๋ฅผ ์‚ฌ์šฉํ•˜์‹  ์ด์œ ๊ฐ€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค!

Comment on lines +68 to +70
userId = response.body()!!.data.authenticationId
userNickname = response.body()!!.data.nickname
userPhone = response.body()!!.data.phone
Copy link
Member

Choose a reason for hiding this comment

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

๋„ ์ฒ˜๋ฆฌ ๊ด€๋ จํ•˜์—ฌ ์ข€ ๋” ์•ˆ์ „ํ•œ ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•ด๋ณด์‹œ๋Š” ๊ฒƒ์€ ์–ด๋–จ๊นŒ์š”?!

if (response.isSuccessful) {
userId = response.body()!!.data.authenticationId
userNickname = response.body()!!.data.nickname
userPhone = response.body()!!.data.phone

Choose a reason for hiding this comment

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

response.body()์— ๋„ˆ๋ฌด ๋งŽ์ด ์ ‘๊ทผํ•˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค! ์ค„์ด๋Š” ๋ฐฉ๋ฒ•์€ ์—†์„๊นŒ์š”?

@t1nm1ksun t1nm1ksun requested review from kez-lab and Sangwook123 May 5, 2024 12:27
Copy link

@l2hyunwoo l2hyunwoo left a comment

Choose a reason for hiding this comment

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

์•ˆ๋…•ํ•˜์„ธ์š” ๋ฏผ์„๋‹˜. ์•ˆ๋“œ๋กœ์ด๋“œ ํŒŒํŠธ ๋ช…์˜ˆ OB ์ดํ˜„์šฐ์ž…๋‹ˆ๋‹ค. ๋งŒ๋‚˜์„œ ๋ฐ˜๊ฐ‘์Šต๋‹ˆ๋‹ค.

์•ž์œผ๋กœ์˜ ๊ณผ์ œ๋“ค์— ๋Œ€ํ•œ ์ฝ”๋“œ๋ฆฌ๋ทฐ๋ฅผ ๋งก๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๊ณ ๋ฏผํ•ด๋ณด์‹œ๋‹ค๊ฐ€ ๊ถ๊ธˆํ•œ ์ ์ด ์žˆ์œผ์‹œ๋ฉด ์ง€์‹ ๊ณต์œ ๋ฐฉ/๋””์Šค์ฝ”๋“œ ์—ฐ๋ฝ ํ•ด์ฃผ์„ธ์š”. ๋Œ€๋ฉด/๋น„๋Œ€๋ฉด ์ž์œ ํ˜•์‹์œผ๋กœ ์ถ”๊ฐ€ ํ”ผ๋“œ๋ฐฑ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

์šฐ์„  ๊ณผ์ œ ์–ด๋ ค์šฐ์…จ์„ํ…๋ฐ ๋น ๋ฅด๊ฒŒ ๊ณผ์ œ ์ˆ˜ํ–‰ํ•ด์ฃผ์‹ ์  ๋„ˆ๋ฌด ์ข‹์Šต๋‹ˆ๋‹ค. ๊ด€๋ จํ•ด์„œ ์ถ”๊ฐ€์ ์œผ๋กœ ํ”ผ๋“œ๋ฐฑ/์งˆ๋ฌธ ๋‚จ๊ธด ๊ฒƒ๋“ค์ด ์žˆ์Šต๋‹ˆ๋‹ค. ์งˆ๋ฌธ์„ ๋‚จ๊ธด ๊ฒฝ์šฐ ์ฝ”๋“œ์— ๋ฌธ์ œ๊ฐ€ ์žˆ์–ด์„œ ์งˆ๋ฌธ์ด ๋‚จ๊ธด ๊ฒƒ์ด ์•„๋‹ˆ๊ณ  ์ •๋ง ๋ฏผ์„๋‹˜์˜ ์ž‘์„ฑ ์˜๋„๊ฐ€ ๊ถ๊ธˆํ•ด์„œ ๋‚จ๊ธด ๊ฒƒ์ด๋‹ˆ ์ด ์  ์ฐธ๊ณ ํ•ด์ฃผ์‹œ๋ฉด ๊ฐ์‚ฌํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

์•ž์œผ๋กœ ์ž˜ ๋ถ€ํƒ๋“œ๋ฆฌ๊ฒ ์Šต๋‹ˆ๋‹ค.

์ถ”๊ฐ€์ ์œผ๋กœ ํ˜„์žฌ ์ƒํƒœ์— ๋”ฐ๋ผ์„œ ํ™”๋ฉด์„ ๊ทธ๋ฆฌ๋Š” ์ปดํฌ์ €๋ธ”์˜ ๋ Œ๋”๋ง ๊ณผ์ •/์ƒํƒœ๊ด€๋ฆฌ/UI์™€ ViewModel์˜ ์—ญํ• ๋ถ„๋ฆฌ์— ๋Œ€ํ•ด ์ดํ•ด๊ฐ€ ํ•„์š”ํ•œ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ํ•ด๋‹น ๋ถ€๋ถ„์€ ์ฝ”๋“œ๋žฉ ํ˜น์€ ์•ˆ๋“œ๋กœ์ด๋“œ ๊ณต์‹ ์–‘์งˆ์˜ ์ƒ˜ํ”Œ๋“ค์„ ํ™•์ธํ•ด๋ณด์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
debugImplementation 'androidx.compose.ui:ui-tooling'
debugImplementation 'androidx.compose.ui:ui-test-manifest'
implementation "androidx.navigation:navigation-compose:2.7.7"

Choose a reason for hiding this comment

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

์ค‘๋ณต์„ ์–ธ์ž…๋‹ˆ๋‹ค.

Comment on lines +22 to +26
fun BottomBar(
navController: NavHostController,
modifier: Modifier = Modifier,
isLoggedIn: Boolean
) {

Choose a reason for hiding this comment

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

Kotlin์—์„œ๋Š” ๋ชจ๋“  ์„ ํƒ์  ํŒจ๋Ÿฌ๋ฏธํ„ฐ(Optional Parameter, ๋””ํดํŠธ ๊ฐ’์ด ์ฃผ์–ด์ง„ ํŒจ๋Ÿฌ๋ฏธํ„ฐ)๋Š” ํ•„์ˆ˜ ํŒจ๋Ÿฌ๋ฏธํ„ฐ ๋’ค์— ๋ฐฐ์น˜๋˜์–ด์•ผํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์ปดํฌ์ฆˆ์—์„œ๋Š” ๋ชจ๋“  ์„ ํƒ์  ํŒจ๋Ÿฌ๋ฏธํ„ฐ ์ œ์ผ ์œ„์— Modifier๊ฐ€ ๋ฐฐ์น˜๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค...๋ผ๊ณ  ์ฝ”๋”ฉ ์ปจ๋ฒค์…˜์—๋Š” ์ ํ˜€ ์žˆ์Šต๋‹ˆ๋‹ค.

ํ•„์ˆ˜๋Š” ์•„๋‹ˆ์ง€๋งŒ ๊ณตํ†ต ๋ฃฐ์„ ์ง€์ผœ๋ณด๋ฉด์„œ ์ฝ”๋“œ ๊ฐ€๋…์„ฑ ์˜ฌ๋ฆฌ๋Š” ๊ฒƒ์— ๋„์›€์ด ๋  ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์„œ ๊ณต์œ ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

Suggested change
fun BottomBar(
navController: NavHostController,
modifier: Modifier = Modifier,
isLoggedIn: Boolean
) {
fun BottomBar(
navController: NavHostController,
isLoggedIn: Boolean,
modifier: Modifier = Modifier,
) {

Comment on lines +32 to +58
if (isLoggedIn) {
val navBackStackEntry by navController.currentBackStackEntryAsState()
val currentRoute = navBackStackEntry?.destination?.route
NavigationBar(
modifier = modifier,
containerColor = Color.LightGray,
) {
screens.forEach { screen ->

NavigationBarItem(
label = {
Text(text = screen.title!!)
},
icon = {
Icon(imageVector = screen.icon!!, contentDescription = "")
},
selected = currentRoute == screen.route,
onClick = {
navController.navigate(screen.route)
},
colors = NavigationBarItemDefaults.colors(
unselectedTextColor = Color.Gray, selectedTextColor = Color.White
),
)
}
}
}

Choose a reason for hiding this comment

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

๋งŒ์•ฝ ๋ฐ”ํ…€๋ฐ”๊ฐ€ ๋กœ๊ทธ์ธ๋œ ์ƒํƒœ ์ด์™ธ์—๋„ ๋ณด์—ฌ์•ผ ํ•œ๋‹ค๋ผ๋Š” ์š”๊ตฌ์‚ฌํ•ญ ๋ณ€๊ฒฝ์ด ๋“ค์–ด์˜ค๋ฉด ์–ด๋–ป๊ฒŒ ๋ ๊นŒ์š”? ๊ทธ๋ฆฌ๊ณ  ํŠน์ • ์กฐ๊ฑด์—์„œ๋„ ๋ณด์ด์ง€ ์•Š์•„์•ผ ํ•œ๋‹ค๋ผ๋Š” ์กฐ๊ฑด์ด ์ถ”๊ฐ€๋œ๋‹ค๋ฉด์š”? ์ปดํฌ๋„ŒํŠธ ๋‹จ์—์„œ ์ด๋Ÿฐ ์•ฑ ๋‚ด ๊ธฐ๋Šฅ ์š”๊ตฌ์‚ฌํ•ญ๋“ค์„ ์•Œ์•„์•ผ ํ•  ํ•„์š”๊ฐ€ ์žˆ์„๊นŒ์š”?

Comment on lines +28 to +30
val screens = listOf(
BottomNavItem.Home, BottomNavItem.Search, BottomNavItem.MyPage
)

Choose a reason for hiding this comment

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

(์•„์ฃผ ์‚ฌ์†Œํ•œ ๋ฆฌ๋ทฐ) ์ด ๋ฆฌ์ŠคํŠธ๋Š” ์ปดํฌ์ €๋ธ” ํ•จ์ˆ˜ ๊ทธ๋ ค์ง€๋Š” ๋™์•ˆ ๋‹จ ํ•œ๋ฒˆ๋งŒ ํ• ๋‹น ์—ฐ์‚ฐ์ด ์‹คํ–‰๋ ๊นŒ์š”?

Comment on lines +62 to +85
sealed class BottomNavItem(
val route: String,
val title: String? = null,
val icon: ImageVector? = null
) {
data object Home : BottomNavItem(
route = Routes.Home.route,
title = "Home",
icon = Icons.Default.Home
)

data object Search : BottomNavItem(
route = Routes.Search.route,
title = "Search",
icon = Icons.Default.Search
)

data object MyPage : BottomNavItem(
route = Routes.MyPage.route,
title = "MyPage",
icon = Icons.Default.Person
)

}

Choose a reason for hiding this comment

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

enum class๋กœ๋„ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Choose a reason for hiding this comment

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

ํ•ด๋‹น ๊ตฌ์กฐ๋ฅผ sealed๋กœ ๋งŒ๋“œ์‹  ์ด์œ ๊ฐ€ ์žˆ์„๊นŒ์š”?

Comment on lines +45 to +53
var previousPassword by remember {
mutableStateOf("")
}
var newPassword by remember {
mutableStateOf("")
}
var newPasswordCheck by remember {
mutableStateOf("")
}

Choose a reason for hiding this comment

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

๋ณ€์ˆ˜๋ช… ์ข‹์Šต๋‹ˆ๋‹ค.


val navViewModel: NavViewModel =
viewModel(viewModelStoreOwner = LocalNavGraphViewModelStoreOwner.current)
val authService by lazy { ServicePool.authService }

Choose a reason for hiding this comment

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

ViewModel์ด ์„ ์–ธ๋˜์–ด์žˆ๋Š”๋ฐ, authService๋ฅผ ๋ทฐ๋‹จ์— ๋Œ๊ณ ์˜จ ์ด์œ ๊ฐ€ ์žˆ์„๊นŒ์š”? View์™€ ViewModel์€ ์–ด๋– ํ•œ ์—ญํ• ์„ ๋งก๊ณ  ๊ตฌ๋ถ„๋˜์–ด์•ผ ํ• ๊นŒ์š”?

Comment on lines +74 to +92
fun changePassword(memberId: Int) {
val passwordRequest = getPasswordRequestDto()
authService.changePassword(memberId, passwordRequest)
.enqueue(object : Callback<ResponseDto> {
override fun onResponse(
call: Call<ResponseDto>,
response: Response<ResponseDto>,
) {
if (response.isSuccessful) {
Toast.makeText(
context,
"๋น„๋ฐ€๋ฒˆํ˜ธ ๋ณ€๊ฒฝ ์™„๋ฃŒ! ์ƒˆ ๋น„๋ฐ€๋ฒˆํ˜ธ๋กœ ๋กœ๊ทธ์ธ ํ•˜์„ธ์š”",
Toast.LENGTH_SHORT
).show()
navController.navigate(Routes.Login.route) {
popUpTo(Routes.Login.route) {
inclusive = true
}
launchSingleTop = true

Choose a reason for hiding this comment

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

์ด๋Ÿฐ ๋กœ์ง๋“ค์ด ๋ทฐ์— ์žˆ์œผ๋ฉด ๋ทฐ๋ชจ๋ธ์„ ๋”ฐ๋กœ ๊ตฌ๋ถ„ํ•ด๋‘˜ ํ•„์š”๊ฐ€ ์žˆ์„๊นŒ์š”?

) {

var textId by remember { mutableStateOf("") }
var textPw by remember { mutableStateOf("") }

Choose a reason for hiding this comment

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

์ถ•์•ฝ์–ด ์ง€์–‘ํ•ด์ฃผ์„ธ์š”

val authService by lazy { ServicePool.authService }


Log.d("MyPageScreen", "MyPageScreen start")

Choose a reason for hiding this comment

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

์ด ๋กœ๊ทธ ๋‹จ ํ•œ๋ฒˆ๋งŒ ์‹คํ–‰ํ• ๊นŒ์š”?

t1nm1ksun added a commit that referenced this pull request May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants