cordova platform fixes

This commit is contained in:
Adam Bradley
2015-07-01 10:24:23 -05:00
parent 5e00b40fa4
commit 92693d85bc
3 changed files with 22 additions and 24 deletions

View File

@ -6,9 +6,7 @@ export class IonicConfig {
constructor(settings) { constructor(settings) {
// defaults // defaults
this._settings = { this._settings = {};
platform: 'ios'
};
// override defaults w/ user config // override defaults w/ user config
if (settings) { if (settings) {

View File

@ -183,7 +183,7 @@ export class PlatformCtrl {
let tmpPlatform = null; let tmpPlatform = null;
for (let platformName in this._registry) { for (let platformName in this._registry) {
tmpPlatform = matchPlatform(platformName, this); tmpPlatform = this.matchPlatform(platformName);
if (tmpPlatform) { if (tmpPlatform) {
// we found a platform match! // we found a platform match!
// check if its more specific than the one we already have // check if its more specific than the one we already have
@ -260,6 +260,24 @@ export class PlatformCtrl {
} }
} }
matchPlatform(platformName) {
// build a PlatformNode and assign config data to it
// use it's getRoot method to build up its hierarchy
// depending on which platforms match
let platformNode = new PlatformNode(platformName);
let rootNode = platformNode.getRoot(this, 0);
if (rootNode) {
rootNode.depth = 0;
let childPlatform = rootNode.child();
while (childPlatform) {
rootNode.depth++
childPlatform = childPlatform.child();
}
}
return rootNode;
}
settings(val) { settings(val) {
if (arguments.length) { if (arguments.length) {
this._settings = val; this._settings = val;
@ -273,24 +291,6 @@ export class PlatformCtrl {
} }
function matchPlatform(platformName, platform) {
// build a PlatformNode and assign config data to it
// use it's getRoot method to build up its hierarchy
// depending on which platforms match
let platformNode = new PlatformNode(platformName);
let tmpPlatform = platformNode.getRoot(platform, 0);
if (tmpPlatform) {
tmpPlatform.depth = 0;
let childPlatform = tmpPlatform.child();
while (childPlatform) {
tmpPlatform.depth++
childPlatform = childPlatform.child();
}
}
return tmpPlatform;
}
function insertSuperset(platformNode) { function insertSuperset(platformNode) {
let supersetPlaformName = platformNode.superset(); let supersetPlaformName = platformNode.superset();
if (supersetPlaformName) { if (supersetPlaformName) {
@ -346,7 +346,7 @@ class PlatformNode {
isMatch(p) { isMatch(p) {
if (typeof this.c.isMatched !== 'boolean') { if (typeof this.c.isMatched !== 'boolean') {
if (p.platformOverride) { if (p.platformOverride && !this.isEngine) {
this.c.isMatched = (p.platformOverride === this.c.name); this.c.isMatched = (p.platformOverride === this.c.name);
} else if (!this.c.isMatch) { } else if (!this.c.isMatch) {
this.c.isMatched = false; this.c.isMatched = false;

View File

@ -4,7 +4,7 @@ import {Platform} from './platform';
Platform.register({ Platform.register({
name: 'core', name: 'core',
settings: { settings: {
mode: 'core' mode: 'ios'
} }
}); });
Platform.setDefault('core'); Platform.setDefault('core');