diff --git a/apps/common/mobile/utils/device.jsx b/apps/common/mobile/utils/device.jsx index f156961a2..72f0cd09f 100644 --- a/apps/common/mobile/utils/device.jsx +++ b/apps/common/mobile/utils/device.jsx @@ -1,8 +1,9 @@ import React from 'react'; import { f7 } from 'framework7-react'; +import { Dom7, Device } from 'framework7' -class Device { +class WrapDevice { constructor(){ const ua = navigator.userAgent, isMobile = /Mobile(\/|\s|;)/.test(ua); @@ -16,6 +17,16 @@ class Device { (/MSIE 10/.test(ua) && /; Touch/.test(ua))); } + initDom() { + const $$ = Dom7; + if ( this.sailfish ) { + $$('html').addClass('sailfish'); + } + + $$('html').addClass(this.phone ? 'phone' : 'tablet'); + // $$(window).on('resize', _.bind(this.onWindowResize, this)); + } + get phone() { return this.isPhone } @@ -37,5 +48,5 @@ class Device { } } -const device = new Device(); +const device = new WrapDevice(); export {device as Device}; diff --git a/apps/documenteditor/mobile/src/view/app.jsx b/apps/documenteditor/mobile/src/view/app.jsx index c91b4b6e9..4830c273c 100644 --- a/apps/documenteditor/mobile/src/view/app.jsx +++ b/apps/documenteditor/mobile/src/view/app.jsx @@ -8,6 +8,7 @@ import '../../../../common/Gateway.js'; import '../../../../common/main/lib/util/utils.js'; import Notifications from '../../../../common/mobile/utils/notifications.js' import MainController from '../controller/Main'; +import {Device} from '../../../../common/mobile/utils/device' export default class extends React.Component { constructor() { @@ -82,6 +83,7 @@ export default class extends React.Component { componentDidMount() { this.$f7ready((f7) => { // Call F7 APIs here + Device.initDom(); }); this.refs.mainController.initSdk(); diff --git a/apps/presentationeditor/mobile/src/page/app.jsx b/apps/presentationeditor/mobile/src/page/app.jsx index d8451deb7..c1349b71d 100644 --- a/apps/presentationeditor/mobile/src/page/app.jsx +++ b/apps/presentationeditor/mobile/src/page/app.jsx @@ -8,6 +8,7 @@ import '../../../../common/Gateway.js'; import '../../../../common/main/lib/util/utils.js'; import Notifications from '../../../../common/mobile/utils/notifications.js' import {MainController} from '../controller/Main'; +import {Device} from '../../../../common/mobile/utils/device' export default class extends React.Component { constructor() { @@ -38,7 +39,7 @@ export default class extends React.Component { componentDidMount() { this.$f7ready((f7) => { - // Call F7 APIs here + Device.initDom(); }); } }