This commit is contained in:
Ilya Laktyushin 2023-10-25 02:36:57 +04:00
parent 3d22de75fc
commit 983e720453
18 changed files with 46 additions and 188 deletions

View File

@ -329,9 +329,6 @@ alternate_icon_folders = [
"Premium", "Premium",
"PremiumBlack", "PremiumBlack",
"PremiumTurbo", "PremiumTurbo",
"PremiumCoffee",
"PremiumDuck",
"PremiumSteam",
] ]
[ [

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

View File

@ -10105,10 +10105,6 @@ Sorry for the inconvenience.";
"ChatContextMenu.TextSelectionTip2" = "Hold on a word, then move cursor to select more| text to copy or quote."; "ChatContextMenu.TextSelectionTip2" = "Hold on a word, then move cursor to select more| text to copy or quote.";
"Appearance.AppIconCoffee" = "Coffee";
"Appearance.AppIconDuck" = "Duck";
"Appearance.AppIconSteam" = "Steam";
"Notification.GiftLink" = "You received a gift"; "Notification.GiftLink" = "You received a gift";
"MESSAGE_GIFTCODE" = "%1$@ sent you a Gift Code for %2$@ months of Telegram Premium"; "MESSAGE_GIFTCODE" = "%1$@ sent you a Gift Code for %2$@ months of Telegram Premium";

View File

@ -38,7 +38,6 @@ final class AppIconsDemoComponent: Component {
private var component: AppIconsDemoComponent? private var component: AppIconsDemoComponent?
private var containerView: UIView private var containerView: UIView
private var axisView = UIView()
private var imageViews: [UIImageView] = [] private var imageViews: [UIImageView] = []
private var isVisible = false private var isVisible = false
@ -50,7 +49,6 @@ final class AppIconsDemoComponent: Component {
super.init(frame: frame) super.init(frame: frame)
self.addSubview(self.containerView) self.addSubview(self.containerView)
self.containerView.addSubview(self.axisView)
} }
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
@ -64,11 +62,7 @@ final class AppIconsDemoComponent: Component {
self.containerView.frame = CGRect(origin: CGPoint(x: -availableSize.width / 2.0, y: 0.0), size: CGSize(width: availableSize.width * 2.0, height: availableSize.height)) self.containerView.frame = CGRect(origin: CGPoint(x: -availableSize.width / 2.0, y: 0.0), size: CGSize(width: availableSize.width * 2.0, height: availableSize.height))
self.axisView.bounds = CGRect(origin: .zero, size: availableSize)
self.axisView.center = CGPoint(x: availableSize.width, y: availableSize.height / 2.0)
if self.imageViews.isEmpty { if self.imageViews.isEmpty {
var i = 0
for icon in component.appIcons { for icon in component.appIcons {
let image: UIImage? let image: UIImage?
switch icon.imageName { switch icon.imageName {
@ -78,12 +72,6 @@ final class AppIconsDemoComponent: Component {
image = UIImage(bundleImageName: "Premium/Icons/Black") image = UIImage(bundleImageName: "Premium/Icons/Black")
case "PremiumTurbo": case "PremiumTurbo":
image = UIImage(bundleImageName: "Premium/Icons/Turbo") image = UIImage(bundleImageName: "Premium/Icons/Turbo")
case "PremiumDuck":
image = UIImage(bundleImageName: "Premium/Icons/Duck")
case "PremiumCoffee":
image = UIImage(bundleImageName: "Premium/Icons/Coffee")
case "PremiumSteam":
image = UIImage(bundleImageName: "Premium/Icons/Steam")
default: default:
image = nil image = nil
} }
@ -95,37 +83,31 @@ final class AppIconsDemoComponent: Component {
imageView.layer.cornerCurve = .continuous imageView.layer.cornerCurve = .continuous
} }
imageView.image = image imageView.image = image
if i == 0 { self.containerView.addSubview(imageView)
self.containerView.addSubview(imageView)
} else {
self.axisView.addSubview(imageView)
}
self.imageViews.append(imageView) self.imageViews.append(imageView)
i += 1
} }
} }
} }
let radius: CGFloat = availableSize.width * 0.33
let angleIncrement: CGFloat = 2 * .pi / CGFloat(self.imageViews.count - 1)
var i = 0 var i = 0
for view in self.imageViews { for view in self.imageViews {
let position: CGPoint let position: CGPoint
if i == 0 { switch i {
position = CGPoint(x: availableSize.width, y: availableSize.height / 2.0) case 0:
} else { position = CGPoint(x: availableSize.width * 0.5, y: availableSize.height * 0.333)
let angle = CGFloat(i - 1) * angleIncrement case 1:
let xPosition = radius * cos(angle) + availableSize.width / 2.0 position = CGPoint(x: availableSize.width * 0.333, y: availableSize.height * 0.667)
let yPosition = radius * sin(angle) + availableSize.height / 2.0 case 2:
position = CGPoint(x: availableSize.width * 0.667, y: availableSize.height * 0.667)
position = CGPoint(x: xPosition, y: yPosition) default:
position = CGPoint(x: availableSize.width * 0.5, y: availableSize.height * 0.5)
}
if !self.animating {
view.center = position.offsetBy(dx: availableSize.width / 2.0, dy: 0.0)
} }
view.center = position
i += 1 i += 1
} }
@ -143,48 +125,6 @@ final class AppIconsDemoComponent: Component {
} }
self.isVisible = isDisplaying self.isVisible = isDisplaying
let rotationDuration: Double = 12.0
if isDisplaying {
if self.axisView.layer.animation(forKey: "rotationAnimation") == nil {
let rotationAnimation = CABasicAnimation(keyPath: "transform.rotation")
rotationAnimation.fromValue = 0.0
rotationAnimation.toValue = 2.0 * CGFloat.pi
rotationAnimation.duration = rotationDuration
rotationAnimation.repeatCount = Float.infinity
self.axisView.layer.add(rotationAnimation, forKey: "rotationAnimation")
var i = 0
for view in self.imageViews {
if i == 0 {
let animation = CABasicAnimation(keyPath: "transform.scale")
animation.duration = 2.0
animation.fromValue = 1.0
animation.toValue = 1.15
animation.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut)
animation.autoreverses = true
animation.repeatCount = .infinity
view.layer.add(animation, forKey: "scale")
} else {
view.transform = CGAffineTransformMakeScale(0.8, 0.8)
let rotationAnimation = CABasicAnimation(keyPath: "transform.rotation")
rotationAnimation.fromValue = 0.0
rotationAnimation.toValue = -2.0 * CGFloat.pi
rotationAnimation.duration = rotationDuration
rotationAnimation.repeatCount = Float.infinity
view.layer.add(rotationAnimation, forKey: "rotationAnimation")
}
i += 1
}
}
} else {
self.axisView.layer.removeAllAnimations()
for view in self.imageViews {
view.layer.removeAllAnimations()
}
}
return availableSize return availableSize
} }
@ -192,37 +132,38 @@ final class AppIconsDemoComponent: Component {
func animateIn(availableSize: CGSize) { func animateIn(availableSize: CGSize) {
self.animating = true self.animating = true
let radius: CGFloat = availableSize.width * 2.5
let angleIncrement: CGFloat = 2 * .pi / CGFloat(self.imageViews.count - 1)
var i = 0 var i = 0
for view in self.imageViews { for view in self.imageViews {
if i > 0 { let from: CGPoint
let delay: Double = 0.033 * Double(i - 1) let delay: Double
switch i {
let angle = CGFloat(i - 1) * angleIncrement case 0:
let xPosition = radius * cos(angle) from = CGPoint(x: -availableSize.width * 0.333, y: -availableSize.height * 0.8)
let yPosition = radius * sin(angle) delay = 0.1
case 1:
let from = CGPoint(x: xPosition, y: yPosition) from = CGPoint(x: -availableSize.width * 0.55, y: availableSize.height * 0.75)
let initialPosition = view.layer.position delay = 0.15
view.layer.position = initialPosition.offsetBy(dx: xPosition, dy: yPosition) case 2:
view.alpha = 0.0 from = CGPoint(x: availableSize.width * 0.9, y: availableSize.height * 0.75)
delay = 0.0
Queue.mainQueue().after(delay) { default:
view.alpha = 1.0 from = CGPoint(x: availableSize.width * 0.5, y: availableSize.height * 0.5)
view.layer.position = initialPosition delay = 0.0
view.layer.animateScale(from: 3.0, to: 0.8, duration: 0.4, timingFunction: kCAMediaTimingFunctionSpring)
view.layer.animatePosition(from: from, to: CGPoint(), duration: 0.4, timingFunction: kCAMediaTimingFunctionSpring, additive: true)
view.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.15)
if i == self.imageViews.count - 1 {
self.animating = false
}
}
} else {
} }
let initialPosition = view.layer.position
view.layer.position = initialPosition.offsetBy(dx: from.x, dy: from.y)
Queue.mainQueue().after(delay) {
view.layer.position = initialPosition
view.layer.animateScale(from: 3.0, to: 1.0, duration: 0.5, delay: 0.0, timingFunction: kCAMediaTimingFunctionSpring)
view.layer.animatePosition(from: from, to: CGPoint(), duration: 0.5, delay: 0.0, timingFunction: kCAMediaTimingFunctionSpring, additive: true)
if i == 2 {
self.animating = false
}
}
i += 1 i += 1
} }
} }

View File

@ -1522,10 +1522,7 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
guard let self else { guard let self else {
return return
} }
var newPerks: [String] = [] let newPerks: [String] = []
if !dismissedPremiumAppIconsBadge {
newPerks.append(PremiumPerk.appIcons.identifier)
}
self.newPerks = newPerks self.newPerks = newPerks
self.updated() self.updated()
}) })
@ -1856,7 +1853,7 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
demoSubject = .animatedUserpics demoSubject = .animatedUserpics
case .appIcons: case .appIcons:
demoSubject = .appIcons demoSubject = .appIcons
let _ = ApplicationSpecificNotice.setDismissedPremiumAppIconsBadge(accountManager: accountContext.sharedContext.accountManager).startStandalone() // let _ = ApplicationSpecificNotice.setDismissedPremiumAppIconsBadge(accountManager: accountContext.sharedContext.accountManager).startStandalone()
case .animatedEmoji: case .animatedEmoji:
demoSubject = .animatedEmoji demoSubject = .animatedEmoji
case .emojiStatus: case .emojiStatus:

View File

@ -365,12 +365,6 @@ class ThemeSettingsAppIconItemNode: ListViewItemNode, ItemListItemNode {
name = item.strings.Appearance_AppIconBlack name = item.strings.Appearance_AppIconBlack
case "PremiumTurbo": case "PremiumTurbo":
name = item.strings.Appearance_AppIconTurbo name = item.strings.Appearance_AppIconTurbo
case "PremiumDuck":
name = item.strings.Appearance_AppIconDuck
case "PremiumCoffee":
name = item.strings.Appearance_AppIconCoffee
case "PremiumSteam":
name = item.strings.Appearance_AppIconSteam
default: default:
name = icon.name name = icon.name
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

View File

@ -1,21 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Coffee.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -1,21 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Duck.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

View File

@ -1,21 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Steam.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

View File

@ -802,11 +802,7 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
icons.append(PresentationAppIcon(name: "Premium", imageName: "Premium", isPremium: true)) icons.append(PresentationAppIcon(name: "Premium", imageName: "Premium", isPremium: true))
icons.append(PresentationAppIcon(name: "PremiumBlack", imageName: "PremiumBlack", isPremium: true)) icons.append(PresentationAppIcon(name: "PremiumBlack", imageName: "PremiumBlack", isPremium: true))
icons.append(PresentationAppIcon(name: "PremiumTurbo", imageName: "PremiumTurbo", isPremium: true)) icons.append(PresentationAppIcon(name: "PremiumTurbo", imageName: "PremiumTurbo", isPremium: true))
icons.append(PresentationAppIcon(name: "PremiumDuck", imageName: "PremiumDuck", isPremium: true))
icons.append(PresentationAppIcon(name: "PremiumCoffee", imageName: "PremiumCoffee", isPremium: true))
icons.append(PresentationAppIcon(name: "PremiumSteam", imageName: "PremiumSteam", isPremium: true))
return icons return icons
} else { } else {
return [] return []