Various improvements

This commit is contained in:
Ilya Laktyushin
2024-12-06 09:31:49 +04:00
parent c7ab78a8a1
commit fdb4b80e27
56 changed files with 520 additions and 153 deletions

View File

@@ -1277,9 +1277,20 @@ public final class ChatPresentationInterfaceState: Equatable {
}
}
public func canBypassRestrictions(chatPresentationInterfaceState: ChatPresentationInterfaceState) -> Bool {
guard let boostsToUnrestrict = chatPresentationInterfaceState.boostsToUnrestrict, boostsToUnrestrict > 0 else {
return false
}
if let appliedBoosts = chatPresentationInterfaceState.appliedBoosts, appliedBoosts >= boostsToUnrestrict {
return true
}
return false
}
public func canSendMessagesToChat(_ state: ChatPresentationInterfaceState) -> Bool {
if let peer = state.renderedPeer?.peer {
if canSendMessagesToPeer(peer) {
let canBypassRestrictions = canBypassRestrictions(chatPresentationInterfaceState: state)
if canSendMessagesToPeer(peer, ignoreDefault: canBypassRestrictions) {
return true
} else {
return false