mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +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(
|
let coinSize = self.coin.update(
|
||||||
transition: .immediate,
|
transition: .immediate,
|
||||||
component: AnyComponent(PremiumCoinComponent(isIntro: true, isVisible: true, hasIdleAnimations: true)),
|
component: AnyComponent(PremiumCoinComponent(mode: .business, isIntro: true, isVisible: true, hasIdleAnimations: true)),
|
||||||
environment: {},
|
environment: {},
|
||||||
containerSize: containerSize
|
containerSize: containerSize
|
||||||
)
|
)
|
||||||
|
@ -9,7 +9,7 @@ import AppBundle
|
|||||||
import LegacyComponents
|
import LegacyComponents
|
||||||
import PremiumStarComponent
|
import PremiumStarComponent
|
||||||
|
|
||||||
private let sceneVersion: Int = 3
|
private let sceneVersion: Int = 4
|
||||||
|
|
||||||
private func deg2rad(_ number: Float) -> Float {
|
private func deg2rad(_ number: Float) -> Float {
|
||||||
return number * .pi / 180
|
return number * .pi / 180
|
||||||
@ -19,19 +19,31 @@ private func rad2deg(_ number: Float) -> Float {
|
|||||||
return number * 180.0 / .pi
|
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 isIntro: Bool
|
||||||
let isVisible: Bool
|
let isVisible: Bool
|
||||||
let hasIdleAnimations: 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.isIntro = isIntro
|
||||||
self.isVisible = isVisible
|
self.isVisible = isVisible
|
||||||
self.hasIdleAnimations = hasIdleAnimations
|
self.hasIdleAnimations = hasIdleAnimations
|
||||||
}
|
}
|
||||||
|
|
||||||
static func ==(lhs: PremiumCoinComponent, rhs: PremiumCoinComponent) -> Bool {
|
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 {
|
final class View: UIView, SCNSceneRendererDelegate, ComponentTaggedView {
|
||||||
@ -350,7 +362,7 @@ class PremiumCoinComponent: Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let material = node.geometry?.materials.first {
|
if let material = node.geometry?.materials.first {
|
||||||
if node.name == "Logos" {
|
if ["Business", "Affiliate", "Plane"].contains(node.name) {
|
||||||
material.metalness.intensity = 0.1
|
material.metalness.intensity = 0.1
|
||||||
} else {
|
} else {
|
||||||
material.metalness.intensity = 0.3
|
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)
|
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
|
self.hasIdleAnimations = component.hasIdleAnimations
|
||||||
|
|
||||||
return availableSize
|
return availableSize
|
||||||
|
@ -3218,6 +3218,7 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
|
|||||||
if case .business = context.component.mode {
|
if case .business = context.component.mode {
|
||||||
header = coin.update(
|
header = coin.update(
|
||||||
component: PremiumCoinComponent(
|
component: PremiumCoinComponent(
|
||||||
|
mode: .business,
|
||||||
isIntro: isIntro,
|
isIntro: isIntro,
|
||||||
isVisible: starIsVisible,
|
isVisible: starIsVisible,
|
||||||
hasIdleAnimations: state.hasIdleAnimations
|
hasIdleAnimations: state.hasIdleAnimations
|
||||||
|
Loading…
x
Reference in New Issue
Block a user