-
-
- +
-
To import insert a SIM card
@@ -241,10 +241,21 @@ -
+
-
+
-
+
+
+ To import Facebook friends connect to Wi-Fi or data network +
+
+ -
Facebook
-Not imported yet
+ +
+
-
+
+
Other accounts
-
-
diff --git a/apps/communications/ftu/js/facebook.js b/apps/communications/ftu/js/facebook.js
index 511ec83e38bb..735089d9721d 100644
--- a/apps/communications/ftu/js/facebook.js
+++ b/apps/communications/ftu/js/facebook.js
@@ -20,14 +20,36 @@ var FacebookIntegration = {
return this.fbImport = document.getElementById('fb_import');
},
+ get fbImportButton() {
+ delete this.fbImportButton;
+ return this.fbImportButton = document.getElementById('fb-import-button');
+ },
+
+ get noNetworkMsg() {
+ delete this.noNetworkMsg;
+ return this.noNetworkMsg = document.getElementById('no-network');
+ },
+
get fbImportFeedback() {
delete this.fbImportFeedback;
return this.fbImportFeedback = document.getElementById(
'fb_import_feedback');
},
+ get fbAfterImport1() {
+ delete this.fbAfterImport1;
+ return this.fbAfterImport1 = document.getElementById(
+ 'fb_after_import1');
+ },
+
+ get fbAfterImport2() {
+ delete this.fbAfterImport2;
+ return this.fbAfterImport2 = document.getElementById(
+ 'fb_after_import2');
+ },
+
init: function fb_init() {
- this.fbImport.addEventListener('click', this);
+ this.fbImportButton.addEventListener('click', this);
document.addEventListener('fb_imported', this);
},
@@ -37,11 +59,33 @@ var FacebookIntegration = {
FbLauncher.start();
break;
case 'fb_imported':
+ this.toggleToImportedState();
this.updateContactsNumber();
break;
}
},
+ checkFbImport: function fb_check(nextState) {
+ var fbOption = this.fbImportButton;
+ var noNetMsg = this.noNetworkMsg;
+
+ if(nextState === 'disabled') {
+ fbOption.setAttribute('disabled','disabled');
+ noNetMsg.classList.remove('hidden');
+ }
+ else if(nextState === 'enabled') {
+ fbOption.removeAttribute('disabled');
+ noNetMsg.classList.add('hidden');
+ }
+ },
+
+ toggleToImportedState: function fb_tg_imported() {
+ this.fbImport.classList.add('hidden');
+ this.fbAfterImport1.classList.remove('hidden');
+ this.fbAfterImport2.classList.remove('hidden');
+ this.fbImport.parentNode.classList.remove('importOption');
+ },
+
updateContactsNumber: function fb_ucn() {
this.fbImportFeedback.textContent = _('fb-checking');
diff --git a/apps/communications/ftu/js/navigation.js b/apps/communications/ftu/js/navigation.js
index f95fc0d8e889..c757c20b58a6 100644
--- a/apps/communications/ftu/js/navigation.js
+++ b/apps/communications/ftu/js/navigation.js
@@ -183,22 +183,23 @@ var Navigation = {
case '#import_contacts':
UIManager.progressBar.className = 'step-state step-5';
UIManager.mainTitle.innerHTML = _('importContacts3');
- var fbOption = document.getElementById('fb_import');
// Enabling or disabling SIM import depending on card status
SimManager.checkSIMButton();
// If we have 3G or Wifi activate FB import
+ var fbState;
if (!WifiManager.api) {
// Desktop
- fbOption.classList.remove('disabled');
+ FacebookIntegration.checkFbImport('enabled');
return;
}
if (WifiManager.api.connection.status === 'connected' ||
DataMobile.isDataAvailable) {
- fbOption.classList.remove('disabled');
+ fbState = 'enabled';
} else {
- fbOption.classList.add('disabled');
+ fbState = 'disabled';
}
+ FacebookIntegration.checkFbImport(fbState);
break;
case '#welcome_browser':
UIManager.progressBar.className = 'step-state step-6';
@@ -221,7 +222,7 @@ var Navigation = {
skipStep: function n_skipStep() {
this.currentStep = this.currentStep + (this.currentStep - this.previousStep);
- if (this.currentStep < 1){
+ if (this.currentStep < 1) {
this.previousStep = this.currentStep = 1;
}
if (this.currentStep > numSteps) {
@@ -242,11 +243,12 @@ var Navigation = {
window.location.hash = steps[self.currentStep].hash;
// SIM card management
if (steps[this.currentStep].requireSIM) {
- SimManager.handleCardState(function (response) {
+ SimManager.oncardstatechange = function card_state_change(response) {
if (!response) {
self.skipStep();
}
- });
+ };
+ SimManager.handleCardState();
}
}
};
diff --git a/apps/communications/ftu/js/sim_manager.js b/apps/communications/ftu/js/sim_manager.js
index 54c4801f0411..0e55a85f167d 100644
--- a/apps/communications/ftu/js/sim_manager.js
+++ b/apps/communications/ftu/js/sim_manager.js
@@ -58,9 +58,7 @@ var SimManager = {
* 'networkLocked',
* 'ready'.
*/
- handleCardState: function sm_handleCardState(callback) {
- if (callback)
- this.accessCallback = callback;
+ handleCardState: function sm_handleCardState() {
switch (this.mobConn.cardState) {
case 'pinRequired':
this.showPinScreen();
@@ -69,29 +67,27 @@ var SimManager = {
this.showPukScreen();
break;
case 'ready':
- if (this.accessCallback) {
- this.accessCallback(true);
+ if (typeof this.oncardstatechange === 'function') {
+ this.oncardstatechange(true);
}
break;
}
-
SimManager.checkSIMButton();
},
checkSIMButton: function sm_checkSIMButton() {
var simOption = UIManager.simImportButton;
// If there is an unlocked SIM we activate import from SIM
- if (!this.alreadyImported && SimManager.available()) {
+ if (!SimManager.alreadyImported && SimManager.available()) {
simOption.removeAttribute('disabled');
UIManager.noSim.classList.add('hidden');
} else {
simOption.setAttribute('disabled', 'disabled');
- if (!this.alreadyImported) {
+ if (!SimManager.alreadyImported) {
UIManager.noSim.classList.remove('hidden');
}
}
},
- accessCallback: null,
showPinScreen: function sm_showScreen() {
UIManager.activationScreen.classList.remove('show');
@@ -118,7 +114,9 @@ var SimManager = {
skip: function sm_skip() {
this.hideScreen();
- this.accessCallback(false);
+ if (typeof this.oncardstatechange === 'function') {
+ this.oncardstatechange(false);
+ }
},
unlock: function sm_unlock() {
diff --git a/apps/communications/ftu/locales/ftu.en-US.properties b/apps/communications/ftu/locales/ftu.en-US.properties
index 95f469a06ccf..01af6f3d2251 100644
--- a/apps/communications/ftu/locales/ftu.en-US.properties
+++ b/apps/communications/ftu/locales/ftu.en-US.properties
@@ -108,6 +108,7 @@ fb-checking = … checking
notImportedYet = Not imported yet
otherAccount = Other accounts
mobile = Mobile
+afterFbImport = You can import and edit Facebook friends anytime in Contacts settings
#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#
# About your rights
-
-