Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for the non US Dexcom Share server #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions config/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ <h3>DATA SOURCE:</h3>
</div>
</label>
</div>
<div class="item-container">
<div class="item-container-content">
<label class="item">
<input name="dexcomNonUS" id="dexcomNonUS" type="checkbox" class="item-checkbox">
Use non US server
</label>
</div>
</div>
<div class="item-container-footer">
Your login information is sent only to Dexcom's servers. Otherwise it is stored only on your phone.
</div>
Expand Down
5 changes: 4 additions & 1 deletion config/js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,8 @@
$('#ns-url').val(current['nightscout_url'] || '');
$('[name=dexcomUsername]').val(current['dexcomUsername'] || '');
$('[name=dexcomPassword]').val(current['dexcomPassword'] || '');

$('[name=dexcomNonUS]').prop('checked', !!current['dexcomNonUS']);

if (current.mmol === true) {
$('#units-mmol').addClass('active');
} else {
Expand Down Expand Up @@ -692,6 +693,7 @@
nightscout_url: $('#ns-url').val().replace(/\/$/, ''),
dexcomUsername: $('[name=dexcomUsername]').val(),
dexcomPassword: $('[name=dexcomPassword]').val(),
dexcomNonUS: $('[name=dexcomNonUS]').is(':checked'),
hGridlines: tryParseInt($('#hGridlines').val()),
plotLineIsCustomColor: $('[name=plotLineIsCustomColor]').val() === 'true',
statusContent: $('#statusContent').val(),
Expand Down Expand Up @@ -754,6 +756,7 @@
delete current['nightscout_url'];
delete current['dexcomUsername'];
delete current['dexcomPassword'];
delete current['dexcomNonUS'];
delete current['statusText'];
delete current['statusUrl'];
delete current['statusJsonUrl'];
Expand Down
1 change: 1 addition & 0 deletions src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ function app(Pebble, c) {
config.nightscout_url !== oldConfig.nightscout_url ||
config.dexcomUsername !== oldConfig.dexcomUsername ||
config.dexcomPassword !== oldConfig.dexcomPassword ||
config.dexcomNonUS !== oldConfig.dexcomNonUS ||
maxSGVs > computeMaxSGVs(oldConfig) ||
config.__CLEAR_CACHE__
);
Expand Down
1 change: 1 addition & 0 deletions src/js/constants.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"nightscout_url" : "",
"dexcomUsername": "",
"dexcomPassword": "",
"dexcomNonUS": false,
"mmol" : false,
"topOfGraph" : 250,
"topOfRange" : 200,
Expand Down
5 changes: 3 additions & 2 deletions src/js/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var data = function(c, maxSGVCount) {

// TODO this file should be split into several smaller modules
var DEXCOM_SERVER = 'https://share1.dexcom.com';
var DEXCOM_SERVER_NON_US = 'https://shareous1.dexcom.com';
var DEXCOM_LOGIN_PATH = '/ShareWebServices/Services/General/LoginPublisherAccountByName';
var DEXCOM_LATEST_GLUCOSE_PATH = '/ShareWebServices/Services/Publisher/ReadPublisherLatestGlucoseValues';
var DEXCOM_HEADERS = {
Expand Down Expand Up @@ -991,7 +992,7 @@ var data = function(c, maxSGVCount) {
return Promise.resolve(dexcomToken);
} else {
return d.postJSON(
DEXCOM_SERVER + DEXCOM_LOGIN_PATH,
(config.dexcomNonUS ? DEXCOM_SERVER_NON_US : DEXCOM_SERVER) + DEXCOM_LOGIN_PATH,
DEXCOM_HEADERS,
{
'applicationId': DEXCOM_APPLICATION_ID,
Expand Down Expand Up @@ -1022,7 +1023,7 @@ var data = function(c, maxSGVCount) {
count = maxSGVCount;
}
var url = [
DEXCOM_SERVER,
config.dexcomNonUS ? DEXCOM_SERVER_NON_US : DEXCOM_SERVER,
DEXCOM_LATEST_GLUCOSE_PATH,
'?sessionId=' + token,
'&minutes=' + 1440,
Expand Down
1 change: 1 addition & 0 deletions src/js/ga.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ function track(data, trackingId, watchInfo, config) {
delete current['nightscout_url'];
delete current['dexcomUsername'];
delete current['dexcomPassword'];
delete current['dexcomNonUS'];
delete current['statusText'];
delete current['statusUrl'];
delete current['statusJsonUrl'];
Expand Down