Skip to content

Commit

Permalink
Merge pull request #87 from hopetambala/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
joseph-mccombs authored Jul 20, 2021
2 parents a77d48b + e9d846e commit bb426e0
Show file tree
Hide file tree
Showing 18 changed files with 187 additions and 209 deletions.
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,32 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.


## [11.8.0](https://github.com/hopetambala/puente-reactnative-collect/compare/v11.7.12...v11.8.0) (2021-07-05)


### Bug fixes

* keyboard automatically dismissing when entering ([b763f2a](https://github.com/hopetambala/puente-reactnative-collect/commit/b763f2a7ca9ea5d86d0e44ab94af6427cb147fd4))
* Pinned Form Translation bug fix ([746de57](https://github.com/hopetambala/puente-reactnative-collect/commit/746de577589d315b472b81c3ee04d800d3833127))
* user not switching when entering data collection epic ([3ba829b](https://github.com/hopetambala/puente-reactnative-collect/commit/3ba829ba1f41e92a74e54c5df646d3656aad1e3b))

### [11.7.12](https://github.com/hopetambala/puente-reactnative-collect/compare/v11.7.11...v11.7.12) (2021-07-03)


### Bug fixes

* logging of session for user and refactor of custom forms function ([b52e7b2](https://github.com/hopetambala/puente-reactnative-collect/commit/b52e7b26c75d1c801349ce72f2f6a5b6eb69a3cd))

### [11.7.11](https://github.com/hopetambala/puente-reactnative-collect/compare/v11.7.10...v11.7.11) (2021-07-03)


### Bug fixes

* forms not changing when user switch organizations or users ([3fa581b](https://github.com/hopetambala/puente-reactnative-collect/commit/3fa581b3a540a23a41356665385eaf5ff0b772d4))

### [11.7.10](https://github.com/hopetambala/puente-reactnative-collect/compare/v11.7.9...v11.7.10) (2021-07-01)

### [11.7.9](https://github.com/hopetambala/puente-reactnative-collect/compare/v11.7.8...v11.7.9) (2021-06-13)

### [11.7.8](https://github.com/hopetambala/puente-reactnative-collect/compare/v11.7.7...v11.7.8) (2021-06-12)
Expand Down
6 changes: 3 additions & 3 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"android",
"web"
],
"version": "11.7.9",
"version": "11.8.2",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"scheme": "myapp",
Expand All @@ -23,7 +23,7 @@
],
"ios": {
"supportsTablet": true,
"buildNumber": "11.7.9",
"buildNumber": "11.8.2",
"infoPlist": {
"NSLocationWhenInUseUsageDescription": "This app uses your location to geo-tag surveys accurately."
},
Expand All @@ -34,7 +34,7 @@
"favicon": "./assets/images/favicon.png"
},
"android": {
"versionCode": 410110709,
"versionCode": 410110802,
"permissions": [
"ACCESS_COARSE_LOCATION",
"ACCESS_FINE_LOCATION",
Expand Down
49 changes: 7 additions & 42 deletions components/Cards/SmallCardsCarousel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import {
Card, Text
} from 'react-native-paper';

import MedEvalSVG from '../../../assets/icons/Heart-Icon.svg';
import EnvSVG from '../../../assets/icons/Home-icon.svg';
import NewRecordSVG from '../../../assets/icons/New-Record-icon.svg';
import I18n from '../../../modules/i18n';
import { theme } from '../../../modules/theme';

Expand Down Expand Up @@ -49,47 +46,15 @@ const SmallCardsCarousel = ({
}}
onLongPress={pinForm ? () => pinForm(form) : null}
>
{form.tag === 'id' && (
<View style={styles.cardContainer}>
<NewRecordSVG height={40} style={styles.svg} />
<View style={styles.textContainer}>
<Text style={styles.text}>
{I18n.t('cards.smallCards.residentID')}
</Text>
</View>
<View style={styles.cardContainer}>
<form.image height={40} style={styles.svg} />
<View style={styles.textContainer}>
<Text style={styles.text}>
{I18n.t(form.name)}
</Text>
</View>
)}
</View>

{form.tag === 'env' && (
<View style={styles.cardContainer}>
<EnvSVG height={40} style={styles.svg} />
<View style={styles.textContainer}>
<Text style={styles.text}>
{`${I18n.t('cards.smallCards.environmental')} ${I18n.t('cards.smallCards.history')}`}
</Text>
</View>
</View>
)}
{form.tag === 'med-eval' && (
<View style={styles.cardContainer}>
<MedEvalSVG height={40} style={styles.svg} />
<View style={styles.textContainer}>
<Text style={styles.text}>
{`${I18n.t('cards.smallCards.medical')} ${I18n.t('cards.smallCards.evaluation')}`}
</Text>
</View>
</View>
)}
{form.tag === 'vitals' && (
<View style={styles.cardContainer}>
<NewRecordSVG height={40} style={styles.svg} />
<View style={styles.textContainer}>
<Text style={styles.text}>
{I18n.t('cards.smallCards.vitals')}
</Text>
</View>
</View>
)}
</Card>
))}
</ScrollView>
Expand Down
2 changes: 1 addition & 1 deletion components/Text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import { Text } from 'react-native';
export default function MonoText(props) {
const { style } = props;
return <Text {...props} style={[style, { fontFamily: 'space-mono' }]} />;
}
}
17 changes: 8 additions & 9 deletions domains/Auth/SignIn/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ const SignIn = ({ navigation }) => {
navigation.navigate('Sign Up');
};

const handleSignIn = async () => {
const handleSignIn = async (values, callback) => {
if (callback) callback();
Keyboard.dismiss();
navigation.navigate('Root');
navigation.navigate('Root', values);
};

const handleSaveCredentials = (currentUser, values) => {
Expand All @@ -119,7 +120,7 @@ const SignIn = ({ navigation }) => {
text: 'No',
style: 'cancel',
onPress: () => {
navigation.navigate('Root');
handleSignIn(values);
}
},
],
Expand Down Expand Up @@ -165,32 +166,30 @@ const SignIn = ({ navigation }) => {
retrieveSignInFunction(values.username, values.password)
.then((currentUser) => {
storeUserInformation(currentUser, values);
getData('currentUser').then((userCreds) => {
getData('currentUser').then(async (userCreds) => {
// credentials stored do not match those entered through sign-in, overwrite
if (userCreds === null || userCreds.store === 'No' || values.username !== userCreds.username
|| values.password !== userCreds.password) {
// Store user organization
storeUserInformation(currentUser, values);
handleSaveCredentials(currentUser, values);
} else {
storeUserInformation(currentUser);
handleSignIn(values, actions.resetForm());
await handleSignIn(values, actions.resetForm);
}
}, () => {
storeUserInformation(currentUser, values);
handleSaveCredentials(currentUser, values);
});
}, (err) => {
handleFailedAttempt(err);
});
} else {
// offline
getData('currentUser').then((userCreds) => {
getData('currentUser').then(async (userCreds) => {
// username and password entered (or saved in creds) match the saved cred
if (values.username === userCreds.username
&& values.password === userCreds.password) {
// need some pincode verification
handleSignIn(values, actions.resetForm());
await handleSignIn(values, actions.resetForm);
} else {
// incorrect usernmae/password offline
handleFailedAttempt();
Expand Down
49 changes: 41 additions & 8 deletions domains/DataCollection/FormGallery/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect, useState } from 'react';
import {
ScrollView,
View
Expand All @@ -11,16 +11,45 @@ import {

import ComingSoonSVG from '../../../assets/graphics/static/Adventurer.svg';
import SmallCardsCarousel from '../../../components/Cards/SmallCardsCarousel';
import { getData, storeData } from '../../../modules/async-storage';
import { customFormsQuery } from '../../../modules/cached-resources';
import I18n from '../../../modules/i18n';
import { layout, theme } from '../../../modules/theme';
import styles from './index.styles';

const FormGallery = (props) => {
const {
navigateToNewRecord, puenteForms,
navigateToCustomForm, customForms, refreshCustomForms,
pinnedForms, pinForm, removePinnedForm
} = props;
const FormGallery = ({
navigateToNewRecord, navigateToCustomForm,
puenteForms,
pinnedForms, setPinnedForms,
setLoading, surveyingOrganization
}) => {
const [customForms, setCustomForms] = useState([]);

useEffect(() => {
getData('customForms').then((forms) => {
setCustomForms(forms);
});
}, [customForms]);

const refreshCustomForms = () => {
setLoading(true);
customFormsQuery(surveyingOrganization).then((forms) => {
setCustomForms(forms);
setLoading(false);
});
};

const pinForm = async (form) => {
setPinnedForms([...pinnedForms, form]);
storeData(pinnedForms, 'pinnedForms');
};

const removePinnedForm = async (form) => {
const filteredPinnedForms = pinnedForms.filter((pinnedForm) => pinnedForm !== form);
setPinnedForms(filteredPinnedForms);
storeData(filteredPinnedForms, 'pinnedForms');
};

return (
<View>
<View key="pinnedForms" style={layout.screenRow}>
Expand All @@ -36,10 +65,14 @@ const FormGallery = (props) => {
}}
onLongPress={() => removePinnedForm(form)}
>

<View style={styles.cardContainer}>
{form.image !== undefined && (
<form.image height={40} style={styles.svg} />
)}
<View style={styles.textContainer}>
<Text style={styles.text}>
{form.name}
{ form.customForm === false ? I18n.t(form.name) : form.name}
</Text>
</View>
</View>
Expand Down
4 changes: 2 additions & 2 deletions domains/DataCollection/Forms/IdentificationForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const IdentificationForm = ({

return (
<View>
<TouchableWithoutFeedback onPress={Keyboard.dismiss()} accessible={false}>
<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
<Formik
initialValues={{}}
onSubmit={async (values,) => {
Expand All @@ -48,7 +48,7 @@ const IdentificationForm = ({
const formObject = values;
const user = await getData('currentUser');

formObject.surveyingOrganization = surveyingOrganization;
formObject.surveyingOrganization = surveyingOrganization || user.organization;
formObject.surveyingUser = await surveyingUserFailsafe(user, surveyingUser, isEmpty);
formObject.appVersion = await getData('appVersion');

Expand Down
2 changes: 1 addition & 1 deletion domains/DataCollection/Forms/SupplementaryForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const SupplementaryForm = ({
const user = await getData('currentUser');

formObject.surveyingUser = await surveyingUserFailsafe(user, surveyingUser, isEmpty);
formObject.surveyingOrganization = surveyingOrganization;
formObject.surveyingOrganization = surveyingOrganization || user.organization;
formObject.appVersion = await getData('appVersion');

let formObjectUpdated = addSelectTextInputs(values, formObject);
Expand Down
2 changes: 1 addition & 1 deletion domains/DataCollection/Forms/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const Forms = (props) => {
)}
{consent === true && selectedForm !== 'id' && selectedForm !== '' && (
<View>
<TouchableWithoutFeedback onPress={Keyboard.dismiss()} accessible={false}>
<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
<View>
<View style={layout.container}>
<ResidentIdSearchbar
Expand Down
Loading

0 comments on commit bb426e0

Please sign in to comment.