mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Possible solution for #327 - platform detect
This commit is contained in:
4
dist/js/ionic-angular.js
vendored
4
dist/js/ionic-angular.js
vendored
@@ -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);
|
||||
}
|
||||
|
||||
2
dist/js/ionic-angular.min.js
vendored
2
dist/js/ionic-angular.min.js
vendored
File diff suppressed because one or more lines are too long
10
dist/js/ionic.js
vendored
10
dist/js/ionic.js
vendored
@@ -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
|
||||
|
||||
4
dist/js/ionic.min.js
vendored
4
dist/js/ionic.min.js
vendored
File diff suppressed because one or more lines are too long
4
js/ext/angular/src/service/ionicPlatform.js
vendored
4
js/ext/angular/src/service/ionicPlatform.js
vendored
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user