mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-04 18:41:00 +00:00
no message
This commit is contained in:
parent
f30b99cdb2
commit
01b9141bb5
@ -159,11 +159,21 @@ public final class BlockedPeersContext {
|
||||
}
|
||||
|> mapToSignal { _ -> Signal<Peer?, BlockedPeersContextAddError> in
|
||||
return postbox.transaction { transaction -> Peer? in
|
||||
transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in
|
||||
let previous: CachedUserData
|
||||
if let current = current as? CachedUserData {
|
||||
previous = current
|
||||
} else {
|
||||
previous = CachedUserData()
|
||||
}
|
||||
return previous.withUpdatedIsBlocked(true)
|
||||
})
|
||||
return transaction.getPeer(peerId)
|
||||
}
|
||||
|> introduceError(BlockedPeersContextAddError.self)
|
||||
}
|
||||
|> deliverOnMainQueue
|
||||
|
||||
|> mapToSignal { peer -> Signal<Never, BlockedPeersContextAddError> in
|
||||
guard let strongSelf = self, let peer = peer else {
|
||||
return .complete()
|
||||
@ -190,7 +200,7 @@ public final class BlockedPeersContext {
|
||||
|
||||
public func remove(peerId: PeerId) -> Signal<Never, BlockedPeersContextRemoveError> {
|
||||
assert(Queue.mainQueue().isCurrent())
|
||||
|
||||
let postbox = self.account.postbox
|
||||
let network = self.account.network
|
||||
return self.account.postbox.transaction { transaction -> Api.InputUser? in
|
||||
return transaction.getPeer(peerId).flatMap(apiInputUser)
|
||||
@ -204,6 +214,21 @@ public final class BlockedPeersContext {
|
||||
|> mapError { _ -> BlockedPeersContextRemoveError in
|
||||
return .generic
|
||||
}
|
||||
|> mapToSignal { value in
|
||||
return postbox.transaction { transaction -> Peer? in
|
||||
transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in
|
||||
let previous: CachedUserData
|
||||
if let current = current as? CachedUserData {
|
||||
previous = current
|
||||
} else {
|
||||
previous = CachedUserData()
|
||||
}
|
||||
return previous.withUpdatedIsBlocked(false)
|
||||
})
|
||||
return transaction.getPeer(peerId)
|
||||
}
|
||||
|> introduceError(BlockedPeersContextRemoveError.self)
|
||||
}
|
||||
|> deliverOnMainQueue
|
||||
|> mapToSignal { _ -> Signal<Never, BlockedPeersContextRemoveError> in
|
||||
guard let strongSelf = self else {
|
||||
|
@ -379,7 +379,7 @@ func fetchMessageHistoryHole(accountPeerId: PeerId, source: FetchMessageHistoryH
|
||||
let messageRange = ids.min()! ... ids.max()!
|
||||
switch direction {
|
||||
case let .aroundId(aroundId):
|
||||
filledRange = min(aroundId.id, messageRange.lowerBound) ... max(aroundId.id, messageRange.lowerBound)
|
||||
filledRange = min(aroundId.id, messageRange.lowerBound) ... max(aroundId.id, messageRange.upperBound)
|
||||
case let .range(start, end):
|
||||
if start.id <= end.id {
|
||||
let minBound = start.id
|
||||
|
@ -347,6 +347,17 @@ public final class TelegramMediaFile: Media, Equatable {
|
||||
return false
|
||||
}
|
||||
|
||||
public var isStaticSticker: Bool {
|
||||
for attribute in self.attributes {
|
||||
if case .Sticker = attribute {
|
||||
if let s = self.size, s < 200 * 1024 {
|
||||
return !isAnimatedSticker
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
public var isVideo: Bool {
|
||||
for attribute in self.attributes {
|
||||
if case .Video = attribute {
|
||||
|
Loading…
x
Reference in New Issue
Block a user