mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 21:45:19 +00:00
Update premium coin component
This commit is contained in:
parent
0512739b8c
commit
0794812bae
BIN
submodules/PremiumUI/Resources/coin
Normal file
BIN
submodules/PremiumUI/Resources/coin
Normal file
Binary file not shown.
Binary file not shown.
@ -56,7 +56,7 @@ private final class HeaderComponent: Component {
|
||||
|
||||
let coinSize = self.coin.update(
|
||||
transition: .immediate,
|
||||
component: AnyComponent(PremiumCoinComponent(isIntro: true, isVisible: true, hasIdleAnimations: true)),
|
||||
component: AnyComponent(PremiumCoinComponent(mode: .business, isIntro: true, isVisible: true, hasIdleAnimations: true)),
|
||||
environment: {},
|
||||
containerSize: containerSize
|
||||
)
|
||||
|
@ -9,7 +9,7 @@ import AppBundle
|
||||
import LegacyComponents
|
||||
import PremiumStarComponent
|
||||
|
||||
private let sceneVersion: Int = 3
|
||||
private let sceneVersion: Int = 4
|
||||
|
||||
private func deg2rad(_ number: Float) -> Float {
|
||||
return number * .pi / 180
|
||||
@ -19,19 +19,31 @@ private func rad2deg(_ number: Float) -> Float {
|
||||
return number * 180.0 / .pi
|
||||
}
|
||||
|
||||
class PremiumCoinComponent: Component {
|
||||
final class PremiumCoinComponent: Component {
|
||||
enum Mode {
|
||||
case business
|
||||
case affiliate
|
||||
}
|
||||
|
||||
let mode: Mode
|
||||
let isIntro: Bool
|
||||
let isVisible: Bool
|
||||
let hasIdleAnimations: Bool
|
||||
|
||||
init(isIntro: Bool, isVisible: Bool, hasIdleAnimations: Bool) {
|
||||
init(
|
||||
mode: Mode,
|
||||
isIntro: Bool,
|
||||
isVisible: Bool,
|
||||
hasIdleAnimations: Bool
|
||||
) {
|
||||
self.mode = mode
|
||||
self.isIntro = isIntro
|
||||
self.isVisible = isVisible
|
||||
self.hasIdleAnimations = hasIdleAnimations
|
||||
}
|
||||
|
||||
static func ==(lhs: PremiumCoinComponent, rhs: PremiumCoinComponent) -> Bool {
|
||||
return lhs.isIntro == rhs.isIntro && lhs.isVisible == rhs.isVisible && lhs.hasIdleAnimations == rhs.hasIdleAnimations
|
||||
return lhs.mode == rhs.mode && lhs.isIntro == rhs.isIntro && lhs.isVisible == rhs.isVisible && lhs.hasIdleAnimations == rhs.hasIdleAnimations
|
||||
}
|
||||
|
||||
final class View: UIView, SCNSceneRendererDelegate, ComponentTaggedView {
|
||||
@ -350,7 +362,7 @@ class PremiumCoinComponent: Component {
|
||||
}
|
||||
|
||||
if let material = node.geometry?.materials.first {
|
||||
if node.name == "Logos" {
|
||||
if ["Business", "Affiliate", "Plane"].contains(node.name) {
|
||||
material.metalness.intensity = 0.1
|
||||
} else {
|
||||
material.metalness.intensity = 0.3
|
||||
@ -501,6 +513,22 @@ class PremiumCoinComponent: Component {
|
||||
self.sceneView.center = CGPoint(x: availableSize.width / 2.0, y: availableSize.height / 2.0)
|
||||
}
|
||||
|
||||
let visibleLogo: String
|
||||
switch component.mode {
|
||||
case .business:
|
||||
visibleLogo = "Business"
|
||||
case .affiliate:
|
||||
visibleLogo = "Affiliate"
|
||||
}
|
||||
|
||||
if let scene = self.sceneView.scene, let node = scene.rootNode.childNode(withName: "star", recursively: false) {
|
||||
for node in node.childNodes {
|
||||
if ["Business", "Affiliate"].contains(node.name) {
|
||||
node.isHidden = node.name != visibleLogo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.hasIdleAnimations = component.hasIdleAnimations
|
||||
|
||||
return availableSize
|
||||
|
@ -3218,6 +3218,7 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
|
||||
if case .business = context.component.mode {
|
||||
header = coin.update(
|
||||
component: PremiumCoinComponent(
|
||||
mode: .business,
|
||||
isIntro: isIntro,
|
||||
isVisible: starIsVisible,
|
||||
hasIdleAnimations: state.hasIdleAnimations
|
||||
|
Loading…
x
Reference in New Issue
Block a user