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

Updates from tidepool #88

Open
wants to merge 1 commit into
base: main
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
60 changes: 57 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
version: 2
jobs:
build-macos:
resource_class: macos.m1.medium.gen1
working_directory: ~/tidepool-org/chrome-uploader
parallelism: 1
# CircleCI 2.0 does not support environment variables that refer to each other the same way as 1.0 did.
# If any of these refer to each other, rewrite them so that they don't or see https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables .
environment:
BASH_ENV: ".circleci/bash_env.sh"
macos:
xcode: '12.5.1'
xcode: '13.4.1'
steps:
- checkout
- run: git submodule sync
Expand Down Expand Up @@ -36,14 +37,67 @@ jobs:
# Test
- run: yarn lint
- run: yarn test

# Keychain setup step
- run:
name: Setup Custom Keychain
command: |
# Check if CSC_LINK and CSC_KEY_PASSWORD are set
if [[ -z "$CSC_LINK" || -z "$CSC_KEY_PASSWORD" ]]; then
echo "CSC_LINK or CSC_KEY_PASSWORD environment variables are missing. Aborting."
exit 1
fi

# Decode the base64-encoded certificate to a temporary file
echo "$CSC_LINK" | base64 --decode > certificate.p12

# Create a temporary directory for the custom keychain
temp_keychain_dir=$(mktemp -d)
custom_keychain_path="$temp_keychain_dir/custom.keychain"

# Keychain and certificate password
custom_keychain_password="tempChainPass"

# Save the temp_keychain_dir to a file for later cleanup
echo "$temp_keychain_dir" > keychain_dir.txt

# Create a custom keychain using the decoded certificate
security create-keychain -p "$custom_keychain_password" "$custom_keychain_path"
security import certificate.p12 -k "$custom_keychain_path" -P "$CSC_KEY_PASSWORD"

# Set the custom keychain as the system default
security default-keychain -s "$custom_keychain_path"

# Remove CSC_LINK from the environment variables
unset CSC_LINK
# Package
- run: if [ -z "$CIRCLE_PR_NUMBER" ]; then yarn package; else echo "Forked repo; no package built."; fi
# Keychain cleanup step
- run:
name: Cleanup Custom Keychain
command: |
# Read the temp_keychain_dir path from the saved file
temp_keychain_dir=$(cat keychain_dir.txt)

# Clean up: Delete the temporary keychain directory
if [ -d "$temp_keychain_dir" ]; then
rm -rf "$temp_keychain_dir"
echo "Custom keychain directory deleted."
else
echo "Custom keychain directory not found."
fi

# Remove the keychain_dir.txt file
rm -f keychain_dir.txt

# Remove the temporary certificate file
rm -f certificate.p12
build-windows:
machine:
# see https://circleci.com/developer/machine/image/windows-server-2019 for details
image: windows-server-2019-vs2019:stable
resource_class: windows.medium
shell: bash.exe
resource_class: windows.medium
shell: bash.exe
steps:
- checkout
- run: git submodule sync
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "lib/drivers/tandem"]
path = lib/drivers/tandem
url = https://github.com/Sensotrend/tandem-driver.git
[submodule "lib/drivers/tandem/tandem-driver"]
path = lib/drivers/tandem/tandem-driver
url = https://github.com/Sensotrend/tandem-driver.git
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ubuntu:18.04

ENV DEBIAN_FRONTEND noninteractive
ENV NODE_VERSION "v12.13.0"
ENV NODE_VERSION "v16.14.2"

# Lots of packages. Some dependencies and stuff for GUI.
RUN apt-get -qq -y update && \
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This README is focused on just the details of getting the uploader running local
## How to set it up

1. Clone this repository.
1. Make sure you have node v12.x installed. If you are managing node installations with [`nvm`](https://github.com/creationix/nvm 'GitHub: nvm'), which we **highly recommend**, you can just do `nvm use` when navigating to this repository to switch to the correct version of node. (In this repository, the correct version of node will always be the version of node packaged by the version of Electron that we are using and specified in the `.nvmrc` file.)
1. Make sure you have node v16.x installed. If you are managing node installations with [`nvm`](https://github.com/creationix/nvm 'GitHub: nvm'), which we **highly recommend**, you can just do `nvm use` when navigating to this repository to switch to the correct version of node. (In this repository, the correct version of node will always be the version of node packaged by the version of Electron that we are using and specified in the `.nvmrc` file.)
1. Run `npm install` or, preferably, `yarn`
1. Set the config for the environment you want to target (see [Config](#config) below)
1. Run the following command:
Expand Down Expand Up @@ -139,6 +139,7 @@ We use the following environment variables on the CI server:
|----------|-----------|-------|
| APPLEID | MacOS | Notarization |
| APPLEIDPASS | MacOS | Notarization |
| TEAMID | MacOS | Notarization |
| AWS_ACCESS_KEY_ID | Both | S3 builds and AV e-mails |
| AWS_SECRET_ACESS_KEY | Both | S3 builds and AV e-mails |
| CSC_FOR_PULL_REQUEST | Both | `true`, code signing for PR |
Expand Down Expand Up @@ -221,7 +222,7 @@ $ yarn package -- --[option]

To package the app on your local machine, you need to set the `ROLLBAR_POST_TOKEN` environment variable to send telemetry data to Rollbar. You can get one for free from https://rollbar.com

macOS: To notarize the app so that it will run on macOS Mojave, you need to set the environment variables `APPLEID` and `APPLEIDPASS`. Note that you need to set an app-specific password in https://appleid.apple.com for this to work.
macOS: To notarize the app so that it will run on macOS Mojave, you need to set the environment variables `APPLEID`, `APPLEIDPASS`, and `TEAMID`. Note that you need to set an app-specific password in https://appleid.apple.com for this to work.

Note that you'll need to build Windows builds on a Windows machine, and MacOS builds on a Mac.

Expand Down
2 changes: 0 additions & 2 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
* [Abbott FreeStyle meters](docs/checklists/abbottFreeStyleLite.md)
* [Abbott Precision Xtra](docs/checklists/abbottPrecisionXtra.md)
* [Accu-chek Aviva Connect & Guide (BGM)](docs/checklists/avivaConnectAndGuide.md)
* [Animas Vibe CGM](docs/checklists/animasCGM.md)
* [Animas Ping and Vibe Insulin Pumps](docs/checklists/animasPingAndVibe.md)
* [Ascensia/Bayer Contour Next meters](docs/checklists/bayerContourNext.md)
* [Dexcom CGM](docs/checklists/dexcom.md)
* [Insulet OmniPod](docs/checklists/insuletOmniPod.md)
Expand Down
50 changes: 50 additions & 0 deletions app/actions/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,56 @@ export function setPage(page, actionSource = actionSources[actionTypes.SET_PAGE]
} else {
dispatch(sync.getClinicsForClinicianSuccess(clinics, clinicianId, options));
}
// fetch EHR and MRN settings for clinics
_.each(clinics, (clinic) => {
console.log('fetching settings for clinic', clinic.clinic.id);
dispatch(fetchClinicEHRSettings(api, clinic.clinic.id));
dispatch(fetchClinicMRNSettings(api, clinic.clinic.id));
});
});
};
}

/**
* Fetch Clinic MRN Settings Action Creator
*
* @param {Object} api - an instance of the API wrapper
* @param {String} clinicId - Id of the clinic
*/
export function fetchClinicMRNSettings(api, clinicId) {
return (dispatch) => {
dispatch(sync.fetchClinicMRNSettingsRequest());

api.clinics.getMRNSettings(clinicId, (err, settings) => {
if (err) {
dispatch(sync.fetchClinicMRNSettingsFailure(
createActionError(ErrorMessages.ERR_FETCHING_CLINIC_MRN_SETTINGS, err), err
));
} else {
dispatch(sync.fetchClinicMRNSettingsSuccess(clinicId, settings));
}
});
};
}

/**
* Fetch Clinic EHR Settings Action Creator
*
* @param {Object} api - an instance of the API wrapper
* @param {String} clinicId - Id of the clinic
*/
export function fetchClinicEHRSettings(api, clinicId) {
return (dispatch) => {
dispatch(sync.fetchClinicEHRSettingsRequest());

api.clinics.getEHRSettings(clinicId, (err, settings) => {
if (err) {
dispatch(sync.fetchClinicEHRSettingsFailure(
createActionError(ErrorMessages.ERR_FETCHING_CLINIC_EHR_SETTINGS, err), err
));
} else {
dispatch(sync.fetchClinicEHRSettingsSuccess(clinicId, settings));
}
});
};
}
52 changes: 52 additions & 0 deletions app/actions/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,58 @@ export function selectClinic(clinicId) {
};
}

export function fetchClinicMRNSettingsRequest() {
return {
type: ActionTypes.FETCH_CLINIC_MRN_SETTINGS_REQUEST,
};
}

export function fetchClinicMRNSettingsSuccess(clinicId, settings) {
return {
type: ActionTypes.FETCH_CLINIC_MRN_SETTINGS_SUCCESS,
payload: {
clinicId,
settings,
},
};
}

export function fetchClinicMRNSettingsFailure(error, apiError) {
return {
type: ActionTypes.FETCH_CLINIC_MRN_SETTINGS_FAILURE,
error: error,
meta: {
apiError: apiError || null,
},
};
}

export function fetchClinicEHRSettingsRequest() {
return {
type: ActionTypes.FETCH_CLINIC_EHR_SETTINGS_REQUEST,
};
}

export function fetchClinicEHRSettingsSuccess(clinicId, settings) {
return {
type: ActionTypes.FETCH_CLINIC_EHR_SETTINGS_SUCCESS,
payload: {
clinicId,
settings,
},
};
}

export function fetchClinicEHRSettingsFailure(error, apiError) {
return {
type: ActionTypes.FETCH_CLINIC_EHR_SETTINGS_FAILURE,
error: error,
meta: {
apiError: apiError || null,
},
};
}

export function keycloakReady(event, error, logoutUrl){
return {
type: ActionTypes.KEYCLOAK_READY,
Expand Down
Loading