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/#121 news number api #124

Merged
merged 21 commits into from
Nov 26, 2024
Merged

Feature/#121 news number api #124

merged 21 commits into from
Nov 26, 2024

Conversation

Eonji-sw
Copy link
Member

@Eonji-sw Eonji-sw commented Nov 25, 2024

โœ… ๐—–๐—ต๐—ฒ๐—ฐ๐—ธ-๐—Ÿ๐—ถ๐˜€๐˜

  • mergeํ•  ๋ธŒ๋žœ์น˜์˜ ์œ„์น˜๋ฅผ ํ™•์ธํ•ด ์ฃผ์„ธ์š”(mainโŒ/developโญ•)
  • ๋ฆฌ๋ทฐ๊ฐ€ ํ•„์š”ํ•œ ๊ฒฝ์šฐ ๋ฆฌ๋ทฐ์–ด๋ฅผ ์ง€์ •ํ•ด ์ฃผ์„ธ์š”
  • P1 ๋‹จ๊ณ„์˜ ๋ฆฌ๋ทฐ๋Š” ํ•„์ˆ˜๋กœ ๋ฐ˜์˜ํ•ฉ๋‹ˆ๋‹ค.
  • Approve๋œ PR์€ assigner๊ฐ€ ๋จธ์ง€ํ•˜๊ณ , ์ˆ˜์ • ์š”์ฒญ์ด ์˜จ ๊ฒฝ์šฐ ์ˆ˜์ • ํ›„ ๋‹ค์‹œ push๋ฅผ ํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ“Œ ๐—œ๐˜€๐˜€๐˜‚๐—ฒ๐˜€

๐Ÿ“Ž๐—ช๐—ผ๐—ฟ๐—ธ ๐——๐—ฒ๐˜€๐—ฐ๐—ฟ๐—ถ๐—ฝ๐˜๐—ถ๐—ผ๐—ป

  • news ํŽ˜์ด์ง€ ๋‰ด์Šค, ๊ณต์ง€์‚ฌํ•ญ ๊ฐœ์ˆ˜ api ๊ตฌํ˜„
  • news ํŽ˜์ด์ง€ ๊ณต์ง€์‚ฌํ•ญ max line ๋ฐ SpaceBetween ์ ์šฉ

๐Ÿ“ท ๐—ฆ๐—ฐ๐—ฟ๐—ฒ๐—ฒ๐—ป๐˜€๐—ต๐—ผ๐˜

2024-11-26.2.28.47.mov
2024-11-26.2.42.14.mov

๐Ÿ’ฌ ๐—ง๐—ผ ๐—ฅ๐—ฒ๐˜ƒ๐—ถ๐—ฒ๐˜„๐—ฒ๐—ฟ๐˜€

์ง„์งœ ์˜ค๋žœ๋งŒ์— ๊ฐœ์ •์ƒ‰ ๋นจ๊ณ  ํ•œ.. flow ๊ฐœ์‹ซ์–ด์š”
image
server number๊ฐ€ local number๋ณด๋‹ค ํด ๋•Œ์—๋งŒ ๋ฑƒ์ง€ ๋„์šฐ๋Š”๊ฑฐ ๋งž์ฃ ?
๋กœ๊ทธ๋Š” ๋จธ์ง€ ์ง์ „์— ์ง€์šธ๊ฒŒ์š” ์ง„์งœ ์Ÿค ์•ˆ์ฐ์—ˆ์œผ๋ฉด pr ๋ชป์˜ฌ๋ ธ์Œ

์ „์ ์œผ๋กœ ๋„์›€ ์ค€ ์ฐฌ์šฐํ–„๊ป˜ ์˜๊ด‘์„ ^^..
์†Œ์‹ ํŽ˜์ด์ง€ ๊ณต์ง€์‚ฌํ•ญ title, content ์›๋ž˜ 18, 50์ž ์ œํ•œ์ธ๋ฐ ๋งํ•  compose๋Š” ๊ทธ๊ฒŒ ์‰ฝ์ง€ ์•Š์•„์„œ ์ผ๋‹จ maxline์œผ๋กœ ์ œ์•ฝ ๊ฑธ์—ˆ์–ด์š” ์ฉ..

@Eonji-sw Eonji-sw added โญ [FEAT] ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ ๊ตฌํ˜„ ๐Ÿฐ ์–ธ์ง€ ๊ธฐ๋งŒ์ง€ labels Nov 25, 2024
@Eonji-sw Eonji-sw self-assigned this Nov 25, 2024
@Eonji-sw Eonji-sw added the โ˜• [COMPOSE] ์ปดํฌ์ฆˆ ui label Nov 25, 2024
Copy link
Collaborator

@chanubc chanubc left a comment

Choose a reason for hiding this comment

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

๋ฐค๋Šฆ๊ฒŒ ๊ณ ์ƒ๋งŽ์œผ์…จ์Šต๋‹ˆ๋‹ค~

}.launchIn(lifecycleScope)
}

private suspend fun saveNumberFromServerToLocal() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

์š”๊ฑด ๋ทฐ๋ชจ๋ธ์˜ ํ•จ์ˆ˜๋กœ ๋„ ๊ฐˆ ์ˆ˜ ์žˆ์„๊ฒƒ ๊ฐ™์€๋ฐ
๋ณ€ํ™”๋œ ์ˆซ์ž ๊ฐ’๋“ค๋งŒ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ๋„˜๊ธฐ๊ณ  ๋‚˜๋จธ์ง€๋Š” ๋ทฐ๋ชจ๋ธ์—์„œ ๋กœ์ง์„ ์ž‘์„ฑํ•ด๋„ ๋ ๊ฒƒ ๊ฐ™์•„์š”

๊ทธ๋Ÿฐ๋ฐ ํ˜น์‹œ suspend๋กœ ์„ ์–ธํ•œ ์ด์œ ๊ฐ€ ์žˆ์„๊นŒ์š”?

Copy link
Collaborator

Choose a reason for hiding this comment

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

์ €๋„ ์ด ๋ถ€๋ถ„์ด ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค
๊ทธ๋ฆฌ๊ณ  ์„œ๋ฒ„ num ์ด๋ž‘ ๋กœ์ปฌ num ๋น„๊ต ๋กœ์ง์„ ๋ทฐ ๋ชจ๋ธ์—์„œ ์ž‘์„ฑํ•˜๊ณ  ๊ทธ ๊ฒฐ๊ณผ๋งŒ state๋กœ ๊ด€๋ฆฌํ•ด๋„ ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”!

Copy link
Member Author

@Eonji-sw Eonji-sw Nov 26, 2024

Choose a reason for hiding this comment

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

viewModel์—์„œ flow first ๋•œ์— ํ•ด๋‹น ํ•จ์ˆ˜๋ฅผ suspend ์ฒ˜๋ฆฌํ•ด์„œ ์ด๋ ‡๊ฒŒ ํ–‡์Šด๋ฏธ๋‹ค..
๋ฐ”๊พธ๊ณ ๋Š” ์‹ถ์€๋ฐ ๋‹ค๋ฅธ ํ”Œ์  ๋•œ์— ์˜ค๋Š˜ ์•ˆ์—๋Š” ์ˆ˜์ • ๋ถˆ๊ฐ€ํ•  ๊ฒƒ ๊ฐ™์•„์„œ ํฌ๊ฒŒ ๋ฌธ์ œ๋˜๋Š”๊ฒŒ ์•„๋‹ˆ๋ผ๋ฏ„.. ๋‚˜์ค‘์— ์ˆ˜์ •ํ•˜๊ณ  ์‹œํผ์š”

}

NewsTabType.NOTICE.idx -> {
trackEvent(CLICK_NOTICE)
setBadgeOnNews(NewsTabType.NOTICE.idx, false)
lifecycleScope.launch { viewModel.saveNoticeNumber(serverNoticeNumber) }
Copy link
Collaborator

Choose a reason for hiding this comment

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

p3 : saveNoticeNumber๊ฐ€ viewmodel scope์—์„œ ์‹คํ–‰๋˜๋Š” ํ•จ์ˆ˜๋ผ๋ฉด ์ฝ”๋ฃจํ‹ด ์Šค์ฝ”ํ”„ ์ค‘์ฒฉ์€ ๋ถˆํ•„์š”ํ•ด๋ณด์—ฌ์š”!

Copy link
Member Author

Choose a reason for hiding this comment

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

๊ทธ๋ฅด๋„ค์š” ๊ตฟ!

Comment on lines 74 to 75
suspend fun saveNewsNumber(newsNumber: Int) = userInfoRepository.saveNewsNumber(newsNumber)

Copy link
Collaborator

Choose a reason for hiding this comment

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

save๋Š” suspend ๋ณด๋‹จ viewmodel scope๋‚ด์—์„œ ์ฒ˜๋ฆฌํ•˜๋Š”๊ฒŒ ์–ด๋– ์‹ ์ง€?
suspend๋Š” ์Šค๋ ˆ๋“œ ๋ธ”๋ฝ์˜ ๊ฐœ๋…์ด ์•„๋‹ˆ๋ผ ์ปจํƒ์ŠคํŠธ ์Šค์œ„์นญ ๋ฐ cpu์—์„œ ์ œ์–ด๊ถŒ์„ ๊ธฐ์–ตํ•˜๋Š” ๋ฆฌ์†Œ์Šค ๋‚ญ๋น„๋Š” ์—†์ง€๋งŒ

์ €์žฅ์˜ ๊ฒฝ์šฐ ์ค‘๋‹จ,์žฌ๊ฐœ๋กœ ์ž‘์—…์„ ์ด์–ด๋‚˜๊ฐˆ ํ•„์š”๋Š” ์—†์„๊ฒƒ ๊ฐ™๋‹ค ์ƒ๊ฐํ•ด์š”!

Copy link
Collaborator

Choose a reason for hiding this comment

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

๊ทธ๋ฆฌ๊ณ  suspendํ•จ์ˆ˜์˜ ํ˜ธ์ถœ ๋ถ€๋Š” ์ฝ”๋ฃจํ‹ด ๋นŒ๋” ๋‚ด๋ถ€์—์„œ ์‹คํ–‰์„ ์‹œ์ผœ์•ผ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๊ฒฐ๊ตญ ๋น„์Šทํ•œ ์ž‘์—…์ด๋ผ ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค!

์ด๋ ‡๊ฒŒ ๋˜๋ฉด ๋ถˆ์•ˆ์ •ํ•œ ์ƒ๋ช…์ฃผ๊ธฐ๋ฅผ ๊ฐ€์ง„ view๋‹จ ๋ณด๋‹จ viewmodelscope์—์„œ io ์ž‘์—…์„ ์ฒ˜๋ฆฌํ•˜๋Š”๊ฒŒ ๋” ๋‚˜์•„๋ณด์—ฌ์š”!

Copy link
Member Author

Choose a reason for hiding this comment

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

์•„ํ•˜ ๋„ต!

Comment on lines +76 to +77
suspend fun getNoticeNumberFromLocal() = userInfoRepository.getNoticeNumber().first()

Copy link
Collaborator

Choose a reason for hiding this comment

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

flow๋Š” ๊ณ„์†ํ•ด์„œ ๋ฐ์ดํ„ฐ์ŠคํŠธ๋ฆผ์„ ๋ฐฉ์ถœํ•œ๋‹ค๋Š” ์žฅ์ ์ด ์žˆ์–ด์š”!
first()๋ณด๋‹จ collectํ•˜๊ฑฐ๋‚˜ stateinํ•ด์„œ ๋ณ€๊ฒฝ๊ฐ’์ด ๊ฐ์ง€ ๋˜์—ˆ์œผ๋ฉด ๋ฑƒ์ง€๋ฅผ ๋„์šฐ๋Š” ๋ฐฉ๋ฒ•๋„ ์ž‡์„๊ฒƒ ๊ฐ™์•„์š”!

์ €์žฅ์„ ํ•ด๋„ ๊ฐ’์ด ๋ณ€๊ฒฝ๋˜๋Š”๋ฐ datastore๋Š” flow๋กœ ์ž‘๋™์ด ๋˜๊ธฐ๋•Œ๋ฌธ์— ๊ฐ’์ด ์ €์žฅ์ด ๋˜์–ด๋„ ๋ฐ”๋กœ ์ƒ์‚ฐ๊ณผ ์†Œ๋น„๊ฐ€ ๋˜์š”! ๊ทธ๋Ÿผ ๊ตฌ๋…ํ•˜๋Š”(sateflow/statein) ์ชฝ์—์„œ ์ƒํƒœ๋ณ€ํ™”๋ฅผ ๊ณง๋ฐ”๋กœ ์•Œ ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์กฐ๊ธˆ ๋” ํšจ์œจ์ ์ผ ๊ฒƒ์ด๋ž€ ์ƒ๊ฐ์ด ๋“ค์–ด์š”

Copy link
Collaborator

Choose a reason for hiding this comment

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

์Œ ๊ทผ๋ฐ ์–ด์ฐจํ”ผ ์„œ๋ฒ„์—์„œ ๊ฐ€์ ธ์˜ค๋Š”๊ฑด restful์ด๋‹ˆ๊นŒ ๋‹จ๋ฐฉํ–ฅ์ด๊ธฐ ๋•Œ๋ฌธ์— first()๋กœ ๋™๊ธฐ์ ์œผ๋กœ ๊ฐ€์ ธ์™€๋„ ์ƒ๊ด€์—†๊ฒ ๋„ค์š”

@chanubc
Copy link
Collaborator

chanubc commented Nov 25, 2024

์•„ ๊ทธ๋ฆฌ๊ณ  ์ œ๋ชฉ , ๋ช‡๋ถ„์ „ -> ์ด๊ฑฐ ์ „ ๊ฐ„๊ฒฉ 10dp๋กœ ํ–ˆ์Šต๋‹ˆ๋‹ค!

Copy link
Collaborator

@sohyun127 sohyun127 left a comment

Choose a reason for hiding this comment

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

์ œ๊ฐ€ ์ž๋Š” ์ƒˆ๋ฒฝ๋™์•ˆ ๋งŽ์€ ์ผ๋“ค์ด ์žˆ์—ˆ๊ตฐ์š”

}.launchIn(lifecycleScope)
}

private suspend fun saveNumberFromServerToLocal() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

์ €๋„ ์ด ๋ถ€๋ถ„์ด ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค
๊ทธ๋ฆฌ๊ณ  ์„œ๋ฒ„ num ์ด๋ž‘ ๋กœ์ปฌ num ๋น„๊ต ๋กœ์ง์„ ๋ทฐ ๋ชจ๋ธ์—์„œ ์ž‘์„ฑํ•˜๊ณ  ๊ทธ ๊ฒฐ๊ณผ๋งŒ state๋กœ ๊ด€๋ฆฌํ•ด๋„ ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”!

Copy link
Collaborator

@sohyun127 sohyun127 left a comment

Choose a reason for hiding this comment

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

๋‚จ์€ ๋ถ€๋ถ„์€ ๋‹ค์Œ pr์—์„œ ๋ฐ˜์˜ํ•ด์ฃผ์‹œ๋ฉด ๋  ๊ฒƒ ๊ฐ™์•„์š”!

@Eonji-sw Eonji-sw merged commit a987de3 into develop Nov 26, 2024
1 check passed
@Eonji-sw Eonji-sw deleted the feature/#121-news-number-api branch November 26, 2024 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
โ˜• [COMPOSE] ์ปดํฌ์ฆˆ ui โญ [FEAT] ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ ๊ตฌํ˜„ ๐Ÿฐ ์–ธ์ง€ ๊ธฐ๋งŒ์ง€
Projects
None yet
3 participants