mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
8b933180d3
@ -9008,6 +9008,10 @@ Sorry for the inconvenience.";
|
||||
"PowerSaving.BatteryLevelLimit.AlwaysOff" = "Always Off";
|
||||
"PowerSaving.BatteryLevelLimit.WhenBelow" = "When Below %@%";
|
||||
|
||||
"PowerSaving.AllDescriptionNever" = "Don’t disable all resource-intensive processes even when the battery is low.";
|
||||
"PowerSaving.AllDescriptionAlways" = "Always disable all resource-intensive processes, regardless of the battery charge level.";
|
||||
"PowerSaving.AllDescriptionLimit" = "Automatically disable all resource-intensive processes when your battery is below %@%.";
|
||||
|
||||
"AppearanceSettings.Animations" = "Animations";
|
||||
|
||||
"SendInviteLink.SkipAction" = "Skip";
|
||||
|
@ -651,7 +651,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
self.readIconView.tintColor = presentationData.theme.contextMenu.secondaryColor
|
||||
let fraction: CGFloat = textFontFraction
|
||||
let iconSize = CGSize(width: floor(readImage.size.width * fraction), height: floor(readImage.size.height * fraction))
|
||||
self.readIconView.frame = CGRect(origin: CGPoint(x: titleFrame.minX, y: textFrame.minY + floor(textFontFraction * 4.0) - UIScreenPixel), size: iconSize)
|
||||
self.readIconView.frame = CGRect(origin: CGPoint(x: titleFrame.minX, y: textFrame.minY + floor(textFontFraction * 4.0) - UIScreenPixel + (item.timestampIsReaction ? -2.0 - UIScreenPixel : 0.0)), size: iconSize)
|
||||
}
|
||||
self.readIconView.isHidden = !self.displayReadTimestamps || text.isEmpty
|
||||
|
||||
|
@ -221,11 +221,11 @@ private func energeSavingSettingsScreenEntries(
|
||||
|
||||
let allText: String
|
||||
if settings.energyUsageSettings.activationThreshold <= 4 {
|
||||
allText = "Don’t disable all resource-intensive processes even when the battery is low."
|
||||
allText = presentationData.strings.PowerSaving_AllDescriptionNever
|
||||
} else if settings.energyUsageSettings.activationThreshold >= 96 {
|
||||
allText = "Always disable all resource-intensive processes, regardless of the battery charge level."
|
||||
allText = presentationData.strings.PowerSaving_AllDescriptionAlways
|
||||
} else {
|
||||
allText = "Automatically disable all resource-intensive processes when your battery is below \(settings.energyUsageSettings.activationThreshold)%."
|
||||
allText = presentationData.strings.PowerSaving_AllDescriptionLimit("\(settings.energyUsageSettings.activationThreshold)").string
|
||||
}
|
||||
entries.append(.allFooter(allText))
|
||||
|
||||
|
@ -6,12 +6,30 @@ import SwiftSignalKit
|
||||
|
||||
@available(iOS 12.0, macOS 10.14, *)
|
||||
final class NetworkFrameworkTcpConnectionInterface: NSObject, MTTcpConnectionInterface {
|
||||
private struct ReadRequest {
|
||||
let length: Int
|
||||
let tag: Int
|
||||
}
|
||||
|
||||
private final class ExecutingReadRequest {
|
||||
let request: ReadRequest
|
||||
var data: Data
|
||||
var readyLength: Int = 0
|
||||
|
||||
init(request: ReadRequest) {
|
||||
self.request = request
|
||||
self.data = Data(count: request.length)
|
||||
}
|
||||
}
|
||||
|
||||
private final class Impl {
|
||||
private let queue: Queue
|
||||
|
||||
private weak var delegate: MTTcpConnectionInterfaceDelegate?
|
||||
private let delegateQueue: DispatchQueue
|
||||
|
||||
private let requestChunkLength: Int
|
||||
|
||||
private var connection: NWConnection?
|
||||
private var reportedDisconnection: Bool = false
|
||||
|
||||
@ -22,6 +40,9 @@ final class NetworkFrameworkTcpConnectionInterface: NSObject, MTTcpConnectionInt
|
||||
private var usageCalculationInfo: MTNetworkUsageCalculationInfo?
|
||||
private var networkUsageManager: MTNetworkUsageManager?
|
||||
|
||||
private var readRequests: [ReadRequest] = []
|
||||
private var currentReadRequest: ExecutingReadRequest?
|
||||
|
||||
init(
|
||||
queue: Queue,
|
||||
delegate: MTTcpConnectionInterfaceDelegate,
|
||||
@ -31,6 +52,8 @@ final class NetworkFrameworkTcpConnectionInterface: NSObject, MTTcpConnectionInt
|
||||
|
||||
self.delegate = delegate
|
||||
self.delegateQueue = delegateQueue
|
||||
|
||||
self.requestChunkLength = 256 * 1024
|
||||
}
|
||||
|
||||
deinit {
|
||||
@ -120,6 +143,8 @@ final class NetworkFrameworkTcpConnectionInterface: NSObject, MTTcpConnectionInt
|
||||
self.connectTimeoutTimer?.start()
|
||||
|
||||
connection.start(queue: self.queue.queue)
|
||||
|
||||
self.processReadRequests()
|
||||
}
|
||||
|
||||
private func stateUpdated(state: NWConnection.State) {
|
||||
@ -164,42 +189,85 @@ final class NetworkFrameworkTcpConnectionInterface: NSObject, MTTcpConnectionInt
|
||||
}
|
||||
|
||||
func read(length: Int, timeout: Double, tag: Int) {
|
||||
self.readRequests.append(NetworkFrameworkTcpConnectionInterface.ReadRequest(length: length, tag: tag))
|
||||
self.processReadRequests()
|
||||
}
|
||||
|
||||
private func processReadRequests() {
|
||||
if self.currentReadRequest != nil {
|
||||
return
|
||||
}
|
||||
if self.readRequests.isEmpty {
|
||||
return
|
||||
}
|
||||
|
||||
let readRequest = self.readRequests.removeFirst()
|
||||
let currentReadRequest = ExecutingReadRequest(request: readRequest)
|
||||
self.currentReadRequest = currentReadRequest
|
||||
|
||||
self.processCurrentRead()
|
||||
}
|
||||
|
||||
private func processCurrentRead() {
|
||||
guard let currentReadRequest = self.currentReadRequest else {
|
||||
return
|
||||
}
|
||||
guard let connection = self.connection else {
|
||||
print("Connection not ready")
|
||||
return
|
||||
}
|
||||
|
||||
connection.receive(minimumIncompleteLength: length, maximumLength: length, completion: { [weak self] data, context, isComplete, error in
|
||||
guard let self = self else {
|
||||
return
|
||||
let requestChunkLength = min(self.requestChunkLength, currentReadRequest.request.length - currentReadRequest.readyLength)
|
||||
if requestChunkLength == 0 {
|
||||
self.currentReadRequest = nil
|
||||
|
||||
weak var delegate = self.delegate
|
||||
self.delegateQueue.async {
|
||||
if let delegate = delegate {
|
||||
delegate.connectionInterfaceDidRead(currentReadRequest.data, withTag: currentReadRequest.request.tag)
|
||||
}
|
||||
}
|
||||
if let data = data {
|
||||
self.networkUsageManager?.addIncomingBytes(UInt(data.count), interface: self.currentInterfaceIsWifi ? MTNetworkUsageManagerInterfaceOther : MTNetworkUsageManagerInterfaceWWAN)
|
||||
|
||||
if isComplete || data.count == length {
|
||||
if data.count == length {
|
||||
|
||||
self.processReadRequests()
|
||||
} else {
|
||||
connection.receive(minimumIncompleteLength: requestChunkLength, maximumLength: requestChunkLength, completion: { [weak self] data, context, isComplete, error in
|
||||
guard let self = self, let currentReadRequest = self.currentReadRequest else {
|
||||
return
|
||||
}
|
||||
if let data = data {
|
||||
self.networkUsageManager?.addIncomingBytes(UInt(data.count), interface: self.currentInterfaceIsWifi ? MTNetworkUsageManagerInterfaceOther : MTNetworkUsageManagerInterfaceWWAN)
|
||||
|
||||
if data.count != 0 && data.count <= currentReadRequest.request.length - currentReadRequest.readyLength {
|
||||
currentReadRequest.data.withUnsafeMutableBytes { currentBuffer in
|
||||
guard let currentBytes = currentBuffer.assumingMemoryBound(to: UInt8.self).baseAddress else {
|
||||
return
|
||||
}
|
||||
data.copyBytes(to: currentBytes.advanced(by: currentReadRequest.readyLength), count: data.count)
|
||||
}
|
||||
currentReadRequest.readyLength += data.count
|
||||
|
||||
let tag = currentReadRequest.request.tag
|
||||
let readCount = data.count
|
||||
weak var delegate = self.delegate
|
||||
self.delegateQueue.async {
|
||||
if let delegate = delegate {
|
||||
delegate.connectionInterfaceDidRead(data, withTag: tag)
|
||||
delegate.connectionInterfaceDidReadPartialData(ofLength: UInt(readCount), tag: tag)
|
||||
}
|
||||
}
|
||||
|
||||
self.processCurrentRead()
|
||||
} else {
|
||||
self.cancelWithError(error: error)
|
||||
}
|
||||
} else {
|
||||
weak var delegate = self.delegate
|
||||
let dataCount = data.count
|
||||
self.delegateQueue.async {
|
||||
if let delegate = delegate {
|
||||
delegate.connectionInterfaceDidReadPartialData(ofLength: UInt(dataCount), tag: tag)
|
||||
}
|
||||
|
||||
if isComplete && data.count == 0 {
|
||||
self.cancelWithError(error: nil)
|
||||
}
|
||||
} else {
|
||||
self.cancelWithError(error: error)
|
||||
}
|
||||
} else {
|
||||
self.cancelWithError(error: error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private func cancelWithError(error: Error?) {
|
||||
|
@ -26,10 +26,10 @@ func applyMediaResourceChanges(from: Media, to: Media, postbox: Postbox, force:
|
||||
}
|
||||
}
|
||||
if let fromLargestRepresentation = largestImageRepresentation(fromImage.representations), let toLargestRepresentation = largestImageRepresentation(toImage.representations) {
|
||||
/*if fromLargestRepresentation.progressiveSizes != toLargestRepresentation.progressiveSizes {
|
||||
} else {*/
|
||||
if fromLargestRepresentation.resource is CloudPeerPhotoSizeMediaResource {
|
||||
} else {
|
||||
copyOrMoveResourceData(from: fromLargestRepresentation.resource, to: toLargestRepresentation.resource, mediaBox: postbox.mediaBox)
|
||||
//}
|
||||
}
|
||||
}
|
||||
} else if let fromFile = from as? TelegramMediaFile, let toFile = to as? TelegramMediaFile {
|
||||
if let fromPreview = smallestImageRepresentation(fromFile.previewRepresentations), let toPreview = smallestImageRepresentation(toFile.previewRepresentations) {
|
||||
|
@ -98,12 +98,22 @@ func _internal_cachedPeerSendAsAvailablePeers(account: Account, peerId: PeerId)
|
||||
|
||||
|
||||
func _internal_peerSendAsAvailablePeers(network: Network, postbox: Postbox, peerId: PeerId) -> Signal<[SendAsPeer], NoError> {
|
||||
return postbox.transaction { transaction -> Api.InputPeer? in
|
||||
return transaction.getPeer(peerId).flatMap(apiInputPeer)
|
||||
} |> mapToSignal { inputPeer in
|
||||
guard let inputPeer = inputPeer else {
|
||||
return .complete()
|
||||
return postbox.transaction { transaction -> Peer? in
|
||||
return transaction.getPeer(peerId)
|
||||
}
|
||||
|> mapToSignal { peer -> Signal<[SendAsPeer], NoError> in
|
||||
guard let peer = peer else {
|
||||
return .single([])
|
||||
}
|
||||
guard let inputPeer = apiInputPeer(peer) else {
|
||||
return .single([])
|
||||
}
|
||||
|
||||
if let channel = peer as? TelegramChannel, case .group = channel.info {
|
||||
} else {
|
||||
return .single([])
|
||||
}
|
||||
|
||||
return network.request(Api.functions.channels.getSendAs(peer: inputPeer))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.channels.SendAsPeers?, NoError> in
|
||||
|
@ -78,7 +78,8 @@ func chatHistoryEntriesForView(
|
||||
associatedThreadInfo: nil
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
var existingGroupStableIds: [UInt32] = []
|
||||
var groupBucket: [(Message, Bool, ChatHistoryMessageSelection, ChatMessageEntryAttributes, MessageHistoryEntryLocation?)] = []
|
||||
var count = 0
|
||||
loop: for entry in view.entries {
|
||||
@ -161,7 +162,11 @@ func chatHistoryEntriesForView(
|
||||
groupBucket.reverse()
|
||||
}
|
||||
if groupMessages {
|
||||
entries.append(.MessageGroupEntry(groupBucket[0].0.groupInfo!, groupBucket, presentationData))
|
||||
let groupStableId = groupBucket[0].0.groupInfo!.stableId
|
||||
if !existingGroupStableIds.contains(groupStableId) {
|
||||
existingGroupStableIds.append(groupStableId)
|
||||
entries.append(.MessageGroupEntry(groupBucket[0].0.groupInfo!, groupBucket, presentationData))
|
||||
}
|
||||
} else {
|
||||
for (message, isRead, selection, attributes, location) in groupBucket {
|
||||
entries.append(.MessageEntry(message, presentationData, isRead, location, selection, attributes))
|
||||
@ -203,7 +208,11 @@ func chatHistoryEntriesForView(
|
||||
groupBucket.reverse()
|
||||
}
|
||||
if groupMessages {
|
||||
entries.append(.MessageGroupEntry(groupBucket[0].0.groupInfo!, groupBucket, presentationData))
|
||||
let groupStableId = groupBucket[0].0.groupInfo!.stableId
|
||||
if !existingGroupStableIds.contains(groupStableId) {
|
||||
existingGroupStableIds.append(groupStableId)
|
||||
entries.append(.MessageGroupEntry(groupBucket[0].0.groupInfo!, groupBucket, presentationData))
|
||||
}
|
||||
} else {
|
||||
for (message, isRead, selection, attributes, location) in groupBucket {
|
||||
entries.append(.MessageEntry(message, presentationData, isRead, location, selection, attributes))
|
||||
|
@ -653,10 +653,21 @@ final class WallpaperBackgroundNodeImpl: ASDisplayNode, WallpaperBackgroundNode
|
||||
private let contentNode: ASDisplayNode
|
||||
|
||||
private var blurredBackgroundContents: UIImage?
|
||||
private var blurredBackgroundPortalSourceView: PortalSourceView?
|
||||
private var blurredBackgroundDimmedNode: GradientBackgroundNode.CloneNode?
|
||||
private var blurredBackgroundDimmedOverlayView: UIView?
|
||||
private var blurredBackgroundContentView: UIImageView?
|
||||
|
||||
private var freeBackgroundPortalSourceView: PortalSourceView?
|
||||
private var freeBackgroundNode: WallpaperBackgroundNodeImpl.BubbleBackgroundNodeImpl? {
|
||||
didSet {
|
||||
if self.freeBackgroundNode !== oldValue {
|
||||
if let oldValue {
|
||||
oldValue.view.removeFromSuperview()
|
||||
}
|
||||
if let freeBackgroundNode = self.freeBackgroundNode, let freeBackgroundPortalSourceView = self.freeBackgroundPortalSourceView {
|
||||
freeBackgroundPortalSourceView.addSubview(freeBackgroundNode.view)
|
||||
freeBackgroundNode.frame = CGRect(origin: CGPoint(), size: freeBackgroundPortalSourceView.bounds.size)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var incomingBackgroundPortalSourceView: PortalSourceView?
|
||||
private var incomingBackgroundNode: WallpaperBackgroundNodeImpl.BubbleBackgroundNodeImpl? {
|
||||
@ -817,14 +828,10 @@ final class WallpaperBackgroundNodeImpl: ASDisplayNode, WallpaperBackgroundNode
|
||||
super.init()
|
||||
|
||||
if #available(iOS 12.0, *) {
|
||||
let blurredBackgroundPortalSourceView = PortalSourceView()
|
||||
self.blurredBackgroundPortalSourceView = blurredBackgroundPortalSourceView
|
||||
blurredBackgroundPortalSourceView.alpha = 0.0
|
||||
self.view.addSubview(blurredBackgroundPortalSourceView)
|
||||
|
||||
let blurredBackgroundContentView = UIImageView()
|
||||
self.blurredBackgroundContentView = blurredBackgroundContentView
|
||||
blurredBackgroundPortalSourceView.addSubview(blurredBackgroundContentView)
|
||||
let freeBackgroundPortalSourceView = PortalSourceView()
|
||||
self.freeBackgroundPortalSourceView = freeBackgroundPortalSourceView
|
||||
freeBackgroundPortalSourceView.alpha = 0.0
|
||||
self.view.addSubview(freeBackgroundPortalSourceView)
|
||||
|
||||
let incomingBackgroundPortalSourceView = PortalSourceView()
|
||||
self.incomingBackgroundPortalSourceView = incomingBackgroundPortalSourceView
|
||||
@ -885,28 +892,11 @@ final class WallpaperBackgroundNodeImpl: ASDisplayNode, WallpaperBackgroundNode
|
||||
scheduleLoopingEvent = true
|
||||
}
|
||||
}
|
||||
if let gradientBackgroundNode = self.gradientBackgroundNode {
|
||||
if self.blurredBackgroundDimmedNode == nil {
|
||||
let blurredBackgroundDimmedNode = GradientBackgroundNode.CloneNode(parentNode: gradientBackgroundNode)
|
||||
self.blurredBackgroundDimmedNode = blurredBackgroundDimmedNode
|
||||
self.blurredBackgroundPortalSourceView?.addSubnode(blurredBackgroundDimmedNode)
|
||||
}
|
||||
if self.blurredBackgroundDimmedOverlayView == nil {
|
||||
let blurredBackgroundDimmedOverlayView = UIView()
|
||||
self.blurredBackgroundDimmedOverlayView = blurredBackgroundDimmedOverlayView
|
||||
self.blurredBackgroundPortalSourceView?.addSubview(blurredBackgroundDimmedOverlayView)
|
||||
}
|
||||
}
|
||||
self.gradientBackgroundNode?.updateColors(colors: mappedColors)
|
||||
|
||||
if let bubbleTheme = self.bubbleTheme {
|
||||
self.blurredBackgroundDimmedOverlayView?.backgroundColor = selectDateFillStaticColor(theme: bubbleTheme, wallpaper: wallpaper)
|
||||
}
|
||||
|
||||
self.contentNode.backgroundColor = nil
|
||||
self.contentNode.contents = nil
|
||||
self.blurredBackgroundContents = nil
|
||||
self.blurredBackgroundContentView?.image = self.blurredBackgroundContents
|
||||
self.motionEnabled = false
|
||||
self.wallpaperDisposable.set(nil)
|
||||
} else {
|
||||
@ -916,14 +906,6 @@ final class WallpaperBackgroundNodeImpl: ASDisplayNode, WallpaperBackgroundNode
|
||||
gradientBackgroundNode.setPatternOverlay(layer: nil)
|
||||
self.layer.insertSublayer(self.patternImageLayer, above: self.contentNode.layer)
|
||||
}
|
||||
if let blurredBackgroundDimmedNode = self.blurredBackgroundDimmedNode {
|
||||
self.blurredBackgroundDimmedNode = nil
|
||||
blurredBackgroundDimmedNode.removeFromSupernode()
|
||||
}
|
||||
if let blurredBackgroundDimmedOverlayView = self.blurredBackgroundDimmedOverlayView {
|
||||
self.blurredBackgroundDimmedOverlayView = nil
|
||||
blurredBackgroundDimmedOverlayView.removeFromSuperview()
|
||||
}
|
||||
|
||||
self.motionEnabled = wallpaper.settings?.motion ?? false
|
||||
|
||||
@ -944,20 +926,17 @@ final class WallpaperBackgroundNodeImpl: ASDisplayNode, WallpaperBackgroundNode
|
||||
})
|
||||
self.contentNode.contents = image?.cgImage
|
||||
self.blurredBackgroundContents = image
|
||||
self.blurredBackgroundContentView?.image = self.blurredBackgroundContents
|
||||
self.wallpaperDisposable.set(nil)
|
||||
} else if gradientColors.count >= 1 {
|
||||
self.contentNode.backgroundColor = UIColor(rgb: gradientColors[0])
|
||||
self.contentNode.contents = nil
|
||||
self.blurredBackgroundContents = nil
|
||||
self.blurredBackgroundContentView?.image = self.blurredBackgroundContents
|
||||
self.wallpaperDisposable.set(nil)
|
||||
} else {
|
||||
self.contentNode.backgroundColor = .white
|
||||
if let image = chatControllerBackgroundImage(theme: nil, wallpaper: wallpaper, mediaBox: self.context.sharedContext.accountManager.mediaBox, knockoutMode: false) {
|
||||
self.contentNode.contents = image.cgImage
|
||||
self.blurredBackgroundContents = generateBlurredContents(image: image)
|
||||
self.blurredBackgroundContentView?.image = self.blurredBackgroundContents
|
||||
self.wallpaperDisposable.set(nil)
|
||||
Queue.mainQueue().justDispatch {
|
||||
self._isReady.set(true)
|
||||
@ -965,7 +944,6 @@ final class WallpaperBackgroundNodeImpl: ASDisplayNode, WallpaperBackgroundNode
|
||||
} else if let image = chatControllerBackgroundImage(theme: nil, wallpaper: wallpaper, mediaBox: self.context.account.postbox.mediaBox, knockoutMode: false) {
|
||||
self.contentNode.contents = image.cgImage
|
||||
self.blurredBackgroundContents = generateBlurredContents(image: image)
|
||||
self.blurredBackgroundContentView?.image = self.blurredBackgroundContents
|
||||
self.wallpaperDisposable.set(nil)
|
||||
Queue.mainQueue().justDispatch {
|
||||
self._isReady.set(true)
|
||||
@ -982,7 +960,6 @@ final class WallpaperBackgroundNodeImpl: ASDisplayNode, WallpaperBackgroundNode
|
||||
} else {
|
||||
strongSelf.blurredBackgroundContents = nil
|
||||
}
|
||||
strongSelf.blurredBackgroundContentView?.image = strongSelf.blurredBackgroundContents
|
||||
strongSelf._isReady.set(true)
|
||||
}))
|
||||
}
|
||||
@ -990,6 +967,12 @@ final class WallpaperBackgroundNodeImpl: ASDisplayNode, WallpaperBackgroundNode
|
||||
}
|
||||
}
|
||||
|
||||
if self.hasBubbleBackground(for: .free) {
|
||||
self.freeBackgroundNode = WallpaperBackgroundNodeImpl.BubbleBackgroundNodeImpl(backgroundNode: self, bubbleType: .free)
|
||||
} else {
|
||||
self.freeBackgroundNode = nil
|
||||
}
|
||||
|
||||
if self.hasBubbleBackground(for: .incoming) {
|
||||
self.incomingBackgroundNode = WallpaperBackgroundNodeImpl.BubbleBackgroundNodeImpl(backgroundNode: self, bubbleType: .incoming)
|
||||
} else {
|
||||
@ -1243,17 +1226,8 @@ final class WallpaperBackgroundNodeImpl: ASDisplayNode, WallpaperBackgroundNode
|
||||
let isFirstLayout = self.validLayout == nil
|
||||
self.validLayout = (size, displayMode)
|
||||
|
||||
if let blurredBackgroundPortalSourceView = self.blurredBackgroundPortalSourceView {
|
||||
transition.updateFrame(view: blurredBackgroundPortalSourceView, frame: CGRect(origin: CGPoint(), size: size))
|
||||
}
|
||||
if let blurredBackgroundContentView = self.blurredBackgroundContentView {
|
||||
transition.updateFrame(view: blurredBackgroundContentView, frame: CGRect(origin: CGPoint(), size: size))
|
||||
}
|
||||
if let blurredBackgroundDimmedNode = self.blurredBackgroundDimmedNode {
|
||||
transition.updateFrame(view: blurredBackgroundDimmedNode.view, frame: CGRect(origin: CGPoint(), size: size))
|
||||
}
|
||||
if let blurredBackgroundDimmedOverlayView = self.blurredBackgroundDimmedOverlayView {
|
||||
transition.updateFrame(view: blurredBackgroundDimmedOverlayView, frame: CGRect(origin: CGPoint(), size: size))
|
||||
if let freeBackgroundPortalSourceView = self.freeBackgroundPortalSourceView {
|
||||
transition.updateFrame(view: freeBackgroundPortalSourceView, frame: CGRect(origin: CGPoint(), size: size))
|
||||
}
|
||||
|
||||
if let incomingBackgroundPortalSourceView = self.incomingBackgroundPortalSourceView {
|
||||
@ -1277,6 +1251,11 @@ final class WallpaperBackgroundNodeImpl: ASDisplayNode, WallpaperBackgroundNode
|
||||
outgoingBubbleGradientBackgroundNode.updateLayout(size: size, transition: transition, extendAnimation: false, backwards: false, completion: {})
|
||||
}
|
||||
|
||||
if let freeBackgroundNode = self.freeBackgroundNode {
|
||||
transition.updateFrame(node: freeBackgroundNode, frame: CGRect(origin: CGPoint(), size: size))
|
||||
freeBackgroundNode.update(rect: CGRect(origin: CGPoint(), size: size), within: size, transition: transition)
|
||||
}
|
||||
|
||||
if let incomingBackgroundNode = self.incomingBackgroundNode {
|
||||
transition.updateFrame(node: incomingBackgroundNode, frame: CGRect(origin: CGPoint(), size: size))
|
||||
incomingBackgroundNode.update(rect: CGRect(origin: CGPoint(), size: size), within: size, transition: transition)
|
||||
@ -1348,8 +1327,10 @@ final class WallpaperBackgroundNodeImpl: ASDisplayNode, WallpaperBackgroundNode
|
||||
self.outgoingBubbleGradientBackgroundNode = nil
|
||||
}
|
||||
|
||||
if let wallpaper = self.wallpaper {
|
||||
self.blurredBackgroundDimmedOverlayView?.backgroundColor = selectDateFillStaticColor(theme: bubbleTheme, wallpaper: wallpaper)
|
||||
if self.hasBubbleBackground(for: .free) {
|
||||
self.freeBackgroundNode = WallpaperBackgroundNodeImpl.BubbleBackgroundNodeImpl(backgroundNode: self, bubbleType: .free)
|
||||
} else {
|
||||
self.freeBackgroundNode = nil
|
||||
}
|
||||
|
||||
if self.hasBubbleBackground(for: .incoming) {
|
||||
@ -1428,7 +1409,7 @@ final class WallpaperBackgroundNodeImpl: ASDisplayNode, WallpaperBackgroundNode
|
||||
var sourceView: PortalSourceView?
|
||||
switch type {
|
||||
case .free:
|
||||
sourceView = self.blurredBackgroundPortalSourceView
|
||||
sourceView = self.freeBackgroundPortalSourceView
|
||||
case .incoming:
|
||||
sourceView = self.incomingBackgroundPortalSourceView
|
||||
case .outgoing:
|
||||
@ -1451,14 +1432,12 @@ final class WallpaperBackgroundNodeImpl: ASDisplayNode, WallpaperBackgroundNode
|
||||
}
|
||||
|
||||
func makeFreeBackground() -> PortalView? {
|
||||
guard let blurredBackgroundPortalSourceView = self.blurredBackgroundPortalSourceView else {
|
||||
if let sourceView = self.freeBackgroundPortalSourceView, let portalView = PortalView(matchPosition: true) {
|
||||
sourceView.addPortal(view: portalView)
|
||||
return portalView
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
guard let portalView = PortalView(matchPosition: true) else {
|
||||
return nil
|
||||
}
|
||||
blurredBackgroundPortalSourceView.addPortal(view: portalView)
|
||||
return portalView
|
||||
}
|
||||
|
||||
func hasExtraBubbleBackground() -> Bool {
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"app": "9.5",
|
||||
"app": "9.5.1",
|
||||
"bazel": "5.3.1",
|
||||
"xcode": "14.2"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user