Skip to content

Commit b2da3fe

Browse files
committed
Add haptic feedback to success and error HUDs
1 parent c6ed324 commit b2da3fe

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Authenticator/Source/AppController.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,21 @@ class AppController {
162162
case let .showErrorMessage(message):
163163
SVProgressHUD.showError(withStatus: message)
164164

165+
// Provide haptic feedback
166+
if #available(iOS 10.0, *) {
167+
let feedbackGenerator = UINotificationFeedbackGenerator()
168+
feedbackGenerator.notificationOccurred(.error)
169+
}
170+
165171
case let .showSuccessMessage(message):
166172
SVProgressHUD.showSuccess(withStatus: message)
167173

174+
// Provide haptic feedback
175+
if #available(iOS 10.0, *) {
176+
let feedbackGenerator = UINotificationFeedbackGenerator()
177+
feedbackGenerator.notificationOccurred(.success)
178+
}
179+
168180
case let .openURL(url):
169181
if #available(iOS 9.0, *) {
170182
let safariViewController = SFSafariViewController(url: url)

0 commit comments

Comments
 (0)