Skip to content

Commit 92b4acd

Browse files
committed
Adding and removing knownRegions to/from PBXProject section
1 parent 59506f1 commit 92b4acd

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

lib/pbxProject.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,6 +1872,39 @@ pbxProject.prototype.addLocalizationVariantGroup = function(name) {
18721872
return localizationVariantGroup;
18731873
};
18741874

1875+
pbxProject.prototype.addKnownRegion = function (name) {
1876+
if (!this.pbxProjectSection()[this.getFirstProject()['uuid']]['knownRegions']) {
1877+
this.pbxProjectSection()[this.getFirstProject()['uuid']]['knownRegions'] = [];
1878+
}
1879+
if (!this.hasKnownRegion(name)) {
1880+
this.pbxProjectSection()[this.getFirstProject()['uuid']]['knownRegions'].push(name);
1881+
}
1882+
}
1883+
1884+
pbxProject.prototype.removeKnownRegion = function (name) {
1885+
var regions = this.pbxProjectSection()[this.getFirstProject()['uuid']]['knownRegions'];
1886+
if (regions) {
1887+
for (var i = 0; i < regions.length; i++) {
1888+
if (regions[i] === name) {
1889+
regions.splice(i, 1);
1890+
break;
1891+
}
1892+
}
1893+
this.pbxProjectSection()[this.getFirstProject()['uuid']]['knownRegions'] = regions;
1894+
}
1895+
}
1896+
1897+
pbxProject.prototype.hasKnownRegion = function (name) {
1898+
var regions = this.pbxProjectSection()[this.getFirstProject()['uuid']]['knownRegions'];
1899+
if (regions) {
1900+
for (var i in regions) {
1901+
if (regions[i] === name) {
1902+
return true;
1903+
}
1904+
}
1905+
}
1906+
return false;
1907+
}
18751908

18761909
pbxProject.prototype.getPBXObject = function(name) {
18771910
return this.hash.project.objects[name];

0 commit comments

Comments
 (0)