Various fixes

This commit is contained in:
Ilya Laktyushin 2022-06-11 16:38:19 +04:00
parent bbc2744915
commit 2178261bad
3 changed files with 26 additions and 15 deletions

View File

@ -111,6 +111,7 @@ private final class PhoneView: UIView {
self.shimmerMaskView = UIView()
self.shimmerBorderView = UIImageView(image: phoneBorderMaskImage)
self.shimmerStarView = UIImageView(image: starMaskImage)
self.shimmerStarView.alpha = 0.7
self.backShimmerView = UIView()
self.backShimmerView.alpha = 0.0
@ -140,10 +141,10 @@ private final class PhoneView: UIView {
self.frontShimmerView.mask = self.shimmerMaskView
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.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"
}
@ -180,8 +181,16 @@ private final class PhoneView: UIView {
let status = videoNode.status
|> mapToSignal { status -> Signal<MediaPlayerStatus?, NoError> in
if let status = status, case .buffering = status.status {
return .single(status) |> delay(1.0, queue: Queue.mainQueue())
var isLoading = false
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 {
return .single(status)
}
@ -205,11 +214,13 @@ private final class PhoneView: UIView {
private func updatePlaybackStatus() {
var isDisplayingProgress = false
if let playbackStatus = self.playbackStatusValue {
if case let .buffering(initial, _, progress, _) = playbackStatus.status, initial || !progress.isZero {
if case .buffering = playbackStatus.status {
isDisplayingProgress = true
} else if playbackStatus.status == .playing {
isDisplayingProgress = false
isDisplayingProgress = playbackStatus.duration.isZero
}
} else {
isDisplayingProgress = true
}
let targetAlpha = isDisplayingProgress ? 1.0 : 0.0
@ -386,9 +397,9 @@ final class PhoneDemoComponent: Component {
fatalError("init(coder:) has not been implemented")
}
// deinit {
// self.playbackStatusDisposable?.dispose()
// }
deinit {
self.playbackStatusDisposable?.dispose()
}
public func update(component: PhoneDemoComponent, availableSize: CGSize, environment: Environment<DemoPageEnvironment>, transition: Transition) -> CGSize {
self.component = component

View File

@ -386,13 +386,13 @@ class PremiumStarComponent: Component {
animation.fromValue = NSValue(scnMatrix4: initial)
animation.toValue = NSValue(scnMatrix4: SCNMatrix4Translate(initial, -1.6, 0.0, 0.0))
animation.timingFunction = CAMediaTimingFunction(name: .easeOut)
animation.beginTime = 0.6
animation.beginTime = 1.1
animation.duration = 0.9
let group = CAAnimationGroup()
group.animations = [animation]
group.beginTime = 1.0
group.duration = 3.0
group.duration = 4.0
group.repeatCount = .infinity
node.geometry?.materials.first?.emission.addAnimation(group, forKey: "shimmer")

View File

@ -358,8 +358,8 @@ public final class SolidRoundedButtonNode: ASDisplayNode {
compositingFilter = nil
}
shimmerView.update(backgroundColor: .clear, foregroundColor: color.withAlphaComponent(alpha), gradientSize: 70.0, globalTimeOffset: false, duration: 3.0, horizontal: true)
borderShimmerView.update(backgroundColor: .clear, foregroundColor: color.withAlphaComponent(borderAlpha), 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: 4.0, horizontal: true)
shimmerView.layer.compositingFilter = compositingFilter
borderShimmerView.layer.compositingFilter = compositingFilter
@ -1008,8 +1008,8 @@ public final class SolidRoundedButtonView: UIView {
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)
borderShimmerView.update(backgroundColor: .clear, foregroundColor: color.withAlphaComponent(borderAlpha), 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: 4.0, horizontal: true)
shimmerView.layer.compositingFilter = compositingFilter
borderShimmerView.layer.compositingFilter = compositingFilter