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
This commit is contained in:
@@ -429,8 +429,12 @@ pub fn TorrentTable() -> impl IntoView {
|
|||||||
set_menu_position.set((x, y));
|
set_menu_position.set((x, y));
|
||||||
set_selected_hash.set(Some(hash.clone()));
|
set_selected_hash.set(Some(hash.clone()));
|
||||||
set_menu_visible.set(true);
|
set_menu_visible.set(true);
|
||||||
|
|
||||||
|
// Haptic feedback (iOS Safari doesn't support vibrate)
|
||||||
let navigator = window().navigator();
|
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<dyn Fn()>);
|
}) as Box<dyn Fn()>);
|
||||||
|
|
||||||
let id = window()
|
let id = window()
|
||||||
|
|||||||
Reference in New Issue
Block a user