Skip to content
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
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# PiS-Hello
Business card holder app

Timeline:
17.11 - 1 stage
13.12 - 2 stage
03.01 - 3 stage
24.01 - 4 stage
# Hello
Application for holding and sharing business cards

### Server

Expand Down Expand Up @@ -110,7 +104,8 @@ npm start
```
After that, you can run the app on an android/iOS device emulator or directly on your mobile device using Expo Go app.

Links:
Useful links:
* [Jira Board](https://hello-pis.atlassian.net/jira/software/projects/HPIS/boards/1)
* [CI documentation](https://circleci.com/docs/2.0/configuration-reference)
* [Documentation](https://www.overleaf.com/read/gyhnrhzrhfxw)
* [CI documentation](https://docs.github.com/en/actions)
* [ORM documentation](https://github.com/JetBrains/Exposed/wiki)
* [Project documentation](https://www.overleaf.com/read/gyhnrhzrhfxw)
File renamed without changes.
File renamed without changes.
15 changes: 2 additions & 13 deletions frontend/App.js → application/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ import React, { useState, useEffect } from 'react';
import { createStore, combineReducers, applyMiddleware } from 'redux';
import { Provider } from 'react-redux';
import * as Font from 'expo-font';
import AppLoading from 'expo-app-loading';
import ReduxThunk from 'redux-thunk';

import { StyleSheet, SafeAreaView, View } from 'react-native';
import { View } from 'react-native';
import AppNavigation from './navigation/AppNavigation';

import authReducer from './reducers/auth';
import searchReducer from './reducers/search';
import businessCardsReducer from './reducers/businessCards';
Expand Down Expand Up @@ -50,7 +47,7 @@ export default function App() {
if (!fontLoaded) {
return (
<View>
<LoadingScreenModal amIVisible={Platform.OS === 'ios' ? false : true} />
<LoadingScreenModal amIVisible={Platform.OS !== 'ios'} />
</View>
);
}
Expand All @@ -77,11 +74,3 @@ export default function App() {
// )
// }
}

const styles = StyleSheet.create({
root: {
flex: 1,
backgroundColor: '#F9FBFC'
}
});

18 changes: 9 additions & 9 deletions frontend/actions/auth.js → application/actions/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ export const signIn = (login, password) => {

console.log(`response status: ${response.status}`);
let token = null;
if(response.status == 200) {
if(response.status === 200) {
const respData = await response.json();
token = respData.token;
console.log(`Received token: ${token}`);
} else if (response.status == 403) {
} else if (response.status === 403) {
console.log(`Request rejected. Wrong credentials.`);
} else {
console.log(`Request rejected for unknown reason.`);
Expand Down Expand Up @@ -120,11 +120,11 @@ export const logInWithGoogle = googleToken => {

console.log(`response status: ${second_response.status}`);
let token = null;
if(first_response.status == 200) {
if(first_response.status === 200) {
const respData = await second_response.json();
token = respData.token;
console.log(`Received token: ${token}`);
} else if (first_response.status == 403) {
} else if (first_response.status === 403) {
console.log(`Request rejected. Wrong credentials.`);
} else {
console.log(`Request rejected for unknown reason.`);
Expand All @@ -138,7 +138,7 @@ export const register = (login, password, passwordRepeat) => {
return async dispatch => {
console.log('registering...');

if (password != passwordRepeat) {
if (password !== passwordRepeat) {
console.log('Passwords are not the same. Please try again.');
return dispatch({ type: REGISTER, outcome: null });
}
Expand Down Expand Up @@ -172,10 +172,10 @@ export const register = (login, password, passwordRepeat) => {
}

console.log(`response status: ${response.status}`);
if(response.status == 201) {
if(response.status === 201) {
console.log(`Registration successful!`);
dispatch({ type: REGISTER, outcome: true });
} else if (response.status == 409) {
} else if (response.status === 409) {
console.log(`Request rejected. Wrong credentials. Try changing your login.`);
dispatch({ type: REGISTER, outcome: false });
} else {
Expand All @@ -192,10 +192,10 @@ export const checkLogin = (login) => {
`http://${serverAddress.address}:8080/check?name=${login}`
);
console.log(`response status: ${response.status}`);
if(response.status == 200) {
if(response.status === 200) {
console.log(`Login available`);
dispatch({ type: CHECK_LOGIN, outcome: true });
} else if (response.status == 409) {
} else if (response.status === 409) {
console.log(`User with this name already exists.`);
dispatch({ type: CHECK_LOGIN, outcome: false });
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { SHA256 } from 'crypto-js';

import serverAddress from '../constants/serverAddress';
import { serverAddress } from '../constants/serverAddress';

export const ADD_CARD = 'ADD_CARD';

Expand Down Expand Up @@ -57,7 +55,7 @@ export const addBusinessCard = (photo, ownerName) => {

console.log(`response status: ${response.status}`);

const outcome = response.status === 201 ? true : false;
const outcome = response.status === 201;

dispatch({ type: ADD_CARD, outcome: outcome });
}
Expand Down
8 changes: 4 additions & 4 deletions frontend/actions/edit.js → application/actions/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function fetchWithTimeout(resource, options = {}) {
}
};

export const editCardData = (idU, company, name, phone, email, category, mode) => {
export const setCardData = (idU, company, name, phone, email, category, mode) => {

return async dispatch => {
const id = parseInt(idU);
Expand All @@ -33,7 +33,7 @@ export const editCardData = (idU, company, name, phone, email, category, mode) =

try {
response = await fetchWithTimeout(
`http://${serverAddress.address}:8080/card/changedata`,
`http://${serverAddress.address}:8080/card/set`,
{
method: 'POST',
headers: {
Expand All @@ -60,10 +60,10 @@ export const editCardData = (idU, company, name, phone, email, category, mode) =
}

console.log(`Response status: ${response.status}`);
if(response.status == 200) {
if(response.status === 200) {
console.log(`Update data successfully`);
dispatch({ type: EDIT_DATA, outcome: true });
} else if (response.status == 404) {
} else if (response.status === 404) {
console.log(`Request rejected. Wrong credentials.`);
dispatch({ type: EDIT_DATA, outcome: false });
} else {
Expand Down
8 changes: 4 additions & 4 deletions frontend/actions/search.js → application/actions/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ export const getMyBusinessCards = (username) => {

console.log(`response status: ${response.status}`);
var respData = [];
if(response.status == 200) {
if(response.status === 200) {
respData = await response.json();
} else if (response.status == 404) {
} else if (response.status === 404) {
console.log(`No business cards found.`);
} else {
console.log(`Request rejected for unknown reason.`);
Expand Down Expand Up @@ -80,9 +80,9 @@ export const searchBusinessCards = ({id=null, profession=null, ownername=null})

console.log(`response status: ${response.status}`);
var respData = [];
if(response.status == 200) {
if(response.status === 200) {
respData = await response.json();
} else if (response.status == 404) {
} else if (response.status === 404) {
console.log(`No business cards found.`);
} else {
console.log(`Request rejected for unknown reason.`);
Expand Down
2 changes: 1 addition & 1 deletion frontend/app.json → application/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"foregroundImage": "./assets/business-card.png",
"backgroundColor": "#FFFFFF"
},
"package": "com.pishello.hellopis"
"package": "com.hello.hello"
},
"web": {
"favicon": "./assets/business-card.png"
Expand Down
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,3 @@ export default function LoadingScreenModal({amIVisible}){
</Modal>
);
};

const styles = StyleSheet.create({

})
File renamed without changes.
2 changes: 1 addition & 1 deletion frontend/package.json → application/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "pis-front",
"name": "hello",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react';
import { View, StyleSheet, Text, Image, Alert, TouchableOpacity, Dimensions } from 'react-native';
import { Camera } from 'expo-camera';
import { AntDesign } from '@expo/vector-icons';
import * as ScreenOrientation from 'expo-screen-orientation';
import * as businessCardsActions from '../actions/businessCards';
import LoadingScreenModal from '../components/LoadingScreenModal';
import OverscreenModal from '../components/OverscreenModal';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import React, {useDebugValue, useEffect, useState} from 'react';
import { View, StyleSheet, Text, TextInput, Image, useWindowDimensions, ScrollView, ImageBackground, Pressable, TouchableOpacity, Button } from 'react-native';
import GoogleSignInButton from '../components/GoogleSignInButton';
import { CommonActions, useNavigation, useRoute} from '@react-navigation/core';
import React, {useEffect, useState} from 'react';
import { View, StyleSheet, Text, TextInput, Image, TouchableOpacity } from 'react-native';
import Card from '../components/Card';
import OverscreenModal from '../components/OverscreenModal';
import LoadingScreenModal from '../components/LoadingScreenModal';
import backgroundImage from '../assets/purple-bg.jpg';
import purple from '../assets/gradient.png';
import { useDispatch, useSelector } from 'react-redux';
import { logInAsync } from 'expo-google-app-auth';
import * as authActions from '../actions/edit';

export default function EditCardScreen({ route, navigation }) {
Expand Down Expand Up @@ -36,7 +32,7 @@ export default function EditCardScreen({ route, navigation }) {
return;
if (editOutcome == null)
return;
if (editOutcome == true)
if (editOutcome === true)
{
dispatch(authActions.editFinished());
navigation.navigate('HomeScreen');
Expand All @@ -46,18 +42,18 @@ export default function EditCardScreen({ route, navigation }) {
}, [editResponse]);


const onChangeDataPressed = async () => {
const onSetDataPressed = async () => {
setWaitingForResponse(true);

dispatch(authActions.editCardData(photoId, company, name, phone, email, category, mode));
dispatch(authActions.setCardData(photoId, company, name, phone, email, category, mode));
}

const onReturnPressed = () => {
navigation.navigate('HomeScreen');
}

function onChangeModePressed () {
if (mode == 'PRIVATE') {
if (mode === 'PRIVATE') {
setMode('PUBLIC')
}
else{
Expand Down Expand Up @@ -139,7 +135,7 @@ export default function EditCardScreen({ route, navigation }) {
</View>
<View style={{flexDirection: 'row', marginVertical: 15,}}>
<View style={{flex: 1}} />
<TouchableOpacity style={styles.signInButton} onPress={onChangeDataPressed} >
<TouchableOpacity style={styles.signInButton} onPress={onSetDataPressed} >
<Text style={styles.signInText }>Wprowadź zmiany</Text>
</TouchableOpacity>
<View style={{flex: 1}} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React, {useEffect, useState} from 'react';
import {Button, View, StyleSheet, Image, Dimensions, TouchableOpacity, Text, Alert} from 'react-native';
import { View, StyleSheet, Image, TouchableOpacity, Alert } from 'react-native';
import { useNavigation } from '@react-navigation/core';
import { useDispatch, useSelector } from 'react-redux';
import * as ImagePicker from 'expo-image-picker';
import {AntDesign} from "@expo/vector-icons";
import LoadingScreenModal from "../components/LoadingScreenModal";
import OverscreenModal from "../components/OverscreenModal";
import * as businessCardsActions from "../actions/businessCards";
import {Camera} from "expo-camera";

export default function GalleryScreen() {
const navigation = useNavigation();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { StatusBar } from 'expo-status-bar';
import React, { useState, useEffect } from 'react';
import React from 'react';
import { StyleSheet, Text, View, ScrollView } from 'react-native';
import { useNavigation } from '@react-navigation/core';
import { useSelector, useDispatch } from 'react-redux';
import { useSelector } from 'react-redux';
import MenuItem from '../components/MenuItem';

export default function HomeScreen() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const MyBusinessCardsScreen = props => {
await dispatch(searchActions.getMyBusinessCards(username));
console.log(`Fetched my business cards`);
setWaitingForResponse(false);
};
}

useEffect(() => {
if (getMyCardsTimestamp === undefined)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { useEffect, useState } from 'react';
import { View, StyleSheet, Text, Image, TouchableOpacity, ImageBackground, Dimensions, FlatList, TextInput } from 'react-native';
import { View, StyleSheet, Text, Image, TouchableOpacity, FlatList, TextInput } from 'react-native';
import { AntDesign } from '@expo/vector-icons';
import { useNavigation } from '@react-navigation/core';
import { useSelector, useDispatch } from 'react-redux';
// import * as ScreenOrientation from 'expo-screen-orientation';
import * as searchActions from '../actions/search';
import serverAddress from '../constants/serverAddress';
import LoadingScreenModal from '../components/LoadingScreenModal';
Expand Down Expand Up @@ -179,10 +178,9 @@ const styles = StyleSheet.create({
},
searchBar: {
flexGrow: 1,
backgroundColor: 'magenta',
backgroundColor: 'white',
borderRadius: 10,
marginHorizontal: 5,
backgroundColor: 'white',
elevation: 3,
padding: 10,
fontSize: 18,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { useEffect, useState } from 'react';
import { View, StyleSheet, Text, TextInput, ScrollView, Image, ImageBackground, TouchableOpacity, StatusBar } from 'react-native';
import { View, StyleSheet, Text, TextInput, ScrollView, Image, TouchableOpacity, StatusBar } from 'react-native';
import { useSelector, useDispatch } from 'react-redux';
import { useNavigation } from '@react-navigation/core';
import gradient from '../../assets/purple-bg.jpg';
import purple from '../../assets/gradient.png';
import Card from '../../components/Card';
import OverscreenModal from '../../components/OverscreenModal';
import LoadingScreenModal from '../../components/LoadingScreenModal';
Expand All @@ -27,7 +26,7 @@ export default function RegisterScreen() {
setWaitingForResponse(false);
if (registerResponse == null)
return;
if (registerOutcome == true)
if (registerOutcome === true)
setSuccessModalVisible(true);
else
setFailureModalVisible(true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useDebugValue, useEffect, useState} from 'react';
import React, {useEffect, useState} from 'react';
import { View, StyleSheet, Text, TextInput, Image, TouchableOpacity } from 'react-native';
import { StatusBar } from 'expo-status-bar';
import GoogleSignInButton from '../../components/GoogleSignInButton';
Expand All @@ -7,9 +7,7 @@ import Card from '../../components/Card';
import OverscreenModal from '../../components/OverscreenModal';
import LoadingScreenModal from '../../components/LoadingScreenModal';
import backgroundImage from '../../assets/purple-bg.jpg';
import purple from '../../assets/gradient.png';
import { useDispatch, useSelector } from 'react-redux';
import { logInAsync } from 'expo-google-app-auth';
import * as authActions from '../../actions/auth';

export default function SignInScreen() {
Expand Down
8 changes: 4 additions & 4 deletions commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# To enable this hook, copy locally this file and move to ".git/hooks/commit-msg".

export MESSAGE=$(<$1)
export JIRA_ISSUE_TAG='HPIS-([0-9]*)'
export GITHUB_ISSUE_TAG='HELL-([0-9]*)'

if [[ $MESSAGE =~ $JIRA_ISSUE_TAG ]]; then
echo -e "\e[32mYes! It contains a JIRA issue!\e[0m"
if [[ $MESSAGE =~ GITHUB_ISSUE_TAG ]]; then
echo -e "\e[32mYes! It contains a GitHub issue!\e[0m"
exit 0;
fi

echo -e "\e[31mOh no... You forgot to add a JIRA issue number!\e[0m";
echo -e "\e[31mOh no... You forgot to add a GitHub issue number!\e[0m";
exit 1;
Loading