2
0
Fork 0

MOBILE-3532 utils: Use device info instead of platform class

main
Pau Ferrer Ocaña 2020-08-31 22:11:48 +02:00
parent 4ba6f0b6fa
commit fd92f7cb03
1 changed files with 4 additions and 2 deletions

View File

@ -17,6 +17,7 @@ import { Platform, App, NavController, MenuController } from 'ionic-angular';
import { Keyboard } from '@ionic-native/keyboard'; import { Keyboard } from '@ionic-native/keyboard';
import { Network } from '@ionic-native/network'; import { Network } from '@ionic-native/network';
import { StatusBar } from '@ionic-native/status-bar'; import { StatusBar } from '@ionic-native/status-bar';
import { Device } from '@ionic-native/device';
import { CoreDbProvider } from './db'; import { CoreDbProvider } from './db';
import { CoreLoggerProvider } from './logger'; import { CoreLoggerProvider } from './logger';
@ -178,6 +179,7 @@ export class CoreAppProvider {
zone: NgZone, zone: NgZone,
private menuCtrl: MenuController, private menuCtrl: MenuController,
private statusBar: StatusBar, private statusBar: StatusBar,
private device: Device,
appRef: ApplicationRef) { appRef: ApplicationRef) {
this.logger = logger.getInstance('CoreAppProvider'); this.logger = logger.getInstance('CoreAppProvider');
@ -390,7 +392,7 @@ export class CoreAppProvider {
* @return Whether the app is running in an Android mobile or tablet device. * @return Whether the app is running in an Android mobile or tablet device.
*/ */
isAndroid(): boolean { isAndroid(): boolean {
return this.platform.is('android'); return this.isMobile() && this.device.platform.toLowerCase() == 'android';
} }
/** /**
@ -410,7 +412,7 @@ export class CoreAppProvider {
* @return Whether the app is running in an iOS mobile or tablet device. * @return Whether the app is running in an iOS mobile or tablet device.
*/ */
isIOS(): boolean { isIOS(): boolean {
return this.platform.is('ios'); return this.isMobile() && this.device.platform.toLowerCase() == 'ios';
} }
/** /**