Web app improvements

This commit is contained in:
Ilya Laktyushin
2022-04-03 20:14:17 +04:00
parent cfbacc23a6
commit b939eade68
3 changed files with 7 additions and 17 deletions

View File

@@ -217,6 +217,7 @@ private final class AttachButtonComponent: CombinedComponent {
account: component.context.account,
animation: AnimatedStickerComponent.Animation(
source: .file(media: animationFile),
scale: UIScreenScale,
loop: false,
tintColor: tintColor
),

View File

@@ -14,11 +14,13 @@ public final class AnimatedStickerComponent: Component {
}
public var source: Source
public var scale: CGFloat
public var loop: Bool
public var tintColor: UIColor?
public init(source: Source, loop: Bool, tintColor: UIColor? = nil) {
public init(source: Source, scale: CGFloat = 2.0, loop: Bool, tintColor: UIColor? = nil) {
self.source = source
self.scale = scale
self.loop = loop
self.tintColor = tintColor
}
@@ -106,7 +108,7 @@ public final class AnimatedStickerComponent: Component {
} else if component.isAnimating {
playbackMode = .once
}
animationNode.setup(source: source, width: Int(component.size.width * 2.0), height: Int(component.size.height * 2.0), playbackMode: playbackMode, mode: .direct(cachePathPrefix: nil))
animationNode.setup(source: source, width: Int(component.size.width * component.animation.scale), height: Int(component.size.height * component.animation.scale), playbackMode: playbackMode, mode: .direct(cachePathPrefix: nil))
animationNode.visibility = self.isInHierarchy
self.animationNode = animationNode

View File

@@ -386,17 +386,10 @@ public final class WebAppController: ViewController, AttachmentContainable {
self.updatedPresentationData = updatedPresentationData
self.presentationData = updatedPresentationData?.initial ?? context.sharedContext.currentPresentationData.with { $0 }
var theme = NavigationBarTheme(rootControllerTheme: self.presentationData.theme)
if self.presentationData.theme.list.plainBackgroundColor.rgb == 0x000000 {
theme = theme.withUpdatedBackgroundColor(self.presentationData.theme.list.itemBlocksBackgroundColor)
} else {
theme = theme.withUpdatedBackgroundColor(self.presentationData.theme.list.plainBackgroundColor)
}
let navigationBarPresentationData = NavigationBarPresentationData(theme: theme, strings: NavigationBarStrings(back: "", close: ""))
self.moreButtonNode = MoreButtonNode(theme: self.presentationData.theme)
self.moreButtonNode.iconNode.enqueueState(.more, animated: false)
let navigationBarPresentationData = NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: self.presentationData.theme), strings: NavigationBarStrings(back: "", close: ""))
super.init(navigationBarPresentationData: navigationBarPresentationData)
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
@@ -422,13 +415,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
if let strongSelf = self {
strongSelf.presentationData = presentationData
var theme = NavigationBarTheme(rootControllerTheme: presentationData.theme)
if presentationData.theme.list.plainBackgroundColor.rgb == 0x000000 {
theme = theme.withUpdatedBackgroundColor(presentationData.theme.list.itemBlocksBackgroundColor)
} else {
theme = theme.withUpdatedBackgroundColor(presentationData.theme.list.plainBackgroundColor)
}
let navigationBarPresentationData = NavigationBarPresentationData(theme: theme, strings: NavigationBarStrings(back: "", close: ""))
let navigationBarPresentationData = NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: presentationData.theme), strings: NavigationBarStrings(back: "", close: ""))
strongSelf.navigationBar?.updatePresentationData(navigationBarPresentationData)
strongSelf.titleView?.theme = presentationData.theme