feat(content): 콘텐츠 탭 당겨서 새로고침을 추가한다

This commit is contained in:
Yu Sung
2026-08-18 13:30:15 +09:00
parent d2561272c0
commit bdd885a082
6 changed files with 135 additions and 30 deletions

View File

@@ -30,17 +30,15 @@ final class MainContentRecommendationViewModel: ObservableObject {
repository.getAudioRecommendations()
.sink { [weak self] result in
guard let self else { return }
switch result {
case .finished:
DEBUG_LOG("finish")
case .failure(let error):
ERROR_LOG(error.localizedDescription)
self.errorMessage = I18n.MainContentRecommendation.loadFailedMessage
self.isShowPopup = true
self.isLoading = false
self.hasLoaded = true
self?.errorMessage = I18n.MainContentRecommendation.loadFailedMessage
self?.isShowPopup = true
self?.isLoading = false
self?.hasLoaded = true
}
} receiveValue: { [weak self] response in
guard let self else { return }
@@ -69,4 +67,14 @@ final class MainContentRecommendationViewModel: ObservableObject {
}
.store(in: &subscription)
}
func refresh() async {
if !isLoading {
fetchRecommendations()
}
for await isLoading in $isLoading.values {
if !isLoading { return }
}
}
}