Skip to content

Commit 7352be9

Browse files
author
Adam Bradley
committed
set major and minor platform versions in body css
1 parent f37b196 commit 7352be9

File tree

6 files changed

+30
-9
lines changed

6 files changed

+30
-9
lines changed

dist/js/ionic-angular.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2762,6 +2762,10 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
27622762
updateHeaderData(data);
27632763
});
27642764

2765+
$rootScope.$on('viewState.titleUpdated', function(e, data) {
2766+
$scope.currentTitle = (data && data.title ? data.title : '');
2767+
});
2768+
27652769
// If a nav page changes the left or right buttons, update our scope vars
27662770
$scope.$parent.$on('viewState.leftButtonsChanged', function(e, data) {
27672771
$scope.leftButtons = data;
@@ -2823,10 +2827,16 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
28232827
$scope.$emit('viewState.rightButtonsChanged', $scope.rightButtons);
28242828
});
28252829

2830+
// watch for changes in the title
2831+
var deregTitle = $scope.$watch('title', function(val) {
2832+
$scope.$emit('viewState.titleUpdated', $scope);
2833+
});
2834+
28262835
$scope.$on('$destroy', function(){
28272836
// deregister on destroy
28282837
deregLeftButtons();
28292838
deregRightButtons();
2839+
deregTitle();
28302840
});
28312841

28322842
};

dist/js/ionic-angular.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/ionic.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,20 +1794,23 @@ window.ionic = {
17941794

17951795
_checkPlatforms: function(platforms) {
17961796
this.platforms = [];
1797+
var v = this.version().toString().replace('.', '_');
17971798

17981799
if(this.isCordova()) {
17991800
this.platforms.push('cordova');
18001801
}
18011802
if(this.isIOS()) {
18021803
this.platforms.push('ios');
1803-
this.platforms.push('ios' + parseInt(this.version(), 10));
1804+
this.platforms.push('ios' + v.split('_')[0]);
1805+
this.platforms.push('ios' + v);
18041806
}
18051807
if(this.isIPad()) {
18061808
this.platforms.push('ipad');
18071809
}
18081810
if(this.isAndroid()) {
18091811
this.platforms.push('android');
1810-
this.platforms.push('android' + parseInt(this.version(), 10));
1812+
this.platforms.push('android' + v.split('_')[0]);
1813+
this.platforms.push('android' + v);
18111814
}
18121815
},
18131816

dist/js/ionic.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/ext/angular/test/service/ionicPlatform.unit.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ describe('Ionic Platform Service', function() {
3535
ionic.Platform.setVersion(' ');
3636
expect(ionic.Platform.version()).toEqual(0);
3737

38+
ionic.Platform.setVersion('me-not-number');
39+
expect(ionic.Platform.version()).toEqual(0);
40+
3841
ionic.Platform.setVersion('');
3942
expect(ionic.Platform.version()).toEqual(0);
4043

@@ -89,18 +92,20 @@ describe('Ionic Platform Service', function() {
8992
expect(ionic.Platform.platforms[0]).toEqual('cordova');
9093
expect(ionic.Platform.platforms[1]).toEqual('ios');
9194
expect(ionic.Platform.platforms[2]).toEqual('ios7');
95+
expect(ionic.Platform.platforms[3]).toEqual('ios7_9');
9296
});
9397

9498
it('sets android platforms', function() {
9599
window.cordova = {};
96100
ionic.Platform.setPlatform('android');
97-
ionic.Platform.setVersion('4.4.4');
101+
ionic.Platform.setVersion('4.2.3');
98102

99103
ionic.Platform._checkPlatforms()
100104

101105
expect(ionic.Platform.platforms[0]).toEqual('cordova');
102106
expect(ionic.Platform.platforms[1]).toEqual('android');
103107
expect(ionic.Platform.platforms[2]).toEqual('android4');
108+
expect(ionic.Platform.platforms[3]).toEqual('android4_2');
104109
});
105110

106111
it('is android', function() {

js/utils/platform.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,23 @@
3838

3939
_checkPlatforms: function(platforms) {
4040
this.platforms = [];
41+
var v = this.version().toString().replace('.', '_');
4142

4243
if(this.isCordova()) {
4344
this.platforms.push('cordova');
4445
}
4546
if(this.isIOS()) {
4647
this.platforms.push('ios');
47-
this.platforms.push('ios' + parseInt(this.version(), 10));
48+
this.platforms.push('ios' + v.split('_')[0]);
49+
this.platforms.push('ios' + v);
4850
}
4951
if(this.isIPad()) {
5052
this.platforms.push('ipad');
5153
}
5254
if(this.isAndroid()) {
5355
this.platforms.push('android');
54-
this.platforms.push('android' + parseInt(this.version(), 10));
56+
this.platforms.push('android' + v.split('_')[0]);
57+
this.platforms.push('android' + v);
5558
}
5659
},
5760

0 commit comments

Comments
 (0)