From 985a8f91357df7f9279d2d0ee5390ce57d8e3771 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Wed, 1 Jun 2022 11:43:30 +0400 Subject: [PATCH] Fix localization --- .../Telegram-iOS/en.lproj/Localizable.strings | 4 +- .../Sources/AppIconsDemoComponent.swift | 91 +++++++++++-------- .../Sources/PremiumIntroScreen.swift | 28 +++--- .../Sources/ReactionsCarouselComponent.swift | 1 - 4 files changed, 69 insertions(+), 55 deletions(-) diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 5ca5dd5f60..42fa86cc74 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -7621,8 +7621,8 @@ Sorry for the inconvenience."; "Premium.Avatar" = "Animated Profile Pictures"; "Premium.AvatarInfo" = "Video avatars animated in chat lists and chats to allow for additional self-expression."; -"Premium.AppIcon" = "App Icons"; -"Premium.AppIconInfo" = "Additional app icons description goes here."; +"Premium.AppIcon" = "Telegram App Icon"; +"Premium.AppIconInfo" = "Choose from a selection of Telegram app icons for your homescreen."; "Premium.AppIconStandalone" = "Additional App Icons"; "Premium.AppIconStandaloneInfo" = "Unlock a wider range of app icons by subscribing to **Telegram Premium**."; diff --git a/submodules/PremiumUI/Sources/AppIconsDemoComponent.swift b/submodules/PremiumUI/Sources/AppIconsDemoComponent.swift index c7daf63b15..d44c528306 100644 --- a/submodules/PremiumUI/Sources/AppIconsDemoComponent.swift +++ b/submodules/PremiumUI/Sources/AppIconsDemoComponent.swift @@ -37,23 +37,31 @@ final class AppIconsDemoComponent: Component { public final class View: UIView { private var component: AppIconsDemoComponent? + private var containerView: UIView private var imageViews: [UIImageView] = [] + + private var isVisible = false + public override init(frame: CGRect) { + self.containerView = UIView() + self.containerView.clipsToBounds = true + + super.init(frame: frame) + + self.addSubview(self.containerView) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + public func update(component: AppIconsDemoComponent, availableSize: CGSize, environment: Environment, transition: Transition) -> CGSize { -// let isDisplaying = environment[DemoPageEnvironment.self].isDisplaying + let isDisplaying = environment[DemoPageEnvironment.self].isDisplaying -// if self.node == nil { -// let node = StickersCarouselNode( -// context: component.context, -// stickers: component.stickers -// ) -// self.node = node -// self.addSubnode(node) -// } - -// let isFirstTime = self.component == nil self.component = component + self.containerView.frame = CGRect(origin: .zero, size: availableSize) + if self.imageViews.isEmpty { for icon in component.appIcons { if let image = UIImage(named: icon.imageName, in: getAppBundle(), compatibleWith: nil) { @@ -61,7 +69,7 @@ final class AppIconsDemoComponent: Component { imageView.clipsToBounds = true imageView.layer.cornerRadius = 24.0 imageView.image = image - self.addSubview(imageView) + self.containerView.addSubview(imageView) self.imageViews.append(imageView) } @@ -92,37 +100,46 @@ final class AppIconsDemoComponent: Component { if let _ = transition.userData(DemoAnimateInTransition.self), abs(mappedPosition) < .ulpOfOne { Queue.mainQueue().after(0.1) { - var i = 0 - for view in self.imageViews { - let from: CGPoint - let delay: Double - switch i { - case 0: - from = CGPoint(x: -availableSize.width * 0.333, y: -availableSize.height * 0.8) - delay = 0.1 - case 1: - from = CGPoint(x: -availableSize.width * 0.75, y: availableSize.height * 0.75) - delay = 0.15 - case 2: - from = CGPoint(x: availableSize.width * 0.9, y: availableSize.height * 0.0) - delay = 0.0 - default: - from = CGPoint(x: availableSize.width * 0.5, y: availableSize.height * 0.5) - delay = 0.0 - } - view.layer.animateScale(from: 3.0, to: 1.0, duration: 0.5, delay: delay, timingFunction: kCAMediaTimingFunctionSpring) - view.layer.animatePosition(from: from, to: CGPoint(), duration: 0.5, delay: delay, timingFunction: kCAMediaTimingFunctionSpring, additive: true) - - i += 1 - } + self.animateIn(availableSize: availableSize) } } + if isDisplaying && !self.isVisible { +// var fast = false +// if let _ = transition.userData(DemoAnimateInTransition.self) { +// fast = true +// } + self.animateIn(availableSize: availableSize) + } + self.isVisible = isDisplaying + return availableSize } - func animateIn() { - + func animateIn(availableSize: CGSize) { + var i = 0 + for view in self.imageViews { + let from: CGPoint + let delay: Double + switch i { + case 0: + from = CGPoint(x: -availableSize.width * 0.333, y: -availableSize.height * 0.8) + delay = 0.1 + case 1: + from = CGPoint(x: -availableSize.width * 0.75, y: availableSize.height * 0.75) + delay = 0.15 + case 2: + from = CGPoint(x: availableSize.width * 0.9, y: availableSize.height * 0.0) + delay = 0.0 + default: + from = CGPoint(x: availableSize.width * 0.5, y: availableSize.height * 0.5) + delay = 0.0 + } + view.layer.animateScale(from: 3.0, to: 1.0, duration: 0.5, delay: delay, timingFunction: kCAMediaTimingFunctionSpring) + view.layer.animatePosition(from: from, to: CGPoint(), duration: 0.5, delay: delay, timingFunction: kCAMediaTimingFunctionSpring, additive: true) + + i += 1 + } } } diff --git a/submodules/PremiumUI/Sources/PremiumIntroScreen.swift b/submodules/PremiumUI/Sources/PremiumIntroScreen.swift index 215055f186..f4cdd18c5e 100644 --- a/submodules/PremiumUI/Sources/PremiumIntroScreen.swift +++ b/submodules/PremiumUI/Sources/PremiumIntroScreen.swift @@ -942,19 +942,18 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent { size.height += text.size.height size.height += 21.0 - let gradientColors: [(UIColor, UIColor)] = [ - (UIColor(rgb: 0xF28528), UIColor(rgb: 0xEF7633)), - (UIColor(rgb: 0xEA5F43), UIColor(rgb: 0xE7504E)), - (UIColor(rgb: 0xDE4768), UIColor(rgb: 0xD54D82)), - (UIColor(rgb: 0xDE4768), UIColor(rgb: 0xD54D82)), - (UIColor(rgb: 0xC654A8), UIColor(rgb: 0xBE5AC2)), - (UIColor(rgb: 0xAF62E9), UIColor(rgb: 0xA668FF)), - (UIColor(rgb: 0x9674FF), UIColor(rgb: 0x8C7DFF)), - (UIColor(rgb: 0x9674FF), UIColor(rgb: 0x8C7DFF)), - (UIColor(rgb: 0x7B88FF), UIColor(rgb: 0x7091FF)), - (UIColor(rgb: 0x609DFF), UIColor(rgb: 0x56A5FF)), - - (UIColor(rgb: 0x609DFF), UIColor(rgb: 0x56A5FF)) + let gradientColors: [UIColor] = [ + UIColor(rgb: 0xF27C30), + UIColor(rgb: 0xE36850), + UIColor(rgb: 0xD15078), + UIColor(rgb: 0xC14998), + UIColor(rgb: 0xB24CB5), + UIColor(rgb: 0xA34ED0), + UIColor(rgb: 0x9054E9), + UIColor(rgb: 0x7561EB), + UIColor(rgb: 0x5A6EEE), + UIColor(rgb: 0x548DFF), + UIColor(rgb: 0x54A3FF) ] var items: [SectionGroupComponent.Item] = [] @@ -976,8 +975,7 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent { PerkComponent( iconName: perk.iconName, iconBackgroundColors: [ - iconBackgroundColors.0, - iconBackgroundColors.1 + iconBackgroundColors ], title: perk.title(strings: strings), titleColor: titleColor, diff --git a/submodules/PremiumUI/Sources/ReactionsCarouselComponent.swift b/submodules/PremiumUI/Sources/ReactionsCarouselComponent.swift index 90fa39fbe8..937875a754 100644 --- a/submodules/PremiumUI/Sources/ReactionsCarouselComponent.swift +++ b/submodules/PremiumUI/Sources/ReactionsCarouselComponent.swift @@ -92,7 +92,6 @@ final class ReactionsCarouselComponent: Component { private let itemSize = CGSize(width: 110.0, height: 110.0) -//private let order = ["👌","😍","🤡","🕊","🥱","🥴"] private let order = ["😍","👌","🥴","🐳","🥱","🕊","🤡"] private class ReactionCarouselNode: ASDisplayNode, UIScrollViewDelegate {