Skip to content

Commit

Permalink
Merge branch 'main' into moving-user-types
Browse files Browse the repository at this point in the history
  • Loading branch information
h1divp authored Sep 13, 2024
2 parents 38312a4 + 13e52aa commit b896e1b
Show file tree
Hide file tree
Showing 23 changed files with 1,280 additions and 288 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,33 @@

![banner](/client/assets/images/github/Echo_banner_small2.png)

Echo is a new chat messaging app aimed at allowing you to talk to strangers *(or as we like to say, friends who haven't met 😆)* within a radius around you. This allows for more time/location relevant chats as well as allowing users to connect with the people who are closer to them. Unlike many chat apps, our app aims to keep interactions in real time and doesn't save chats/information after you are done chatting! Just like real conversations, we believe the best socializing happens on the spot!
Echo is a new chat messaging app aimed at allowing you to talk to strangers _(or as we like to say, friends who haven't met 😆)_ within a radius around you. This allows for more time/location relevant chats as well as allowing users to connect with the people who are closer to them. Unlike many chat apps, our app aims to keep interactions in real time and doesn't save chats/information after you are done chatting! Just like real conversations, we believe the best socializing happens on the spot!

## Overview

This repository holds the all of the code that our Echo app utilizes (pretty cool right? 😎). This repository is public because we believe in the future of open source projects, the community is what makes developing so special ✨! It is split into the frontend/app `/client` and the backend/server `/server`. Take a look around, we're sure you'll find yourself wanting to help out! Ready? Head here 👉 [contributing](#contributing)

If you are interested in contributing to the UI/UX design of our app, please see our Figma design [here](https://www.figma.com/file/2mvddKeA4XMODdCidYkDid/Proximity-Chat-App?type=design&node-id=0%3A1&mode=design&t=V5A9MVRhlmdxGH0M-1). Improvements here are always welcome.

## Useful Links

- [Documentation](https://osc-proximity-documentation.vercel.app/) 📖
- [Figma Design](https://www.figma.com/file/2mvddKeA4XMODdCidYkDid/Proximity-Chat-App?type=design&node-id=0%3A1&mode=design&t=V5A9MVRhlmdxGH0M-1) 🖌️

## Installation

Unfortunately, as of Spring Semester of 2024, the app is still under development and you cannot download justttt yet. However, we promise it will be out soon! 🙏

Want to speed up the development? Join our team by follow the instructions in [contributing](#contributing)!

## Contributing

As an open source project, developers of all walks of life are encouraged to pick up issues and speed up the development of the app! However, it is probably a good idea to get yourself used to the app's structure!

If you want to set up the app for development follow the steps in the [documentation](https://osc-proximity-documentation.vercel.app/). 📖

## About Us

The Echo app team was founded in Fall 2023 by 💻 [@h1dvp](https://github.com/h1divp) + ⚡ [@doigdaniels](https://github.com/doigdaniels) + 🦆 [@AlexanderWangY](https://github.com/AlexanderWangY).

Our team consists of a handful of dedicated and talented developers from the University of Florida. We started out of and currently reside within UF's Open Source Club. We are always on the lookout for more developers trying to get their hands dirty on a real project! We would love to have **YOU** join our team! ❤️
Expand All @@ -31,6 +38,7 @@ Our team consists of a handful of dedicated and talented developers from the Uni
This project is licensed under the [GNU General Public License v3.0](LICENSE) (GPL-3.0). If you intend to make a fork or a different distribution of our work, please remember to retain the same license. Other than that, happy hacking!

## Acknowledgments

A big thanks to [Open Source Club @ UF](https://github.com/ufosc) for hosting the development of this app!

And last but not least, **THANK YOU**! Your contributions and commitment make the app what it is! ❤️🥳
Expand Down
12 changes: 11 additions & 1 deletion client/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
// https://docs.expo.dev/guides/using-eslint/
module.exports = {
extends: 'expo',
extends: "expo",
rules: {
"import/no-unresolved": [2, { ignore: ["^@env"] }],
},
settings: {
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
},
},
};
2 changes: 1 addition & 1 deletion client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ yarn-error.*
# typescript
*.tsbuildinfo

.prettierrc
.prettierrc
171 changes: 171 additions & 0 deletions client/app/components/settings/TextInputs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
import React, {useState} from "react";
import {
Button,
Modal,
SafeAreaView,
Text,
TextInput,
View,
StyleSheet,
Pressable,
TouchableWithoutFeedback
} from "react-native";

type GenericTextInputProps = {
defaultValue: string;
isVisible: boolean;
visibleSetter: Function;
outputSetter: Function;
headerText: string;
errorMessage: string;
maxLength: number;
inputValidator: Function;

}

const GenericTextInput = ({
defaultValue,
isVisible,
visibleSetter,
outputSetter,
headerText,
errorMessage,
maxLength,
inputValidator,
}: GenericTextInputProps) => {
const[textInput, setTextInput] = useState('');
const[error, setError] = useState('');

return(
<Modal
animationType="fade"
transparent={true}
visible={isVisible}
onRequestClose={() => {
visibleSetter(false);
setError('');
}}
>
<Pressable onPress={() => {
visibleSetter(false);
setError('');
}}>
<SafeAreaView style={styles.centeredView}>
<TouchableWithoutFeedback>
<View style={styles.inputModal}>
<Text style={styles.inputHeader}>{headerText}</Text>
<Text style={error==='' ? {display:"none"} : {color: "red"}}>{error}</Text>
<TextInput
defaultValue={defaultValue}
maxLength={maxLength}
style={styles.textInput}
onChangeText={text => {setTextInput(text); setError('');}}
/>
<View style={styles.buttonContainer}>
<Button title="Cancel"
onPress={() => {
visibleSetter(false);
setError('');
}}
/>
<Button title="Save" onPress={() => {
if (inputValidator(textInput)) {
visibleSetter(false);
outputSetter(textInput);
defaultValue=textInput;
setError('');
} else
setError(errorMessage);
}}
/>
</View>
</View>
</TouchableWithoutFeedback>
</SafeAreaView>
</Pressable>
</Modal>
)};

type InputProps = {
defaultValue: string;
isVisible: boolean;
visibleSetter: Function;
outputSetter: Function;
};

export const DisplayNameInput = ({
defaultValue,
isVisible,
visibleSetter,
outputSetter,
}: InputProps) => GenericTextInput({
defaultValue: defaultValue,
isVisible: isVisible,
visibleSetter: visibleSetter,
outputSetter: outputSetter,
headerText: "Edit Display Name",
errorMessage: "Please enter a display name.",
maxLength: 12,
inputValidator: (input: string) => input.length > 0,
});

export const ColorInput = ({
defaultValue,
isVisible,
visibleSetter,
outputSetter,
}: InputProps) => GenericTextInput({
defaultValue: defaultValue,
isVisible: isVisible,
visibleSetter: visibleSetter,
outputSetter: outputSetter,
headerText: "Edit Profile Color",
errorMessage: "Please enter a valid hex code.",
maxLength: 7,
inputValidator: (input: string) => (/^#[0-9A-Fa-f]{6}|#[0-9A-Fa-f]{3}$/).exec(input),
});

const styles = StyleSheet.create({
inputHeader: {
fontSize: 14,
fontWeight: "600",
color: "#a7a7a7",
textTransform: "uppercase",
letterSpacing: 1.2,
},
centeredView: {
height: "100%",
justifyContent: "flex-start",
alignItems: "center",
backgroundColor: "rgba(54, 54, 54, 0.5)",
},
inputModal: {
alignItems: "center",
backgroundColor: "#cccccc",
marginTop: "50%",
width: "70%",
borderRadius: 20,
padding: "5%",
shadowColor: "black",
shadowOffset: {
width: 0,
height: 2,
},
shadowOpacity: 0.25,
shadowRadius: 4,
elevation: 5,
},
buttonContainer: {
paddingHorizontal: "5%",
flexDirection: 'row',
justifyContent: 'space-between',
width: "90%",
},
textInput: {
marginVertical: "5%",
width: "75%",
textAlign: "center",
borderBottomWidth: 2,
fontSize: 20,
},
});
2 changes: 1 addition & 1 deletion client/app/configs/firebaseConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {

const firebaseConfig = {
apiKey: API_KEY || "Mock-Key",
authDomain: AUTH_DOMAIN
authDomain: AUTH_DOMAIN,
};

let app;
Expand Down
7 changes: 6 additions & 1 deletion client/app/contexts/UserContext.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { createContext, useContext, useState } from "react";
import React, { createContext, useContext, useEffect, useState } from "react";

import { UserType } from "../types/User";
import { generateName } from "@app/utils/scripts";

const UserContext = createContext<UserType | null>(null);

Expand All @@ -17,5 +18,9 @@ export const UserProvider = ({ children }: { children: React.ReactNode }) => {
},
});

useEffect(() => {
user.displayName = generateName()
}, [])

Check warning on line 23 in client/app/contexts/UserContext.tsx

View workflow job for this annotation

GitHub Actions / lint (21.x)

React Hook useEffect has a missing dependency: 'user'. Either include it or remove the dependency array

return <UserContext.Provider value={user}>{children}</UserContext.Provider>;
};
5 changes: 3 additions & 2 deletions client/app/screens/chat/ChatScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,22 @@ import { useSocket } from "../../contexts/SocketContext";
import { AuthStore } from "../../services/AuthStore";
import { Message } from "../../types/Message";
import { useState, useEffect } from "react";
import { useUser } from "@app/contexts/UserContext";

const ChatScreen = () => {
const settings = useSettings();
const screenHeight = Dimensions.get("window").height;
const keyboardBehavior = Platform.OS === "ios" ? "padding" : undefined;
const socket = useSocket();
const location = useLocation();
const user = useUser();
const userAuth = AuthStore.useState();
// Note: To prevent complexity, all user information is grabbed from different contexts and services. If we wanted most information inside of UserContext, we would have to import contexts within contexts and have state change as certain things mount, which could cause errors that are difficult to pinpoint.

// Message loading and sending logic
const [messages, setMessages] = useState<Message[]>([]);
const [messageContent, setMessageContent] = useState<string>("");


useEffect(() => {
if (socket === null) return; // This line might need to be changed

Expand All @@ -54,7 +55,7 @@ const ChatScreen = () => {
const newMessage: Message = {
author: {
uid: String(userAuth.userAuthInfo?.uid),
displayName: "Anonymous",
displayName: String(user?.displayName),
},
msgId: Crypto.randomUUID(),
msgContent: messageContent.trim(),
Expand Down
Loading

0 comments on commit b896e1b

Please sign in to comment.