diff --git a/web/app/assets/javascripts/networkTestHelper.js b/web/app/assets/javascripts/networkTestHelper.js index 1f9260790..a3bf5d25f 100644 --- a/web/app/assets/javascripts/networkTestHelper.js +++ b/web/app/assets/javascripts/networkTestHelper.js @@ -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: "
It appears that your computer is connected to your network using WiFi.
" + + "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.
"}) + } + 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: "It appears that your computer is connected to your network using WiFi.
" + - "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.
"}) - } - 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: "We are unable to determine if your computer is connected to your network using WiFi.
" + + "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.
"}) }); }) .fail(function (jqXHR) {