samples/cordova/video_chat/plugins/cordova-custom-config/hooks/applyCustomConfig.js
function updateXCBuildConfiguration(item, buildConfig, mode){
        var modified = false;
        for(var blockName in buildConfig){
            var block = buildConfig[blockName];

            if(typeof(block) !== "object" || !(block["buildSettings"])) continue;
            var literalMatch = !!block["buildSettings"][item.name],
                quotedMatch = !!block["buildSettings"][quoteEscape(item.name)],
                match = literalMatch || quotedMatch;

            if((match || mode === "add") &&
                (!item.buildType || item.buildType.toLowerCase() === block['name'].toLowerCase())){

                var name;
                if(match){
                    name = literalMatch ? item.name : quoteEscape(item.name);
                }else{
                    // adding
                    name = (item.quote && (item.quote === "none" || item.quote === "value")) ? item.name : quoteEscape(item.name);
                }
                var value = (item.quote && (item.quote === "none" || item.quote === "key")) ? item.value : quoteEscape(item.value);

                block["buildSettings"][name] = value;
                modified = true;
                logger.verbose(mode+" XCBuildConfiguration key={ "+name+" } to value={ "+value+" } for build type='"+block['name']+"' in block='"+blockName+"'");
            }
        }
        return modified;
    }
function updateXCBuildConfiguration(item, buildConfig, mode){
        var modified = false;
        for(var blockName in buildConfig){
            var block = buildConfig[blockName];

            if(typeof(block) !== "object" || !(block["buildSettings"])) continue;
            var literalMatch = !!block["buildSettings"][item.name],
                quotedMatch = !!block["buildSettings"][quoteEscape(item.name)],
                match = literalMatch || quotedMatch;

            if((match || mode === "add") &&
                (!item.buildType || item.buildType.toLowerCase() === block['name'].toLowerCase())){

                var name;
                if(match){
                    name = literalMatch ? item.name : quoteEscape(item.name);
                }else{
                    // adding
                    name = (item.quote && (item.quote === "none" || item.quote === "value")) ? item.name : quoteEscape(item.name);
                }
                var value = (item.quote && (item.quote === "none" || item.quote === "key")) ? item.value : quoteEscape(item.value);

                block["buildSettings"][name] = value;
                modified = true;
                logger.verbose(mode+" XCBuildConfiguration key={ "+name+" } to value={ "+value+" } for build type='"+block['name']+"' in block='"+blockName+"'");
            }
        }
        return modified;
    }
function updateXCBuildConfiguration ( item , buildConfig , mode ) { var modified = false ; for ( var blockName in buildConfig ) { var block = buildConfig [ blockName ] ; if ( typeof ( block ) !== "object" || ! ( block [ "buildSettings" ] ) ) continue ; var literalMatch = ! ! block [ "buildSettings" ] [ item . name ] , quotedMatch = ! ! block [ "buildSettings" ] [ quoteEscape ( item . name ) ] , match = literalMatch || quotedMatch ; if ( ( match || mode === "add" ) && ( ! item . buildType || item . buildType . toLowerCase ( ) === block [ 'name' ] . toLowerCase ( ) ) ) { var name ; if ( match ) { name = literalMatch ? item . name : quoteEscape ( item . name ) ; } else { // adding name = ( item . quote && ( item . quote === "none" || item . quote === "value" ) ) ? item . name : quoteEscape ( item . name ) ; } var value = ( item . quote && ( item . quote === "none" || item . quote === "key" ) ) ? item . value : quoteEscape ( item . value ) ; block [ "buildSettings" ] [ name ] = value ; modified = true ; logger . verbose ( mode + " XCBuildConfiguration key={ " + name + " } to value={ " + value + " } for build type='" + block [ 'name' ] + "' in block='" + blockName + "'" ) ; } } return modified ; }
Updates an XCode build configuration setting with the given item.
@param {Object} item - configuration item containing setting data
@param {Object} buildConfig - XCode build config object
@param {String} mode - update mode: "replace" to replace only existing keys or "add" to add a new key to every block
@returns {boolean} true if buildConfig was modified
Updates an XCode build configuration setting with the given item .