fix: disable fullscreen for desktop
This commit is contained in:
@@ -36,18 +36,19 @@ app
|
||||
const settings = useSettingsStore();
|
||||
const blocks = useBlocksStore();
|
||||
const pulse = usePulseStore();
|
||||
const tg = window.Telegram.WebApp;
|
||||
|
||||
const appLoading = createApp(AppLoading);
|
||||
appLoading.mount('#app');
|
||||
|
||||
function setTelegramUIColors() {
|
||||
const daisyUIBgColor = getCssVarOklchRgb('--color-base-200');
|
||||
window.Telegram.WebApp.setHeaderColor(daisyUIBgColor);
|
||||
window.Telegram.WebApp.setBackgroundColor(daisyUIBgColor);
|
||||
tg.setHeaderColor(daisyUIBgColor);
|
||||
tg.setBackgroundColor(daisyUIBgColor);
|
||||
}
|
||||
|
||||
settings.load()
|
||||
.then(() => window.Telegram.WebApp.lockOrientation())
|
||||
.then(() => tg.lockOrientation())
|
||||
.then(() => {
|
||||
if (settings.app_enabled === false) {
|
||||
throw new Error('App disabled (maintenance mode)');
|
||||
@@ -55,7 +56,7 @@ settings.load()
|
||||
})
|
||||
.then(() => settings.ya_metrika_enabled && injectYaMetrika())
|
||||
.then(() => {
|
||||
if (! window.Telegram.WebApp.initData) {
|
||||
if (! tg.initData) {
|
||||
throw new TelegramInitDataError('Invalid init data. Application not in Telegram View');
|
||||
}
|
||||
})
|
||||
@@ -84,9 +85,9 @@ settings.load()
|
||||
.then(() => blocks.processBlocks(settings.mainpage_blocks))
|
||||
.then(() => {
|
||||
console.debug('[Init] Set theme attributes');
|
||||
document.documentElement.setAttribute('data-theme', settings.theme[window.Telegram.WebApp.colorScheme]);
|
||||
document.documentElement.setAttribute('data-theme', settings.theme[tg.colorScheme]);
|
||||
if (settings.night_auto) {
|
||||
window.Telegram.WebApp.onEvent('themeChanged', function () {
|
||||
tg.onEvent('themeChanged', function () {
|
||||
document.documentElement.setAttribute('data-theme', settings.theme[this.colorScheme]);
|
||||
setTelegramUIColors();
|
||||
});
|
||||
@@ -115,10 +116,12 @@ settings.load()
|
||||
appLoading.unmount();
|
||||
app.mount('#app');
|
||||
})
|
||||
.then(() => window.Telegram.WebApp.ready())
|
||||
.then(() => tg.ready())
|
||||
.then(() => {
|
||||
window.Telegram.WebApp.disableVerticalSwipes();
|
||||
window.Telegram.WebApp.requestFullscreen();
|
||||
if (tg.platform !== 'tdesktop') {
|
||||
tg.disableVerticalSwipes();
|
||||
tg.requestFullscreen();
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
|
||||
Reference in New Issue
Block a user