mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-30 02:23:47 +00:00
Update useTelegramWebApp.ts
This commit is contained in:
@@ -101,14 +101,22 @@ export function useTelegramWebApp() {
|
|||||||
}, [isFullscreen, requestFullscreen, exitFullscreen])
|
}, [isFullscreen, requestFullscreen, exitFullscreen])
|
||||||
|
|
||||||
const disableVerticalSwipes = useCallback(() => {
|
const disableVerticalSwipes = useCallback(() => {
|
||||||
if (webApp?.disableVerticalSwipes) {
|
try {
|
||||||
webApp.disableVerticalSwipes()
|
if (webApp?.disableVerticalSwipes && webApp.version && webApp.version >= '7.7') {
|
||||||
|
webApp.disableVerticalSwipes()
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// Not supported in this version
|
||||||
}
|
}
|
||||||
}, [webApp])
|
}, [webApp])
|
||||||
|
|
||||||
const enableVerticalSwipes = useCallback(() => {
|
const enableVerticalSwipes = useCallback(() => {
|
||||||
if (webApp?.enableVerticalSwipes) {
|
try {
|
||||||
webApp.enableVerticalSwipes()
|
if (webApp?.enableVerticalSwipes && webApp.version && webApp.version >= '7.7') {
|
||||||
|
webApp.enableVerticalSwipes()
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// Not supported in this version
|
||||||
}
|
}
|
||||||
}, [webApp])
|
}, [webApp])
|
||||||
|
|
||||||
@@ -140,9 +148,13 @@ export function initTelegramWebApp() {
|
|||||||
webApp.ready()
|
webApp.ready()
|
||||||
webApp.expand()
|
webApp.expand()
|
||||||
|
|
||||||
// Disable vertical swipes to prevent accidental closing
|
// Disable vertical swipes to prevent accidental closing (requires Bot API 7.7+)
|
||||||
if (webApp.disableVerticalSwipes) {
|
try {
|
||||||
webApp.disableVerticalSwipes()
|
if (webApp.disableVerticalSwipes && webApp.version && webApp.version >= '7.7') {
|
||||||
|
webApp.disableVerticalSwipes()
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// Swipe control not supported in this version
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auto-enter fullscreen if enabled in settings (use cached value for instant response)
|
// Auto-enter fullscreen if enabled in settings (use cached value for instant response)
|
||||||
|
|||||||
Reference in New Issue
Block a user