mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
_checkPlatforms refactor
This commit is contained in:
@@ -33,6 +33,9 @@ describe('Ionic Platform Service', function() {
|
||||
ionic.Platform.setVersion('1');
|
||||
expect(ionic.Platform.version()).toEqual(1.0);
|
||||
|
||||
ionic.Platform.setVersion('0.1');
|
||||
expect(ionic.Platform.version()).toEqual(0.1);
|
||||
|
||||
ionic.Platform.setVersion(' ');
|
||||
expect(ionic.Platform.version()).toEqual(0);
|
||||
|
||||
|
||||
@@ -44,31 +44,27 @@
|
||||
this.platforms = [];
|
||||
this.grade = 'a';
|
||||
|
||||
var v = this.version().toString();
|
||||
if(v.indexOf('.') > 0) {
|
||||
v = v.replace('.', '_');
|
||||
} else {
|
||||
v += '_0';
|
||||
}
|
||||
if(this.isCordova()) this.platforms.push('cordova');
|
||||
if(this.isIPad()) this.platforms.push('ipad');
|
||||
|
||||
if(this.isCordova()) {
|
||||
this.platforms.push('cordova');
|
||||
}
|
||||
if(this.isIOS()) {
|
||||
this.platforms.push('ios');
|
||||
this.platforms.push('ios' + v.split('_')[0]);
|
||||
this.platforms.push('ios' + v);
|
||||
}
|
||||
if(this.isIPad()) {
|
||||
this.platforms.push('ipad');
|
||||
}
|
||||
if(this.isAndroid()) {
|
||||
this.platforms.push('android');
|
||||
this.platforms.push('android' + v.split('_')[0]);
|
||||
this.platforms.push('android' + v);
|
||||
var platform = this.platform();
|
||||
if(platform) {
|
||||
this.platforms.push(platform);
|
||||
|
||||
if(platformVersion > 0 && platformVersion < 4.4) {
|
||||
this.grade = (platformVersion < 4 ? 'c' : 'b');
|
||||
var version = this.version();
|
||||
if(version) {
|
||||
var v = version.toString();
|
||||
if(v.indexOf('.') > 0) {
|
||||
v = v.replace('.', '_');
|
||||
} else {
|
||||
v += '_0';
|
||||
}
|
||||
this.platforms.push(platform + v.split('_')[0]);
|
||||
this.platforms.push(platform + v);
|
||||
|
||||
if(this.isAndroid() && version < 4.4) {
|
||||
this.grade = (version < 4 ? 'c' : 'b');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user