Skip to content

Commit

Permalink
Merge branch 'krystophv/electron' into dorianscholz/electron-fslibre
Browse files Browse the repository at this point in the history
  • Loading branch information
krystophv committed Aug 8, 2017
2 parents 8799839 + 683fe93 commit 2f758b0
Show file tree
Hide file tree
Showing 72 changed files with 303 additions and 644 deletions.
30 changes: 8 additions & 22 deletions app/actions/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,28 +250,14 @@ export function doDeviceUpload(driverId, opts = {}, utc) {

device.detect(driverId, opts, (err, dev) => {
if (err) {
if ((os === 'mac' && _.get(targetDevice, ['showDriverLink', os], false) === true) ||
(os === 'win' && _.get(targetDevice, ['showDriverLink', os], false) === true)) {
let displayErr = new Error();
let driverLinkErrProps = {
details: err.message,
utc: actionUtils.getUtc(utc),
code: 'E_DRIVER',
version: version
};
displayErr.driverLink = urls.DRIVER_DOWNLOAD;
return dispatch(syncActions.uploadFailure(displayErr, driverLinkErrProps, targetDevice));
}
else {
let displayErr = new Error(errorText.E_SERIAL_CONNECTION);
let deviceDetectErrProps = {
details: err.message,
utc: actionUtils.getUtc(utc),
code: 'E_SERIAL_CONNECTION',
version: version
};
return dispatch(syncActions.uploadFailure(displayErr, deviceDetectErrProps, targetDevice));
}
let displayErr = new Error(errorText.E_SERIAL_CONNECTION);
let deviceDetectErrProps = {
details: err.message,
utc: actionUtils.getUtc(utc),
code: 'E_SERIAL_CONNECTION',
version: version
};
return dispatch(syncActions.uploadFailure(displayErr, deviceDetectErrProps, targetDevice));
}

if (!dev && opts.filename == null) {
Expand Down
2 changes: 2 additions & 0 deletions app/actions/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ export function makeUploadCb(dispatch, getState, errCode, utc) {
step: err.step || null,
datasetId: err.datasetId || null,
requestTrace: err.requestTrace || null,
sessionTrace: err.sessionTrace || null,
sessionToken: err.sessionToken || null,
code: err.code || errCode,
version: version,
data: recs
Expand Down
2 changes: 1 addition & 1 deletion app/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import * as actionSources from '../constants/actionSources';
import { pages, pagesMap } from '../constants/otherConstants';

import styles from '../../styles/components/Header.module.less';
import logo from '../../images/Tidepool_Logo_light x2.png';
import logo from '../../images/Tidepool_Logo_Light x2.png';

export class Header extends Component {
static propTypes = {
Expand Down
79 changes: 48 additions & 31 deletions app/components/UpdateModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,40 +48,57 @@ export class UpdateModal extends Component {
sync
} = this.props;

if ( checkingElectronUpdate ||
(
!(electronUpdateDownloaded && !electronUpdateAvailableDismissed) &&
!(electronUpdateManualChecked && (
!electronUpdateAvailableDismissed ||
electronUpdateDownloaded
)
)
)
) {
let title, text, actions;

if(electronUpdateAvailableDismissed){
return null;
}

let title, text, actions;

if(electronUpdateAvailable) {
title = 'Update Available!';
text = 'After clicking Install, the uploader will restart to complete the installation.';
actions = [
<button key='dismiss' className={styles.buttonSecondary} onClick={sync.dismissUpdateAvailable}>
Dismiss
</button>,
<button key='install' className={styles.button} onClick={this.handleInstall}>
Install
</button>
];
} else {
title = 'Uploader is up-to-date!';
text = `You are running version ${config.version}, the most recent one.`;
actions = (
<button className={styles.button} onClick={sync.dismissUpdateNotAvailable}>
Okay!
</button>
);
if (electronUpdateManualChecked) {
if (checkingElectronUpdate){
title = 'Checking for update...';
} else {
if (electronUpdateAvailable) {
title = 'Update Available!';
if (!electronUpdateDownloaded) {
text = 'Downloading update';
} else { // available and downloaded
text = 'After clicking Install, the uploader will restart to complete the installation.';
actions = [
<button key='dismiss' className={styles.buttonSecondary} onClick={sync.dismissUpdateAvailable}>
Dismiss
</button>,
<button key='install' className={styles.button} onClick={this.handleInstall}>
Install
</button>
];
}
} else { // no update available
title = 'Uploader is up-to-date!';
text = `You are running version ${config.version}, the most recent one.`;
actions = (
<button className={styles.button} onClick={sync.dismissUpdateNotAvailable}>
Okay!
</button>
);
}
}
}
else { // automatic background check
if(electronUpdateAvailable && electronUpdateDownloaded){
title = 'Update Available!';
text = 'After clicking Install, the uploader will restart to complete the installation.';
actions = [
<button key='dismiss' className={styles.buttonSecondary} onClick={sync.dismissUpdateAvailable}>
Dismiss
</button>,
<button key='install' className={styles.button} onClick={this.handleInstall}>
Install
</button>
];
} else {
return null;
}
}

return (
Expand Down
20 changes: 6 additions & 14 deletions app/components/UploadList.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,12 @@ export default class UploadList extends Component {
}
const errorDetails = upload.showErrorDetails ?
(<div>{upload.error.debug}</div>) : null;
const errorMessage = upload.error.driverLink ?
(
<div className={styles.errorMessageWrapper}>
<span className={styles.errorMessage}>{this.props.text.UPLOAD_FAILED}</span>
<span className={styles.errorMessageFriendly}>{'It\'s possible you need to install the '}</span>
<span className={styles.errorMessageLinkWrap}><a className={styles.errorMessageLink} href={upload.error.driverLink} target="_blank">Tidepool USB driver</a></span>
</div>
) :
(
<div className={styles.errorMessageWrapper}>
<span className={styles.errorMessage}>{this.props.text.UPLOAD_FAILED}</span>
<span className={styles.errorMessageFriendly}>{upload.error.message}</span>
</div>
);
const errorMessage = (
<div className={styles.errorMessageWrapper}>
<span className={styles.errorMessage}>{this.props.text.UPLOAD_FAILED}</span>
<span className={styles.errorMessageFriendly}>{upload.error.message}</span>
</div>
);
const showErrorsText = upload.showErrorDetails ? this.props.text.HIDE_ERROR : this.props.text.SHOW_ERROR;

function makeToggleDetailsFn() {
Expand Down
1 change: 0 additions & 1 deletion app/constants/otherConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export const steps = {
};

export const urls = {
DRIVER_DOWNLOAD: 'http://tidepool.org/downloads/',
HOW_TO_UPDATE_KB_ARTICLE: 'http://support.tidepool.org/article/6-how-to-install-or-upgrade-the-tidepool-uploader-gen',
HOW_TO_SHARE_DATA_KB_ARTICLE: 'http://support.tidepool.org/article/16-share-your-data'
};
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tidepool-uploader",
"productName": "tidepool-uploader",
"version": "0.310.0-alpha.11",
"version": "0.310.0-alpha.17",
"description": "Tidepool Project Universal Uploader",
"main": "./main.js",
"author": {
Expand Down
14 changes: 0 additions & 14 deletions app/reducers/devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const devices = {
name: 'Medtronic',
// for the device selection list
selectName: 'Medtronic (from CareLink)',
showDriverLink: {mac: false, win: false},
source: {type: 'carelink'},
enabled: {mac: true, win: true}
},
Expand All @@ -22,55 +21,48 @@ const devices = {
key: 'medtronic',
name: 'Medtronic - 523, 723 or 530G',
selectName: 'Medtronic direct from Bayer Contour Next Link',
showDriverLink: {mac: false, win: false},
source: {type: 'device', driverId: 'Medtronic'},
enabled: {mac: true, win: true}
},
omnipod: {
instructions: 'Plug in PDM with mini-USB and choose .ibf file from PDM',
key: 'omnipod',
name: 'Insulet OmniPod',
showDriverLink: {mac: false, win: false},
source: {type: 'block', driverId: 'InsuletOmniPod', extension: '.ibf'},
enabled: {mac: true, win: true}
},
dexcom: {
instructions: 'Plug in receiver with micro-USB',
key: 'dexcom',
name: 'Dexcom',
showDriverLink: {mac: true, win: true},
source: {type: 'device', driverId: 'Dexcom'},
enabled: {mac: true, win: true}
},
precisionxtra: {
instructions: 'Plug in meter with cable',
key: 'precisionxtra',
name: 'Abbott Precision Xtra',
showDriverLink: {mac: false, win: true},
source: {type: 'device', driverId: 'AbbottPrecisionXtra'},
enabled: {mac: false, win: true}
},
tandem: {
instructions: 'Plug in pump with micro-USB',
key: 'tandem',
name: 'Tandem',
showDriverLink: {mac: false, win: true},
source: {type: 'device', driverId: 'Tandem'},
enabled: {mac: true, win: true}
},
abbottfreestylelite: {
instructions: 'Plug in meter with cable',
key: 'abbottfreestylelite',
name: 'Abbott FreeStyle Lite',
showDriverLink: {mac: false, win: true},
source: {type: 'device', driverId: 'AbbottFreeStyleLite'},
enabled: {mac: false, win: true}
},
abbottfreestylefreedomlite: {
instructions: 'Plug in meter with cable',
key: 'abbottfreestylefreedomlite',
name: 'Abbott FreeStyle Freedom Lite',
showDriverLink: {mac: false, win: true},
source: {type: 'device', driverId: 'AbbottFreeStyleFreedomLite'},
enabled: {mac: false, win: true}
},
Expand All @@ -86,47 +78,41 @@ const devices = {
instructions: 'Plug in meter with micro-USB',
key: 'bayercontournext',
name: 'Bayer Contour Next',
showDriverLink: {mac: false, win: false},
source: {type: 'device', driverId: 'BayerContourNext'},
enabled: {mac: true, win: true}
},
bayercontournextusb: {
instructions: 'Plug meter into USB port',
key: 'bayercontournextusb',
name: 'Bayer Contour Next USB',
showDriverLink: {mac: false, win: false},
source: {type: 'device', driverId: 'BayerContourNextUsb'},
enabled: {mac: true, win: true}
},
bayercontourusb: {
instructions: 'Plug meter into USB port',
key: 'bayercontourusb',
name: 'Bayer Contour USB',
showDriverLink: {mac: false, win: false},
source: {type: 'device', driverId: 'BayerContourUsb'},
enabled: {mac: true, win: true}
},
bayercontournextlink: {
instructions: 'Plug meter into USB port',
key: 'bayercontournextlink',
name: 'Bayer Contour Next Link',
showDriverLink: {mac: false, win: false},
source: {type: 'device', driverId: 'BayerContourNextLink'},
enabled: {mac: true, win: true}
},
animas: {
instructions: 'Suspend and align back of pump with IR dongle front',
key: 'animas',
name: 'Animas',
showDriverLink: {mac: true, win: true},
source: {type: 'device', driverId: 'Animas'},
enabled: {mac: true, win: true}
},
onetouchverioiq: {
instructions: 'Plug in meter with mini-USB',
name: 'OneTouch VerioIQ',
key: 'onetouchverioiq',
showDriverLink: {mac: true, win: true},
source: {type: 'device', driverId: 'OneTouchVerioIQ'},
enabled: {mac: true, win: true}
}
Expand Down
2 changes: 2 additions & 0 deletions app/reducers/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ function uploading(state = false, action) {
function checkingElectronUpdate(state = false, action) {
switch (action.type) {
case actionTypes.CHECKING_FOR_UPDATES:
case actionTypes.AUTO_UPDATE_CHECKING_FOR_UPDATES:
case actionTypes.MANUAL_UPDATE_CHECKING_FOR_UPDATES:
return true;
case actionTypes.UPDATE_AVAILABLE:
case actionTypes.UPDATE_NOT_AVAILABLE:
Expand Down
2 changes: 2 additions & 0 deletions app/utils/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const errorProps = {
step: 'Driver Step',
datasetId: 'Dataset ID',
requestTrace: 'Request Trace',
sessionToken: 'Session Token',
sessionTrace: 'Session Trace',
stringifiedStack: 'Stack Trace',
utc: 'UTC Time',
version: 'Version'
Expand Down
Loading

0 comments on commit 2f758b0

Please sign in to comment.