зеркало из https://github.com/mozilla/gecko-dev.git
Bug 675824 - End mobile setup wizard with first sync download status/progress bar. r=philikon
This commit is contained in:
Родитель
0421dfe761
Коммит
382b8d959b
|
@ -24,6 +24,7 @@
|
|||
- Brad Lassey <blassey@mozilla.com>
|
||||
- Mark Finkle <mfinkle@mozila.com>
|
||||
- Matt Brubeck <mbrubeck@mozila.com>
|
||||
- Allison Naaktgeboren <ally@mozilla.com>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -593,7 +594,15 @@
|
|||
</hbox>
|
||||
</vbox>
|
||||
<vbox id="syncsetup-waiting" class="syncsetup-page" flex="1" hidden="true">
|
||||
<description class="syncsetup-desc syncsetup-center" flex="1">&sync.setup.waiting;</description>
|
||||
<progressmeter id="syncsetup-progressbar" mode="undetermined"/>
|
||||
<vbox id="syncsetup-waiting-top" align="center" flex="1">
|
||||
<description id="syncsetup-waiting-desc" class="syncsetup-desc syncsetup-center" flex="1">&sync.setup.waiting;</description>
|
||||
<description id="syncsetup-waitingdownload-desc" class="syncsetup-desc syncsetup-center" hidden="true" flex="1">&sync.setup.waitingdownload;</description>
|
||||
</vbox>
|
||||
<hbox class="prompt-buttons" pack="center" align="end">
|
||||
<button id="syncsetup-waiting-cancel" class="prompt-button" oncommand="WeaveGlue.close();">&sync.setup.cancel;</button>
|
||||
<button id="syncsetup-waiting-close" class="prompt-button" hidden="true" oncommand="WeaveGlue.close();">&sync.setup.close;</button>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<vbox id="syncsetup-fallback" class="syncsetup-page" flex="1" hidden="true">
|
||||
<scrollbox class="prompt-message" orient="vertical" flex="1">
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
* Mark Finkle <mfinkle@mozila.com>
|
||||
* Matt Brubeck <mbrubeck@mozila.com>
|
||||
* Jono DiCarlo <jdicarlo@mozilla.com>
|
||||
* Allison Naaktgeboren <ally@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -38,9 +39,14 @@
|
|||
|
||||
let WeaveGlue = {
|
||||
setupData: null,
|
||||
_boundOnEngineSync: null, // Needed to unhook the observers in close().
|
||||
_boundOnServiceSync: null,
|
||||
jpake: null,
|
||||
_bundle: null,
|
||||
_loginError: false,
|
||||
_progressBar: null,
|
||||
_progressValue: 0,
|
||||
_progressMax: null,
|
||||
|
||||
init: function init() {
|
||||
if (this._bundle)
|
||||
|
@ -64,6 +70,9 @@ let WeaveGlue = {
|
|||
} else if (Weave.Status.login != Weave.LOGIN_FAILED_NO_USERNAME) {
|
||||
this.loadSetupData();
|
||||
}
|
||||
this._boundOnEngineSync = this.onEngineSync.bind(this);
|
||||
this._boundOnServiceSync = this.onServiceSync.bind(this);
|
||||
this._progressBar = document.getElementById("syncsetup-progressbar");
|
||||
},
|
||||
|
||||
abortEasySetup: function abortEasySetup() {
|
||||
|
@ -128,7 +137,16 @@ let WeaveGlue = {
|
|||
|
||||
onComplete: function onComplete(aCredentials) {
|
||||
self.jpake = null;
|
||||
self.close();
|
||||
|
||||
self._progressBar.mode = "determined";
|
||||
document.getElementById("syncsetup-waiting-desc").hidden = true;
|
||||
document.getElementById("syncsetup-waiting-cancel").hidden = true;
|
||||
document.getElementById("syncsetup-waitingdownload-desc").hidden = false;
|
||||
document.getElementById("syncsetup-waiting-close").hidden = false;
|
||||
Services.obs.addObserver(self._boundOnEngineSync, "weave:engine:sync:finish", false);
|
||||
Services.obs.addObserver(self._boundOnEngineSync, "weave:engine:sync:error", false);
|
||||
Services.obs.addObserver(self._boundOnServiceSync, "weave:service:sync:finish", false);
|
||||
Services.obs.addObserver(self._boundOnServiceSync, "weave:service:sync:error", false);
|
||||
self.setupData = aCredentials;
|
||||
self.connect();
|
||||
},
|
||||
|
@ -204,7 +222,37 @@ let WeaveGlue = {
|
|||
this.canConnect();
|
||||
},
|
||||
|
||||
onEngineSync: function onEngineSync(subject, topic, data) {
|
||||
// The Clients engine syncs first. At this point we don't necessarily know
|
||||
// yet how many engines will be enabled, so we'll ignore the Clients engine
|
||||
// and evaluate how many engines are enabled when the first "real" engine
|
||||
// syncs.
|
||||
if (data == 'clients') {
|
||||
return;
|
||||
}
|
||||
if (this._progressMax == null) {
|
||||
this._progressMax = Weave.Engines.getEnabled().length;
|
||||
this._progressBar.max = this._progressMax;
|
||||
}
|
||||
this._progressValue += 1;
|
||||
this._progressBar.setAttribute("value", this._progressValue);
|
||||
},
|
||||
|
||||
onServiceSync: function onServiceSync() {
|
||||
this.close();
|
||||
},
|
||||
|
||||
close: function close() {
|
||||
try {
|
||||
Services.obs.removeObserver(this._boundOnEngineSync, "weave:engine:sync:finish");
|
||||
Services.obs.removeObserver(this._boundOnEngineSync, "weave:engine:sync:error");
|
||||
Services.obs.removeObserver(this._boundOnServiceSync, "weave:service:sync:finish");
|
||||
Services.obs.removeObserver(this._boundOnServiceSync, "weave:service:sync:error");
|
||||
}
|
||||
catch(e) {
|
||||
// Observers weren't registered because we never got as far as onComplete.
|
||||
}
|
||||
|
||||
if (this.jpake)
|
||||
this.abortEasySetup();
|
||||
|
||||
|
@ -226,6 +274,15 @@ let WeaveGlue = {
|
|||
this._elements.usecustomserver.checked = false;
|
||||
this._elements.customserver.disabled = true;
|
||||
this._elements.customserver.value = "";
|
||||
document.getElementById("syncsetup-waiting-desc").hidden = false;
|
||||
document.getElementById("syncsetup-waiting-cancel").hidden = false;
|
||||
document.getElementById("syncsetup-waitingdownload-desc").hidden = true;
|
||||
document.getElementById("syncsetup-waiting-close").hidden = true;
|
||||
this._progressMax = null;
|
||||
this._progressValue = 0;
|
||||
this._progressBar.max = 0;
|
||||
this._progressBar.value = 0;
|
||||
this._progressBar.mode = "undetermined";
|
||||
|
||||
// Close the connect UI
|
||||
document.getElementById("syncsetup-container").hidden = true;
|
||||
|
|
|
@ -20,3 +20,5 @@
|
|||
<!ENTITY sync.setup.cancel "Cancel">
|
||||
<!ENTITY sync.setup.tutorial "Show me how">
|
||||
<!ENTITY sync.setup.waiting "Pairing in progress…">
|
||||
<!ENTITY sync.setup.close "Close">
|
||||
<!ENTITY sync.setup.waitingdownload "Your data is now being downloaded in the background. You can close this window at any time.">
|
||||
|
|
|
@ -1534,7 +1534,11 @@ setting {
|
|||
}
|
||||
|
||||
#syncsetup-waiting {
|
||||
padding: 10em 0;
|
||||
padding: 2em 0 0 0;
|
||||
}
|
||||
|
||||
#syncsetup-waiting-top {
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
/* content scrollbars */
|
||||
|
|
Загрузка…
Ссылка в новой задаче