mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Various fixes
This commit is contained in:
@@ -60,7 +60,7 @@ private final class AccessoryItemIconButtonNode: HighlightTrackingButtonNode {
|
||||
self.addSubnode(self.iconImageNode)
|
||||
|
||||
switch item {
|
||||
case .input, .botInput:
|
||||
case .input, .botInput, .silentPost:
|
||||
self.iconImageNode.isHidden = true
|
||||
self.animationView = ComponentView<Empty>()
|
||||
default:
|
||||
@@ -169,104 +169,123 @@ private final class AccessoryItemIconButtonNode: HighlightTrackingButtonNode {
|
||||
self.iconImageNode.image = AccessoryItemIconButtonNode.imageAndInsets(item: item, theme: self.theme, strings: self.strings).0
|
||||
|
||||
let bottomInset: CGFloat = 0.0
|
||||
// let iconSize = CGSize(width: 32.0, height: 32.0)
|
||||
let imageFrame = CGRect(origin: CGPoint(x: floor((size.width - image.size.width) / 2.0), y: floor((size.height - image.size.height) / 2.0) - bottomInset), size: image.size)
|
||||
self.iconImageNode.frame = imageFrame
|
||||
|
||||
if let animationView = self.animationView {
|
||||
let animationFrame = imageFrame.insetBy(dx: -4.0, dy: -4.0)
|
||||
let width = AccessoryItemIconButtonNode.calculateWidth(item: item, image: image, text: "", strings: self.strings)
|
||||
|
||||
var previousInputMode: ChatTextInputAccessoryItem.InputMode?
|
||||
var inputMode: ChatTextInputAccessoryItem.InputMode?
|
||||
|
||||
switch previousItem {
|
||||
case let .input(_, itemInputMode), let .botInput(_, itemInputMode):
|
||||
previousInputMode = itemInputMode
|
||||
default:
|
||||
break
|
||||
}
|
||||
switch item {
|
||||
case let .input(_, itemInputMode), let .botInput(_, itemInputMode):
|
||||
inputMode = itemInputMode
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
let emojiColorKeys = [
|
||||
"Ellipse 33.Ellipse 33.Stroke 1",
|
||||
"Ellipse 34.Ellipse 34.Stroke 1",
|
||||
"Oval.Oval.Fill 1",
|
||||
"Oval 2.Oval.Fill 1",
|
||||
"Path 85.Path 85.Stroke 1"
|
||||
]
|
||||
let animationFrame = CGRect(origin: CGPoint(x: floor((size.width - width) / 2.0), y: floor((size.height - width) / 2.0) - bottomInset), size: CGSize(width: width, height: width))
|
||||
|
||||
var colorKeys: [String] = ["__allcolors__"]
|
||||
let animationName: String
|
||||
var animationMode: LottieAnimationComponent.AnimationItem.Mode = .still(position: .end)
|
||||
if let inputMode = inputMode {
|
||||
switch inputMode {
|
||||
case .keyboard:
|
||||
if let previousInputMode = previousInputMode {
|
||||
if case .stickers = previousInputMode {
|
||||
animationName = "anim_stickerToKey"
|
||||
animationMode = .animating(loop: false)
|
||||
} else if case .emoji = previousInputMode {
|
||||
animationName = "anim_smileToKey"
|
||||
animationMode = .animating(loop: false)
|
||||
} else if case .bot = previousInputMode {
|
||||
animationName = "anim_botToKey"
|
||||
animationMode = .animating(loop: false)
|
||||
} else {
|
||||
animationName = "anim_stickerToKey"
|
||||
}
|
||||
} else {
|
||||
animationName = "anim_stickerToKey"
|
||||
}
|
||||
case .stickers:
|
||||
if let previousInputMode = previousInputMode {
|
||||
if case .keyboard = previousInputMode {
|
||||
animationName = "anim_keyToSticker"
|
||||
animationMode = .animating(loop: false)
|
||||
} else if case .emoji = previousInputMode {
|
||||
animationName = "anim_smileToSticker"
|
||||
animationMode = .animating(loop: false)
|
||||
colorKeys = emojiColorKeys
|
||||
} else {
|
||||
animationName = "anim_keyToSticker"
|
||||
}
|
||||
} else {
|
||||
animationName = "anim_keyToSticker"
|
||||
}
|
||||
case .emoji:
|
||||
if let previousInputMode = previousInputMode {
|
||||
if case .keyboard = previousInputMode {
|
||||
animationName = "anim_keyToSmile"
|
||||
animationMode = .animating(loop: false)
|
||||
} else if case .stickers = previousInputMode {
|
||||
animationName = "anim_stickerToSmile"
|
||||
animationMode = .animating(loop: false)
|
||||
colorKeys = emojiColorKeys
|
||||
} else {
|
||||
animationName = "anim_keyToSmile"
|
||||
}
|
||||
} else {
|
||||
animationName = "anim_keyToSmile"
|
||||
}
|
||||
case .bot:
|
||||
if let previousInputMode = previousInputMode {
|
||||
if case .keyboard = previousInputMode {
|
||||
animationName = "anim_keyToBot"
|
||||
animationMode = .animating(loop: false)
|
||||
} else {
|
||||
animationName = "anim_keyToBot"
|
||||
}
|
||||
} else {
|
||||
animationName = "anim_keyToBot"
|
||||
}
|
||||
|
||||
if case let .silentPost(muted) = item {
|
||||
if case let .silentPost(previousMuted) = previousItem {
|
||||
if muted {
|
||||
animationName = "anim_channelMute"
|
||||
} else {
|
||||
animationName = "anim_channelUnmute"
|
||||
}
|
||||
if muted != previousMuted {
|
||||
animationMode = .animating(loop: false)
|
||||
}
|
||||
} else {
|
||||
animationName = "anim_channelMute"
|
||||
}
|
||||
} else {
|
||||
animationName = ""
|
||||
var previousInputMode: ChatTextInputAccessoryItem.InputMode?
|
||||
var inputMode: ChatTextInputAccessoryItem.InputMode?
|
||||
|
||||
switch previousItem {
|
||||
case let .input(_, itemInputMode), let .botInput(_, itemInputMode):
|
||||
previousInputMode = itemInputMode
|
||||
default:
|
||||
break
|
||||
}
|
||||
switch item {
|
||||
case let .input(_, itemInputMode), let .botInput(_, itemInputMode):
|
||||
inputMode = itemInputMode
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
let emojiColorKeys = [
|
||||
"Ellipse 33.Ellipse 33.Stroke 1",
|
||||
"Ellipse 34.Ellipse 34.Stroke 1",
|
||||
"Oval.Oval.Fill 1",
|
||||
"Oval 2.Oval.Fill 1",
|
||||
"Path 85.Path 85.Stroke 1"
|
||||
]
|
||||
|
||||
if let inputMode = inputMode {
|
||||
switch inputMode {
|
||||
case .keyboard:
|
||||
if let previousInputMode = previousInputMode {
|
||||
if case .stickers = previousInputMode {
|
||||
animationName = "anim_stickerToKey"
|
||||
animationMode = .animating(loop: false)
|
||||
} else if case .emoji = previousInputMode {
|
||||
animationName = "anim_smileToKey"
|
||||
animationMode = .animating(loop: false)
|
||||
} else if case .bot = previousInputMode {
|
||||
animationName = "anim_botToKey"
|
||||
animationMode = .animating(loop: false)
|
||||
} else {
|
||||
animationName = "anim_stickerToKey"
|
||||
}
|
||||
} else {
|
||||
animationName = "anim_stickerToKey"
|
||||
}
|
||||
case .stickers:
|
||||
if let previousInputMode = previousInputMode {
|
||||
if case .keyboard = previousInputMode {
|
||||
animationName = "anim_keyToSticker"
|
||||
animationMode = .animating(loop: false)
|
||||
} else if case .emoji = previousInputMode {
|
||||
animationName = "anim_smileToSticker"
|
||||
animationMode = .animating(loop: false)
|
||||
colorKeys = emojiColorKeys
|
||||
} else {
|
||||
animationName = "anim_keyToSticker"
|
||||
}
|
||||
} else {
|
||||
animationName = "anim_keyToSticker"
|
||||
}
|
||||
case .emoji:
|
||||
if let previousInputMode = previousInputMode {
|
||||
if case .keyboard = previousInputMode {
|
||||
animationName = "anim_keyToSmile"
|
||||
animationMode = .animating(loop: false)
|
||||
} else if case .stickers = previousInputMode {
|
||||
animationName = "anim_stickerToSmile"
|
||||
animationMode = .animating(loop: false)
|
||||
colorKeys = emojiColorKeys
|
||||
} else {
|
||||
animationName = "anim_keyToSmile"
|
||||
}
|
||||
} else {
|
||||
animationName = "anim_keyToSmile"
|
||||
}
|
||||
case .bot:
|
||||
if let previousInputMode = previousInputMode {
|
||||
if case .keyboard = previousInputMode {
|
||||
animationName = "anim_keyToBot"
|
||||
animationMode = .animating(loop: false)
|
||||
} else {
|
||||
animationName = "anim_keyToBot"
|
||||
}
|
||||
} else {
|
||||
animationName = "anim_keyToBot"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
animationName = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var colors: [String: UIColor] = [:]
|
||||
for colorKey in colorKeys {
|
||||
colors[colorKey] = self.theme.chat.inputPanel.inputControlColor
|
||||
|
||||
Reference in New Issue
Block a user