[PE mobile] skip using "Suspense" option for app's launch

This commit is contained in:
Maxim Kadushkin 2021-09-23 23:45:10 +03:00
parent 07d6f30377
commit 858c7a3ad4
9 changed files with 45 additions and 12 deletions

View file

@ -34,6 +34,10 @@ body {
background-color: #40865c; background-color: #40865c;
} }
.skl-navbar.skl-navbar--slide {
background-color: #aa5252;
}
.skl-navbar::before { .skl-navbar::before {
content: ''; content: '';
position: absolute; position: absolute;

View file

@ -35,9 +35,9 @@ Framework7.use(Framework7React)
ReactDOM.render( ReactDOM.render(
<I18nextProvider i18n={i18n}> <I18nextProvider i18n={i18n}>
<Provider {...stores}> <Provider {...stores}>
<Suspense fallback=""> {/*<Suspense fallback="">*/}
<App /> <App />
</Suspense> {/*</Suspense>*/}
</Provider> </Provider>
</I18nextProvider>, </I18nextProvider>,
document.getElementById('app'), document.getElementById('app'),

View file

@ -40,8 +40,10 @@ class ContextMenu extends ContextMenuController {
super.componentWillUnmount(); super.componentWillUnmount();
const api = Common.EditorApi.get(); const api = Common.EditorApi.get();
api.asc_unregisterCallback('asc_onShowComment', this.onApiShowComment); if ( api ) {
api.asc_unregisterCallback('asc_onHideComment', this.onApiHideComment); api.asc_unregisterCallback('asc_onShowComment', this.onApiShowComment);
api.asc_unregisterCallback('asc_onHideComment', this.onApiHideComment);
}
} }

View file

@ -13,7 +13,7 @@ const ErrorController = inject('storeAppOptions')(({storeAppOptions, LoadingDocu
}); });
return () => { return () => {
const api = Common.EditorApi.get(); const api = Common.EditorApi.get();
api.asc_unregisterCallback('asc_onError', onError); if ( api ) api.asc_unregisterCallback('asc_onError', onError);
} }
}); });

View file

@ -35,9 +35,11 @@ const LongActionsController = () => {
return (() => { return (() => {
const api = Common.EditorApi.get(); const api = Common.EditorApi.get();
api.asc_unregisterCallback('asc_onStartAction', onLongActionBegin); if ( api ) {
api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd); api.asc_unregisterCallback('asc_onStartAction', onLongActionBegin);
api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument); api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd);
api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument);
}
Common.Notifications.off('preloader:endAction', onLongActionEnd); Common.Notifications.off('preloader:endAction', onLongActionEnd);
Common.Notifications.off('preloader:beginAction', onLongActionBegin); Common.Notifications.off('preloader:beginAction', onLongActionBegin);

View file

@ -184,7 +184,6 @@ class MainController extends Component {
}); });
Common.Notifications.trigger('engineCreated', this.api); Common.Notifications.trigger('engineCreated', this.api);
Common.EditorApi = {get: () => this.api};
this.appOptions = {}; this.appOptions = {};
this.bindEvents(); this.bindEvents();
@ -475,7 +474,9 @@ class MainController extends Component {
} }
applyLicense () { applyLicense () {
const _t = this._t; const { t } = this.props;
const _t = t('Controller.Main', {returnObjects:true});
const warnNoLicense = _t.warnNoLicense.replace(/%1/g, __COMPANY_NAME__); const warnNoLicense = _t.warnNoLicense.replace(/%1/g, __COMPANY_NAME__);
const warnNoLicenseUsers = _t.warnNoLicenseUsers.replace(/%1/g, __COMPANY_NAME__); const warnNoLicenseUsers = _t.warnNoLicenseUsers.replace(/%1/g, __COMPANY_NAME__);
const textNoLicenseTitle = _t.textNoLicenseTitle.replace(/%1/g, __COMPANY_NAME__); const textNoLicenseTitle = _t.textNoLicenseTitle.replace(/%1/g, __COMPANY_NAME__);
@ -830,6 +831,7 @@ class MainController extends Component {
} }
componentDidMount () { componentDidMount () {
Common.EditorApi = {get: () => this.api};
this.initSdk(); this.initSdk();
} }
} }

View file

@ -22,17 +22,28 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="apple-touch-icon" href="static/icons/apple-touch-icon.png"> <link rel="apple-touch-icon" href="static/icons/apple-touch-icon.png">
<link rel="icon" href="static/icons/favicon.png"> <link rel="icon" href="static/icons/favicon.png">
<link rel="stylesheet" type="text/css" href="../../common/mobile/resources/less/skeleton.css">
<!-- built styles file will be auto injected --> <!-- built styles file will be auto injected -->
</head> </head>
<body> <body>
<section class="skl-container">
<div class="skl-navbar skl-navbar--slide"></div>
</section>
<script> <script>
const isAndroid = /Android/.test(navigator.userAgent); const isAndroid = /Android/.test(navigator.userAgent);
if ( isAndroid && navigator.platform == 'Win32' ) if ( isAndroid && navigator.platform == 'Win32' )
// Framework7 doesn't set Device.android flag when navigator.platform == 'Win32', change it for debug // Framework7 doesn't set Device.android flag when navigator.platform == 'Win32', change it for debug
navigator.__defineGetter__('platform', () => 'Win32Debug'); navigator.__defineGetter__('platform', () => 'Win32Debug');
let navbar = document.querySelector('.skl-navbar');
if ( window.devicePixelRatio ) {
if ( navbar ) {
navbar.classList.add(`skl-pixel-ratio--${Math.floor(window.devicePixelRatio)}`);
}
}
if ( !isAndroid ) { if ( !isAndroid ) {
const ua = navigator.userAgent; const ua = navigator.userAgent;
const iPad = ua.match(/(iPad).*OS\s([\d_]+)/); const iPad = ua.match(/(iPad).*OS\s([\d_]+)/);
@ -43,6 +54,10 @@
get: function () { return `iPad; CPU OS 11_0 ${ua}`; } get: function () { return `iPad; CPU OS 11_0 ${ua}`; }
}); });
} }
} else {
if ( navbar ) {
navbar.classList.add('skl-navbar--md');
}
} }
const getUrlParams = () => { const getUrlParams = () => {

View file

@ -12,6 +12,9 @@ i18n.use(initReactI18next)
loadPath: './locale/{{lng}}.json' loadPath: './locale/{{lng}}.json'
}, },
interpolation: { escapeValue: false }, interpolation: { escapeValue: false },
react: {
useSuspense: false,
},
}); });
export default i18n; export default i18n;

View file

@ -89,6 +89,11 @@ class MainPage extends Component {
}); });
}; };
componentDidMount () {
if ( $$('.skl-container').length )
$$('.skl-container').remove();
}
render() { render() {
const appOptions = this.props.storeAppOptions; const appOptions = this.props.storeAppOptions;
const config = appOptions.config; const config = appOptions.config;