UNPKG

@geogirafe/lib-geoportal

Version:

GeoGirafe is a flexible application to build online geoportals.

70 lines (69 loc) 4.89 kB
// SPDX-License-Identifier: Apache-2.0 import AlignNorthButtonMobile from '../../components/alignnorthbutton-mobile/component.js'; import MobileOauthComponent from '../../components/auth-mobile/component.js'; import MobileThemeComponent from '../../components/themes-mobile/themes-select/component.js'; import DisplayMenuButtonMobile from '../../components/displaymenubutton-mobile/component.js'; import DisplaySelectorButtonMobile from '../../components/displayselectorbutton-mobile/component.js'; import DrawingContainerMobile from '../../components/drawing-container-mobile/component.js'; import DrawingComponentMobile from '../../components/drawing/component-mobile.js'; import GeolocationMobile from '../../components/geolocation-mobile/component.js'; import InfoboxComponent from '../../components/infobox/component.js'; import MapComponent from '../../components/map/component.js'; import MenuMobile3dButton from '../../components/menu-buttons-mobile/MenuMobile3dButton.js'; import MenuMobileDrawingButton from '../../components/menu-buttons-mobile/MenuMobileDrawingButton.js'; import MenuMobileOfflineButton from '../../components/menu-buttons-mobile/MenuMobileOfflineButton.js'; import MenuMobile from '../../components/menu-mobile/component.js'; import ModalsComponent from '../../components/modals/component.js'; import OfflineComponent from '../../components/offline/component.js'; import MobileSearchComponent from '../../components/search-mobile/component.js'; import SelectionPanelMobile from '../../components/selectionpanel-mobile/component.js'; import SwipeUpPanelMobile from '../../components/swipe-up-panel-mobile/component.js'; import GeoGirafeApp from './geogirafeapp.js'; import MobileThemeElementComponent from '../../components/themes-mobile/theme/component.js'; import MobileGroupElementComponent from '../../components/themes-mobile/group/component.js'; import MobileLayerElementComponent from '../../components/themes-mobile/layer/component.js'; import MobileSelectedLayerElementComponent from '../../components/themes-mobile/layer-selected/component.js'; import GetDirectionsArtifact from '../../components/getdirections/component.js'; export default class GeoGirafeAppMobile extends GeoGirafeApp { initializeInterface() { if (window.cordova) { // If this runs in Cordova, we have to wait the deviceready event to be able to use the connectivity plugin document.addEventListener('deviceready', () => { const networkState = navigator.connection.type; const isOffline = networkState === Connection.NONE; this.context.offlineManager.initializeOfflineState(isOffline); }, false); } else { // Otherwise, just do it without waiting this.context.offlineManager.initializeOfflineState(!navigator.onLine); } this.context.stateManager.state.interface.isMobile = true; } defineCoreComponents() { customElements.define('girafe-infobox', InfoboxComponent); customElements.define('girafe-map', MapComponent); customElements.define('girafe-search', MobileSearchComponent); customElements.define('girafe-offline', OfflineComponent); customElements.define('girafe-theme-select', MobileThemeComponent); customElements.define('girafe-display-selector-button-mobile', DisplaySelectorButtonMobile); customElements.define('girafe-display-menu-button-mobile', DisplayMenuButtonMobile); customElements.define('girafe-menu-mobile', MenuMobile); customElements.define('girafe-modals', ModalsComponent); customElements.define('girafe-swipe-up-panel', SwipeUpPanelMobile); customElements.define('girafe-align-north-button-mobile', AlignNorthButtonMobile); customElements.define('girafe-selection-panel-mobile', SelectionPanelMobile); customElements.define('girafe-geolocation-mobile', GeolocationMobile); customElements.define('girafe-drawing-mobile', DrawingComponentMobile); customElements.define('girafe-drawing-container-mobile', DrawingContainerMobile); customElements.define('girafe-menu-mobile-3d-button', MenuMobile3dButton); customElements.define('girafe-menu-mobile-offline-button', MenuMobileOfflineButton); customElements.define('girafe-menu-mobile-drawing-button', MenuMobileDrawingButton); customElements.define('girafe-oauth-mobile', MobileOauthComponent); customElements.define('girafe-theme', MobileThemeElementComponent); customElements.define('girafe-group', MobileGroupElementComponent); customElements.define('girafe-layer', MobileLayerElementComponent); customElements.define('girafe-layer-selected', MobileSelectedLayerElementComponent); customElements.define('girafe-get-directions', GetDirectionsArtifact); } }