From 60fc8873271c10c5988878272a8ec77a2b758e32 Mon Sep 17 00:00:00 2001 From: spinline Date: Thu, 5 Feb 2026 23:30:54 +0300 Subject: [PATCH] fix(ios): add vibrate API feature detection for iOS Safari - iOS Safari doesn't support navigator.vibrate() - Added feature detection before calling vibrate - Prevents TypeError on iOS devices - Haptic feedback still works on Android/Chrome --- frontend/src/components/torrent/table.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/torrent/table.rs b/frontend/src/components/torrent/table.rs index 251ad03..b8bce12 100644 --- a/frontend/src/components/torrent/table.rs +++ b/frontend/src/components/torrent/table.rs @@ -429,8 +429,12 @@ pub fn TorrentTable() -> impl IntoView { set_menu_position.set((x, y)); set_selected_hash.set(Some(hash.clone())); set_menu_visible.set(true); + + // Haptic feedback (iOS Safari doesn't support vibrate) let navigator = window().navigator(); - let _ = navigator.vibrate_with_duration(50); + if js_sys::Reflect::has(&navigator, &wasm_bindgen::JsValue::from_str("vibrate")).unwrap_or(false) { + let _ = navigator.vibrate_with_duration(50); + } }) as Box); let id = window()