Fix exception list

This commit is contained in:
Ali 2023-08-16 00:16:28 +04:00
parent 051380c565
commit 12c85a9968
2 changed files with 16 additions and 4 deletions

View File

@ -18,10 +18,13 @@ public final class NotificationExceptionsList: Equatable {
}
}
func _internal_notificationExceptionsList(accountPeerId: PeerId, postbox: Postbox, network: Network) -> Signal<NotificationExceptionsList, NoError> {
func _internal_notificationExceptionsList(accountPeerId: PeerId, postbox: Postbox, network: Network, isStories: Bool) -> Signal<NotificationExceptionsList, NoError> {
var flags: Int32 = 0
flags |= 1 << 1
flags |= 1 << 2
if isStories {
flags |= 1 << 2
} else {
flags |= 1 << 1
}
return network.request(Api.functions.account.getNotifyExceptions(flags: flags, peer: nil))
|> retryRequest

View File

@ -637,7 +637,16 @@ public extension TelegramEngine {
}
public func notificationExceptionsList() -> Signal<NotificationExceptionsList, NoError> {
return _internal_notificationExceptionsList(accountPeerId: self.account.peerId, postbox: self.account.postbox, network: self.account.network)
return combineLatest(
_internal_notificationExceptionsList(accountPeerId: self.account.peerId, postbox: self.account.postbox, network: self.account.network, isStories: false),
_internal_notificationExceptionsList(accountPeerId: self.account.peerId, postbox: self.account.postbox, network: self.account.network, isStories: true)
)
|> map { lhs, rhs in
return NotificationExceptionsList(
peers: lhs.peers.merging(rhs.peers, uniquingKeysWith: { a, _ in a }),
settings: lhs.settings.merging(rhs.settings, uniquingKeysWith: { a, _ in a })
)
}
}
public func fetchAndUpdateCachedPeerData(peerId: PeerId) -> Signal<Bool, NoError> {