mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-07 23:03:35 +00:00
UI fixes
This commit is contained in:
parent
781a633521
commit
a7a090cfcd
@ -42,6 +42,8 @@ final class ChatListBadgeNode: ASDisplayNode {
|
||||
private var text: String?
|
||||
private var content: ChatListBadgeContent?
|
||||
|
||||
private var isHiddenInternal = false
|
||||
|
||||
override init() {
|
||||
self.backgroundNode = ASImageNode()
|
||||
self.backgroundNode.isLayerBacked = true
|
||||
@ -114,6 +116,7 @@ final class ChatListBadgeNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
if currentIsEmpty && !nextIsEmpty {
|
||||
strongSelf.isHiddenInternal = false
|
||||
strongSelf.layer.animateScale(from: 0.0001, to: 1.2, duration: 0.2, removeOnCompletion: false, completion: { [weak self] finished in
|
||||
if let strongSelf = self {
|
||||
strongSelf.layer.animateScale(from: 1.15, to: 1.0, duration: 0.12, removeOnCompletion: false)
|
||||
@ -121,6 +124,7 @@ final class ChatListBadgeNode: ASDisplayNode {
|
||||
})
|
||||
} else if !currentIsEmpty && !nextIsEmpty && currentContent?.text != content.text {
|
||||
var animateScale = true
|
||||
strongSelf.isHiddenInternal = false
|
||||
if let currentText = currentContent?.text, let currentValue = Int(currentText), let text = content.text, let value = Int(text) {
|
||||
if value < currentValue {
|
||||
animateScale = false
|
||||
@ -148,7 +152,8 @@ final class ChatListBadgeNode: ASDisplayNode {
|
||||
snapshotView.layer.animatePosition(from: CGPoint(), to: CGPoint(x: (badgeWidth - previousBadgeWidth) / 2.0, y: -8.0), duration: 0.15, timingFunction: kCAMediaTimingFunctionEaseInEaseOut, removeOnCompletion: false, additive: true)
|
||||
}
|
||||
animateTextNode = true
|
||||
} else if !currentIsEmpty && nextIsEmpty {
|
||||
} else if !currentIsEmpty && nextIsEmpty && !strongSelf.isHiddenInternal {
|
||||
strongSelf.isHiddenInternal = true
|
||||
strongSelf.layer.animateScale(from: 1.0, to: 0.0001, duration: 0.12, removeOnCompletion: true, completion: { [weak self] finished in
|
||||
if let strongSelf = self {
|
||||
strongSelf.isHidden = true
|
||||
@ -158,8 +163,10 @@ final class ChatListBadgeNode: ASDisplayNode {
|
||||
} else {
|
||||
if case .none = content {
|
||||
strongSelf.isHidden = true
|
||||
strongSelf.isHiddenInternal = true
|
||||
} else {
|
||||
strongSelf.isHidden = false
|
||||
strongSelf.isHiddenInternal = false
|
||||
}
|
||||
if case .text = content {
|
||||
strongSelf.textNode.alpha = 1.0
|
||||
|
||||
@ -293,7 +293,7 @@ enum ChatListNodeScrollPosition {
|
||||
case top
|
||||
}
|
||||
|
||||
enum ChatListNodeEmtpyState: Equatable {
|
||||
enum ChatListNodeEmptyState: Equatable {
|
||||
case notEmpty(containsChats: Bool)
|
||||
case empty(isLoading: Bool)
|
||||
}
|
||||
@ -365,8 +365,8 @@ final class ChatListNode: ListView {
|
||||
}
|
||||
}
|
||||
|
||||
var isEmptyUpdated: ((ChatListNodeEmtpyState) -> Void)?
|
||||
private var currentIsEmptyState: ChatListNodeEmtpyState?
|
||||
var isEmptyUpdated: ((ChatListNodeEmptyState) -> Void)?
|
||||
private var currentIsEmptyState: ChatListNodeEmptyState?
|
||||
|
||||
var addedVisibleChatsWithPeerIds: (([PeerId]) -> Void)?
|
||||
|
||||
@ -1141,7 +1141,7 @@ final class ChatListNode: ListView {
|
||||
strongSelf._ready.set(true)
|
||||
}
|
||||
|
||||
let isEmptyState: ChatListNodeEmtpyState
|
||||
let isEmptyState: ChatListNodeEmptyState
|
||||
if transition.chatListView.isLoading {
|
||||
isEmptyState = .empty(isLoading: true)
|
||||
} else if transition.chatListView.filteredEntries.isEmpty {
|
||||
|
||||
@ -785,6 +785,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
var game: TelegramMediaGame?
|
||||
var webpage: TelegramMediaWebpage?
|
||||
var invoice: TelegramMediaInvoice?
|
||||
for media in message.media {
|
||||
@ -792,6 +793,8 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode {
|
||||
webpage = media
|
||||
} else if let media = media as? TelegramMediaInvoice {
|
||||
invoice = media
|
||||
} else if let media = media as? TelegramMediaGame {
|
||||
game = media
|
||||
}
|
||||
}
|
||||
|
||||
@ -904,6 +907,8 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode {
|
||||
fetchStatus = actualFetchStatus
|
||||
}
|
||||
|
||||
let gifTitle = game != nil ? strings.Message_Game.uppercased() : strings.Message_Animation.uppercased()
|
||||
|
||||
switch fetchStatus {
|
||||
case let .Fetching(_, progress):
|
||||
let adjustedProgress = max(progress, 0.027)
|
||||
@ -922,10 +927,10 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode {
|
||||
if let size = file.size {
|
||||
let sizeString = "\(dataSizeString(Int(Float(size) * progress), forceDecimal: true, decimalSeparator: decimalSeparator)) / \(dataSizeString(size, forceDecimal: true, decimalSeparator: decimalSeparator))"
|
||||
if file.isAnimated && (!automaticDownload || !automaticPlayback) {
|
||||
badgeContent = .mediaDownload(backgroundColor: bubbleTheme.mediaDateAndStatusFillColor, foregroundColor: bubbleTheme.mediaDateAndStatusTextColor, duration: "GIF " + sizeString, size: nil, muted: false, active: false)
|
||||
badgeContent = .mediaDownload(backgroundColor: bubbleTheme.mediaDateAndStatusFillColor, foregroundColor: bubbleTheme.mediaDateAndStatusTextColor, duration: "\(gifTitle) " + sizeString, size: nil, muted: false, active: false)
|
||||
}
|
||||
else if let duration = file.duration, !message.flags.contains(.Unsent) {
|
||||
let durationString = file.isAnimated ? "GIF" : stringForDuration(playerDuration > 0 ? playerDuration : duration, position: playerPosition)
|
||||
let durationString = file.isAnimated ? gifTitle : stringForDuration(playerDuration > 0 ? playerDuration : duration, position: playerPosition)
|
||||
if isMediaStreamable(message: message, media: file) {
|
||||
badgeContent = .mediaDownload(backgroundColor: bubbleTheme.mediaDateAndStatusFillColor, foregroundColor: bubbleTheme.mediaDateAndStatusTextColor, duration: durationString, size: active ? sizeString : nil, muted: muted, active: active)
|
||||
mediaDownloadState = .fetching(progress: automaticPlayback ? nil : adjustedProgress)
|
||||
@ -1019,17 +1024,17 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
if let file = media as? TelegramMediaFile, let duration = file.duration {
|
||||
let durationString = file.isAnimated ? "GIF" : stringForDuration(playerDuration > 0 ? playerDuration : duration, position: playerPosition)
|
||||
let durationString = file.isAnimated ? gifTitle : stringForDuration(playerDuration > 0 ? playerDuration : duration, position: playerPosition)
|
||||
badgeContent = .mediaDownload(backgroundColor: bubbleTheme.mediaDateAndStatusFillColor, foregroundColor: bubbleTheme.mediaDateAndStatusTextColor, duration: durationString, size: nil, muted: muted, active: false)
|
||||
}
|
||||
case .Remote:
|
||||
state = .download(bubbleTheme.mediaOverlayControlForegroundColor)
|
||||
if let file = self.media as? TelegramMediaFile {
|
||||
if file.isAnimated && (!automaticDownload || !automaticPlayback) {
|
||||
let string = "GIF " + dataSizeString(file.size ?? 0, decimalSeparator: decimalSeparator)
|
||||
let string = "\(gifTitle) " + dataSizeString(file.size ?? 0, decimalSeparator: decimalSeparator)
|
||||
badgeContent = .mediaDownload(backgroundColor: bubbleTheme.mediaDateAndStatusFillColor, foregroundColor: bubbleTheme.mediaDateAndStatusTextColor, duration: string, size: nil, muted: false, active: false)
|
||||
} else {
|
||||
let durationString = file.isAnimated ? "GIF" : stringForDuration(playerDuration > 0 ? playerDuration : (file.duration ?? 0), position: playerPosition)
|
||||
let durationString = file.isAnimated ? gifTitle : stringForDuration(playerDuration > 0 ? playerDuration : (file.duration ?? 0), position: playerPosition)
|
||||
if wideLayout {
|
||||
if isMediaStreamable(message: message, media: file) {
|
||||
state = automaticPlayback ? .none : .play(bubbleTheme.mediaOverlayControlForegroundColor)
|
||||
|
||||
@ -232,7 +232,7 @@ final class SelectablePeerNode: ASDisplayNode {
|
||||
|
||||
let avatarFrame = self.avatarNode.frame
|
||||
|
||||
self.onlineNode.frame = CGRect(origin: CGPoint(x: avatarFrame.width - self.onlineNode.frame.width + 2.0, y: avatarFrame.height - self.onlineNode.frame.height + 2.0), size: self.onlineNode.frame.size)
|
||||
self.onlineNode.frame = CGRect(origin: CGPoint(x: avatarFrame.maxX - self.onlineNode.frame.width + 9.0, y: avatarFrame.maxY - self.onlineNode.frame.height + 2.0), size: self.onlineNode.frame.size)
|
||||
|
||||
if let checkView = self.checkView {
|
||||
let checkSize = checkView.bounds.size
|
||||
|
||||
@ -126,7 +126,6 @@ final class ShareControllerPeerGridItem: GridItem {
|
||||
final class ShareControllerPeerGridItemNode: GridItemNode {
|
||||
private var currentState: (Account, RenderedPeer, Bool)?
|
||||
private let peerNode: SelectablePeerNode
|
||||
|
||||
|
||||
var controllerInteraction: ShareControllerInteraction?
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user