Skip to content

Commit

Permalink
Fix the Haptic Feedback action
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Sep 26, 2023
1 parent dda990e commit e32c5e3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Shared/Actions/HapticFeedback.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ On macOS, it does nothing.

func perform() async throws -> some IntentResult {
#if canImport(UIKit)
Device.hapticFeedback(type.toNative)
try? await Task.sleep(for: .seconds(1))
if #available(macOS 14, iOS 17, tvOS 17, watchOS 10, *) {
try? await Task.sleep(for: .seconds(0.5))
Device.hapticFeedback(type.toNative)
} else {
Device.hapticFeedback(type.toNative)
try? await Task.sleep(for: .seconds(1))
}
await ShortcutsApp.open()
#endif

Expand Down

0 comments on commit e32c5e3

Please sign in to comment.