mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-22 17:45:02 +02:00
Switch huly core (#10041)
* Switch to huly.core Signed-off-by: Andrey Sobolev <haiodo@gmail.com> * Fix build Signed-off-by: Andrey Sobolev <haiodo@gmail.com> --------- Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -2,14 +2,17 @@ const FLAG_OPEN_IN_DESKTOP = 'flagOpenInDesktopApp'
|
||||
const TIMESTAMP_OPEN_IN_DESKTOP = 'timeOpenInDesktopApp'
|
||||
const TIMEOUT_OPEN_IN_DESKTOP = 24 * 60 * 60 * 1000
|
||||
|
||||
export function tryOpenInDesktopApp(protocol: string) {
|
||||
export function tryOpenInDesktopApp (protocol: string) {
|
||||
if (!window.location.origin) {
|
||||
return
|
||||
}
|
||||
|
||||
// Once for a new TAB
|
||||
if (window.sessionStorage && (window.sessionStorage.getItem(FLAG_OPEN_IN_DESKTOP) === 'true'
|
||||
|| window.localStorage.getItem(FLAG_OPEN_IN_DESKTOP) === 'true')) {
|
||||
if (
|
||||
window.sessionStorage &&
|
||||
(window.sessionStorage.getItem(FLAG_OPEN_IN_DESKTOP) === 'true' ||
|
||||
window.localStorage.getItem(FLAG_OPEN_IN_DESKTOP) === 'true')
|
||||
) {
|
||||
return
|
||||
}
|
||||
window.sessionStorage.setItem(FLAG_OPEN_IN_DESKTOP, 'true')
|
||||
@@ -19,7 +22,7 @@ export function tryOpenInDesktopApp(protocol: string) {
|
||||
const timeStr = window.localStorage.getItem(TIMESTAMP_OPEN_IN_DESKTOP)
|
||||
const time = Number(timeStr)
|
||||
const now = Date.now()
|
||||
if ((now - time) < TIMEOUT_OPEN_IN_DESKTOP) {
|
||||
if (now - time < TIMEOUT_OPEN_IN_DESKTOP) {
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -28,16 +31,15 @@ export function tryOpenInDesktopApp(protocol: string) {
|
||||
// Filter only URLs inside a workbench
|
||||
const link = window.location.toString()
|
||||
|
||||
if (link.indexOf('/workbench/') === -1) {
|
||||
if (!link.includes('/workbench/')) {
|
||||
return
|
||||
}
|
||||
|
||||
const deepLink = link.replace('http://', protocol)
|
||||
.replace('https://', protocol)
|
||||
const deepLink = link.replace('http://', protocol).replace('https://', protocol)
|
||||
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.style.display = 'none';
|
||||
iframe.src = deepLink;
|
||||
const iframe = document.createElement('iframe')
|
||||
iframe.style.display = 'none'
|
||||
iframe.src = deepLink
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
document.body.appendChild(iframe)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user