mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
477 B
Swift
20 lines
477 B
Swift
import AudioToolbox
|
|
|
|
public final class Vibration {
|
|
|
|
public static let shared = Vibration()
|
|
|
|
private var vibrationTimer: Timer?
|
|
|
|
public func startVibration() {
|
|
vibrationTimer = Timer.scheduledTimer(withTimeInterval: 2, repeats: true) { _ in
|
|
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
|
|
}
|
|
}
|
|
|
|
public func stopVibrationIfPossible() {
|
|
vibrationTimer?.invalidate()
|
|
vibrationTimer = nil
|
|
}
|
|
}
|