Allow to mobile (#5015)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2024-03-19 21:34:28 +06:00 committed by GitHub
parent 6e194d133c
commit 5b1fd6a9b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 34 additions and 8 deletions

View File

@ -29,6 +29,7 @@
"NewVersionAvailable": "New version is available", "NewVersionAvailable": "New version is available",
"PleaseUpdate": "Please update", "PleaseUpdate": "Please update",
"ServerUnderMaintenance": "Server is under maintenance", "ServerUnderMaintenance": "Server is under maintenance",
"MobileNotSupported": "Sorry, mobile devices support coming soon. In the meantime, please use Desktop" "MobileNotSupported": "Sorry, mobile devices support coming soon. In the meantime, please use Desktop",
"LogInAnyway": "Log in anyway"
} }
} }

View File

@ -29,6 +29,7 @@
"NewVersionAvailable": "Nueva versión disponible", "NewVersionAvailable": "Nueva versión disponible",
"PleaseUpdate": "Por favor, actualice", "PleaseUpdate": "Por favor, actualice",
"ServerUnderMaintenance": "El servidor está en mantenimiento", "ServerUnderMaintenance": "El servidor está en mantenimiento",
"MobileNotSupported": "Disculpa, el soporte para dispositivos móviles estará disponible próximamente. Mientras tanto, por favor usa el escritorio." "MobileNotSupported": "Disculpa, el soporte para dispositivos móviles estará disponible próximamente. Mientras tanto, por favor usa el escritorio.",
"LogInAnyway": "Iniciar sesión de todas formas"
} }
} }

View File

@ -29,6 +29,7 @@
"NewVersionAvailable": "Nova versão disponível", "NewVersionAvailable": "Nova versão disponível",
"PleaseUpdate": "Atualize", "PleaseUpdate": "Atualize",
"ServerUnderMaintenance": "Servidor em manutenção", "ServerUnderMaintenance": "Servidor em manutenção",
"MobileNotSupported": "Desculpe, o suporte para dispositivos móveis estará disponível em breve. Enquanto isso, por favor, use o Desktop." "MobileNotSupported": "Desculpe, o suporte para dispositivos móveis estará disponível em breve. Enquanto isso, por favor, use o Desktop.",
"LogInAnyway": "Entrar de qualquer maneira"
} }
} }

View File

@ -29,6 +29,7 @@
"NewVersionAvailable": "Доступна новая версия", "NewVersionAvailable": "Доступна новая версия",
"PleaseUpdate": "Пожалуйста, обновите приложение", "PleaseUpdate": "Пожалуйста, обновите приложение",
"ServerUnderMaintenance": "Обслуживание сервера", "ServerUnderMaintenance": "Обслуживание сервера",
"MobileNotSupported": "Простите, поддержка мобильных устройств скоро будет доступна. Пока воспользуйтесь компьютером." "MobileNotSupported": "Простите, поддержка мобильных устройств скоро будет доступна. Пока воспользуйтесь компьютером.",
"LogInAnyway": "Все равно войти"
} }
} }

View File

@ -14,20 +14,38 @@
--> -->
<script lang="ts"> <script lang="ts">
import { getMetadata } from '@hcengineering/platform' import { getMetadata } from '@hcengineering/platform'
import { Component, Label, Loading, Notifications, deviceOptionsStore, location } from '@hcengineering/ui' import {
Button,
Component,
Label,
Loading,
Notifications,
deviceOptionsStore,
fetchMetadataLocalStorage,
location,
setMetadataLocalStorage
} from '@hcengineering/ui'
import { connect, versionError } from '../connect' import { connect, versionError } from '../connect'
import { workbenchId } from '@hcengineering/workbench' import { workbenchId } from '@hcengineering/workbench'
import workbench from '../plugin' import workbench from '../plugin'
const isNeedUpgrade = window.location.host === '' const isNeedUpgrade = window.location.host === ''
let mobileAllowed = fetchMetadataLocalStorage(workbench.metadata.MobileAllowed)
function allowMobile () {
setMetadataLocalStorage(workbench.metadata.MobileAllowed, true)
mobileAllowed = true
}
</script> </script>
{#if $location.path[0] === workbenchId || $location.path[0] === workbench.component.WorkbenchApp} {#if $location.path[0] === workbenchId || $location.path[0] === workbench.component.WorkbenchApp}
{#if $deviceOptionsStore.isMobile} {#if $deviceOptionsStore.isMobile && mobileAllowed !== true}
<div class="version-wrapper"> <div class="version-wrapper">
<div class="antiPopup version-popup"> <div class="antiPopup version-popup">
<h1><Label label={workbench.string.MobileNotSupported} /></h1> <h1><Label label={workbench.string.MobileNotSupported} /></h1>
<Button label={workbench.string.LogInAnyway} on:click={allowMobile} />
</div> </div>
</div> </div>
{:else} {:else}

View File

@ -14,7 +14,7 @@
// //
import { mergeIds } from '@hcengineering/platform' import { mergeIds } from '@hcengineering/platform'
import type { IntlString } from '@hcengineering/platform' import type { IntlString, Metadata } from '@hcengineering/platform'
import workbench, { workbenchId } from '@hcengineering/workbench' import workbench, { workbenchId } from '@hcengineering/workbench'
import { type AnyComponent } from '@hcengineering/ui' import { type AnyComponent } from '@hcengineering/ui'
@ -42,7 +42,11 @@ export default mergeIds(workbenchId, workbench, {
OpenInNewTab: '' as IntlString, OpenInNewTab: '' as IntlString,
NewVersionAvailable: '' as IntlString, NewVersionAvailable: '' as IntlString,
PleaseUpdate: '' as IntlString, PleaseUpdate: '' as IntlString,
MobileNotSupported: '' as IntlString MobileNotSupported: '' as IntlString,
LogInAnyway: '' as IntlString
},
metadata: {
MobileAllowed: '' as Metadata<boolean>
}, },
component: { component: {
SpacePanel: '' as AnyComponent, SpacePanel: '' as AnyComponent,