Skip to content

Commit

Permalink
Added ability to change alert showing duration
Browse files Browse the repository at this point in the history
  • Loading branch information
LowKostKustomz committed Mar 10, 2018
1 parent 7bc7f10 commit c75a554
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Sources/StatusAlert/StatusAlert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ import UIKit
/// Announced to VoiceOver when the alert gets presented
@objc public var accessibilityAnnouncement: String? = nil

/// How long StatusAlert should on screen.
///
/// - Note: This time should include fade animation duration (which `UINavigationControllerHideShowBarDuration`)
/// - Note: Changes while showing will have no effect
@objc public var alertShowingDuration: TimeInterval = 2

// MARK: - Private fields -

/// Used to present only one `StatusAlert` at once
private static var isPresenting: Bool = false

private let defaultDisappearTimerTimeInterval: TimeInterval = 2
private let defaultFadeAnimationDuration: TimeInterval = TimeInterval(UINavigationControllerHideShowBarDuration)
private let blurEffect: UIBlurEffect = UIBlurEffect(style: .light)

Expand Down Expand Up @@ -471,7 +476,7 @@ import UIKit

let scale: CGFloat = SizesAndDistances.defaultInitialScale
timer = Timer.scheduledTimer(
timeInterval: defaultDisappearTimerTimeInterval - defaultFadeAnimationDuration,
timeInterval: alertShowingDuration - defaultFadeAnimationDuration,
target: self,
selector: #selector(dismiss),
userInfo: nil,
Expand Down

0 comments on commit c75a554

Please sign in to comment.