Revert "Rotate call button icons when the phone is in landscape"

This reverts commit 54701df408.
This commit is contained in:
Sasha Weiss 2022-08-04 14:21:21 -07:00 committed by GitHub
parent d1a455b1a2
commit 2cc4502fbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,6 @@
//
import Foundation
import UIKit
class CallButton: UIButton {
var iconName: String { didSet { updateAppearance() } }
@ -99,17 +98,6 @@ class CallButton: UIButton {
updateAppearance()
updateSizing()
updateOrientation()
UIDevice.current.beginGeneratingDeviceOrientationNotifications()
NotificationCenter.default.addObserver(self,
selector: #selector(updateOrientation),
name: UIDevice.orientationDidChangeNotification,
object: nil)
}
deinit {
UIDevice.current.endGeneratingDeviceOrientationNotifications()
}
private func updateAppearance() {
@ -159,25 +147,6 @@ class CallButton: UIButton {
}
}
@objc
private func updateOrientation() {
let rotationAngle: CGFloat
switch UIDevice.current.orientation {
case .landscapeLeft:
rotationAngle = .pi / 2
case .landscapeRight:
rotationAngle = -.pi / 2
case .portrait, .portraitUpsideDown, .faceDown, .faceUp, .unknown:
fallthrough
@unknown default:
rotationAngle = 0
}
UIView.animate(withDuration: 0.3, delay: 0, options: .allowUserInteraction) {
self.circleView.transform = CGAffineTransform(rotationAngle: rotationAngle)
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}