Closed
Bug 1030158
Opened 10 years ago
Closed 9 years ago
Raise notifications if unable to complete actions when offline
Categories
(Marketplace Graveyard :: Consumer Pages, enhancement, P2)
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1177847
People
(Reporter: clouserw, Unassigned)
References
Details
(Whiteboard: [ktlo])
In yogafire we show notifications if a person is offline and tries to do something that requires they are online (like installing an app). We should do the same in fireplace.
Reporter | ||
Updated•10 years ago
|
Priority: -- → P2
Updated•10 years ago
|
Assignee: nobody → mpillard
Comment 2•10 years ago
|
||
Summary of the current state of affairs:
- On Firefox OS devices, Marketplace is currently distributed through a privileged package that just iframes https://marketplace.firefox.com/, passing some messages to it to handle various things needing privileges. That package has a check on `navigator.onLine` and displays an error message when offline; when displayed, that message takes up the whole screen, and completely preventing you from accessing Marketplace - your only option is to connect to the internet and hit "try again".
- Everywhere else (Android, Desktop, experimental "true" package), when the user is offline and tries to navigate, we prevent the action and display a notification "No internet connection". Again, we use `navigator.onLine` to tell us he is not online.
- On tarako, where we expect connection state to be much more flaky (especially with no 3G) when we tested our code, we noticed `navigator.onLine` was too unreliable and built our own implementation : we try to open a TCP connection to our CDN in the background, every 10 seconds. We then send an event and set our own `z.onLine` variable accordingly, and prevent the user from doing the action like above, except we do that for more things than just navigation.
There are 2 problems with the tarako approach:
1) It's done in the background, which is good to avoid blocking for too long when the user does something, but can be annoying as it means that when launched, Marketplace always consumes data. This isn't such a big deal on a phone where every app can expect to be killed as soon as the user is done with it, but is much more problematic on devices where this is not the case.
2) Our technique requires the app to be privileged, so only truly works on Firefox OS devices. We have an alternative fallback that just loads an image, but this would consume even more data.
For these 2 reasons, I'm not really a fan of directly copying the technique we used on tarako. I'd prefer relying on `navigator.onLine`, which is not 100% accurate but provides the basics, add checks where needed like at app install time (since the checks at navigation time are already there), and ask platform to improve `navigator.onLine` (bug 654579, bug 756364, maybe others).
Comment 3•10 years ago
|
||
ni? cvan to get his opinion since he battled with navigator.onLine in the past.
Flags: needinfo?(cvan)
Updated•10 years ago
|
Assignee: mpillard → nobody
Comment 4•10 years ago
|
||
Stuart added this in bug 1044225. So isn't this a dupe?
Stuart's approach is to check upon launch. I like that approach.
If this bug is about polling to see when we are offline and then showing an error, I don't think we should that. With the Metropolis, the offline Marketplace prototype, I never polled first. I would only ever poll when the user did something that explicitly required an Internet connection. So when a user would click an "Install" button, we requested a dummy .gif, and if the graphic loaded then we could proceed with the install. If it failed, then we had probable cause to believe the user was offline. And then we would show a notification that the user was offline and we then queued the app install for later.
We then polled for the .gif every three seconds. If and when the graphic finally loaded, we knew that the user regained connectivity. And this could even happen on page reload or when the app relaunched later. (The install queue was persisted in localStorage.) When the user regained connectivity, the queued app was installed.
I know the Tarako and Fireplace offline-checking code is a bit different now, but I still think we should maintain the original Metropolis approach: check for connectivity only when the user performs an action that requires connectivity.
Flags: needinfo?(cvan)
Updated•10 years ago
|
Severity: normal → enhancement
Updated•10 years ago
|
Whiteboard: [ktlo]
Updated•9 years ago
|
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•