Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Bug 883510 - Partner customization should be able to set Facebook OAu…
Browse files Browse the repository at this point in the history
…th ...

(cherry picked from commit e7479d3)
  • Loading branch information
jmcanterafonseca committed Jun 28, 2013
1 parent 4a5aa95 commit c9e9b09
Show file tree
Hide file tree
Showing 5 changed files with 169 additions and 112 deletions.
14 changes: 8 additions & 6 deletions apps/communications/manifest.webapp
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,15 @@
{ "ussd-received": "/dialer/index.html#keyboard-view" }
],
"redirects": [
{"from": "http://intense-tundra-4122.herokuapp.com/fbowd/oauth2_new/flow.html",
{"from": "facebook",
"to": "/redirects/redirect.html"},
{"from": "https://serene-cove-3587.herokuapp.com/liveowd/oauth2_new/flow_live.html",
"to": "/redirects/redirect.html"},
{"from": "http://intense-tundra-4122.herokuapp.com/fbowd/oauth2_new/dialogs_end.html",
{"from": "facebook_dialogs",
"to": "/redirects/dialogs_end.html"},
{"from": "http://intense-tundra-4122.herokuapp.com/fbowd/oauth2_new/logout.json",
"to": "/redirects/logout.json"}
{"from": "facebook_logout",
"to": "/redirects/logout.json"},
{"from": "live",
"to": "/redirects/redirect.html"},
{"from": "gmail",
"to": "/redirects/redirect.html"}
]
}
106 changes: 28 additions & 78 deletions build/applications-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,28 @@ function iconDescriptor(directory, app_name, entry_point) {
// 'metadata.json' file that specifies the URL.
let dir = getFile(GAIA_DIR, directory, app_name);
let metadataFile = dir.clone();
metadataFile.append("metadata.json");
metadataFile.append('metadata.json');
if (metadataFile.exists()) {
let metadata = getJSON(metadataFile);
origin = metadata.origin.replace(/^\s+|\s+$/, '');
manifestURL = metadata.manifestURL;
if (manifestURL) {
manifestURL = manifestURL.replace(/^\s+|\s+$/, '');
} else if (origin.slice(-1) == "/") {
manifestURL = origin + "manifest.webapp";
} else if (origin.slice(-1) == '/') {
manifestURL = origin + 'manifest.webapp';
} else {
manifestURL = origin + "/manifest.webapp";
manifestURL = origin + '/manifest.webapp';
}
}

let manifestFile = dir.clone();
manifestFile.append("manifest.webapp");
manifestFile.append('manifest.webapp');
let manifest;
if (manifestFile.exists()) {
manifest = getJSON(manifestFile);
} else {
manifestFile = dir.clone();
manifestFile.append("update.webapp");
manifestFile.append('update.webapp');
dump('Looking for packaged app: ' + manifestFile.path + '\n');
manifest = getJSON(manifestFile);
}
Expand All @@ -96,15 +96,6 @@ function iconDescriptor(directory, app_name, entry_point) {
};
}

function getDistributionFileContent(name, defaultContent) {
if (Gaia.distributionDir) {
let distributionFile = getFile(Gaia.distributionDir, name + '.json');
if (distributionFile.exists()) {
return getFileContent(distributionFile);
}
}
return JSON.stringify(defaultContent, null, ' ');
}

// zeroth grid page is the dock
let customize = {"homescreens": [
Expand Down Expand Up @@ -167,40 +158,45 @@ let init = getFile(GAIA_DIR, GAIA_CORE_APP_SRCDIR, 'homescreen', 'js', 'init.jso
writeContent(init, JSON.stringify(content));

// Apps that should never appear in settings > app permissions
// bug 830659: We want homescreen to appear in order to remove e.me geolocation permission
// bug 830659: We want homescreen to appear in order to remove e.me geolocation
// permission
let hidden_apps = [
gaiaManifestURL('keyboard'),
gaiaManifestURL('wallpaper'),
gaiaManifestURL('bluetooth'),
gaiaManifestURL('pdfjs')
];

init = getFile(GAIA_DIR, GAIA_CORE_APP_SRCDIR, 'settings', 'js', 'hiddenapps.js');
writeContent(init, "var HIDDEN_APPS = " + JSON.stringify(hidden_apps));
init = getFile(GAIA_DIR, GAIA_CORE_APP_SRCDIR, 'settings', 'js',
'hiddenapps.js');
writeContent(init, 'var HIDDEN_APPS = ' + JSON.stringify(hidden_apps));

// Apps that should never appear as icons in the homescreen grid or dock
hidden_apps = hidden_apps.concat([
gaiaManifestURL('homescreen'),
gaiaManifestURL('system')
]);

init = getFile(GAIA_DIR, GAIA_CORE_APP_SRCDIR, 'homescreen', 'js', 'hiddenapps.js');
writeContent(init, "var HIDDEN_APPS = " + JSON.stringify(hidden_apps));
init = getFile(GAIA_DIR, GAIA_CORE_APP_SRCDIR, 'homescreen', 'js',
'hiddenapps.js');
writeContent(init, 'var HIDDEN_APPS = ' + JSON.stringify(hidden_apps));

// SMS
init = getFile(GAIA_DIR, 'apps', 'sms', 'js', 'blacklist.json');
content = ["4850", "7000"];
content = ['4850', '7000'];

writeContent(init, getDistributionFileContent('sms-blacklist', content));

// Browser
init = getFile(GAIA_DIR, 'apps', 'browser', 'js', 'init.json');

// bind mcc, mnc pair as key from http://en.wikipedia.org/wiki/Mobile_country_code
// bind mcc, mnc pair as key from
// http://en.wikipedia.org/wiki/Mobile_country_code
// the match sequence is Carrier + Nation > Carrier default > system default
// key always with 6 digits, the default key is "000000"
// mcc:3 digits
// mnc:3 digits, fill with leading zeros, fill '000' in MNC to provide the carrier default bookmark
// mnc:3 digits, fill with leading zeros, fill '000' in MNC to provide the
// carrier default bookmark

content = {
"000000":{
Expand All @@ -220,7 +216,7 @@ content = {
}
]
}
}
};

writeContent(init, getDistributionFileContent('browser', content));

Expand All @@ -239,8 +235,8 @@ writeContent(init, getDistributionFileContent('support', content));
// ICC / STK
init = getFile(GAIA_DIR, 'apps', 'system', 'resources', 'icc.json');
content = {
"defaultURL": "http://www.mozilla.org/en-US/firefoxos/"
}
'defaultURL': 'http://www.mozilla.org/en-US/firefoxos/'
};

writeContent(init, getDistributionFileContent('icc', content));

Expand Down Expand Up @@ -304,7 +300,8 @@ content = {
}
};

writeContent(init, 'Calendar.Presets = ' + getDistributionFileContent('calendar', content) + ';');
writeContent(init, 'Calendar.Presets = ' +
getDistributionFileContent('calendar', content) + ';');

// Communications config
init = getFile(GAIA_DIR, 'apps', 'communications', 'contacts', 'config.json');
Expand All @@ -319,57 +316,10 @@ content = {
writeContent(init, getDistributionFileContent('communications', content));

// Communications External Services
init = getFile(GAIA_DIR, 'apps', 'communications', 'contacts', 'oauth2', 'js', 'parameters.js');
content = {
facebook: {
appOrigin:
'app://communications.gaiamobile.org',
redirectURI:
'http://intense-tundra-4122.herokuapp.com/fbowd/oauth2_new/flow.html',
loginPage:
'https://m.facebook.com/dialog/oauth/?',
applicationId:
'',
scope:
['friends_about_me', 'friends_birthday', 'friends_hometown',
'friends_location', 'friends_work_history', 'read_stream'],
redirectMsg:
'http://intense-tundra-4122.herokuapp.com/fbowd/oauth2_new/dialogs_end.html',
redirectLogout:
'http://intense-tundra-4122.herokuapp.com/fbowd/oauth2_new/logout.json'
},

live: {
appOrigin:
'app://communications.gaiamobile.org',
redirectURI:
'https://serene-cove-3587.herokuapp.com/liveowd/oauth2_new/flow_live.html',
loginPage:
'https://login.live.com/oauth20_authorize.srf?',
applicationId:
'00000000480EABC6',
scope:
['wl.basic', 'wl.contacts_emails', 'wl.contacts_phone_numbers',
'wl.contacts_birthday', 'wl.contacts_postal_addresses'],
logoutUrl:
'https://login.live.com/logout.srf'
},

gmail: {
appOrigin:
'app://communications.gaiamobile.org',
redirectURI:
'https://serene-cove-3587.herokuapp.com/liveowd/oauth2_new/flow_live.html',
loginPage:
'https://accounts.google.com/o/oauth2/auth?',
applicationId:
'664741361278.apps.googleusercontent.com',
scope:
['https://www.google.com/m8/feeds/'],
logoutUrl:
'https://accounts.google.com/Logout'
}
};
init = getFile(GAIA_DIR, 'apps', 'communications', 'contacts', 'oauth2', 'js',
'parameters.js');
content = JSON.parse(getFileContent(getFile(GAIA_DIR, 'build',
'communications_services.json')));

// Bug 883344 Only use default facebook app id if is mozilla partner build
if (OFFICIAL === '1') {
Expand Down
50 changes: 50 additions & 0 deletions build/communications_services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"facebook": {
"appOrigin":
"app://communications.gaiamobile.org",
"redirectURI":
"https://www.facebook.com/connect/login_success.html",
"loginPage":
"https://m.facebook.com/dialog/oauth/?",
"applicationId":
"323630664378726",
"scope":
["friends_about_me", "friends_birthday", "friends_hometown",
"friends_location", "friends_work_history", "read_stream"],
"redirectMsg":
"http://intense-tundra-4122.herokuapp.com/fbowd/oauth2_new/dialogs_end.html",
"redirectLogout":
"http://intense-tundra-4122.herokuapp.com/fbowd/oauth2_new/logout.json"
},

"live": {
"appOrigin":
"app://communications.gaiamobile.org",
"redirectURI":
"https://serene-cove-3587.herokuapp.com/liveowd/oauth2_new/flow_live.html",
"loginPage":
"https://login.live.com/oauth20_authorize.srf?",
"applicationId":
"00000000480EABC6",
"scope":
["wl.basic", "wl.contacts_emails", "wl.contacts_phone_numbers",
"wl.contacts_birthday", "wl.contacts_postal_addresses"],
"logoutUrl":
"https://login.live.com/logout.srf"
},

"gmail": {
"appOrigin":
"app://communications.gaiamobile.org",
"redirectURI":
"https://serene-cove-3587.herokuapp.com/liveowd/oauth2_new/flow_live.html",
"loginPage":
"https://accounts.google.com/o/oauth2/auth?",
"applicationId":
"664741361278.apps.googleusercontent.com",
"scope":
["https://www.google.com/m8/feeds/"],
"logoutUrl":
"https://accounts.google.com/Logout"
}
}
10 changes: 10 additions & 0 deletions build/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function getSubDirectories(directory) {
return dirs;
}


/**
* Returns an array of nsIFile's for a given directory
*
Expand Down Expand Up @@ -216,3 +217,12 @@ function gaiaManifestURL(name) {
return gaiaOriginURL(name) + '/manifest.webapp';
}

function getDistributionFileContent(name, defaultContent) {
if (Gaia.distributionDir) {
let distributionFile = getFile(Gaia.distributionDir, name + '.json');
if (distributionFile.exists()) {
return getFileContent(distributionFile);
}
}
return JSON.stringify(defaultContent, null, ' ');
}
Loading

0 comments on commit c9e9b09

Please sign in to comment.