[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;
}
.skl-navbar.skl-navbar--slide {
background-color: #aa5252;
}
.skl-navbar::before {
content: '';
position: absolute;

View file

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

View file

@ -40,8 +40,10 @@ class ContextMenu extends ContextMenuController {
super.componentWillUnmount();
const api = Common.EditorApi.get();
api.asc_unregisterCallback('asc_onShowComment', this.onApiShowComment);
api.asc_unregisterCallback('asc_onHideComment', this.onApiHideComment);
if ( api ) {
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 () => {
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 (() => {
const api = Common.EditorApi.get();
api.asc_unregisterCallback('asc_onStartAction', onLongActionBegin);
api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd);
api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument);
if ( api ) {
api.asc_unregisterCallback('asc_onStartAction', onLongActionBegin);
api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd);
api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument);
}
Common.Notifications.off('preloader:endAction', onLongActionEnd);
Common.Notifications.off('preloader:beginAction', onLongActionBegin);

View file

@ -184,7 +184,6 @@ class MainController extends Component {
});
Common.Notifications.trigger('engineCreated', this.api);
Common.EditorApi = {get: () => this.api};
this.appOptions = {};
this.bindEvents();
@ -475,7 +474,9 @@ class MainController extends Component {
}
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 warnNoLicenseUsers = _t.warnNoLicenseUsers.replace(/%1/g, __COMPANY_NAME__);
const textNoLicenseTitle = _t.textNoLicenseTitle.replace(/%1/g, __COMPANY_NAME__);
@ -830,6 +831,7 @@ class MainController extends Component {
}
componentDidMount () {
Common.EditorApi = {get: () => this.api};
this.initSdk();
}
}

View file

@ -22,17 +22,28 @@
<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="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 -->
</head>
<body>
<section class="skl-container">
<div class="skl-navbar skl-navbar--slide"></div>
</section>
<script>
const isAndroid = /Android/.test(navigator.userAgent);
if ( isAndroid && navigator.platform == 'Win32' )
// Framework7 doesn't set Device.android flag when navigator.platform == 'Win32', change it for debug
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 ) {
const ua = navigator.userAgent;
const iPad = ua.match(/(iPad).*OS\s([\d_]+)/);
@ -43,6 +54,10 @@
get: function () { return `iPad; CPU OS 11_0 ${ua}`; }
});
}
} else {
if ( navbar ) {
navbar.classList.add('skl-navbar--md');
}
}
const getUrlParams = () => {

View file

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

View file

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