hide the install spinner we focus is regained (bug 974196) #376

Closed
wants to merge 2 commits into
from

Projects

None yet

3 participants

@mstriemer
Member

https://bugzilla.mozilla.org/show_bug.cgi?id=974196

When the window regains focus, hide the spinner. I'm assuming that once the user comes back to marketplace they have either installed or cancelled. There is no event for the installation being cancelled, just when there is an error.

@ngokevin ngokevin commented on an outdated diff Feb 22, 2014
hearth/media/js/buttons.js
@@ -213,6 +213,10 @@ define('buttons',
}
function do_install(data) {
+ $(window).one('focus', function() {
@ngokevin
ngokevin Feb 22, 2014 Member

window is already wrapped in z.win

@ngokevin
Member

Will finish reviewing next week 👋

@ngokevin ngokevin commented on an outdated diff Feb 24, 2014
hearth/media/js/buttons.js
@@ -213,6 +213,10 @@ define('buttons',
}
function do_install(data) {
+ $(window).one('focus', function() {
+ console.log('clearing spinner, regained focus');
+ revertButton($this);
+ });
return apps.install(product, data || {}).done(function(installer) {
@ngokevin
ngokevin Feb 24, 2014 Member

We should probably clear the spinner when the install fails too?

@ngokevin
Member

What if the user goes back while the download is in progress?

@ngokevin
Member

I just simulated a re-focus in the middle of the download.

The button text gets reverted and when the app does get installed, it will read its former text "Free" instead of "Launch". Maybe we can just remove the button class instead of calling revertButton.

@ngokevin
Member

Actually, we can also just check if the app is installed before calling revertButton.

@mstriemer
Member

Hmm, I'm not sure what to do about the packaged app situation. Android seems to perform the download up-front (which is really not great once we start allowing packaged apps) so this makes sense there but on FxOS it doesn't really work. Maybe this is a platform bug instead? Should cancelling the install dialog on android cause an install error?

@ngokevin
Member

I don't think cancelling the install dialog causes any error nor does it cause a blank button for me. I'm actually not quite clear how to reproduce this since I don't know what the bug means by cancelling the click event.

I think we should handle the packaged app situation esp. considering the data connections of our users.

@mstriemer
Member

Looks like this is a deal breaker for fxos. Closing.

@mstriemer mstriemer closed this Feb 27, 2014
@mstriemer mstriemer deleted the mstriemer:hide-spinner-when-install-cancelled-974196 branch Feb 27, 2014
@cvan cvan commented on the diff Feb 27, 2014
hearth/media/js/buttons.js
@@ -213,6 +213,10 @@ define('buttons',
}
function do_install(data) {
+ z.doc.one('visibilitychange', function() {
@cvan
cvan Feb 27, 2014 Member

consider using blur and focus

@ngokevin
ngokevin Feb 27, 2014 Member

it was actually focus before

@mstriemer
mstriemer Feb 27, 2014 Member

Yeah, I did focus at first and it appeared to be working but it was flaky on Android.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment