mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
bbc2744915
commit
2178261bad
@ -111,6 +111,7 @@ private final class PhoneView: UIView {
|
|||||||
self.shimmerMaskView = UIView()
|
self.shimmerMaskView = UIView()
|
||||||
self.shimmerBorderView = UIImageView(image: phoneBorderMaskImage)
|
self.shimmerBorderView = UIImageView(image: phoneBorderMaskImage)
|
||||||
self.shimmerStarView = UIImageView(image: starMaskImage)
|
self.shimmerStarView = UIImageView(image: starMaskImage)
|
||||||
|
self.shimmerStarView.alpha = 0.7
|
||||||
|
|
||||||
self.backShimmerView = UIView()
|
self.backShimmerView = UIView()
|
||||||
self.backShimmerView.alpha = 0.0
|
self.backShimmerView.alpha = 0.0
|
||||||
@ -140,10 +141,10 @@ private final class PhoneView: UIView {
|
|||||||
self.frontShimmerView.mask = self.shimmerMaskView
|
self.frontShimmerView.mask = self.shimmerMaskView
|
||||||
self.frontShimmerView.addSubview(self.shimmerEffectView)
|
self.frontShimmerView.addSubview(self.shimmerEffectView)
|
||||||
|
|
||||||
self.backShimmerEffectView.update(backgroundColor: .clear, foregroundColor: UIColor.white.withAlphaComponent(0.35), gradientSize: 70.0, globalTimeOffset: true, duration: 3.0, horizontal: true)
|
self.backShimmerEffectView.update(backgroundColor: .clear, foregroundColor: UIColor.white.withAlphaComponent(0.35), gradientSize: 60.0, globalTimeOffset: true, duration: 4.0, horizontal: true)
|
||||||
self.backShimmerEffectView.layer.compositingFilter = "overlayBlendMode"
|
self.backShimmerEffectView.layer.compositingFilter = "overlayBlendMode"
|
||||||
|
|
||||||
self.shimmerEffectView.update(backgroundColor: .clear, foregroundColor: UIColor.white.withAlphaComponent(0.65), gradientSize: 70.0, globalTimeOffset: true, duration: 3.0, horizontal: true)
|
self.shimmerEffectView.update(backgroundColor: .clear, foregroundColor: UIColor.white.withAlphaComponent(0.5), gradientSize: 16.0, globalTimeOffset: true, duration: 4.0, horizontal: true)
|
||||||
self.shimmerEffectView.layer.compositingFilter = "overlayBlendMode"
|
self.shimmerEffectView.layer.compositingFilter = "overlayBlendMode"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,8 +181,16 @@ private final class PhoneView: UIView {
|
|||||||
|
|
||||||
let status = videoNode.status
|
let status = videoNode.status
|
||||||
|> mapToSignal { status -> Signal<MediaPlayerStatus?, NoError> in
|
|> mapToSignal { status -> Signal<MediaPlayerStatus?, NoError> in
|
||||||
if let status = status, case .buffering = status.status {
|
var isLoading = false
|
||||||
return .single(status) |> delay(1.0, queue: Queue.mainQueue())
|
if let status = status {
|
||||||
|
if case .buffering = status.status {
|
||||||
|
isLoading = true
|
||||||
|
} else if status.duration.isZero {
|
||||||
|
isLoading = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if isLoading {
|
||||||
|
return .single(status) |> delay(0.6, queue: Queue.mainQueue())
|
||||||
} else {
|
} else {
|
||||||
return .single(status)
|
return .single(status)
|
||||||
}
|
}
|
||||||
@ -205,11 +214,13 @@ private final class PhoneView: UIView {
|
|||||||
private func updatePlaybackStatus() {
|
private func updatePlaybackStatus() {
|
||||||
var isDisplayingProgress = false
|
var isDisplayingProgress = false
|
||||||
if let playbackStatus = self.playbackStatusValue {
|
if let playbackStatus = self.playbackStatusValue {
|
||||||
if case let .buffering(initial, _, progress, _) = playbackStatus.status, initial || !progress.isZero {
|
if case .buffering = playbackStatus.status {
|
||||||
isDisplayingProgress = true
|
isDisplayingProgress = true
|
||||||
} else if playbackStatus.status == .playing {
|
} else if playbackStatus.status == .playing {
|
||||||
isDisplayingProgress = false
|
isDisplayingProgress = playbackStatus.duration.isZero
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
isDisplayingProgress = true
|
||||||
}
|
}
|
||||||
|
|
||||||
let targetAlpha = isDisplayingProgress ? 1.0 : 0.0
|
let targetAlpha = isDisplayingProgress ? 1.0 : 0.0
|
||||||
@ -386,9 +397,9 @@ final class PhoneDemoComponent: Component {
|
|||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
// deinit {
|
deinit {
|
||||||
// self.playbackStatusDisposable?.dispose()
|
self.playbackStatusDisposable?.dispose()
|
||||||
// }
|
}
|
||||||
|
|
||||||
public func update(component: PhoneDemoComponent, availableSize: CGSize, environment: Environment<DemoPageEnvironment>, transition: Transition) -> CGSize {
|
public func update(component: PhoneDemoComponent, availableSize: CGSize, environment: Environment<DemoPageEnvironment>, transition: Transition) -> CGSize {
|
||||||
self.component = component
|
self.component = component
|
||||||
|
@ -386,13 +386,13 @@ class PremiumStarComponent: Component {
|
|||||||
animation.fromValue = NSValue(scnMatrix4: initial)
|
animation.fromValue = NSValue(scnMatrix4: initial)
|
||||||
animation.toValue = NSValue(scnMatrix4: SCNMatrix4Translate(initial, -1.6, 0.0, 0.0))
|
animation.toValue = NSValue(scnMatrix4: SCNMatrix4Translate(initial, -1.6, 0.0, 0.0))
|
||||||
animation.timingFunction = CAMediaTimingFunction(name: .easeOut)
|
animation.timingFunction = CAMediaTimingFunction(name: .easeOut)
|
||||||
animation.beginTime = 0.6
|
animation.beginTime = 1.1
|
||||||
animation.duration = 0.9
|
animation.duration = 0.9
|
||||||
|
|
||||||
let group = CAAnimationGroup()
|
let group = CAAnimationGroup()
|
||||||
group.animations = [animation]
|
group.animations = [animation]
|
||||||
group.beginTime = 1.0
|
group.beginTime = 1.0
|
||||||
group.duration = 3.0
|
group.duration = 4.0
|
||||||
group.repeatCount = .infinity
|
group.repeatCount = .infinity
|
||||||
|
|
||||||
node.geometry?.materials.first?.emission.addAnimation(group, forKey: "shimmer")
|
node.geometry?.materials.first?.emission.addAnimation(group, forKey: "shimmer")
|
||||||
|
@ -358,8 +358,8 @@ public final class SolidRoundedButtonNode: ASDisplayNode {
|
|||||||
compositingFilter = nil
|
compositingFilter = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
shimmerView.update(backgroundColor: .clear, foregroundColor: color.withAlphaComponent(alpha), gradientSize: 70.0, globalTimeOffset: false, duration: 3.0, horizontal: true)
|
shimmerView.update(backgroundColor: .clear, foregroundColor: color.withAlphaComponent(alpha), gradientSize: 70.0, globalTimeOffset: false, duration: 4.0, horizontal: true)
|
||||||
borderShimmerView.update(backgroundColor: .clear, foregroundColor: color.withAlphaComponent(borderAlpha), gradientSize: 70.0, globalTimeOffset: false, duration: 3.0, horizontal: true)
|
borderShimmerView.update(backgroundColor: .clear, foregroundColor: color.withAlphaComponent(borderAlpha), gradientSize: 70.0, globalTimeOffset: false, duration: 4.0, horizontal: true)
|
||||||
|
|
||||||
shimmerView.layer.compositingFilter = compositingFilter
|
shimmerView.layer.compositingFilter = compositingFilter
|
||||||
borderShimmerView.layer.compositingFilter = compositingFilter
|
borderShimmerView.layer.compositingFilter = compositingFilter
|
||||||
@ -1008,8 +1008,8 @@ public final class SolidRoundedButtonView: UIView {
|
|||||||
|
|
||||||
let globalTimeOffset = self.icon == nil && self.animation == nil
|
let globalTimeOffset = self.icon == nil && self.animation == nil
|
||||||
|
|
||||||
shimmerView.update(backgroundColor: .clear, foregroundColor: color.withAlphaComponent(alpha), gradientSize: 70.0, globalTimeOffset: globalTimeOffset, duration: 3.0, horizontal: true)
|
shimmerView.update(backgroundColor: .clear, foregroundColor: color.withAlphaComponent(alpha), gradientSize: 70.0, globalTimeOffset: globalTimeOffset, duration: 4.0, horizontal: true)
|
||||||
borderShimmerView.update(backgroundColor: .clear, foregroundColor: color.withAlphaComponent(borderAlpha), gradientSize: 70.0, globalTimeOffset: globalTimeOffset, duration: 3.0, horizontal: true)
|
borderShimmerView.update(backgroundColor: .clear, foregroundColor: color.withAlphaComponent(borderAlpha), gradientSize: 70.0, globalTimeOffset: globalTimeOffset, duration: 4.0, horizontal: true)
|
||||||
|
|
||||||
shimmerView.layer.compositingFilter = compositingFilter
|
shimmerView.layer.compositingFilter = compositingFilter
|
||||||
borderShimmerView.layer.compositingFilter = compositingFilter
|
borderShimmerView.layer.compositingFilter = compositingFilter
|
||||||
|
Loading…
x
Reference in New Issue
Block a user