File tree Expand file tree Collapse file tree 4 files changed +15
-12
lines changed
ServiceProtocols/DataProviders Expand file tree Collapse file tree 4 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -478,24 +478,28 @@ private extension ChatViewController {
478478 self ? . didTapSelectText ( text: text)
479479 }
480480 . store ( in: & subscriptions)
481+
481482 viewModel. $unreadMesaggesIndexes
482483 . removeDuplicates ( )
483484 . sink { [ weak self] _ in
484485 self ? . updateUnreadMessages ( )
485486 }
486487 . store ( in: & subscriptions)
488+
487489 viewModel. $unreadMessagesIds
488490 . removeDuplicates ( )
489491 . sink { _ in
490492 self . updateScrollDownButtonVisibility ( )
491493 }
492494 . store ( in: & subscriptions)
495+
493496 viewModel. $messagesWithUnredReactionsIds
494497 . removeDuplicates ( )
495498 . sink { [ weak self] _ in
496499 self ? . updateScrollToUnreadButtonVisibility ( )
497500 }
498501 . store ( in: & subscriptions)
502+
499503 viewModel. showBuyAndSell
500504 . sink { [ weak self] in
501505 self ? . presentBuyAndSell ( )
Original file line number Diff line number Diff line change @@ -271,8 +271,9 @@ final class ChatViewModel: NSObject {
271271 return
272272 }
273273
274- let isChatLoaded = await chatsProvider. isChatLoaded ( with: address)
275- let isChatLoading = await chatsProvider. isChatLoading ( with: address)
274+ async let chatLoadingState = ( chatsProvider. isChatLoaded ( with: address) , chatsProvider. isChatLoading ( with: address) )
275+
276+ let ( isChatLoaded, isChatLoading) = await chatLoadingState
276277
277278 guard !isChatLoading else {
278279 await waitForChatLoading ( with: address)
@@ -1149,7 +1150,7 @@ private extension ChatViewModel {
11491150 await chatsProvider. stateObserver
11501151 . receive ( on: DispatchQueue . main)
11511152 . sink { [ weak self] state in
1152- self ? . isHeaderLoading = state == . updating ? true : false
1153+ self ? . isHeaderLoading = state. isUpdating
11531154 }
11541155 . store ( in: & subscriptions)
11551156 } . stored ( in: tasksStorage)
Original file line number Diff line number Diff line change @@ -1589,15 +1589,6 @@ extension ChatListViewController {
15891589 }
15901590}
15911591
1592- private extension DataProviderState {
1593- var isUpdating : Bool {
1594- switch self {
1595- case . updating: true
1596- case . failedToUpdate, . upToDate, . empty: false
1597- }
1598- }
1599- }
1600-
16011592private extension UITableView {
16021593 func reloadRowsAndPreserveSelection( at indexPaths: [ IndexPath ] ) {
16031594 let selectedRowIndexPath = indexPathForSelectedRow
Original file line number Diff line number Diff line change @@ -14,6 +14,13 @@ enum DataProviderState {
1414 case updating
1515 case upToDate
1616 case failedToUpdate( Error )
17+
18+ var isUpdating : Bool {
19+ switch self {
20+ case . updating: true
21+ case . failedToUpdate, . upToDate, . empty: false
22+ }
23+ }
1724}
1825
1926protocol DataProvider : AnyObject , Actor {
You can’t perform that action at this time.
0 commit comments