* VRFS-2054 - be nicer when we fail the primePump phase

This commit is contained in:
Seth Call 2014-08-14 17:24:46 -05:00
parent 134826c1ff
commit 3e52a03604
1 changed files with 54 additions and 29 deletions

View File

@ -49,6 +49,7 @@
var scoringZoneWidth = 100;//px
var inGearWizard = false;
var operatingSystem = null;
var PRIME_PUMP_TIME = 1;
// these try to make it such that we only pass a NetworkTest Pass/Failed one time in a new user flow
var trackedPass = false;
@ -364,7 +365,7 @@
clearPrimeGuard();
primeGuardTimeout = setTimeout(function () {
primeTimedOut()
}, 2 * 1000);
}, PRIME_PUMP_TIME * 2 * 1000);
}
function setBackendGuard() {
@ -410,7 +411,7 @@
context.jamClient.TestNetworkPktBwRate(serverClientId, createSuccessCallbackName(true), createTimeoutCallbackName(true),
NETWORK_TEST_TYPES.PktTest400LowLatency,
1, // minimum time needed to prime pump
PRIME_PUMP_TIME,
2,
PAYLOAD_SIZE, gon.global.ftue_network_test_backend_retries);
@ -418,6 +419,40 @@
return primeDeferred;
}
function cancelTest() {
scoring = false;
configureStartButton();
renderStopTest();
$self.triggerHandler(NETWORK_TEST_CANCEL)
}
function postPumpRun() {
// check if on Wifi 1st
var isWireless = context.jamClient.IsMyNetworkWireless();
if (isWireless == -1) {
logger.warn("unable to determine if the user is on wireless or not for network test. skipping prompt.")
}
if (isWireless == 1) {
context.JK.Banner.showAlert({buttons: [
{name: 'CANCEL', click: function () {
cancelTest();
}},
{name: 'RUN NETWORK TEST ANYWAY', click: function () {
attemptTestPass();
;
}}
],
html: "<p>It appears that your computer is connected to your network using WiFi.</p>" +
"<p>We strongly advise against running the JamKazam application on a WiFi connection. " +
"We recommend using a wired Ethernet connection from your computer to your router. " +
"A WiFi connection is likely to cause significant issues in both latency and audio quality.</p>"})
}
else {
attemptTestPass();
}
}
function prepareNetworkTest() {
if (scoring) return false;
@ -438,35 +473,25 @@
primePump()
.done(function () {
// check if on Wifi 1st
var isWireless = context.jamClient.IsMyNetworkWireless();
if (isWireless == -1) {
logger.warn("unable to determine if the user is on wireless or not for network test. skipping prompt.")
}
if (isWireless == 1) {
context.JK.Banner.showAlert({buttons: [
{name: 'CANCEL', click: function () {
scoring = false;
configureStartButton();
renderStopTest();
$self.triggerHandler(NETWORK_TEST_CANCEL)
}},
{name: 'RUN NETWORK TEST ANYWAY', click: function () {
attemptTestPass();;
}}
],
html: "<p>It appears that your computer is connected to your network using WiFi.</p>" +
"<p>We strongly advise against running the JamKazam application on a WiFi connection. " +
"We recommend using a wired Ethernet connection from your computer to your router. " +
"A WiFi connection is likely to cause significant issues in both latency and audio quality.</p>"})
}
else {
attemptTestPass();
}
postPumpRun();
})
.fail(function () {
context.JK.Banner.showAlert("Network Test Failure", "Unable to determine internet connection type.")
logger.debug("unable to determine user's network type. primePump failed.")
context.JK.Banner.showAlert({
title: 'Unable to Determine Network Type',
buttons: [
{name: 'CANCEL', click: function () {
cancelTest();
}},
{name: 'RUN NETWORK TEST ANYWAY', click: function () {
attemptTestPass();
;
}}
],
html: "<p>We are unable to determine if your computer is connected to your network using WiFi.</p>" +
"<p>We strongly advise against running the JamKazam application on a WiFi connection. " +
"We recommend using a wired Ethernet connection from your computer to your router. " +
"A WiFi connection is likely to cause significant issues in both latency and audio quality.</p>"})
});
})
.fail(function (jqXHR) {