Skip to content

Commit

Permalink
chore: merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-mccombs committed Dec 13, 2020
2 parents a832613 + 2c0bee4 commit 1812733
Show file tree
Hide file tree
Showing 15 changed files with 187 additions and 132 deletions.
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,44 @@

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.

### [8.9.1](https://github.com/hopetambala/puente-reactnative-collect/compare/v8.9.0...v8.9.1) (2020-12-10)


### Bug fixes

* add surveyingUser fix to supplementary forms ([062a3a5](https://github.com/hopetambala/puente-reactnative-collect/commit/062a3a5331499bd042aa7d977529471998942d89))

## [8.9.0](https://github.com/hopetambala/puente-reactnative-collect/compare/v8.8.2...v8.9.0) (2020-12-10)


### Housekeeping Tasks

* fix setView on find records page ([0520b1e](https://github.com/hopetambala/puente-reactnative-collect/commit/0520b1ef40b224087aefacc1092ef7b044770586))
* fix validation on supplementary forms ([09ccc19](https://github.com/hopetambala/puente-reactnative-collect/commit/09ccc19d7111cd5a8ee9d9a1df4c55b2a3fec3f6))


### New Features

* hotfix for not populating surveyor names ([ae0103b](https://github.com/hopetambala/puente-reactnative-collect/commit/ae0103be414cd752e85a54985b37d3e3b1cbe9e2))

### [8.8.2](https://github.com/hopetambala/puente-reactnative-collect/compare/v8.8.1...v8.8.2) (2020-12-03)


### Bug fixes

* incorrect usage of current async function ([4739d74](https://github.com/hopetambala/puente-reactnative-collect/commit/4739d74078fd799003e461e2364552e3fd5bf417))
* keyboard not hiding when signning in ([f2d631b](https://github.com/hopetambala/puente-reactnative-collect/commit/f2d631bb8a6a21ba0153f5f8c96abb428e5c6e5e))


### New Features

* add loading indicator for location ([e55ce97](https://github.com/hopetambala/puente-reactnative-collect/commit/e55ce97ebaec4d5cddd6afb9cae05cac24cf8e40))


### Housekeeping Tasks

* reformat findResident page ([a7d780f](https://github.com/hopetambala/puente-reactnative-collect/commit/a7d780f79e54948133055f767311f7762ef62a47))

### [8.8.1](https://github.com/hopetambala/puente-reactnative-collect/compare/v8.8.0...v8.8.1) (2020-11-27)

## [8.8.0](https://github.com/hopetambala/puente-reactnative-collect/compare/v8.7.0...v8.8.0) (2020-11-26)
Expand Down
108 changes: 62 additions & 46 deletions components/FindResidents/Resident/ResidentPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
View, StyleSheet, Image
} from 'react-native';
import {
Text, Button, Title
Text, Button
} from 'react-native-paper';

import Demographics from './Demographics';
Expand Down Expand Up @@ -41,11 +41,11 @@ const ResidentPage = ({
setForms(true);
};

const showHousehold = () => {
setForms(false);
setDemographics(false);
setHousehold(true);
};
// const showHousehold = () => {
// setForms(false);
// setDemographics(false);
// setHousehold(true);
// };
return (
<View>
<Button icon="arrow-left" width={100} onPress={() => setSelectPerson()}>
Expand All @@ -56,50 +56,63 @@ const ResidentPage = ({
style={styles.profPic}
source={pictureUrl}
/>
<View style={styles.nameContainer}>
<Title>{`${fname} ${lname}`}</Title>
<View style={{ margin: 7 }}>
<View style={styles.nameContainer}>
<Text style={[styles.name, { fontWeight: 'bold' }]}>{`${fname} ${lname}`}</Text>
</View>
<Text style={styles.name}>{`"${nickname}"`}</Text>
<Button

{/* <Button
style={styles.button}
contentStyle={styles.buttonContent}
>
{I18n.t('findResident.residentPage.household.editProfile')}
</Button>
</Button> */}
</View>
</View>
<View
style={styles.horizontalLine}
/>
<View style={styles.navigationButtons}>
<Button onPress={() => showDemographics()}>{I18n.t('findResident.residentPage.household.demographics')}</Button>
<Button onPress={() => showForms(true)}>{I18n.t('findResident.residentPage.household.forms')}</Button>
<Button onPress={() => showHousehold(true)}>{I18n.t('findResident.residentPage.household.household')}</Button>
<View style={styles.navigationButtonsContainer}>
<Button style={styles.navigationButton} labelStyle={styles.navigationButtonText} onPress={() => showDemographics()}>{I18n.t('findResident.residentPage.household.demographics')}</Button>
<Button style={styles.navigationButton} labelStyle={styles.navigationButtonText} onPress={() => showForms(true)}>{I18n.t('findResident.residentPage.household.forms')}</Button>
{/* <Button style={styles.navigationButton}
labelStyle={styles.navigationButtonText}
onPress={() => showHousehold(true)}>
{I18n.t('findResident.residentPage.household.household')}
</Button> */}
</View>
<View
style={styles.horizontalLine}
/>
{demographics && (
<Demographics
dob={selectPerson.dob}
city={city}
community={selectPerson.communityname}
province={selectPerson.province}
license={selectPerson.license}
selectPerson={selectPerson}
/>
)}
{forms && (
<Forms
puenteForms={puenteForms}
navigateToNewRecord={navigateToNewRecord}
surveyee={selectPerson}
setSurveyee={setSurveyee}
setView={setView}
/>
)}
{household && (
<Household />
)}
{
demographics && (
<Demographics
dob={selectPerson.dob}
city={city}
community={selectPerson.communityname}
province={selectPerson.province}
license={selectPerson.license}
selectPerson={selectPerson}
/>
)
}
{
forms && (
<Forms
puenteForms={puenteForms}
navigateToNewRecord={navigateToNewRecord}
surveyee={selectPerson}
setSurveyee={setSurveyee}
setView={setView}
/>
)
}
{
household && (
<Household />
)
}
<Button onPress={() => setSelectPerson()}>{I18n.t('findResident.residentPage.household.goBack')}</Button>
</View>
);
Expand All @@ -115,14 +128,15 @@ const styles = StyleSheet.create({
},
picNameContainer: {
flexDirection: 'row',
margin: 20
margin: 14
},
nameContainer: {
flexDirection: 'column',
marginLeft: 20,
flexDirection: 'row',
},
name: {
color: '#696969'
color: '#696969',
flexShrink: 1,
marginVertical: 7,
},
button: {
width: 120,
Expand All @@ -135,13 +149,15 @@ const styles = StyleSheet.create({
borderBottomColor: theme.colors.primary,
borderBottomWidth: 1,
},
navigationButtons: {
navigationButtonsContainer: {
flexDirection: 'row',
marginLeft: 15,
marginRight: 15,
marginTop: 5,
marginBottom: 5

alignItems: 'flex-start',
},
navigationButton: {
flex: 1,
},
navigationButtonText: {
fontWeight: 'bold'
}
});

Expand Down
32 changes: 21 additions & 11 deletions components/FormikFields/PaperInputPicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import {
View, Text
} from 'react-native';
import {
TextInput, Button, Headline
TextInput, Button, Headline,
} from 'react-native-paper';
import { Spinner } from 'native-base';

import getLocation from '../../../modules/geolocation';
import I18n from '../../../modules/i18n';
Expand All @@ -28,14 +29,19 @@ const PaperInputPicker = ({
handleChange, handleBlur, errors, setFieldValue, values
} = formikProps;

const [location, setLocation] = React.useState({ latitude: 5, longitude: 10, altitude: 0 });
const [location, setLocation] = React.useState({ latitude: 0, longitude: 0, altitude: 0 });
const [locationLoading, setLocationLoading] = React.useState(false);

const handleLocation = async () => {
const currentLocation = await getLocation();
setLocationLoading(true);
const currentLocation = await getLocation().catch((e) => e);
const { latitude, longitude, altitude } = currentLocation.coords;

setFieldValue('location', { latitude, longitude, altitude });
setLocation({ latitude, longitude, altitude });
setTimeout(() => {
setLocationLoading(false);
}, 1000);
};

const translatedLabel = customForm ? label : I18n.t(label);
Expand Down Expand Up @@ -340,14 +346,18 @@ const PaperInputPicker = ({
buttonText="Get Location Again"
/>
<View style={{ marginLeft: 'auto', marginRight: 'auto', flexDirection: 'row' }}>
<Text style={{ paddingRight: 5, fontWeight: 'bold' }}>
Latitude:
{location.latitude}
</Text>
<Text style={{ paddingLeft: 5, fontWeight: 'bold' }}>
Longitude:
{location.longitude}
</Text>
{
locationLoading === true
&& <Spinner color={theme.colors.primary} />
}
{locationLoading === false
&& (
<View>
<Headline>
{`(${location.latitude.toFixed(2)}, ${location.longitude.toFixed(2)})`}
</Headline>
</View>
)}
</View>
<Text style={{ color: 'red' }}>
{errors[formikKey]}
Expand Down
16 changes: 1 addition & 15 deletions components/MapView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,8 @@ const Maps = ({ organization }) => {
handleLocation();
}, []);

// useEffect(() => {
// let isSubscribed = true;
// retrieveMarkers().then((records) => {
// if (isSubscribed) {
// if (records !== markers) {
// setMarkers(records); // sets records if promise is reached during mounting
// }
// }
// });
// return function cleanup() {
// isSubscribed = false; // cancels promise when component unmounts
// };
// }, []);

const handleLocation = async () => {
const currentLocation = await getLocation();
const currentLocation = await getLocation().catch((e) => e);
const { latitude, longitude } = currentLocation.coords;
setRegion({
...region,
Expand Down
4 changes: 2 additions & 2 deletions domains/Auth/PinCode/GetPinCode/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Text, Button } from 'react-native-paper';
import { Formik } from 'formik';
import FormInput from '../../../../components/FormikFields/FormInput';
import { storeData, getData, deleteData } from '../../../../modules/async-storage';
import { retrieveSignInFunction, retrieveCurrentUserFunction } from '../../../../services/parse/auth';
import { retrieveSignInFunction, retrieveCurrentUserAsyncFunction } from '../../../../services/parse/auth';
import I18n from '../../../../modules/i18n';

const GetPinCode = ({ navigation }) => {
Expand All @@ -21,7 +21,7 @@ const GetPinCode = ({ navigation }) => {
.then((userCreds) => {
retrieveSignInFunction(userCreds.username, userCreds.password)
.then(() => {
const currentUser = retrieveCurrentUserFunction();
const currentUser = retrieveCurrentUserAsyncFunction();
getData('currentUser').then((user) => {
if (user !== currentUser) {
storeData(currentUser, 'currentUser');
Expand Down
19 changes: 11 additions & 8 deletions domains/Auth/SignIn/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
View,
StyleSheet,
Alert,
Keyboard,
KeyboardAvoidingView,
Platform,
ScrollView
Expand Down Expand Up @@ -82,6 +83,11 @@ const SignIn = ({ navigation }) => {
navigation.navigate('Sign Up');
};

const handleSignIn = () => {
Keyboard.dismiss();
navigation.navigate('Root');
};

const handleSaveCredentials = (values) => {
Alert.alert(
I18n.t('signIn.credentials'),
Expand Down Expand Up @@ -124,12 +130,9 @@ const SignIn = ({ navigation }) => {
};

const storeUserInformation = async () => {
const currentUser = await retrieveCurrentUserAsyncFunction();
getData('organization').then((asyncOrg) => {
if (asyncOrg !== currentUser.get('organization')) {
storeData(currentUser.get('organization'), 'organization');
storeData(currentUser, 'currentUser');
}
await retrieveCurrentUserAsyncFunction().then((currentUser) => {
storeData(currentUser.organization, 'organization');
storeData(currentUser, 'currentUser');
});
};

Expand Down Expand Up @@ -166,7 +169,7 @@ const SignIn = ({ navigation }) => {
// no credentials saved, give option to save
handleSaveCredentials(values);
});
navigation.navigate('Root');
handleSignIn();
}, (err) => {
handleFailedAttempt(err);
});
Expand All @@ -177,7 +180,7 @@ const SignIn = ({ navigation }) => {
if (values.username === userCreds.username
&& values.password === userCreds.password) {
// need some pincode verification
navigation.navigate('Root');
handleSignIn();
} else {
// cannot log in offline without saved credentials, connect to internet
}
Expand Down
18 changes: 0 additions & 18 deletions domains/Auth/StoreOrganization/index.js

This file was deleted.

Loading

0 comments on commit 1812733

Please sign in to comment.