Skip to content

Commit

Permalink
Merge pull request #69 from hopetambala/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
joseph-mccombs authored Feb 20, 2021
2 parents 4460054 + 059c240 commit 351ba11
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions domains/DataCollection/Forms/IdentificationForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import PaperButton from '../../../../components/Button';
import ErrorPicker from '../../../../components/FormikFields/ErrorPicker';
import PaperInputPicker from '../../../../components/FormikFields/PaperInputPicker';
import yupValidationPicker from '../../../../components/FormikFields/YupValidation';
import { getData } from '../../../../modules/async-storage';
import { postIdentificationForm } from '../../../../modules/cached-resources';
import I18n from '../../../../modules/i18n';
import { layout, theme } from '../../../../modules/theme';
Expand Down Expand Up @@ -46,6 +47,7 @@ const IdentificationForm = ({
const formObject = values;
formObject.surveyingOrganization = surveyingOrganization;
formObject.surveyingUser = await surveyingUserFailsafe(surveyingUser, isEmpty);
formObject.appVersion = await getData('appVersion');

formObject.latitude = values.location?.latitude || 0;
formObject.longitude = values.location?.longitude || 0;
Expand Down
2 changes: 2 additions & 0 deletions domains/DataCollection/Forms/SupplementaryForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Button, Text } from 'react-native-paper';
import ErrorPicker from '../../../../components/FormikFields/ErrorPicker';
import PaperInputPicker from '../../../../components/FormikFields/PaperInputPicker';
import yupValidationPicker from '../../../../components/FormikFields/YupValidation';
import { getData } from '../../../../modules/async-storage';
import { postSupplementaryForm } from '../../../../modules/cached-resources';
import I18n from '../../../../modules/i18n';
import { layout, theme } from '../../../../modules/theme';
Expand Down Expand Up @@ -59,6 +60,7 @@ const SupplementaryForm = ({
const formObject = values;
formObject.surveyingUser = await surveyingUserFailsafe(surveyingUser, isEmpty);
formObject.surveyingOrganization = surveyingOrganization;
formObject.appVersion = await getData('appVersion');

let formObjectUpdated = addSelectTextInputs(values, formObject);
if (selectedForm === 'vitals') {
Expand Down
11 changes: 11 additions & 0 deletions modules/cached-resources/populate-cache.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Constants from 'expo-constants';

import { retrieveCurrentUserAsyncFunction } from '../../services/parse/auth';
import { getData, storeData } from '../async-storage';
import { cacheAutofillData, cacheResidentData, customFormsQuery } from './read';
Expand Down Expand Up @@ -45,5 +47,14 @@ export default function populateCache(user) {
})
.then(async () => {
await customFormsQuery(user.get('organization'));
})
.then(async () => {
// store current app version
const appVersion = Constants.manifest.version;
await getData('appVersion').then(async (currentAppVersion) => {
if (appVersion !== currentAppVersion && appVersion !== null && appVersion !== undefined) {
await storeData(appVersion, 'appVersion');
}
});
});
}

0 comments on commit 351ba11

Please sign in to comment.