Skip to content
This repository has been archived by the owner on Dec 4, 2017. It is now read-only.

Commit

Permalink
Start guest login automatically on the mobile page if Persona isn't a…
Browse files Browse the repository at this point in the history
…vailable.
  • Loading branch information
fqueze committed Feb 15, 2013
1 parent bc9074c commit f137327
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions static/checks.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
var webrtcChecks = {
checkSupport: function webrtc_checkSupport(aDisplaySuccess) {
var support = this.hasWebRTC() && this.hasBrowserId();

if (!support)
if (!this.hasWebRTC())
this.displayWarning();
else if (aDisplaySuccess)
this.displaySuccess();
else {
if (aDisplaySuccess)
this.displaySuccess();
this.checkPersona();
}
},

hasWebRTC: function webrtc_hasWebRTC() {
Expand All @@ -19,19 +20,23 @@ var webrtcChecks = {
return true;
},

hasBrowserId: function webrtc_hasBrowserId() {
return !!navigator.id;
},

checkSidebarSupport: function webrtc_checkSidebarSupport() {
if (!this.hasWebRTC())
this.displaySidebarWarning();

if (!this.hasBrowserId()) {
webrtcMedia.hasInternetAccess = false;
$("#guest").show();
startGuest();
}
this.checkPersona();
},

checkPersona: function webrtc_checkPersona() {
if (navigator.id)
return;

// If Persona isn't available, we are likely on a network without
// Internet access, tell webrtcMedia about it and start guest login
// automatically.
webrtcMedia.hasInternetAccess = false;
$("#guest").show();
startGuest();
},

displayWarning: function webrtc_displayWarning() {
Expand Down

0 comments on commit f137327

Please sign in to comment.