VulpesOS/gaia/build/contacts-import-services.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

47 lines
1.4 KiB
JavaScript
Executable file
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
/**
* This module contains all the build time generation logic needed to
* use the import functionality both by the FTU and Comms Applications
*
* The Functions exported by this module are used by the build scripts
* of Comms and FTU apps
*/
const utils = require('./utils');
// Generates the communications services configuration as JS file
// loaded by the application (parameters.js)
function generateServicesConfig(config) {
var importServicesFile = utils.resolve(config.CONTACTS_IMPORT_SERVICES_PATH,
config.GAIA_DIR);
if (!importServicesFile.exists()) {
   throw new Error('file not found: ' + importServicesFile.path);
 }
var importServices = utils.getJSON(importServicesFile);
// Bug 883344 Only use default facebook app id if is mozilla partner build
if (config.OFFICIAL === '1') {
importServices.facebook.applicationId = '395559767228801';
importServices.live.applicationId = '00000000440F8B08';
}
var resultFile = utils.resolve(utils.joinPath('shared', 'pages', 'import',
'js', 'parameters.js'), config.GAIA_DIR);
var jsPrefix = 'var oauthflow = this.oauthflow || {}; oauthflow.params = ';
var content = jsPrefix + JSON.stringify(importServices) + ';';
if (resultFile.exists()) {
let prev = utils.getFileContent(resultFile);
if (prev === content) {
return;
}
}
utils.writeContent(resultFile, content);
}
exports.execute = function(config) {
generateServicesConfig(config);
};