mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Various fixes
This commit is contained in:
parent
8180c08855
commit
f4aaf08e8c
@ -17,6 +17,8 @@ swift_library(
|
||||
"//submodules/AvatarNode",
|
||||
"//submodules/Components/MultilineTextComponent",
|
||||
"//submodules/AccountContext",
|
||||
"//submodules/TelegramUI/Components/EmojiTextAttachmentView",
|
||||
"//submodules/TextFormat",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
|
@ -7,6 +7,8 @@ import TelegramPresentationData
|
||||
import AccountContext
|
||||
import AvatarNode
|
||||
import MultilineTextComponent
|
||||
import EmojiTextAttachmentView
|
||||
import TextFormat
|
||||
|
||||
public final class PremiumPeerShortcutComponent: Component {
|
||||
let context: AccountContext
|
||||
@ -43,6 +45,7 @@ public final class PremiumPeerShortcutComponent: Component {
|
||||
private let backgroundView = UIView()
|
||||
private let avatarNode: AvatarNode
|
||||
private let text = ComponentView<Empty>()
|
||||
private var animationLayer: InlineStickerItemLayer?
|
||||
|
||||
private var component: PremiumPeerShortcutComponent?
|
||||
private weak var state: EmptyComponentState?
|
||||
@ -88,7 +91,7 @@ public final class PremiumPeerShortcutComponent: Component {
|
||||
containerSize: CGSize(width: availableSize.width - 50.0, height: availableSize.height)
|
||||
)
|
||||
|
||||
let size = CGSize(width: 30.0 + textSize.width + 20.0, height: 32.0)
|
||||
var size = CGSize(width: 30.0 + textSize.width + 20.0, height: 32.0)
|
||||
if let view = self.text.view {
|
||||
if view.superview == nil {
|
||||
self.addSubview(view)
|
||||
@ -97,6 +100,45 @@ public final class PremiumPeerShortcutComponent: Component {
|
||||
view.frame = textFrame
|
||||
}
|
||||
|
||||
if let icon = component.icon {
|
||||
let iconSize = CGSize(width: 20.0, height: 20.0)
|
||||
let iconSpacing: CGFloat = 2.0
|
||||
let animationLayer: InlineStickerItemLayer
|
||||
if let current = self.animationLayer {
|
||||
animationLayer = current
|
||||
} else {
|
||||
let emoji = ChatTextInputTextCustomEmojiAttribute(
|
||||
interactivelySelectedFromPackId: nil,
|
||||
fileId: icon.fileId.id,
|
||||
file: icon
|
||||
)
|
||||
animationLayer = InlineStickerItemLayer(
|
||||
context: .account(component.context),
|
||||
userLocation: .other,
|
||||
attemptSynchronousLoad: false,
|
||||
emoji: emoji,
|
||||
file: icon,
|
||||
cache: component.context.animationCache,
|
||||
renderer: component.context.animationRenderer,
|
||||
unique: true,
|
||||
placeholderColor: component.theme.list.mediaPlaceholderColor,
|
||||
pointSize: CGSize(width: 20.0, height: 20.0),
|
||||
loopCount: 1
|
||||
)
|
||||
animationLayer.isVisibleForAnimations = true
|
||||
if icon.isCustomTemplateEmoji {
|
||||
animationLayer.dynamicColor = component.theme.actionSheet.controlAccentColor
|
||||
}
|
||||
self.layer.addSublayer(animationLayer)
|
||||
self.animationLayer = animationLayer
|
||||
}
|
||||
animationLayer.frame = CGRect(origin: CGPoint(x: size.width - 7.0, y: floorToScreenPixels((size.height - iconSize.height) / 2.0)), size: iconSize)
|
||||
size.width += iconSize.width + iconSpacing
|
||||
} else if let animationLayer = self.animationLayer {
|
||||
self.animationLayer = nil
|
||||
animationLayer.removeFromSuperlayer()
|
||||
}
|
||||
|
||||
self.backgroundView.frame = CGRect(origin: .zero, size: size)
|
||||
|
||||
return size
|
||||
|
@ -772,7 +772,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
||||
if controller.isFullscreen {
|
||||
customInsets.top = layout.statusBarHeight ?? 0.0
|
||||
}
|
||||
if layout.intrinsicInsets.bottom > 44.0 {
|
||||
if layout.intrinsicInsets.bottom > 44.0 || (layout.inputHeight ?? 0.0) > 0.0 {
|
||||
customInsets.bottom = 0.0
|
||||
} else {
|
||||
customInsets.bottom = layout.intrinsicInsets.bottom
|
||||
|
@ -158,6 +158,9 @@ private final class SheetContent: CombinedComponent {
|
||||
case let .auto(textValue, entitiesValue, _):
|
||||
text = textValue
|
||||
entities = entitiesValue
|
||||
if let content = reference.content {
|
||||
media = [content]
|
||||
}
|
||||
case let .text(textValue, entitiesValue, disableUrlPreview, previewParameters, _):
|
||||
text = textValue
|
||||
entities = entitiesValue
|
||||
|
@ -172,7 +172,8 @@ private final class SheetContent: CombinedComponent {
|
||||
component: PremiumPeerShortcutComponent(
|
||||
context: component.context,
|
||||
theme: theme,
|
||||
peer: component.accountPeer
|
||||
peer: component.accountPeer,
|
||||
icon: component.file
|
||||
),
|
||||
availableSize: CGSize(width: context.availableSize.width - 32.0, height: context.availableSize.height),
|
||||
transition: .immediate
|
||||
@ -272,7 +273,8 @@ private final class WebAppSetEmojiStatusSheetComponent: CombinedComponent {
|
||||
file: context.component.file,
|
||||
dismiss: {
|
||||
animateOut.invoke(Action { _ in
|
||||
if let controller = controller() {
|
||||
if let controller = controller() as? WebAppSetEmojiStatusScreen {
|
||||
controller.complete(result: false)
|
||||
controller.dismiss(completion: nil)
|
||||
}
|
||||
})
|
||||
@ -293,12 +295,14 @@ private final class WebAppSetEmojiStatusSheetComponent: CombinedComponent {
|
||||
dismiss: { animated in
|
||||
if animated {
|
||||
animateOut.invoke(Action { _ in
|
||||
if let controller = controller() {
|
||||
if let controller = controller() as? WebAppSetEmojiStatusScreen {
|
||||
controller.complete(result: false)
|
||||
controller.dismiss(completion: nil)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if let controller = controller() {
|
||||
if let controller = controller() as? WebAppSetEmojiStatusScreen {
|
||||
controller.complete(result: false)
|
||||
controller.dismiss(completion: nil)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user