Possible solution for #327 - platform detect

This commit is contained in:
Max Lynch
2014-01-12 20:46:53 -06:00
parent 3bb36d3fda
commit ddadc461c0
6 changed files with 25 additions and 9 deletions

View File

@@ -405,8 +405,8 @@ angular.module('ionic.service.platform', [])
// We need to do some stuff as soon as we know the platform,
// like adjust header margins for iOS 7, etc.
setTimeout(function afterReadyWait() {
if(isReady()) {
ionic.Platform.detect();
if(isReady() && ionic.Platform.detect()) {
return;
} else {
setTimeout(afterReadyWait, 50);
}

View File

File diff suppressed because one or more lines are too long

10
dist/js/ionic.js vendored
View File

@@ -1740,7 +1740,7 @@ window.ionic = {
detect: function() {
var platforms = [];
this._checkPlatforms(platforms);
var didDetect = this._checkPlatforms(platforms);
var classify = function() {
if(!document.body) { return; }
@@ -1755,6 +1755,8 @@ window.ionic = {
});
classify();
return didDetect;
},
_checkPlatforms: function(platforms) {
if(this.isCordova()) {
@@ -1769,6 +1771,12 @@ window.ionic = {
if(this.isAndroid()) {
platforms.push('android');
}
// Return whether we detected anything
if(platforms.length === 0) {
return false;
}
return true;
},
// Check if we are running in Cordova, which will have

View File

File diff suppressed because one or more lines are too long

View File

@@ -28,8 +28,8 @@ angular.module('ionic.service.platform', [])
// We need to do some stuff as soon as we know the platform,
// like adjust header margins for iOS 7, etc.
setTimeout(function afterReadyWait() {
if(isReady()) {
ionic.Platform.detect();
if(isReady() && ionic.Platform.detect()) {
return;
} else {
setTimeout(afterReadyWait, 50);
}

View File

@@ -4,7 +4,7 @@
detect: function() {
var platforms = [];
this._checkPlatforms(platforms);
var didDetect = this._checkPlatforms(platforms);
var classify = function() {
if(!document.body) { return; }
@@ -19,6 +19,8 @@
});
classify();
return didDetect;
},
_checkPlatforms: function(platforms) {
if(this.isCordova()) {
@@ -33,6 +35,12 @@
if(this.isAndroid()) {
platforms.push('android');
}
// Return whether we detected anything
if(platforms.length === 0) {
return false;
}
return true;
},
// Check if we are running in Cordova, which will have