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

๐Ÿš€ 4๋‹จ๊ณ„ - ํŽ˜์ด๋จผ์ธ (์นด๋“œ ์ˆ˜์ •) #98

Open
wants to merge 5 commits into
base: ethanchaee
Choose a base branch
from

Conversation

ethanchaee
Copy link

@ethanchaee ethanchaee commented Mar 2, 2025

์•ˆ๋…•ํ•˜์„ธ์š” ์œคํ˜๋‹˜ ๋ฆฌ๋ทฐ ์ž˜๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค :)

๊ตฌํ˜„ ์‚ฌํ•ญ

  • ์ฝ”๋“œ๋ฆฌ๋ทฐ ๋ฐ˜์˜
  • ์ˆ˜์ •๊ธฐ๋Šฅ

๊ธฐ์กด์— ํด๋ฆญ ์ด๋ฒคํŠธ๋ฅผ composable ์—์„œ ์ฒ˜๋ฆฌํ–ˆ๋Š”๋ฐ, viewModel ๊ณผ Activity ์—์„œ ์ฒ˜๋ฆฌํ•˜๊ฒŒ ๋ณ€๊ฒฝํ–ˆ์Šต๋‹ˆ๋‹ค.
composable ์€ UI ๋ฅผ ๊ทธ๋ฆฌ๊ธฐ ์œ„ํ•จ์ด์ง€ ๋กœ์ง ์ฒ˜๋ฆฌ๋ฅผ ํ•˜๋Š” ๊ณณ์€ ์•„๋‹Œ๋ฐ, UI ๋ฅผ ๊ทธ๋ฆฌ๋Š” ๊ฒƒ๊ณผ ์ƒ๊ด€ ์—†๋Š”, ํ† ์ŠคํŠธ ๋…ธ์ถœ์ด๋‚˜ ๋‚ด๋น„๊ฒŒ์ด์…˜ ๋™์ž‘์€
Activity ์—์„œ ์ฒ˜๋ฆฌํ–ˆ์Šต๋‹ˆ๋‹ค.

์ถ”๊ฐ€/์ˆ˜์ •์„ ํŒ๊ฐ€๋ฆ„ํ•˜๊ธฐ ์œ„ํ•ด ์ตœ์ดˆ์— ๋ฐ›์•„์˜จ Card ์ •๋ณด๋ฅผ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ถ€๋ถ„๋„, rember ๋ฅผ ์ด์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.
๋ณดํ†ต ํ”„๋กœ์ ํŠธ์—์„œ DI ๋ฅผ ์‚ฌ์šฉํ•ด์„œ viewModel ์— ํ•ด๋‹น ๊ฐ’์„ Injection ํ•ด์„œ ์‚ฌ์šฉํ–ˆ์—ˆ๋Š”๋ฐ, ์ด๋ฒˆ์ฒ˜๋Ÿผ composable ์— ์˜ํ–ฅ์„ ์ค„ ์ˆ˜ ์žˆ๋Š” ๊ณณ์— ์‚ฌ์šฉํ•˜๋‹ค ๋ณด๋‹ˆ ํ•ด๋‹น ํ‚ค์›Œ๋“œ๋ฅผ ๋” ์ž˜ ์ดํ•ดํ•˜๊ฒŒ ๋˜์–ด ๋ฐฐ์šด์ ์ด ๋งŽ์€ ๊ณผ์ œ์˜€์Šต๋‹ˆ๋‹ค :)

Copy link
Member

@malibinYun malibinYun left a comment

Choose a reason for hiding this comment

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

4๋‹จ๊ณ„ ๋ฏธ์…˜ ๊ณ ์ƒ ๋งŽ์œผ์…จ์–ด์š”!
์—ฌ๋Ÿฌ ์ฝ”๋ฉ˜ํŠธ ๋‚จ๊ฒจ๋‘์—ˆ์œผ๋‹ˆ ํ™•์ธ๋ถ€ํƒ๋“œ๋ ค์š” :)
๋ฏธ์…˜์„ ์ด๋งŒ ๋งˆ๋ฌด๋ฆฌ ์ง“๊ณ  ์‹ถ์œผ์‹œ๋‹ค๋ฉด ์ฝ”๋ฉ˜ํŠธ๋‚˜ ๋ฉ”์‹œ์ง€ ๋‚จ๊ฒจ์ฃผ์‹œ๊ณ , ๋” ์‹œ๋„ํ•˜๊ณ  ์‹ถ์œผ์‹  ๊ฒƒ์ด ์žˆ์œผ์‹œ๋‹ค๋ฉด ๋ฐ˜์˜ ํ›„ ๋‹ค์‹œ ๋ฆฌ๋ทฐ์š”์ฒญ ๋ถ€ํƒ๋“œ๋ ค์š”!

Comment on lines 33 to +35
@Composable
fun CardAddScreen(
fun CardAddModifyScreen(
isModify: Boolean,
Copy link
Member

Choose a reason for hiding this comment

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

์นด๋“œ ์ˆ˜์ •ํ•˜๊ธฐ Screen๊ณผ ์ƒˆ๋กœ ๋งŒ๋“œ๋Š” Screen ์ปดํฌ๋„ŒํŠธ๋Š” ์™„์ „ํžˆ ๋™์ผํ•˜๋‹ˆ,
๊ธฐ์กด ๋งŒ๋“ค์–ด ๋‘” Stateless Screen ์ปดํฌ๋„ŒํŠธ๋ฅผ ์ˆ˜์ •, ์ถ”๊ฐ€ ์•กํ‹ฐ๋น„ํ‹ฐ์—์„œ ํ™œ์šฉํ•˜๋Š” ํ˜•ํƒœ๋กœ ๊ตฌ์„ฑํ•ด๋ณด๋Š” ๊ฑด ์–ด๋–จ๊นŒ์š”?
Stateless Screen ์ปดํฌ๋„ŒํŠธ๋ฅผ ๊ฐ๊ฐ ๊ฐ€์ง€๋Š” Stateful Screen์ด ๋‘ ๊ฐœ ๋งŒ๋“ค์–ด์งˆ ์ˆ˜๋„ ์žˆ๊ฒ ์–ด์š”.
๊ทธ๋ ‡๋‹ค๋ฉด ๊ฐ stateful Screen์„ ํ…Œ์ŠคํŠธํ•  ๋•Œ๋„ ์šฉ์ดํ•  ๊ฑฐ๋ผ ์ƒ๊ฐํ•ด์š”!

Comment on lines 165 to 166
private fun CardListScreenPreview2() {
val cards = listOf(
Copy link
Member

Choose a reason for hiding this comment

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

์ €๋Š” Preview์ด๋ฆ„์„ ์ง€์„ ๋•Œ, ์ปดํฌ๋„ŒํŠธPreview_๊ทธ์ปดํฌ๋„ŒํŠธ์˜ํŠน์ง• ์ด๋Ÿฐ ํ˜•ํƒœ๋กœ ์ง“๋Š” ํŽธ์ด์—์š”.

ex) CardListPreview_ManyCards()

Preview๋ Œ๋”๋ง ๋œ ๊ฒƒ์„ ๋ณด๋”๋ผ๋„ ์–ด๋–ค ํŠน์ง•์„ ๊ฐ€์ง€๋Š”์ง€ ์•Œ๊ธฐ ์–ด๋ ค์šธ ๋•Œ, Preview์˜ ํ•จ์ˆ˜๋ช…์— ์ข€ ๋” ๊ทธ ํŠน์ง•์„ ๋ฌ˜์‚ฌํ•ด์„œ ์กฐ๊ธˆ์ด๋ผ๋„ Preview๋ฅผ ์‰ฝ๊ฒŒ ํŒŒ์•…ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋„์™€์ฃผ๋ ค๊ณ  ์ด๋ ‡๊ฒŒ ์ž‘์„ฑํ•˜๋Š” ํŽธ์ด์—์š” :)

Comment on lines +44 to +47
Card(
modifier = Modifier.clickable(enabled = enabled) { context.toCardModify(cardId = model.id) },
backgroundColor = cardColor,
) {
Copy link
Member

Choose a reason for hiding this comment

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

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

Comment on lines +87 to +123
@Composable
private fun CardNumberInputField(
value: String,
onValueChange: (String) -> Unit,
modifier: Modifier = Modifier,
) {
CardInputField(
value = value,
onValueChange = onValueChange,
maxLength = 16,
labelText = stringResource(R.string.card_number_label),
placeHolderText = stringResource(R.string.card_number_placeholder),
keyboardType = KeyboardType.Number,
visualTransformation = CardNumberVisualTransformation(),
)
}

@Composable
private fun OwnerNameInputField(
value: String,
onValueChange: (String) -> Unit,
modifier: Modifier = Modifier,
) {
CardInputField(
value = value,
onValueChange = onValueChange,
maxLength = 20,
labelText = stringResource(R.string.card_owner_name_label),
placeHolderText = stringResource(R.string.card_owner_name_placeholder),
keyboardType = KeyboardType.Text,
visualTransformation = VisualTransformation.None,
)
}

@Composable
private fun ExpireDateInputField(
value: String,
Copy link
Member

Choose a reason for hiding this comment

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

์ด ์ปดํฌ๋„ŒํŠธ๋“ค์„ ํŒŒ์ผ ๋ถ„๋ฆฌํ•œ๋‹ค๋ฉด ํ…Œ์ŠคํŠธ๋„ ์ปดํฌ๋„ŒํŠธ๋ณ„๋กœ ๊ตญ์†Œ์ ์œผ๋กœ ๊ตฌ์„ฑํ•ด๋ณผ ์ˆ˜ ์žˆ๊ฒ ์–ด์š”!

Copy link
Member

Choose a reason for hiding this comment

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

์ „๋ถ€ ์ปดํฌ๋„ŒํŠธํ™” ํ•˜๋Š” ๊ฒƒ์ด ์‰ฌ์šด ์ผ์ด ์•„๋‹ˆ์…จ์„ ํ…๋ฐ ๋ชจ๋‘ ๋ฐ˜์˜ํ•ด์ฃผ์‹œ๋‹ค๋‹ˆ ๋ฉ‹์ง€์‹ญ๋‹ˆ๋‹ค ๐Ÿ‘

Comment on lines +66 to +68
if (cardsUiState is CardsUiState.Many) {
CardListTopBar(onAddClick = { context.toCardAdd() })
} else {
Copy link
Member

Choose a reason for hiding this comment

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

์ด๋ถ€๋ถ„์€ ์ง€๋‚œ ๋ฆฌ๋ทฐ์—์„œ ๋†“์ณค๋„ค์š”!
์ด๋ถ€๋ถ„๋„, ํŠน์ • ํด๋ฆญ ์ด๋ฒคํŠธ์— ์ข…์†์ ์ด ๋˜๋‹ˆ, ํด๋ฆญ ์ด๋ฒคํŠธ๋Š” ์™ธ๋ถ€์—์„œ ์ฃผ์ž… ๋ฐ›๋„๋ก ํ•˜๋Š” ๊ฒƒ์€ ์–ด๋–จ๊นŒ์š”?

Comment on lines 115 to +116
) {
val context = LocalContext.current
Copy link
Member

Choose a reason for hiding this comment

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

์—ฌ๊ธฐ context๋Š” ์‹ค์ˆ˜๋กœ ์ถ”๊ฐ€๋œ ๊ฑธ๊นŒ์š” ?_?

Comment on lines 69 to +70
Text(
text = CardInputType.CardNumber.maskingText(model.number),
text = cardNumberMaskingText(model.number),
Copy link
Member

Choose a reason for hiding this comment

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

์–ด๋–ค ํฌ๋งคํŒ…์„ ์œ„ํ•œ interface - ๊ตฌํ˜„์ฒด๋ฅผ ๋งŒ๋“ ๋’ค, Card ์ปดํฌ๋„ŒํŠธ์˜ ํŒŒ๋ผ๋ฏธํ„ฐ์—๋Š” interface๋ฅผ ๋ฐ›๊ณ , ๋””ํดํŠธ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ๊ตฌํ˜„์ฒด๋ฅผ ๋ฐ›๋Š” ํ˜•ํƒœ๋กœ ์˜์กด๊ด€๊ณ„๋ฅผ ๋Š์Šจํ•˜๊ฒŒ ๊ตฌ์„ฑํ•ด๋ณด๋Š” ๊ฑด ์–ด๋–จ๊นŒ์š”?

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.

2 participants