mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-04 10:30:42 +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
|
|> mapToSignal { _ -> Signal<Peer?, BlockedPeersContextAddError> in
|
||||||
return postbox.transaction { transaction -> Peer? 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)
|
return transaction.getPeer(peerId)
|
||||||
}
|
}
|
||||||
|> introduceError(BlockedPeersContextAddError.self)
|
|> introduceError(BlockedPeersContextAddError.self)
|
||||||
}
|
}
|
||||||
|> deliverOnMainQueue
|
|> deliverOnMainQueue
|
||||||
|
|
||||||
|> mapToSignal { peer -> Signal<Never, BlockedPeersContextAddError> in
|
|> mapToSignal { peer -> Signal<Never, BlockedPeersContextAddError> in
|
||||||
guard let strongSelf = self, let peer = peer else {
|
guard let strongSelf = self, let peer = peer else {
|
||||||
return .complete()
|
return .complete()
|
||||||
@ -190,7 +200,7 @@ public final class BlockedPeersContext {
|
|||||||
|
|
||||||
public func remove(peerId: PeerId) -> Signal<Never, BlockedPeersContextRemoveError> {
|
public func remove(peerId: PeerId) -> Signal<Never, BlockedPeersContextRemoveError> {
|
||||||
assert(Queue.mainQueue().isCurrent())
|
assert(Queue.mainQueue().isCurrent())
|
||||||
|
let postbox = self.account.postbox
|
||||||
let network = self.account.network
|
let network = self.account.network
|
||||||
return self.account.postbox.transaction { transaction -> Api.InputUser? in
|
return self.account.postbox.transaction { transaction -> Api.InputUser? in
|
||||||
return transaction.getPeer(peerId).flatMap(apiInputUser)
|
return transaction.getPeer(peerId).flatMap(apiInputUser)
|
||||||
@ -204,6 +214,21 @@ public final class BlockedPeersContext {
|
|||||||
|> mapError { _ -> BlockedPeersContextRemoveError in
|
|> mapError { _ -> BlockedPeersContextRemoveError in
|
||||||
return .generic
|
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
|
|> deliverOnMainQueue
|
||||||
|> mapToSignal { _ -> Signal<Never, BlockedPeersContextRemoveError> in
|
|> mapToSignal { _ -> Signal<Never, BlockedPeersContextRemoveError> in
|
||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
|
@ -379,7 +379,7 @@ func fetchMessageHistoryHole(accountPeerId: PeerId, source: FetchMessageHistoryH
|
|||||||
let messageRange = ids.min()! ... ids.max()!
|
let messageRange = ids.min()! ... ids.max()!
|
||||||
switch direction {
|
switch direction {
|
||||||
case let .aroundId(aroundId):
|
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):
|
case let .range(start, end):
|
||||||
if start.id <= end.id {
|
if start.id <= end.id {
|
||||||
let minBound = start.id
|
let minBound = start.id
|
||||||
|
@ -347,6 +347,17 @@ public final class TelegramMediaFile: Media, Equatable {
|
|||||||
return false
|
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 {
|
public var isVideo: Bool {
|
||||||
for attribute in self.attributes {
|
for attribute in self.attributes {
|
||||||
if case .Video = attribute {
|
if case .Video = attribute {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user