MOBILE-3532 ionic: Apply ios mode on iPadOS
parent
dbae55bff2
commit
c69d108c11
|
@ -13,7 +13,7 @@
|
|||
// limitations under the License.
|
||||
|
||||
import { Component, OnInit, NgZone } from '@angular/core';
|
||||
import { Platform, IonicApp } from 'ionic-angular';
|
||||
import { Config, Platform, IonicApp } from 'ionic-angular';
|
||||
import { Network } from '@ionic-native/network';
|
||||
import { CoreApp, CoreAppProvider } from '@providers/app';
|
||||
import { CoreEventsProvider } from '@providers/events';
|
||||
|
@ -28,6 +28,7 @@ import { Keyboard } from '@ionic-native/keyboard';
|
|||
import { ScreenOrientation } from '@ionic-native/screen-orientation';
|
||||
import { CoreLoginSitesPage } from '@core/login/pages/sites/sites';
|
||||
import { CoreWindow } from '@singletons/window';
|
||||
import { Device } from '@ionic-native/device';
|
||||
|
||||
@Component({
|
||||
templateUrl: 'app.html'
|
||||
|
@ -40,13 +41,62 @@ export class MoodleMobileApp implements OnInit {
|
|||
protected lastUrls = {};
|
||||
protected lastInAppUrl: string;
|
||||
|
||||
constructor(private platform: Platform, logger: CoreLoggerProvider, keyboard: Keyboard, private app: IonicApp,
|
||||
private eventsProvider: CoreEventsProvider, private loginHelper: CoreLoginHelperProvider, private zone: NgZone,
|
||||
private appProvider: CoreAppProvider, private langProvider: CoreLangProvider, private sitesProvider: CoreSitesProvider,
|
||||
private screenOrientation: ScreenOrientation, private urlSchemesProvider: CoreCustomURLSchemesProvider,
|
||||
private utils: CoreUtilsProvider, private urlUtils: CoreUrlUtilsProvider, private network: Network) {
|
||||
constructor(
|
||||
private platform: Platform,
|
||||
logger: CoreLoggerProvider,
|
||||
keyboard: Keyboard,
|
||||
config: Config,
|
||||
device: Device,
|
||||
private app: IonicApp,
|
||||
private eventsProvider: CoreEventsProvider,
|
||||
private loginHelper: CoreLoginHelperProvider,
|
||||
private zone: NgZone,
|
||||
private appProvider: CoreAppProvider,
|
||||
private langProvider: CoreLangProvider,
|
||||
private sitesProvider: CoreSitesProvider,
|
||||
private screenOrientation: ScreenOrientation,
|
||||
private urlSchemesProvider: CoreCustomURLSchemesProvider,
|
||||
private utils: CoreUtilsProvider,
|
||||
private urlUtils: CoreUrlUtilsProvider,
|
||||
private network: Network
|
||||
) {
|
||||
this.logger = logger.getInstance('AppComponent');
|
||||
|
||||
if (this.appProvider.isIOS() && !platform.is('ios')) {
|
||||
// Solve problem with wrong detected iPadOS.
|
||||
const platforms = platform.platforms();
|
||||
const index = platforms.indexOf('core');
|
||||
if (index > -1) {
|
||||
platforms.splice(index, 1);
|
||||
}
|
||||
platforms.push('mobile');
|
||||
platforms.push('ios');
|
||||
platforms.push('ipad');
|
||||
platforms.push('tablet');
|
||||
|
||||
app.setElementClass('app-root-ios', true);
|
||||
platform.ready().then(() => {
|
||||
if (device.version) {
|
||||
const [major, minor]: string[] = device.version.split('.', 2);
|
||||
app.setElementClass('platform-ios' + major, true);
|
||||
app.setElementClass('platform-ios' + major + '_' + minor, true);
|
||||
}
|
||||
});
|
||||
|
||||
app._elementRef.nativeElement.classList.remove('app-root-md');
|
||||
|
||||
const iosConfig = config.getModeConfig('ios');
|
||||
|
||||
config.set('mode', 'ios');
|
||||
|
||||
Object.keys(iosConfig).forEach((key) => {
|
||||
// Already overriden: pageTransition, do not change.
|
||||
if (key != 'pageTransition') {
|
||||
config.set('ios', key, iosConfig[key]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
platform.ready().then(() => {
|
||||
// Okay, so the platform is ready and our plugins are available.
|
||||
// Here you can do any higher level native things you might need.
|
||||
|
|
Loading…
Reference in New Issue