diff --git a/backend/server/server.js b/backend/server/server.js index 48a7c51..c71471d 100644 --- a/backend/server/server.js +++ b/backend/server/server.js @@ -40,9 +40,11 @@ app.use("/notifications", notifications); app.use("/users", users); // Cron - Cloud Function usage -cron.schedule("0 0 0 * * *", function () { - // Run at 00:00:00 - logger.warn("It's 00:00. Resetting all user hug counts :)"); +cron.schedule("0 0 8 * * *", function () { + // Run at 00:00:00 (00:00 PST) == (08:00 UTC) + let d = new Date(Date.now()); + let timeString = d.toTimeString(); + logger.warn(`It's ${timeString}. Resetting all user hug counts :)`); CloudFunctionsAPI.resetUserHugCounts(); }); diff --git a/frontend/.expo-shared/README.md b/frontend/.expo-shared/README.md new file mode 100644 index 0000000..e9e5318 --- /dev/null +++ b/frontend/.expo-shared/README.md @@ -0,0 +1,11 @@ +> Why do I have a folder named ".expo-shared" in my project? + +The ".expo-shared" folder is created when running commands that produce state that is intended to be shared with all developers on the project. For example, "npx expo-optimize". + +> What does the "assets.json" file contain? + +The "assets.json" file describes the assets that have been optimized through "expo-optimize" and do not need to be processed again. + +> Should I commit the ".expo-shared" folder? + +Yes, you should share the ".expo-shared" folder with your collaborators. diff --git a/frontend/app.json b/frontend/app.json index fd432b6..37b8bc8 100644 --- a/frontend/app.json +++ b/frontend/app.json @@ -1,12 +1,12 @@ { "expo": { - "name": "fouro-application", - "slug": "fouro-application", + "name": "Fouro", + "slug": "fouro", "version": "1.0.0", "orientation": "portrait", - "icon": "./assets/icon.png", + "icon": "./assets/images/icon.png", "splash": { - "image": "./assets/splash.png", + "image": "./assets/images/splash.png", "resizeMode": "contain", "backgroundColor": "#ffffff" }, @@ -30,12 +30,15 @@ }, "android": { "adaptiveIcon": { - "foregroundImage": "./assets/adaptive-icon.png", + "foregroundImage": "./assets/images/adaptive-icon.png", "backgroundColor": "#FFFFFF" - } + }, + "package": "com.teamcafe.fouro" }, "web": { "favicon": "./assets/favicon.png" - } + }, + "description": "Fouro is an iOS/Android application that allows you to send virtual hugs to friends and feel close and connected to others. Fouro will help remind you to reach out to friends you haven't connected with in a while as well as serve as a platform to share and store memories together. Send and receive hugs with friends and stay socially connected to loved ones around you!\n", + "githubUrl": "https://github.com/evansuong/fouro-application" } } diff --git a/frontend/assets/adaptive-icon.png b/frontend/assets/adaptive-icon.png deleted file mode 100644 index 03d6f6b..0000000 Binary files a/frontend/assets/adaptive-icon.png and /dev/null differ diff --git a/frontend/assets/icon.png b/frontend/assets/icon.png deleted file mode 100644 index a0b1526..0000000 Binary files a/frontend/assets/icon.png and /dev/null differ diff --git a/frontend/assets/images/adaptive-icon.png b/frontend/assets/images/adaptive-icon.png new file mode 100644 index 0000000..6699560 Binary files /dev/null and b/frontend/assets/images/adaptive-icon.png differ diff --git a/frontend/assets/images/icon.png b/frontend/assets/images/icon.png new file mode 100644 index 0000000..a1ba166 Binary files /dev/null and b/frontend/assets/images/icon.png differ diff --git a/frontend/assets/images/splash.png b/frontend/assets/images/splash.png new file mode 100644 index 0000000..1b2fb39 Binary files /dev/null and b/frontend/assets/images/splash.png differ diff --git a/frontend/assets/splash.png b/frontend/assets/splash.png deleted file mode 100644 index 6f47774..0000000 Binary files a/frontend/assets/splash.png and /dev/null differ diff --git a/frontend/src/API.js b/frontend/src/API.js index 8fd5e6c..9b3dbab 100644 --- a/frontend/src/API.js +++ b/frontend/src/API.js @@ -1,6 +1,6 @@ import axios from "axios"; -const server = "http://192.168.50.7:3000"; +const server = "http://54.244.107.90:3000"; // AWS server const onAccept = (res, response) => { // console.log('API 6 accepting'); diff --git a/frontend/src/pages/off-nav/SearchPage.js b/frontend/src/pages/off-nav/SearchPage.js index 9c04f19..d5e47b3 100644 --- a/frontend/src/pages/off-nav/SearchPage.js +++ b/frontend/src/pages/off-nav/SearchPage.js @@ -1,68 +1,206 @@ -import React, { useContext, useEffect, useState } from 'react' -import { - View, - Text, - StyleSheet, - Image, - ScrollView, +import React, { useContext, useEffect, useState } from "react"; +import { + View, + Text, + StyleSheet, + Image, + ScrollView, TouchableOpacity, TextInput, -} from 'react-native'; -import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs'; -import { getFocusedRouteNameFromRoute, useFocusEffect } from '@react-navigation/native'; +} from "react-native"; +import { createMaterialTopTabNavigator } from "@react-navigation/material-top-tabs"; +import { + getFocusedRouteNameFromRoute, + useFocusEffect, +} from "@react-navigation/native"; // Contexts -import { DimensionContext } from 'contexts/DimensionContext'; -import { UserContext } from 'contexts/UserContext'; -import { ReadAPI } from '../../API'; -import Header from 'components/Header'; -import { set } from 'react-native-reanimated'; - - +import { DimensionContext } from "contexts/DimensionContext"; +import { UserContext } from "contexts/UserContext"; +import { ReadAPI } from "../../API"; +import Header from "components/Header"; +import { set } from "react-native-reanimated"; /*------- testing --------*/ -const pic = 'https://firebasestorage.googleapis.com/v0/b/cafe-fouro.appspot.com/o/profile_pictures%2FPhoto%20on%203-30-20%20at%205.34%20PM.jpg?alt=media&token=478c304d-37e4-463e-a821-b817b6119edb' +const pic = + "https://firebasestorage.googleapis.com/v0/b/cafe-fouro.appspot.com/o/profile_pictures%2FPhoto%20on%203-30-20%20at%205.34%20PM.jpg?alt=media&token=478c304d-37e4-463e-a821-b817b6119edb"; // when we actually pass info to the OtherUserProfilePage, just append isStranger and isPending to the end const testFriendData = [ - {user_id: 1, name: 'e', username: 'a', pfp: pic, isStranger: false, isPending: false}, - {user_id: 2, name: 'eva', username: 'al', pfp: pic, isStranger: false, isPending: false}, - {user_id: 3, name: 'eva', username: 'ale', pfp: pic, isStranger: false, isPending: false}, - {user_id: 4, name: 'evan', username: 'alex', pfp: pic, isStranger: false, isPending: false}, - {user_id: 5, name: 'evans', username: 'alexc',pfp: pic, isStranger: false, isPending: false}, - {user_id: 6, name: 'evansu', username: 'alexch', pfp: pic, isStranger: false, isPending: false}, - {user_id: 7, name: 'evansuo', username: 'alexchow',pfp: pic, isStranger: false, isPending: false}, - {user_id: 8, name: 'evansuon', username: 'alexchowmein',pfp: pic, isStranger: false, isPending: false}, - {user_id: 9, name: 'evansuong', username: 'alexchowmei', pfp: pic, isStranger: false, isPending: false}, - {user_id: 10, name: 'evansuong', username: 'alexchowmen', pfp: pic, isStranger: false, isPending: false}, -] + { + user_id: 1, + name: "e", + username: "a", + pfp: pic, + isStranger: false, + isPending: false, + }, + { + user_id: 2, + name: "eva", + username: "al", + pfp: pic, + isStranger: false, + isPending: false, + }, + { + user_id: 3, + name: "eva", + username: "ale", + pfp: pic, + isStranger: false, + isPending: false, + }, + { + user_id: 4, + name: "evan", + username: "alex", + pfp: pic, + isStranger: false, + isPending: false, + }, + { + user_id: 5, + name: "evans", + username: "alexc", + pfp: pic, + isStranger: false, + isPending: false, + }, + { + user_id: 6, + name: "evansu", + username: "alexch", + pfp: pic, + isStranger: false, + isPending: false, + }, + { + user_id: 7, + name: "evansuo", + username: "alexchow", + pfp: pic, + isStranger: false, + isPending: false, + }, + { + user_id: 8, + name: "evansuon", + username: "alexchowmein", + pfp: pic, + isStranger: false, + isPending: false, + }, + { + user_id: 9, + name: "evansuong", + username: "alexchowmei", + pfp: pic, + isStranger: false, + isPending: false, + }, + { + user_id: 10, + name: "evansuong", + username: "alexchowmen", + pfp: pic, + isStranger: false, + isPending: false, + }, +]; -// again, pass +// again, pass const testStrangerData = [ - {user_id: 1, name: 's', username: 'a', pfp: pic, isStranger: true, isPending: false}, - {user_id: 2, name: 'su', username: 'al', pfp: pic, isStranger: true, isPending: true}, - {user_id: 3, name: 'suo', username: 'ale', pfp: pic, isStranger: true, isPending: false}, - {user_id: 4, name: 'suon', username: 'alex', pfp: pic, isStranger: true, isPending: false}, - {user_id: 5, name: 'suong', username: 'alexc', pfp: pic, isStranger: true, isPending: true}, - {user_id: 6, name: 'suonge', username: 'alexch', pfp: pic, isStranger: true, isPending: false}, - {user_id: 7, name: 'suongev', username: 'alexcho', pfp: pic, isStranger: true, isPending: true}, - {user_id: 8, name: 'suongeva', username: 'alexchow', pfp: pic, isStranger: true, isPending: true}, - {user_id: 9, name: 'suongevan', username: 'alexchowm', pfp: pic, isStranger: true, isPending: false}, - {user_id: 10, name: 'suongevan', username: 'alexchowme', pfp: pic, isStranger: true, isPending: false}, -] + { + user_id: 1, + name: "s", + username: "a", + pfp: pic, + isStranger: true, + isPending: false, + }, + { + user_id: 2, + name: "su", + username: "al", + pfp: pic, + isStranger: true, + isPending: true, + }, + { + user_id: 3, + name: "suo", + username: "ale", + pfp: pic, + isStranger: true, + isPending: false, + }, + { + user_id: 4, + name: "suon", + username: "alex", + pfp: pic, + isStranger: true, + isPending: false, + }, + { + user_id: 5, + name: "suong", + username: "alexc", + pfp: pic, + isStranger: true, + isPending: true, + }, + { + user_id: 6, + name: "suonge", + username: "alexch", + pfp: pic, + isStranger: true, + isPending: false, + }, + { + user_id: 7, + name: "suongev", + username: "alexcho", + pfp: pic, + isStranger: true, + isPending: true, + }, + { + user_id: 8, + name: "suongeva", + username: "alexchow", + pfp: pic, + isStranger: true, + isPending: true, + }, + { + user_id: 9, + name: "suongevan", + username: "alexchowm", + pfp: pic, + isStranger: true, + isPending: false, + }, + { + user_id: 10, + name: "suongevan", + username: "alexchowme", + pfp: pic, + isStranger: true, + isPending: false, + }, +]; /*------- end of testing --------*/ - - - - export default function SearchPage({ navigation, route }) { // States const [userList, setUserList] = useState([]); const [searchFriends, setSearchFriends] = useState(true); - const [searchInput, setSearchInput] = useState(''); - const [placeholder, setPlaceHolder] = useState(''); + const [searchInput, setSearchInput] = useState(""); + const [placeholder, setPlaceHolder] = useState(""); // Contexts const { windowWidth, windowHeight } = useContext(DimensionContext); @@ -73,230 +211,239 @@ export default function SearchPage({ navigation, route }) { useFocusEffect(() => { let routeName = getFocusedRouteNameFromRoute(route); if (routeName === "Users") { - setPlaceHolder('search username (i.e. fourouser)') + setPlaceHolder("search username (i.e. fourouser)"); } else { - setPlaceHolder('search name (i.e. First Last)') + setPlaceHolder("search name (i.e. First)"); } - }) - + }); function search() { if (searchFriends) { - ReadAPI.searchFriends(uid, searchInput).then(response => { - setUserList(response.data.friends) - } - ) + ReadAPI.searchFriends(uid, searchInput).then((response) => { + setUserList(response.data.friends); + }); } else { - ReadAPI.searchUsers(uid, searchInput).then(response => { + ReadAPI.searchUsers(uid, searchInput).then((response) => { if (response.data.user.length != 0) { - setUserList([response.data.user]) + setUserList([response.data.user]); } - }) + }); } } - + useEffect(() => { - if (searchInput === '') { + if (searchInput === "") { setUserList([]); } else { search(); } - }, [searchInput, searchFriends]) + }, [searchInput, searchFriends]); function searchStrangersList({ route }) { useFocusEffect(() => { setSearchFriends(false); - }) + }); function viewStranger(userData) { - navigation.navigate('Friend Profile', - { + navigation.navigate("Friend Profile", { data: Object.assign( - {}, - { - otheruser_id: userData.user_id, - profile_pic: userData.pfp, ...userData + {}, + { + otheruser_id: userData.user_id, + profile_pic: userData.pfp, + ...userData, } - ) + ), }); } - let textColor = isLightTheme ? '#000' : '#FFF'; - let borderColor = isLightTheme ? '#FFF' : '#555'; - let backgroundColor = isLightTheme ? '#FFF' : '#333' + let textColor = isLightTheme ? "#000" : "#FFF"; + let borderColor = isLightTheme ? "#FFF" : "#555"; + let backgroundColor = isLightTheme ? "#FFF" : "#333"; return ( - {userList.length > 0 && userList[0] ? - - {userList.map(userData => { - return ( - viewStranger(userData)} - > - - - - {userData.name} - - - - )})} - : <>} + {userList.length > 0 && userList[0] ? ( + + {userList.map((userData) => { + return ( + viewStranger(userData)} + > + + + + {userData.name} + + + + ); + })} + + ) : ( + <> + )} - ) + ); } function searchFriendList({ route }) { - useFocusEffect(() => { - setSearchFriends(true) - }) + useFocusEffect(() => { + setSearchFriends(true); + }); - function viewUser(userData) { - navigation.navigate('Friend Profile', - { - data: Object.assign( - {}, - { - otheruser_id: userData.user_id, - profile_pic: userData.pfp, - ...userData - } - ) - }) - } + function viewUser(userData) { + navigation.navigate("Friend Profile", { + data: Object.assign( + {}, + { + otheruser_id: userData.user_id, + profile_pic: userData.pfp, + ...userData, + } + ), + }); + } - let textColor = isLightTheme ? '#000' : '#FFF'; - let borderColor = isLightTheme ? '#FFF' : '#555'; - let backgroundColor = isLightTheme ? '#FFF' : '#333' + let textColor = isLightTheme ? "#000" : "#FFF"; + let borderColor = isLightTheme ? "#FFF" : "#555"; + let backgroundColor = isLightTheme ? "#FFF" : "#333"; - return ( - userList && userList.length > 0 ? - - {userList.map(userData => ( - viewUser(userData)} + return userList && userList.length > 0 ? ( + + {userList.map((userData) => ( + viewUser(userData)} + > + + + - - - - {userData.name} - - - - ))} - : <> - ) + {userData.name} + + + + ))} + + ) : ( + <> + ); } - let backgroundColor = isLightTheme ? '#FFF' : '#rgb(40, 40, 40)'; + let backgroundColor = isLightTheme ? "#FFF" : "#rgb(40, 40, 40)"; const styles = StyleSheet.create({ userCard: { - padding: 10, - borderBottomColor: '#BBB', - borderBottomWidth: 1, - display: 'flex', - flexDirection: 'row', - alignItems: 'center', - justifyContent: 'flex-start', - width: '100%', + padding: 10, + borderBottomColor: "#BBB", + borderBottomWidth: 1, + display: "flex", + flexDirection: "row", + alignItems: "center", + justifyContent: "flex-start", + width: "100%", }, userText: { - fontSize: 20, - marginHorizontal: 10, + fontSize: 20, + marginHorizontal: 10, }, profPic: { - borderRadius: 100, - width: windowWidth / 10, - height: windowWidth / 10, + borderRadius: 100, + width: windowWidth / 10, + height: windowWidth / 10, }, mainContainer: { - marginTop: windowHeight * .13, + marginTop: windowHeight * 0.13, width: windowWidth, - height: windowHeight * .9, + height: windowHeight * 0.9, }, tabNavigator: { - backgroundColor: '#E57777', - shadowColor: '#000', + backgroundColor: "#E57777", + shadowColor: "#000", shadowOffset: { - height: 1, + height: 1, }, shadowOpacity: 0.2, shadowRadius: 2, elevation: 2, }, inputContainer: { - display: 'flex', - flexDirection: 'row', - justifyContent: 'flex-end', - }, + display: "flex", + flexDirection: "row", + justifyContent: "flex-end", + }, input: { - position: 'absolute', - height: windowHeight * .06, - width: windowWidth * .8, + position: "absolute", + height: windowHeight * 0.06, + width: windowWidth * 0.8, zIndex: 100, - backgroundColor: '#FFF', + backgroundColor: "#FFF", borderRadius: 10, - top: windowHeight * .06, - right: windowWidth * .05, + top: windowHeight * 0.06, + right: windowWidth * 0.05, paddingHorizontal: 20, }, body: { height: windowHeight / 1.4, - marginTop: windowHeight * .14, - } - }) + marginTop: windowHeight * 0.14, + }, + }); - return ( - -
- setSearchInput(val)} - autoCapitalize='none' - placeholder={placeholder} - style={styles.input} - /> - - - - - - - - ) -} \ No newline at end of file + return ( + +
+ setSearchInput(val)} + autoCapitalize="none" + placeholder={placeholder} + style={styles.input} + /> + + + + + + + + ); +}