mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
chore(): rename IonicPlatform to Platform
This commit is contained in:
@ -1,11 +1,11 @@
|
|||||||
import {IonicPlatform, Page, ActionSheet} from 'ionic/ionic';
|
import {Platform, Page, ActionSheet} from 'ionic/ionic';
|
||||||
|
|
||||||
@Page({
|
@Page({
|
||||||
templateUrl: 'actionSheet/actionSheet.html',
|
templateUrl: 'actionSheet/actionSheet.html',
|
||||||
})
|
})
|
||||||
export class ActionSheetPage {
|
export class ActionSheetPage {
|
||||||
|
|
||||||
constructor(actionSheet: ActionSheet, platform: IonicPlatform) {
|
constructor(actionSheet: ActionSheet, platform: Platform) {
|
||||||
this.actionSheet = actionSheet;
|
this.actionSheet = actionSheet;
|
||||||
console.log('actionSheet', actionSheet);
|
console.log('actionSheet', actionSheet);
|
||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {IonicPlatform, Page} from 'ionic/ionic';
|
import {Page} from 'ionic/ionic';
|
||||||
|
|
||||||
@Page({
|
@Page({
|
||||||
templateUrl: 'buttons/buttons.html',
|
templateUrl: 'buttons/buttons.html',
|
||||||
@ -88,4 +88,4 @@ export class ButtonsInComponentsPage {
|
|||||||
constructor() {
|
constructor() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {IonicPlatform, Page} from 'ionic/ionic';
|
import {Page} from 'ionic/ionic';
|
||||||
|
|
||||||
@Page({
|
@Page({
|
||||||
templateUrl: 'cards/cards.html',
|
templateUrl: 'cards/cards.html',
|
||||||
@ -7,4 +7,4 @@ export class CardsPage {
|
|||||||
constructor() {
|
constructor() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {IonicPlatform, Page} from 'ionic/ionic';
|
import {Page} from 'ionic/ionic';
|
||||||
|
|
||||||
@Page({
|
@Page({
|
||||||
templateUrl: 'icons/icons.html',
|
templateUrl: 'icons/icons.html',
|
||||||
@ -7,4 +7,4 @@ export class IconsPage {
|
|||||||
constructor() {
|
constructor() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {App, IonicApp, IonicPlatform, ActionSheet} from 'ionic/ionic';
|
import {App, IonicApp, Platform, ActionSheet} from 'ionic/ionic';
|
||||||
import {Page, Config, Events} from 'ionic/ionic';
|
import {Page, Config, Events} from 'ionic/ionic';
|
||||||
import {ActionSheetPage} from './actionSheet/actionSheet';
|
import {ActionSheetPage} from './actionSheet/actionSheet';
|
||||||
import * as helpers from './helpers';
|
import * as helpers from './helpers';
|
||||||
@ -11,7 +11,7 @@ class DemoApp {
|
|||||||
|
|
||||||
rootPage: any;
|
rootPage: any;
|
||||||
|
|
||||||
constructor(app: IonicApp, platform: IonicPlatform) {
|
constructor(app: IonicApp, platform: Platform) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {IonicPlatform, Page} from 'ionic/ionic';
|
import {Page} from 'ionic/ionic';
|
||||||
|
|
||||||
@Page({
|
@Page({
|
||||||
templateUrl: 'lists/lists.html',
|
templateUrl: 'lists/lists.html',
|
||||||
@ -7,4 +7,4 @@ export class ListsPage {
|
|||||||
constructor() {
|
constructor() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {IonicPlatform, Page, Popup} from 'ionic/ionic';
|
import {Page, Popup} from 'ionic/ionic';
|
||||||
|
|
||||||
@Page({
|
@Page({
|
||||||
templateUrl: 'popups/popups.html',
|
templateUrl: 'popups/popups.html',
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {IonicPlatform, Page} from 'ionic/ionic';
|
import {Page} from 'ionic/ionic';
|
||||||
|
|
||||||
@Page({
|
@Page({
|
||||||
templateUrl: 'slides/slides.html',
|
templateUrl: 'slides/slides.html',
|
||||||
@ -7,4 +7,4 @@ export class SlidesPage {
|
|||||||
constructor() {
|
constructor() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {App, IonicView, IonicApp, Config, IonicPlatform} from 'ionic/ionic';
|
import {App, IonicView, IonicApp, Config, Platform} from 'ionic/ionic';
|
||||||
import {Modal, ActionSheet, NavController, NavParams, Animation} from 'ionic/ionic';
|
import {Modal, ActionSheet, NavController, NavParams, Animation} from 'ionic/ionic';
|
||||||
|
|
||||||
|
|
||||||
@ -7,7 +7,7 @@ import {Modal, ActionSheet, NavController, NavParams, Animation} from 'ionic/ion
|
|||||||
})
|
})
|
||||||
class MyAppCmp {
|
class MyAppCmp {
|
||||||
|
|
||||||
constructor(modal: Modal, app: IonicApp, config: Config, platform: IonicPlatform) {
|
constructor(modal: Modal, app: IonicApp, config: Config, platform: Platform) {
|
||||||
this.modal = modal;
|
this.modal = modal;
|
||||||
|
|
||||||
console.log('platforms', platform.platforms());
|
console.log('platforms', platform.platforms());
|
||||||
|
@ -4,7 +4,7 @@ import {Ion} from '../ion';
|
|||||||
import {IonicApp} from '../app/app';
|
import {IonicApp} from '../app/app';
|
||||||
import {Config} from '../../config/config';
|
import {Config} from '../../config/config';
|
||||||
import {ConfigComponent} from '../../config/decorators';
|
import {ConfigComponent} from '../../config/decorators';
|
||||||
import {IonicPlatform} from '../../platform/platform';
|
import {Platform} from '../../platform/platform';
|
||||||
import {IonicKeyboard} from '../../util/keyboard';
|
import {IonicKeyboard} from '../../util/keyboard';
|
||||||
import * as gestures from './menu-gestures';
|
import * as gestures from './menu-gestures';
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ export class Menu extends Ion {
|
|||||||
app: IonicApp,
|
app: IonicApp,
|
||||||
elementRef: ElementRef,
|
elementRef: ElementRef,
|
||||||
config: Config,
|
config: Config,
|
||||||
platform: IonicPlatform,
|
platform: Platform,
|
||||||
keyboard: IonicKeyboard
|
keyboard: IonicKeyboard
|
||||||
) {
|
) {
|
||||||
super(elementRef, config);
|
super(elementRef, config);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {App, Page, IonicApp, Config, IonicPlatform} from 'ionic/ionic';
|
import {App, Page, IonicApp, Config, Platform} from 'ionic/ionic';
|
||||||
import {Modal, ActionSheet, NavController, NavParams, Animation} from 'ionic/ionic';
|
import {Modal, ActionSheet, NavController, NavParams, Animation} from 'ionic/ionic';
|
||||||
|
|
||||||
|
|
||||||
@ -7,7 +7,7 @@ import {Modal, ActionSheet, NavController, NavParams, Animation} from 'ionic/ion
|
|||||||
})
|
})
|
||||||
class MyAppCmp {
|
class MyAppCmp {
|
||||||
|
|
||||||
constructor(modal: Modal, app: IonicApp, config: Config, platform: IonicPlatform) {
|
constructor(modal: Modal, app: IonicApp, config: Config, platform: Platform) {
|
||||||
this.modal = modal;
|
this.modal = modal;
|
||||||
|
|
||||||
console.log('platforms', platform.platforms());
|
console.log('platforms', platform.platforms());
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {Directive, Attribute, NgZone} from 'angular2/angular2'
|
import {Directive, Attribute, NgZone} from 'angular2/angular2'
|
||||||
|
|
||||||
import {IonicPlatform} from '../../platform/platform';
|
import {Platform} from '../../platform/platform';
|
||||||
|
|
||||||
|
|
||||||
class DisplayWhen {
|
class DisplayWhen {
|
||||||
@ -68,7 +68,7 @@ export class ShowWhen extends DisplayWhen {
|
|||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
@Attribute('show-when') showWhen: string,
|
@Attribute('show-when') showWhen: string,
|
||||||
platform: IonicPlatform,
|
platform: Platform,
|
||||||
ngZone: NgZone
|
ngZone: NgZone
|
||||||
) {
|
) {
|
||||||
super(showWhen, platform, ngZone);
|
super(showWhen, platform, ngZone);
|
||||||
@ -97,7 +97,7 @@ export class HideWhen extends DisplayWhen {
|
|||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
@Attribute('hide-when') hideWhen: string,
|
@Attribute('hide-when') hideWhen: string,
|
||||||
platform: IonicPlatform,
|
platform: Platform,
|
||||||
ngZone: NgZone
|
ngZone: NgZone
|
||||||
) {
|
) {
|
||||||
super(hideWhen, platform, ngZone);
|
super(hideWhen, platform, ngZone);
|
||||||
|
@ -6,7 +6,7 @@ import {Label} from './label';
|
|||||||
import {IonicApp} from '../app/app';
|
import {IonicApp} from '../app/app';
|
||||||
import {Content} from '../content/content';
|
import {Content} from '../content/content';
|
||||||
import * as dom from '../../util/dom';
|
import * as dom from '../../util/dom';
|
||||||
import {IonicPlatform} from '../../platform/platform';
|
import {Platform} from '../../platform/platform';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,7 +33,7 @@ export class TextInput {
|
|||||||
renderer: Renderer,
|
renderer: Renderer,
|
||||||
app: IonicApp,
|
app: IonicApp,
|
||||||
zone: NgZone,
|
zone: NgZone,
|
||||||
platform: IonicPlatform,
|
platform: Platform,
|
||||||
@Optional() @Host() scrollView: Content
|
@Optional() @Host() scrollView: Content
|
||||||
) {
|
) {
|
||||||
renderer.setElementClass(elementRef, 'item', true);
|
renderer.setElementClass(elementRef, 'item', true);
|
||||||
|
@ -3,7 +3,7 @@ import {ROUTER_PROVIDERS, LocationStrategy, HashLocationStrategy} from 'angular2
|
|||||||
|
|
||||||
import {IonicApp} from '../components/app/app';
|
import {IonicApp} from '../components/app/app';
|
||||||
import {Config} from './config';
|
import {Config} from './config';
|
||||||
import {IonicPlatform} from '../platform/platform';
|
import {Platform} from '../platform/platform';
|
||||||
import {OverlayController} from '../components/overlay/overlay-controller';
|
import {OverlayController} from '../components/overlay/overlay-controller';
|
||||||
import {IonicForm} from '../util/form';
|
import {IonicForm} from '../util/form';
|
||||||
import {IonicKeyboard} from '../util/keyboard';
|
import {IonicKeyboard} from '../util/keyboard';
|
||||||
@ -21,7 +21,7 @@ import * as dom from '../util/dom';
|
|||||||
|
|
||||||
export function ionicProviders(config) {
|
export function ionicProviders(config) {
|
||||||
let app = new IonicApp();
|
let app = new IonicApp();
|
||||||
let platform = new IonicPlatform();
|
let platform = new Platform();
|
||||||
|
|
||||||
if (!(config instanceof Config)) {
|
if (!(config instanceof Config)) {
|
||||||
config = new Config(config);
|
config = new Config(config);
|
||||||
@ -46,7 +46,7 @@ export function ionicProviders(config) {
|
|||||||
return [
|
return [
|
||||||
provide(IonicApp, {useValue: app}),
|
provide(IonicApp, {useValue: app}),
|
||||||
provide(Config, {useValue: config}),
|
provide(Config, {useValue: config}),
|
||||||
provide(IonicPlatform, {useValue: platform}),
|
provide(Platform, {useValue: platform}),
|
||||||
provide(TapClick, {useValue: tapClick}),
|
provide(TapClick, {useValue: tapClick}),
|
||||||
provide(FeatureDetect, {useValue: featureDetect}),
|
provide(FeatureDetect, {useValue: featureDetect}),
|
||||||
provide(Events, {useValue: events}),
|
provide(Events, {useValue: events}),
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Config allows you to set the modes of your components
|
* Config allows you to set the modes of your components
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {IonicPlatform} from '../platform/platform';
|
import {Platform} from '../platform/platform';
|
||||||
import {isObject, isDefined, isFunction, isArray, extend} from '../util/util';
|
import {isObject, isDefined, isFunction, isArray, extend} from '../util/util';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,7 +152,7 @@ export class Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get default platform's setting
|
// get default platform's setting
|
||||||
configObj = IonicPlatform.get(activePlatformKeys[i]);
|
configObj = Platform.get(activePlatformKeys[i]);
|
||||||
if (configObj && configObj.settings) {
|
if (configObj && configObj.settings) {
|
||||||
|
|
||||||
if (isDefined(configObj.settings[key])) {
|
if (isDefined(configObj.settings[key])) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {Config, IonicPlatform, ionicProviders} from 'ionic/ionic';
|
import {Config, Platform, ionicProviders} from 'ionic/ionic';
|
||||||
|
|
||||||
export function run() {
|
export function run() {
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ export function run() {
|
|||||||
let config = new Config({
|
let config = new Config({
|
||||||
mode: 'md'
|
mode: 'md'
|
||||||
});
|
});
|
||||||
let platform = new IonicPlatform(['ios']);
|
let platform = new Platform(['ios']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
expect(config.get('mode')).toEqual('md');
|
expect(config.get('mode')).toEqual('md');
|
||||||
@ -50,7 +50,7 @@ export function run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let platform = new IonicPlatform(['ios']);
|
let platform = new Platform(['ios']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
expect(config.get('mode')).toEqual('md');
|
expect(config.get('mode')).toEqual('md');
|
||||||
@ -69,7 +69,7 @@ export function run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let platform = new IonicPlatform(['mobile']);
|
let platform = new Platform(['mobile']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
expect(config.get('mode')).toEqual('modeB');
|
expect(config.get('mode')).toEqual('modeB');
|
||||||
@ -79,7 +79,7 @@ export function run() {
|
|||||||
let config = new Config({
|
let config = new Config({
|
||||||
mode: 'modeA'
|
mode: 'modeA'
|
||||||
});
|
});
|
||||||
let platform = new IonicPlatform(['core']);
|
let platform = new Platform(['core']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
expect(config.get('mode')).toEqual('modeA');
|
expect(config.get('mode')).toEqual('modeA');
|
||||||
@ -89,7 +89,7 @@ export function run() {
|
|||||||
let config = new Config({
|
let config = new Config({
|
||||||
hoverCSS: true
|
hoverCSS: true
|
||||||
});
|
});
|
||||||
let platform = new IonicPlatform(['ios']);
|
let platform = new Platform(['ios']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
expect(config.get('hoverCSS')).toEqual(true);
|
expect(config.get('hoverCSS')).toEqual(true);
|
||||||
@ -97,7 +97,7 @@ export function run() {
|
|||||||
|
|
||||||
it('should get ios mode for core platform', () => {
|
it('should get ios mode for core platform', () => {
|
||||||
let config = new Config();
|
let config = new Config();
|
||||||
let platform = new IonicPlatform(['core']);
|
let platform = new Platform(['core']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
expect(config.get('mode')).toEqual('ios');
|
expect(config.get('mode')).toEqual('ios');
|
||||||
@ -105,7 +105,7 @@ export function run() {
|
|||||||
|
|
||||||
it('should get ios mode for ipad platform', () => {
|
it('should get ios mode for ipad platform', () => {
|
||||||
let config = new Config();
|
let config = new Config();
|
||||||
let platform = new IonicPlatform(['mobile', 'ios', 'ipad', 'tablet']);
|
let platform = new Platform(['mobile', 'ios', 'ipad', 'tablet']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
expect(config.get('mode')).toEqual('ios');
|
expect(config.get('mode')).toEqual('ios');
|
||||||
@ -113,7 +113,7 @@ export function run() {
|
|||||||
|
|
||||||
it('should get md mode for windowsphone platform', () => {
|
it('should get md mode for windowsphone platform', () => {
|
||||||
let config = new Config();
|
let config = new Config();
|
||||||
let platform = new IonicPlatform(['mobile', 'windowsphone']);
|
let platform = new Platform(['mobile', 'windowsphone']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
expect(config.get('mode')).toEqual('md');
|
expect(config.get('mode')).toEqual('md');
|
||||||
@ -121,7 +121,7 @@ export function run() {
|
|||||||
|
|
||||||
it('should get md mode for android platform', () => {
|
it('should get md mode for android platform', () => {
|
||||||
let config = new Config();
|
let config = new Config();
|
||||||
let platform = new IonicPlatform(['mobile', 'android']);
|
let platform = new Platform(['mobile', 'android']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
expect(config.get('mode')).toEqual('md');
|
expect(config.get('mode')).toEqual('md');
|
||||||
@ -136,7 +136,7 @@ export function run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let platform = new IonicPlatform(['ios']);
|
let platform = new Platform(['ios']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
expect(config.get('tabBarPlacement')).toEqual('top');
|
expect(config.get('tabBarPlacement')).toEqual('top');
|
||||||
@ -146,7 +146,7 @@ export function run() {
|
|||||||
let config = new Config({
|
let config = new Config({
|
||||||
tabBarPlacement: 'top'
|
tabBarPlacement: 'top'
|
||||||
});
|
});
|
||||||
let platform = new IonicPlatform(['ios']);
|
let platform = new Platform(['ios']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
expect(config.get('tabBarPlacement')).toEqual('top');
|
expect(config.get('tabBarPlacement')).toEqual('top');
|
||||||
@ -154,7 +154,7 @@ export function run() {
|
|||||||
|
|
||||||
it('should get setting from md mode', () => {
|
it('should get setting from md mode', () => {
|
||||||
let config = new Config();
|
let config = new Config();
|
||||||
let platform = new IonicPlatform(['android']);
|
let platform = new Platform(['android']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
expect(config.get('tabBarPlacement')).toEqual('top');
|
expect(config.get('tabBarPlacement')).toEqual('top');
|
||||||
@ -162,7 +162,7 @@ export function run() {
|
|||||||
|
|
||||||
it('should get setting from ios mode', () => {
|
it('should get setting from ios mode', () => {
|
||||||
let config = new Config();
|
let config = new Config();
|
||||||
let platform = new IonicPlatform(['ios']);
|
let platform = new Platform(['ios']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
expect(config.get('tabBarPlacement')).toEqual('bottom');
|
expect(config.get('tabBarPlacement')).toEqual('bottom');
|
||||||
@ -170,7 +170,7 @@ export function run() {
|
|||||||
|
|
||||||
it('should set/get platform setting from set()', () => {
|
it('should set/get platform setting from set()', () => {
|
||||||
let config = new Config();
|
let config = new Config();
|
||||||
let platform = new IonicPlatform(['ios']);
|
let platform = new Platform(['ios']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
config.set('tabBarPlacement', 'bottom');
|
config.set('tabBarPlacement', 'bottom');
|
||||||
@ -181,7 +181,7 @@ export function run() {
|
|||||||
|
|
||||||
it('should set/get setting from set()', () => {
|
it('should set/get setting from set()', () => {
|
||||||
let config = new Config();
|
let config = new Config();
|
||||||
let platform = new IonicPlatform(['ios']);
|
let platform = new Platform(['ios']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
config.set('tabBarPlacement', 'top');
|
config.set('tabBarPlacement', 'top');
|
||||||
@ -191,7 +191,7 @@ export function run() {
|
|||||||
|
|
||||||
it('should set ios platform settings from settings()', () => {
|
it('should set ios platform settings from settings()', () => {
|
||||||
let config = new Config();
|
let config = new Config();
|
||||||
let platform = new IonicPlatform(['ios']);
|
let platform = new Platform(['ios']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
config.settings('ios', {
|
config.settings('ios', {
|
||||||
@ -203,7 +203,7 @@ export function run() {
|
|||||||
|
|
||||||
it('should set/get mobile setting even w/ higher priority ios', () => {
|
it('should set/get mobile setting even w/ higher priority ios', () => {
|
||||||
let config = new Config();
|
let config = new Config();
|
||||||
let platform = new IonicPlatform(['mobile', 'ios']);
|
let platform = new Platform(['mobile', 'ios']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
config.settings({
|
config.settings({
|
||||||
@ -220,7 +220,7 @@ export function run() {
|
|||||||
|
|
||||||
it('should set/get mobile setting even w/ higher priority ios', () => {
|
it('should set/get mobile setting even w/ higher priority ios', () => {
|
||||||
let config = new Config();
|
let config = new Config();
|
||||||
let platform = new IonicPlatform(['mobile', 'ios']);
|
let platform = new Platform(['mobile', 'ios']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
config.settings({
|
config.settings({
|
||||||
@ -237,7 +237,7 @@ export function run() {
|
|||||||
|
|
||||||
it('should set/get android setting w/ higher priority than mobile', () => {
|
it('should set/get android setting w/ higher priority than mobile', () => {
|
||||||
let config = new Config();
|
let config = new Config();
|
||||||
let platform = new IonicPlatform(['mobile', 'android']);
|
let platform = new Platform(['mobile', 'android']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
config.settings({
|
config.settings({
|
||||||
@ -257,7 +257,7 @@ export function run() {
|
|||||||
|
|
||||||
it('should set/get ios setting w/ platforms set', () => {
|
it('should set/get ios setting w/ platforms set', () => {
|
||||||
let config = new Config();
|
let config = new Config();
|
||||||
let platform = new IonicPlatform(['ios']);
|
let platform = new Platform(['ios']);
|
||||||
config.setPlatform(platform);
|
config.setPlatform(platform);
|
||||||
|
|
||||||
config.settings({
|
config.settings({
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
+* @name platform
|
+* @name platform
|
||||||
+* @module ionic
|
+* @module ionic
|
||||||
+* @description
|
+* @description
|
||||||
+* IonicPlatform returns the availble information about your current platform
|
+* Platform returns the availble information about your current platform
|
||||||
+*/
|
+*/
|
||||||
|
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ import * as dom from '../util/dom';
|
|||||||
/**
|
/**
|
||||||
* TODO
|
* TODO
|
||||||
*/
|
*/
|
||||||
export class IonicPlatform {
|
export class Platform {
|
||||||
|
|
||||||
constructor(platforms=[]) {
|
constructor(platforms=[]) {
|
||||||
this._platforms = platforms;
|
this._platforms = platforms;
|
||||||
@ -33,9 +33,9 @@ export class IonicPlatform {
|
|||||||
* @returns {bool}
|
* @returns {bool}
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* import {IonicPlatform} 'ionic/ionic';
|
* import {Platform} 'ionic/ionic';
|
||||||
* export MyClass {
|
* export MyClass {
|
||||||
* constructor(platform: IonicPlatform){
|
* constructor(platform: Platform){
|
||||||
* this.platform = platform;
|
* this.platform = platform;
|
||||||
* if(this.platform.is('ios'){
|
* if(this.platform.is('ios'){
|
||||||
* // what ever you need to do for
|
* // what ever you need to do for
|
||||||
@ -57,9 +57,9 @@ export class IonicPlatform {
|
|||||||
* it would return mobile, ios, and iphone.
|
* it would return mobile, ios, and iphone.
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* import {IonicPlatform} 'ionic/ionic';
|
* import {Platform} 'ionic/ionic';
|
||||||
* export MyClass {
|
* export MyClass {
|
||||||
* constructor(platform: IonicPlatform){
|
* constructor(platform: Platform){
|
||||||
* this.platform = platform;
|
* this.platform = platform;
|
||||||
* console.log(this.platform.platforms());
|
* console.log(this.platform.platforms());
|
||||||
* // This will return an array of all the availble platforms
|
* // This will return an array of all the availble platforms
|
||||||
@ -82,9 +82,9 @@ export class IonicPlatform {
|
|||||||
* Returns an object containing the os version
|
* Returns an object containing the os version
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* import {IonicPlatform} 'ionic/ionic';
|
* import {Platform} 'ionic/ionic';
|
||||||
* export MyClass {
|
* export MyClass {
|
||||||
* constructor(platform: IonicPlatform){
|
* constructor(platform: Platform){
|
||||||
* this.platform = platform;
|
* this.platform = platform;
|
||||||
* console.log(this.platform.versions('android'));
|
* console.log(this.platform.versions('android'));
|
||||||
* // Returns an object with the os version as a string,
|
* // Returns an object with the os version as a string,
|
||||||
@ -112,9 +112,9 @@ export class IonicPlatform {
|
|||||||
* Returns a promise when the platform is ready and native functionality can be called
|
* Returns a promise when the platform is ready and native functionality can be called
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* import {IonicPlatform} 'ionic/ionic';
|
* import {Platform} 'ionic/ionic';
|
||||||
* export MyClass {
|
* export MyClass {
|
||||||
* constructor(platform: IonicPlatform){
|
* constructor(platform: Platform){
|
||||||
* this.platform = platform;
|
* this.platform = platform;
|
||||||
* this.platform.ready().then(() => {
|
* this.platform.ready().then(() => {
|
||||||
* console.log('Platform ready');
|
* console.log('Platform ready');
|
||||||
@ -450,7 +450,7 @@ function insertSuperset(platformNode) {
|
|||||||
class PlatformNode {
|
class PlatformNode {
|
||||||
|
|
||||||
constructor(platformName) {
|
constructor(platformName) {
|
||||||
this.c = IonicPlatform.get(platformName);
|
this.c = Platform.get(platformName);
|
||||||
this.isEngine = this.c.isEngine;
|
this.isEngine = this.c.isEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,7 +538,7 @@ class PlatformNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getSubsetParents(subsetPlatformName) {
|
getSubsetParents(subsetPlatformName) {
|
||||||
let platformRegistry = IonicPlatform.registry();
|
let platformRegistry = Platform.registry();
|
||||||
|
|
||||||
let parentPlatformNames = [];
|
let parentPlatformNames = [];
|
||||||
let platform = null;
|
let platform = null;
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
import {IonicPlatform} from './platform';
|
import {Platform} from './platform';
|
||||||
import {windowLoad} from '../util/dom';
|
import {windowLoad} from '../util/dom';
|
||||||
|
|
||||||
|
|
||||||
IonicPlatform.register({
|
Platform.register({
|
||||||
name: 'core',
|
name: 'core',
|
||||||
settings: {
|
settings: {
|
||||||
mode: 'ios',
|
mode: 'ios',
|
||||||
keyboardHeight: 290,
|
keyboardHeight: 290,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
IonicPlatform.setDefault('core');
|
Platform.setDefault('core');
|
||||||
|
|
||||||
|
|
||||||
IonicPlatform.register({
|
Platform.register({
|
||||||
name: 'mobile'
|
name: 'mobile'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
IonicPlatform.register({
|
Platform.register({
|
||||||
name: 'phablet',
|
name: 'phablet',
|
||||||
isMatch(p) {
|
isMatch(p) {
|
||||||
let smallest = Math.min(p.width(), p.height());
|
let smallest = Math.min(p.width(), p.height());
|
||||||
@ -28,7 +28,7 @@ IonicPlatform.register({
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
IonicPlatform.register({
|
Platform.register({
|
||||||
name: 'tablet',
|
name: 'tablet',
|
||||||
isMatch(p) {
|
isMatch(p) {
|
||||||
let smallest = Math.min(p.width(), p.height());
|
let smallest = Math.min(p.width(), p.height());
|
||||||
@ -39,7 +39,7 @@ IonicPlatform.register({
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
IonicPlatform.register({
|
Platform.register({
|
||||||
name: 'android',
|
name: 'android',
|
||||||
superset: 'mobile',
|
superset: 'mobile',
|
||||||
subsets: [
|
subsets: [
|
||||||
@ -62,7 +62,7 @@ IonicPlatform.register({
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
IonicPlatform.register({
|
Platform.register({
|
||||||
name: 'ios',
|
name: 'ios',
|
||||||
superset: 'mobile',
|
superset: 'mobile',
|
||||||
subsets: [
|
subsets: [
|
||||||
@ -91,7 +91,7 @@ IonicPlatform.register({
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
IonicPlatform.register({
|
Platform.register({
|
||||||
name: 'ipad',
|
name: 'ipad',
|
||||||
superset: 'tablet',
|
superset: 'tablet',
|
||||||
settings: {
|
settings: {
|
||||||
@ -103,7 +103,7 @@ IonicPlatform.register({
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
IonicPlatform.register({
|
Platform.register({
|
||||||
name: 'iphone',
|
name: 'iphone',
|
||||||
subsets: [
|
subsets: [
|
||||||
'phablet'
|
'phablet'
|
||||||
@ -114,7 +114,7 @@ IonicPlatform.register({
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
IonicPlatform.register({
|
Platform.register({
|
||||||
name: 'windowsphone',
|
name: 'windowsphone',
|
||||||
superset: 'mobile',
|
superset: 'mobile',
|
||||||
subsets: [
|
subsets: [
|
||||||
@ -133,7 +133,7 @@ IonicPlatform.register({
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
IonicPlatform.register({
|
Platform.register({
|
||||||
name: 'cordova',
|
name: 'cordova',
|
||||||
isEngine: true,
|
isEngine: true,
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import {IonicPlatform} from 'ionic/ionic';
|
import {Platform} from 'ionic/ionic';
|
||||||
|
|
||||||
export function run() {
|
export function run() {
|
||||||
|
|
||||||
it('should set core as the fallback', () => {
|
it('should set core as the fallback', () => {
|
||||||
let platform = new IonicPlatform();
|
let platform = new Platform();
|
||||||
platform.userAgent('idk');
|
platform.userAgent('idk');
|
||||||
platform.load();
|
platform.load();
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ export function run() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should set android via platformOverride, despite ios user agent', () => {
|
it('should set android via platformOverride, despite ios user agent', () => {
|
||||||
let platform = new IonicPlatform();
|
let platform = new Platform();
|
||||||
platform.userAgent(IPAD_UA);
|
platform.userAgent(IPAD_UA);
|
||||||
platform.load('android');
|
platform.load('android');
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ export function run() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should set ios via platformOverride, despite android querystring', () => {
|
it('should set ios via platformOverride, despite android querystring', () => {
|
||||||
let platform = new IonicPlatform();
|
let platform = new Platform();
|
||||||
platform.url('/?ionicplatform=android');
|
platform.url('/?ionicplatform=android');
|
||||||
platform.load('ios');
|
platform.load('ios');
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ export function run() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should set ios via platformOverride', () => {
|
it('should set ios via platformOverride', () => {
|
||||||
let platform = new IonicPlatform();
|
let platform = new Platform();
|
||||||
platform.load('ios');
|
platform.load('ios');
|
||||||
|
|
||||||
expect(platform.is('android')).toEqual(false);
|
expect(platform.is('android')).toEqual(false);
|
||||||
@ -39,7 +39,7 @@ export function run() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should set android via platformOverride', () => {
|
it('should set android via platformOverride', () => {
|
||||||
let platform = new IonicPlatform();
|
let platform = new Platform();
|
||||||
platform.load('android');
|
platform.load('android');
|
||||||
|
|
||||||
expect(platform.is('android')).toEqual(true);
|
expect(platform.is('android')).toEqual(true);
|
||||||
@ -47,7 +47,7 @@ export function run() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should set ios via querystring', () => {
|
it('should set ios via querystring', () => {
|
||||||
let platform = new IonicPlatform();
|
let platform = new Platform();
|
||||||
platform.url('/?ionicplatform=ios');
|
platform.url('/?ionicplatform=ios');
|
||||||
platform.load();
|
platform.load();
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ export function run() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should set ios via querystring, even with android user agent', () => {
|
it('should set ios via querystring, even with android user agent', () => {
|
||||||
let platform = new IonicPlatform();
|
let platform = new Platform();
|
||||||
platform.url('/?ionicplatform=ios');
|
platform.url('/?ionicplatform=ios');
|
||||||
platform.userAgent(ANDROID_UA);
|
platform.userAgent(ANDROID_UA);
|
||||||
platform.load();
|
platform.load();
|
||||||
@ -68,7 +68,7 @@ export function run() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should set android via querystring', () => {
|
it('should set android via querystring', () => {
|
||||||
let platform = new IonicPlatform();
|
let platform = new Platform();
|
||||||
platform.url('/?ionicplatform=android');
|
platform.url('/?ionicplatform=android');
|
||||||
platform.load();
|
platform.load();
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ export function run() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should set android via querystring, even with ios user agent', () => {
|
it('should set android via querystring, even with ios user agent', () => {
|
||||||
let platform = new IonicPlatform();
|
let platform = new Platform();
|
||||||
platform.url('/?ionicplatform=android');
|
platform.url('/?ionicplatform=android');
|
||||||
platform.userAgent(IPHONE_UA);
|
platform.userAgent(IPHONE_UA);
|
||||||
platform.load();
|
platform.load();
|
||||||
@ -87,7 +87,7 @@ export function run() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should set android via user agent', () => {
|
it('should set android via user agent', () => {
|
||||||
let platform = new IonicPlatform();
|
let platform = new Platform();
|
||||||
platform.userAgent(ANDROID_UA);
|
platform.userAgent(ANDROID_UA);
|
||||||
platform.load();
|
platform.load();
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ export function run() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should set iphone via user agent', () => {
|
it('should set iphone via user agent', () => {
|
||||||
let platform = new IonicPlatform();
|
let platform = new Platform();
|
||||||
platform.userAgent(IPHONE_UA);
|
platform.userAgent(IPHONE_UA);
|
||||||
platform.load();
|
platform.load();
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ export function run() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should set ipad via user agent', () => {
|
it('should set ipad via user agent', () => {
|
||||||
let platform = new IonicPlatform();
|
let platform = new Platform();
|
||||||
platform.userAgent(IPAD_UA);
|
platform.userAgent(IPAD_UA);
|
||||||
platform.load();
|
platform.load();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user