fix: wrap all SDK isSupported() calls in try-catch

This commit is contained in:
c0mrade
2026-02-01 20:29:38 +03:00
parent baa57b907e
commit e5ea09dd3a
2 changed files with 42 additions and 18 deletions

View File

@@ -88,9 +88,13 @@ export function initTelegramSDK() {
}
// Disable vertical swipes if supported (sync)
if (swipeBehavior.isSupported()) {
swipeBehavior.mount();
swipeBehavior.disableVertical();
try {
if (swipeBehavior.isSupported()) {
swipeBehavior.mount();
swipeBehavior.disableVertical();
}
} catch {
// Swipe behavior not available
}
// Mount viewport and bind CSS variables (async)
@@ -233,20 +237,32 @@ export function useTelegramSDK() {
const expand = useCallback(() => {
if (!isReady) return;
viewport.expand();
try {
viewport.expand();
} catch {
// Viewport not available
}
}, [isReady]);
const disableVerticalSwipes = useCallback(() => {
if (!isReady) return;
if (swipeBehavior.isSupported()) {
swipeBehavior.disableVertical();
try {
if (swipeBehavior.isSupported()) {
swipeBehavior.disableVertical();
}
} catch {
// Swipe behavior not available
}
}, [isReady]);
const enableVerticalSwipes = useCallback(() => {
if (!isReady) return;
if (swipeBehavior.isSupported()) {
swipeBehavior.enableVertical();
try {
if (swipeBehavior.isSupported()) {
swipeBehavior.enableVertical();
}
} catch {
// Swipe behavior not available
}
}, [isReady]);