mirror of
https://github.com/twofas/2fas-ios.git
synced 2024-11-25 03:40:26 +01:00
[TF-1552] pr changes and fix formatting
This commit is contained in:
parent
b2cd42d48d
commit
32d7692dfa
@ -129,7 +129,6 @@ extension TokensViewController: TokensViewControlling {
|
|||||||
// MARK: - Navibar icons
|
// MARK: - Navibar icons
|
||||||
func updateNaviIcons(using state: TokensViewControllerAddState, hasUnreadNews: Bool) {
|
func updateNaviIcons(using state: TokensViewControllerAddState, hasUnreadNews: Bool) {
|
||||||
func createNewsButton() -> UIBarButtonItem {
|
func createNewsButton() -> UIBarButtonItem {
|
||||||
print("Create news icon called")
|
|
||||||
if presenter.hasUnreadNews {
|
if presenter.hasUnreadNews {
|
||||||
let naviButton = UnreadNewsNaviButton()
|
let naviButton = UnreadNewsNaviButton()
|
||||||
naviButton.translatesAutoresizingMaskIntoConstraints = false
|
naviButton.translatesAutoresizingMaskIntoConstraints = false
|
||||||
@ -405,8 +404,11 @@ private extension TokensViewController {
|
|||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
newsImageView.centerXAnchor.constraint(equalTo: centerXAnchor),
|
newsImageView.centerXAnchor.constraint(equalTo: centerXAnchor),
|
||||||
newsImageView.centerYAnchor.constraint(equalTo: centerYAnchor),
|
newsImageView.centerYAnchor.constraint(equalTo: centerYAnchor),
|
||||||
badgeImageView.topAnchor.constraint(equalTo: topAnchor, constant: Theme.Metrics.halfSpacing),
|
badgeImageView.topAnchor.constraint(equalTo: topAnchor, constant: Theme.Metrics.halfSpacing),
|
||||||
badgeImageView.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -Theme.Metrics.quaterSpacing),
|
badgeImageView.trailingAnchor.constraint(
|
||||||
|
equalTo: trailingAnchor,
|
||||||
|
constant: -Theme.Metrics.quaterSpacing
|
||||||
|
),
|
||||||
badgeImageView.widthAnchor.constraint(equalToConstant: badgeWidth),
|
badgeImageView.widthAnchor.constraint(equalToConstant: badgeWidth),
|
||||||
badgeImageView.heightAnchor.constraint(equalToConstant: badgeWidth)
|
badgeImageView.heightAnchor.constraint(equalToConstant: badgeWidth)
|
||||||
])
|
])
|
||||||
@ -415,38 +417,46 @@ private extension TokensViewController {
|
|||||||
func animate() {
|
func animate() {
|
||||||
let angle: Double = .pi / 12
|
let angle: Double = .pi / 12
|
||||||
let numberOfFrames: Double = 5
|
let numberOfFrames: Double = 5
|
||||||
let frameDuration = Double(1/numberOfFrames)
|
let frameDuration = Double(0.7 / numberOfFrames)
|
||||||
|
|
||||||
UIView.animateKeyframes(withDuration: 1, delay: 0, animations: { [newsImageView] in
|
UIView.animateKeyframes(
|
||||||
UIView.addKeyframe(withRelativeStartTime: 0.0, relativeDuration: frameDuration) {
|
withDuration: 1,
|
||||||
newsImageView.transform = CGAffineTransform(rotationAngle: -angle)
|
delay: 0,
|
||||||
|
animations: { [newsImageView] in
|
||||||
|
UIView.addKeyframe(withRelativeStartTime: 0.0, relativeDuration: frameDuration) {
|
||||||
|
newsImageView.transform = CGAffineTransform(rotationAngle: -angle)
|
||||||
|
}
|
||||||
|
UIView.addKeyframe(withRelativeStartTime: frameDuration, relativeDuration: frameDuration) {
|
||||||
|
newsImageView.transform = CGAffineTransform(rotationAngle: +angle)
|
||||||
|
}
|
||||||
|
UIView.addKeyframe(withRelativeStartTime: 2 * frameDuration, relativeDuration: frameDuration) {
|
||||||
|
newsImageView.transform = CGAffineTransform(rotationAngle: -angle)
|
||||||
|
}
|
||||||
|
UIView.addKeyframe(withRelativeStartTime: 3 * frameDuration, relativeDuration: frameDuration) {
|
||||||
|
newsImageView.transform = CGAffineTransform(rotationAngle: +angle)
|
||||||
|
}
|
||||||
|
UIView.addKeyframe(withRelativeStartTime: 4 * frameDuration, relativeDuration: frameDuration) {
|
||||||
|
newsImageView.transform = CGAffineTransform.identity
|
||||||
|
}
|
||||||
|
},
|
||||||
|
completion: { [weak self] _ in
|
||||||
|
self?.badgeImageView.isHidden = false
|
||||||
|
self?.animateBadge()
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
UIView.addKeyframe(withRelativeStartTime: frameDuration, relativeDuration: frameDuration) {
|
private func animateBadge() {
|
||||||
newsImageView.transform = CGAffineTransform(rotationAngle: +angle)
|
UIView.animate(
|
||||||
|
withDuration: 0.2,
|
||||||
|
animations: { [badgeImageView, badgeWidth] in
|
||||||
|
badgeImageView.transform = CGAffineTransform(scaleX: 12.0 / badgeWidth, y: 12.0 / badgeWidth)
|
||||||
|
}, completion: { [badgeImageView, badgeWidth] _ in
|
||||||
|
UIView.animate(withDuration: 0.15) {
|
||||||
|
badgeImageView.transform = CGAffineTransform(scaleX: 8.0 / badgeWidth, y: 8.0 / badgeWidth)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
)
|
||||||
UIView.addKeyframe(withRelativeStartTime: 2*frameDuration, relativeDuration: frameDuration) {
|
|
||||||
newsImageView.transform = CGAffineTransform(rotationAngle: -angle)
|
|
||||||
}
|
|
||||||
|
|
||||||
UIView.addKeyframe(withRelativeStartTime: 3*frameDuration, relativeDuration: frameDuration) {
|
|
||||||
newsImageView.transform = CGAffineTransform(rotationAngle: +angle)
|
|
||||||
}
|
|
||||||
|
|
||||||
UIView.addKeyframe(withRelativeStartTime: 4*frameDuration, relativeDuration: frameDuration) {
|
|
||||||
newsImageView.transform = CGAffineTransform.identity
|
|
||||||
}
|
|
||||||
}, completion: { [badgeImageView, badgeWidth] _ in
|
|
||||||
badgeImageView.isHidden = false
|
|
||||||
UIView.animate(withDuration: 0.3, animations: {
|
|
||||||
badgeImageView.transform = CGAffineTransform(scaleX: 12.0/badgeWidth, y: 12.0/badgeWidth)
|
|
||||||
}, completion: { _ in
|
|
||||||
UIView.animate(withDuration: 0.2, animations: {
|
|
||||||
badgeImageView.transform = CGAffineTransform(scaleX: 8.0/badgeWidth, y: 8.0/badgeWidth)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user