Skip to content

Commit b6b2f55

Browse files
committed
[fix] hotfix
1 parent dab6bb9 commit b6b2f55

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

DailyQuest/DailyQuest/Data/Repositories/DefaultBrowseRepository.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private extension DefaultBrowseRepository {
5858
.read(type: QuestDTO.self, userCase: .anotherUser(user.uuid), access: .quests, filter: .today(Date()))
5959
.map { $0.toDomain() }
6060
.toArray()
61-
.map { BrowseQuest(user: user, quests: $0) }
61+
.map { BrowseQuest(user: user, quests: Array($0.prefix(3))) }
6262
}
6363

6464
func saveBrowseQuestPersistentStorage(browseQuest: BrowseQuest) -> Observable<BrowseQuest> {

DailyQuest/DailyQuest/Domain/UseCases/Home/DefaultQuestUseCase.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ extension DefaultQuestUseCase: QuestUseCase {
3838
return questsRepository
3939
.delete(with: quest.uuid)
4040
.do(onSuccess: { quest in
41-
if quest.state {
42-
NotificationCenter.default.post(name: .questStateChanged, object: quest.date)
43-
}
41+
NotificationCenter.default.post(name: .questStateChanged, object: quest.date)
4442
})
4543
.map { _ in true }
4644
.catchAndReturn(false)

DailyQuest/DailyQuest/Presentation/Home/ViewModel/HomeViewModel.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,16 @@ final class HomeViewModel {
8181
.rx
8282
.notification(.userUpdated)
8383

84+
let questStateChangedNotification = NotificationCenter
85+
.default
86+
.rx
87+
.notification(.questStateChanged)
88+
8489
let updateNotification = Observable
8590
.merge(
8691
questUpdateNotification,
87-
userUpdateNotification
92+
userUpdateNotification,
93+
questStateChangedNotification
8894
)
8995

9096
let notification = updateNotification
@@ -116,10 +122,10 @@ final class HomeViewModel {
116122
.do(onNext: { [weak self] date in
117123
self?.currentDate = date
118124
})
119-
.flatMap(questUseCase.fetch(by:))
125+
.flatMap(questUseCase.fetch(by:))
120126
.asDriver(onErrorJustReturn: [])
121127

122-
let userNotification = NotificationCenter
128+
let userNotification = NotificationCenter
123129
.default
124130
.rx
125131
.notification(.userUpdated)

0 commit comments

Comments
 (0)