From 92693d85bcfa18508cca5b13570c29a3a5c172be Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Wed, 1 Jul 2015 10:24:23 -0500 Subject: [PATCH] cordova platform fixes --- ionic/config/config.js | 4 +--- ionic/platform/platform.js | 40 +++++++++++++++++++------------------- ionic/platform/registry.js | 2 +- 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/ionic/config/config.js b/ionic/config/config.js index 01e466e375..6bd799c01e 100644 --- a/ionic/config/config.js +++ b/ionic/config/config.js @@ -6,9 +6,7 @@ export class IonicConfig { constructor(settings) { // defaults - this._settings = { - platform: 'ios' - }; + this._settings = {}; // override defaults w/ user config if (settings) { diff --git a/ionic/platform/platform.js b/ionic/platform/platform.js index cc1133a56d..8a2748cd67 100644 --- a/ionic/platform/platform.js +++ b/ionic/platform/platform.js @@ -183,7 +183,7 @@ export class PlatformCtrl { let tmpPlatform = null; for (let platformName in this._registry) { - tmpPlatform = matchPlatform(platformName, this); + tmpPlatform = this.matchPlatform(platformName); if (tmpPlatform) { // we found a platform match! // 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) { if (arguments.length) { 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) { let supersetPlaformName = platformNode.superset(); if (supersetPlaformName) { @@ -346,7 +346,7 @@ class PlatformNode { isMatch(p) { if (typeof this.c.isMatched !== 'boolean') { - if (p.platformOverride) { + if (p.platformOverride && !this.isEngine) { this.c.isMatched = (p.platformOverride === this.c.name); } else if (!this.c.isMatch) { this.c.isMatched = false; diff --git a/ionic/platform/registry.js b/ionic/platform/registry.js index a28e82fdf9..09375b6578 100644 --- a/ionic/platform/registry.js +++ b/ionic/platform/registry.js @@ -4,7 +4,7 @@ import {Platform} from './platform'; Platform.register({ name: 'core', settings: { - mode: 'core' + mode: 'ios' } }); Platform.setDefault('core');