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] add refresh button #139

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open

Conversation

VronzeWook
Copy link
Collaborator

@VronzeWook VronzeWook commented Jan 20, 2025

๐Ÿ”ฅ ์ž‘์—…ํ•œ ๋‚ด์šฉ

  • MainView ์ƒˆ๋กœ ๊ณ ์นจ ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค. ๋ฉ”์ธ ํ™”๋ฉด์„ ์•„๋ž˜๋กœ ์Šคํฌ๋กคํ•˜๋ฉด ์ƒˆ๋กœ๊ณ ์นจ ๊ธฐ๋Šฅ์ด ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค. ์ƒˆ๋กœ๊ณ ์นจ ๊ธฐ๋Šฅ์€ HealthKit์— ์ €์žฅ๋œ ๋ฐ์ดํ„ฐ๋ฅผ ์ƒˆ๋กœ ๋ถˆ๋Ÿฌ์˜ค๋Š” ๊ธฐ๋Šฅ์„ ์ˆ˜ํ–‰ํ•˜๋Š”๋ฐ, ์ด๋ ‡๊ฒŒ ์ˆ˜ํ–‰ํ•ด์„œ ์ƒˆ๋กœ ๊ณ ์นจ๋˜์ง€ ์•Š๋Š” ๊ฒƒ์€

Watch <-> HeatlhStore <-> Phone

์ด ์‚ฌ์ด์—์„œ ๋ฐ์ดํ„ฐ ๋™๊ธฐํ™”๋˜๋Š”๋ฐ ์‹œ๊ฐ„์ด ๊ฑธ๋ฆฌ๋Š” ๊ฒƒ์œผ๋กœ ์ˆ˜์ •์ด ํž˜๋“ค์–ด ๋ณด์ž…๋‹ˆ๋‹ค.
(iOS์™€ watchOS ๋ฐ์ดํ„ฐ๋ฅผ ์—ฐ๊ฒฐ ์‹œํ‚ค๊ณ  ๋ณ„๋„์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์‹ค์‹œ๊ฐ„์œผ๋กœ ์ฃผ๊ณ  ๋ฐ›๋„๋ก ํ•˜๋Š” ๋ฐฉ๋ฒ•๋„ ์žˆ์ง€๋งŒ, ๊ฐœ์ธ์ ์œผ๋กœ ๋ฐฐ๊ผฝ์ด ๋” ์ปค์ง€์ง€ ์•Š๋‚˜๋ผ๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. )

  • @Environment(.scenePhase)์„ ์ด์šฉํ•ด์„œ ๋ฐฑ๊ทธ๋ผ์šด๋“œ์—์„œ ํฌ๊ทธ๋ผ์šด๋“œ๋กœ ์ง„์ž… ์‹œ์—๋„ ๋ฐ์ดํ„ฐ๋ฅผ ์ƒˆ๋กœ ๋ฐ›์•„์˜ค๋„๋ก ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

  • ์ƒˆ๋กœ๊ณ ์นจ ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€ํ•˜๊ณ  ScrollView์˜ ์˜ํ–ฅ์œผ๋กœ UI๊ฐ€ ์กฐ๊ธˆ ๋ฐ”๋€Œ์–ด์„œ ํ”ผ๊ทธ๋งˆ๋ฅผ ๋ณด๋ฉด์„œ ๋น„์Šทํ•˜๊ฒŒ ๋‹ค์‹œ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

โญ๏ธ PR Point

๐Ÿ“ธ ์Šคํฌ๋ฆฐ์ƒท

Simulator.Screen.Recording.-.kopis.-.2025-01-20.at.14.36.30.mp4

๐Ÿšจ ๊ด€๋ จ ์ด์Šˆ

@VronzeWook VronzeWook added the ๐Ÿชข Chore ์ž์ž˜ํ•œ ์ˆ˜์ •, ์„ธํŒ… ์‹œ ์‚ฌ์šฉ label Jan 20, 2025
@VronzeWook VronzeWook self-assigned this Jan 20, 2025
@VronzeWook VronzeWook changed the title Feat/#138 add refresh button [Feat] add refresh button Jan 20, 2025
Comment on lines +169 to +184
private func triggerRefresh() {
// ํ–…ํ‹ฑ ๋ฐœ์ƒ
let generator = UIImpactFeedbackGenerator(style: .light)
generator.impactOccurred()

// ๋กœ๋”ฉ ์ƒํƒœ ํ™œ์„ฑํ™”
isLoading = true

// ๋ฐ์ดํ„ฐ ์—…๋ฐ์ดํŠธ ์‹คํ–‰
viewModel.updateTodayRecord()

// ๋กœ๋”ฉ ์ƒํƒœ ๋น„ํ™œ์„ฑํ™” (๋”œ๋ ˆ์ด ์‹œ๋ฎฌ๋ ˆ์ด์…˜)
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
isLoading = false
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

๋กœ๋”ฉ์ด๋‚˜ ๋ฐ์ดํ„ฐ ๊ฐฑ์‹  ๋ถ€๋ถ„ MainViewModel๋กœ ๋‚˜๋ˆ„๊ธฐ์—” ๋„ˆ๋ฌด ์ž‘์„๊นŒ์š”?

Copy link
Collaborator

Choose a reason for hiding this comment

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

๊ณต๊ฐํ•ฉ๋‹ˆ๋‹ค! ํ•ด๋‹น ๋ถ€๋ถ„ MainViewModel๋กœ ์˜ฎ๊ฒจ๋„ ๋˜์ง€ ์•Š์„๊นŒ ์‹ถ์Šต๋‹ˆ๋‹ค!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

์ €๋„ ํ•ด๋‹น ๋ถ€๋ถ„์ด ๊ณ ๋ฏผ๋˜์–ด GPT ์„ผ์„ธํ•œํ…Œ ๋ฌผ์–ด๋ดค๋Š”๋ฐ ํ•ด๋‹น ๊ธฐ๋Šฅ์€ ๋น„์ง€๋‹ˆ์Šค ๋กœ์ง๋ณด๋‹ค ํ™”๋ฉด ์ฒ˜๋ฆฌ์— ๊ฐ€๊นŒ์›Œ View์— ์–ด์šธ๋ฆฐ๋‹ค๊ณ  ํ•˜์‹œ๋”๊ตฐ์š”...! ์šฐ์„  ์ด๊ฑด ์ด๋Œ€๋กœ ํ•ฉ์น˜๊ณ  ๋‹ค์Œ๋ฒˆ ์ฝ”๋“œ ์ˆ˜์ •์—์„œ ์žฌ๋…ผ์˜ ํ•˜๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค!

Comment on lines +169 to +184
private func triggerRefresh() {
// ํ–…ํ‹ฑ ๋ฐœ์ƒ
let generator = UIImpactFeedbackGenerator(style: .light)
generator.impactOccurred()

// ๋กœ๋”ฉ ์ƒํƒœ ํ™œ์„ฑํ™”
isLoading = true

// ๋ฐ์ดํ„ฐ ์—…๋ฐ์ดํŠธ ์‹คํ–‰
viewModel.updateTodayRecord()

// ๋กœ๋”ฉ ์ƒํƒœ ๋น„ํ™œ์„ฑํ™” (๋”œ๋ ˆ์ด ์‹œ๋ฎฌ๋ ˆ์ด์…˜)
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
isLoading = false
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

๊ณต๊ฐํ•ฉ๋‹ˆ๋‹ค! ํ•ด๋‹น ๋ถ€๋ถ„ MainViewModel๋กœ ์˜ฎ๊ฒจ๋„ ๋˜์ง€ ์•Š์„๊นŒ ์‹ถ์Šต๋‹ˆ๋‹ค!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
๐Ÿชข Chore ์ž์ž˜ํ•œ ์ˆ˜์ •, ์„ธํŒ… ์‹œ ์‚ฌ์šฉ
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] ๋ฉ”์ธ ํ™”๋ฉด ์ƒˆ๋กœ๊ณ ์นจ ๊ธฐ๋Šฅ ์ถ”๊ฐ€
3 participants