Show " Post Sent!"-pill if post was sent successfully (IOS-234)

Maybe we could think about an error-message here, too?
This commit is contained in:
Nathan Mattes 2024-04-08 10:40:16 +02:00
parent 527d250024
commit 6c0faede75
2 changed files with 15 additions and 1 deletions

View File

@ -332,6 +332,20 @@ extension HomeTimelineViewController {
}
})
.store(in: &disposeBag)
context.publisherService.statusPublishResult.prepend(.failure(AppError.badRequest))
.receive(on: DispatchQueue.main)
.sink { [weak self] publishResult in
guard let self else { return }
switch publishResult {
case .success:
self.timelinePill.update(with: .postSent)
self.showTimelinePill()
case .failure:
self.hideTimelinePill()
}
}
.store(in: &disposeBag)
}
override func viewWillAppear(_ animated: Bool) {

View File

@ -33,7 +33,7 @@ final class HomeTimelineViewModel: NSObject {
@Published var scrollPositionRecord: ScrollPositionRecord? = nil
@Published var displaySettingBarButtonItem = true
@Published var hasPendingStatusEditReload = false
var hasNewPosts = CurrentValueSubject<Bool, Never>(false)
let hasNewPosts = CurrentValueSubject<Bool, Never>(false)
var timelineContext: MastodonFeed.Kind.TimelineContext = .home
weak var tableView: UITableView?