diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-11-05 20:52:40 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-11-05 20:52:40 +0100 |
| commit | f7ac115cc2c43d08f61c0e5a16657fd732a0a520 (patch) | |
| tree | 08b1289094669d8b75f418ec46dacb0bdf0cc0d9 /StoneIsland/www/js/lib/etc/sim.js | |
| parent | 60a306af8be5e06ac4c13419dd6b4189105f216e (diff) | |
API check
Diffstat (limited to 'StoneIsland/www/js/lib/etc/sim.js')
| -rw-r--r-- | StoneIsland/www/js/lib/etc/sim.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/StoneIsland/www/js/lib/etc/sim.js b/StoneIsland/www/js/lib/etc/sim.js index 4507e160..c9cb77fe 100644 --- a/StoneIsland/www/js/lib/etc/sim.js +++ b/StoneIsland/www/js/lib/etc/sim.js @@ -4,24 +4,33 @@ var sim = (function(){ sim.loaded = false sim.data = { carrierName: 'unknown', - countryCode: 'xx', + countryCode: 'us', mcc: '0', mnc: '0', } - sim.fetch = function(){ + sim.fetch = function(cb){ + sim.afterFetch = cb window.plugins.sim.getSimInfo(sim.success, sim.error) } + sim.afterFetch = function(){} + sim.success = function(data){ console.log(data) sim.data = data sim.data.countryCode = sim.data.countryCode.toLowerCase() + // app is only available in US or Canada, so call the US API regardless + if (sim.data.countryCode !== 'ca') { + sim.data.countryCode = 'us' + } sim.loaded = true + sim.afterFetch() } sim.error = function(){ console.log("no SIM card detected") + sim.afterFetch() } return sim |
