Fixed bug with rotation device.
This commit is contained in:
BIN
Binary file not shown.
+1
-1
@@ -1,7 +1,7 @@
|
||||
Pod::Spec.new do |s|
|
||||
|
||||
s.name = 'SPIndicator'
|
||||
s.version = '1.4.2'
|
||||
s.version = '1.5.0'
|
||||
s.summary = 'Floating indicator, mimicrate to indicator which appear when silent mode turn on / off. Support large texts.'
|
||||
s.homepage = 'https://github.com/ivanvorobei/SPIndicator'
|
||||
s.source = { :git => 'https://github.com/ivanvorobei/SPIndicator.git', :tag => s.version }
|
||||
|
||||
@@ -205,6 +205,7 @@ open class SPIndicatorView: UIView {
|
||||
present(duration: self.duration, haptic: haptic, completion: completion)
|
||||
}
|
||||
|
||||
|
||||
open func present(duration: TimeInterval, haptic: SPIndicatorHaptic = .success, completion: (() -> Void)? = nil) {
|
||||
|
||||
if self.presentWindow == nil {
|
||||
@@ -250,9 +251,16 @@ open class SPIndicatorView: UIView {
|
||||
iconView.animate()
|
||||
}
|
||||
}
|
||||
|
||||
safeAreaInsetsObserver = window.observe(\.safeAreaInsets, changeHandler: { [weak self] window, _ in
|
||||
guard let self = self else { return }
|
||||
self.center.x = window.frame.midX
|
||||
self.toPresentPosition(.visible(self.presentSide))
|
||||
})
|
||||
}
|
||||
|
||||
@objc open func dismiss() {
|
||||
safeAreaInsetsObserver?.invalidate()
|
||||
UIView.animate(withDuration: presentAndDismissDuration, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 0, options: [.beginFromCurrentState, .curveEaseIn], animations: {
|
||||
self.toPresentPosition(.prepare(self.presentSide))
|
||||
if self.presentWithOpacity { self.alpha = 0 }
|
||||
@@ -272,7 +280,6 @@ open class SPIndicatorView: UIView {
|
||||
private var whenGesterEndShoudHide: Bool = false
|
||||
|
||||
@objc func handlePan(_ gestureRecognizer: UIPanGestureRecognizer) {
|
||||
|
||||
if gestureRecognizer.state == .began || gestureRecognizer.state == .changed {
|
||||
self.gesterIsDragging = true
|
||||
let translation = gestureRecognizer.translation(in: self)
|
||||
@@ -395,6 +402,8 @@ open class SPIndicatorView: UIView {
|
||||
private var spaceBetweenTitles: CGFloat = 1
|
||||
private var spaceBetweenTitlesAndImage: CGFloat = 16
|
||||
|
||||
private var safeAreaInsetsObserver: NSKeyValueObservation?
|
||||
|
||||
private var titlesCompactWidth: CGFloat {
|
||||
if let iconView = self.iconView {
|
||||
let space = iconView.frame.maxY + spaceBetweenTitlesAndImage
|
||||
|
||||
Reference in New Issue
Block a user