feat(home): 홈 탭 당겨서 새로고침을 추가한다

This commit is contained in:
Yu Sung
2026-08-18 13:29:55 +09:00
parent 9297cd28f9
commit d2561272c0
6 changed files with 131 additions and 33 deletions

View File

@@ -21,16 +21,14 @@ final class MainHomeRecommendationViewModel: ObservableObject {
repository.getRecommendations()
.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.Common.commonError
self.isShowPopup = true
self.isLoading = false
self?.errorMessage = I18n.Common.commonError
self?.isShowPopup = true
self?.isLoading = false
}
} receiveValue: { [weak self] response in
guard let self else { return }
@@ -58,6 +56,16 @@ final class MainHomeRecommendationViewModel: ObservableObject {
.store(in: &subscription)
}
func refresh() async {
if !isLoading {
fetchRecommendations()
}
for await isLoading in $isLoading.values {
if !isLoading { return }
}
}
func followAll(creatorIds: [Int], completionKey: String) {
guard !creatorIds.isEmpty, !completionKey.isEmpty else { return }
guard !completedFollowKeys.contains(completionKey), !followingKeys.contains(completionKey) else { return }