diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2016-09-09 19:28:46 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2016-09-09 19:28:46 -0400 |
| commit | 5c6bd778aee817b81e09e71ca55494c8d0aa4f1f (patch) | |
| tree | af64131a6651b5303ea6422a7d3bdf1449b86972 /www/js/DataModel.js | |
| parent | 425bb3acd2c9e34040d5c351b3d468c8bb21d886 (diff) | |
#321 initial bw fix
Former-commit-id: fe6361043c82ae7204ed4ce5741aa5af1290ecb5
Diffstat (limited to 'www/js/DataModel.js')
| -rw-r--r-- | www/js/DataModel.js | 62 |
1 files changed, 35 insertions, 27 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index c5649b93..435b9bf9 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -145,6 +145,37 @@ angular.module('zmApp.controllers') return true; } + function getBandwidth() + { + // if mode is not on always return high + if (loginData.enableLowBandwidth == false) + { + return "highbw"; + } + // if mode is force on, return low + if (loginData.enableLowBandwidth == true && loginData.autoSwitchBandwidth != true) + { + return "lowbw"; + } + if (loginData.enableLowBandwidth == true && loginData.autoSwitchBandwidth == true && $rootScope.platformOS == 'desktop') + { + return "highbw"; + } + // else return real state + + var networkState = navigator.connection.type; + var strState; + switch (networkState) + { + + case Connection.WIFI: strState="highbw"; break; + case Connection.ETHERNET: strState="highbw"; break; + default: strState = "lowbw"; break; + + } + return strState; + } + //-------------------------------------------------------------------------- // uses fileLogger to write logs to file for later investigation //-------------------------------------------------------------------------- @@ -712,6 +743,9 @@ angular.module('zmApp.controllers') } + $rootScope.runMode = getBandwidth(); + log("Setting DataModel init bandwidth to: " +$rootScope.runMode); + @@ -1100,33 +1134,7 @@ angular.module('zmApp.controllers') // returns high or low BW mode //-------------------------------------------------------------------------- getBandwidth: function () { - // if mode is not on always return high - if (loginData.enableLowBandwidth == false) - { - return "highbw"; - } - // if mode is force on, return low - if (loginData.enableLowBandwidth == true && loginData.autoSwitchBandwidth != true) - { - return "lowbw"; - } - if (loginData.enableLowBandwidth == true && loginData.autoSwitchBandwidth == true && $rootScope.platformOS == 'desktop') - { - return "highbw"; - } - // else return real state - - var networkState = navigator.connection.type; - var strState; - switch (networkState) - { - - case Connection.WIFI: strState="highbw"; break; - case Connection.ETHERNET: strState="highbw"; break; - default: strState = "lowbw"; break; - - } - return strState; + return getBandwidth(); }, //-------------------------------------------------------------------------- |
