Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Staging #76

Merged
merged 11 commits into from
Nov 15, 2021
70 changes: 62 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,29 @@ Karl Schaller, Rebecca Robb, Jordan Billie, Christine Gregotski, Christian Davis
The Temple Cats mobile app is for people in the Temple University area who want to help local stray cats. The Temple Cats organization tracks its own feral cat colony, but the Temple University area also has an extremely high population of stray cats who were abandoned by their owners and are in need of care or a home. The mobile app aims mainly to address this problem by providing a lost & found service for reporting cats, as well as by connecting users with extensive resources and information specific to the Temple University area for all different types of cat related situations users might encounter.

## Release Notes
### v3.0
* User Features Added
* Query Feature
* Search name on home screen and map directs to you the searched cats location
* Report Inappropriate Cat Functionaily
* Added button to report cats and give reason why
* Feeding Stations
* Added various feeding stations with modal pop up
* Pin Tap View
* Cats and feeding stations have pop-up views on pin press
* Commenting
* Commenting functionality on cat pop-up view
* Upvoting and Downvoting
* On cat pop-view you can now vote on the posts
* Moderator Features Added
* Account Screen Buttons
* Moderators see “Reported Posts” button
* This screen displays all reported posts and has functionailty to resolve or navigate to the post.
* Moderators see “Downvoted Posts” button
* Delete Cat Functionality (ADDED)
* On cat view of pin, moderators see a “Delete Cat Button” which deletes the cat’s information and photo in the database in real time.


### v2.0
* Login Page (UPDATED)
* Layout and styling updates
Expand Down Expand Up @@ -47,11 +70,12 @@ Currently, v2.0 of the application is being hosted on an Expo server. In order t

## Testing Instructions

Depending on iOS and Andriod some of the pop-ups may appear in a different order. In any case please click allow on all permission pop-ups.

Depending on iOS and Andriod some of the pop-ups may appear in a different order.
In any case please click allow on all permission pop-ups.
Warnings may appear you may dismiss them.
For testing the latest version of our app, follow these testing procedures:

### Login
### Login Procedure
* Open the app after following the installation instructions.
* Click the login button.
* (iPhone only) A pop-up will appear saying '"Expo" Wants to Use "expo.io" to Sign In'. Click the continue button.
Expand All @@ -60,12 +84,12 @@ For testing the latest version of our app, follow these testing procedures:
* (on Android) A pop-up will appear asking to use your location.
* You should be redirected to the home screen.

### Cat Form Submission
### Map on Home Tab: Cat Form Submission
* From the home screen, click the top left "+" button to open the cat form screen.
* (on iPhone) A pop-up will appear saying 1 of 2 things, "Allow to use location" or "Experience needs permissions" click allow.
* Click Submit Cat
* An alert should say an image is required
* Click upload image and choose either from camera or from camera roll.
* Click upload image and choose either from camera or from camera roll. (Note: we prefer you to upload picture of an actual cat)
* If you pick from the camera, test out the flash and selfie modes.
* The door icon will allow you to go back to the cat form.
* If you pick from a camera roll, you’ll then be prompted to crop the image you select.
Expand All @@ -82,11 +106,40 @@ For testing the latest version of our app, follow these testing procedures:
* The date should appear on the form.
* Click on the time and choose a time.
* The time should appear on the form.
* Click Submit Cat
* An alert should appear telling you that the cat was submitted
* Reload the app in order to update the pins on the map.
* Fill in additional information "Enter possible name"
* Remember the name you give that cat.
* Click Submit Cat
* (Might have a few seconds of delay) An alert should appear telling you that the cat was submitted
* Click OK and swipe down
* Your cat should appear at your selected location on the map.

### Map on Home Tab: Feeding Station, Query, Comment and Report and Downvote
* Click on the icon of a yellow cat food bag.
* Feeding Station modal will appear.
* Swipe down the feeding modal.
* Click on the text input box that says "Search for cats here"
* Type in the the name you gave the cat you just uploaded and tap on it when the drop down appears
* The map should redirect you to the pin picture of the cat
* Click on the photo
* A view will appear with information about the cat
* Give your cat 1 upvote.
* Scroll down to the text box that says "Enter a comment"
* Keyboard should appear and enter a comment "This is a test"
* Close keyboard
* Click submit comment.
* Swipe down the cat information view to look at map again.
* Once again we will click on the "Search for cats here"
* Enter the name "Gwapo"
* Click Gwapo on the drop down, the map will direct you to 10th and Edgley
* Click Gwapo on the map.
* Downvote Gwapo.
* Scroll down to the report button and click on it.
* A pop up will appear asking for a reason.
* You may enter "This is a dog" in the text box and click submit.
* Click report button again and click close.
* The pop up should close.
* Swipe entire view down from top of screen to display home again.

### Resources Tab
* Click the resources button on the navigation bar.
* The resources screen should appear with information and images for PAWS and FORGOTTEN CATS
Expand Down Expand Up @@ -121,5 +174,6 @@ For testing the latest version of our app, follow these testing procedures:


## Source Code
* [v3.0](https://github.com/Capstone-Projects-2021-Fall/project-teams-temple-cats/releases/tag/v3.0.0)
* [v2.0](https://github.com/Capstone-Projects-2021-Fall/project-teams-temple-cats/releases/tag/v2.0.0)
* [v1.0](https://github.com/Capstone-Projects-2021-Fall/project-teams-temple-cats/releases/tag/v1.0.0)
124 changes: 118 additions & 6 deletions screens/ReportedPostsModal.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,112 @@
import * as React from 'react';
import { StyleSheet } from 'react-native';

import { StyleSheet, Image, Button, Alert, TouchableOpacity } from 'react-native';
import firebase from "../utils/firebase";
import { Text, View } from '../components/Themed';
import { useEffect } from 'react';
import { Cat, Comment, Report, RootStackScreenProps } from '../types';

export default function ModalScreen({ navigation }: RootStackScreenProps<'ReportedPosts'>) {
const [reportedCats, setReportedCats] = React.useState<Cat[]>([]);
const [reportedComments, setReportedComments] = React.useState<Comment[]>([]);

const catsRef = firebase.database().ref().child('Cats/');
const picsRef = firebase.storage().ref();

useEffect(() => {
catsRef.get().then((snapshot) => {
const cats: Cat[] = Object.values(snapshot.val());
const reportedCats: Cat[] = [];
const reportedComments: Comment[] = [];

cats.forEach((cat) => {
// find cats that have reports
if (cat.reports && Object.keys(cat.reports).length > 0) {
picsRef.child(cat.accountID + '/' + cat.catID).getDownloadURL().then((picUrl) => {
cat.media = picUrl
});
reportedCats.push(cat);
}

// find comments that have reports
if (cat.commentList) {
Object.values(cat.commentList).forEach((comment) => {
if (comment.reports && Object.keys(comment.reports).length > 0) {
reportedComments.push(comment);
}
});
}
});

setReportedCats(reportedCats);
setReportedComments(reportedComments);
});
}, []);

export default function ModalScreen() {
return (
<View style={styles.container}>
<Text style={styles.title}>Reported stuff</Text>
<View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
<View style={[styles.container, styles.flexColumnContainer]}>

<Text style={styles.title}>Reported Cats</Text>
{/* <View style={styles.separator}/> */}
<View style={styles.flexColumnContainer}>
{reportedCats.map((cat, index) => (
<View key={index} style={styles.flexRowContainer}>
<TouchableOpacity onPress={() => navigation.push('Cat', { cat })}>
<Image style={styles.catImage} source={{ uri: cat.media }}/>
</TouchableOpacity>
{Object.values(cat.reports).map((report, index) => {
return (
<View key={index}>
<Text>{'Reason: ' + report.reason}</Text>
<Button title='Resolve' color='#9D2235' onPress={() => resolveReport(report)}/>
</View>
);
})}
</View>
))}
</View>

<View style={styles.separator}/>

<Text style={styles.title}>Reported Comments</Text>
{/* <View style={styles.separator}/> */}
<View style={styles.flexColumnContainer}>
{reportedComments.map((comment, index) => (
<View key={index} style={styles.flexRowContainer}>
<Text>{comment.content}</Text>
{Object.values(comment.reports).map((report, index) => {
return (
<View key={index}>
<Text>{'Reason: ' + report.reason}</Text>
<Button title='Resolve' color='#9D2235' onPress={() => resolveReport(report)}/>
</View>
);
})}
</View>
))}
</View>
</View>
);

function resolveReport(report: Report) {
Alert.alert(
'Alert',
'Do you want to resolve this report? This will delete the report. This should be done when you have reviewed the report and do not want to delete the post.',
[
{
text: 'No',
style: 'cancel',
},
{
text: 'Yes',
onPress: () => {
catsRef.child(report.catID + '/reports/' + report.reportID).remove();
setReportedCats(reportedCats.filter((cat) => cat.catID !== report.catID));
},
},
],
{ cancelable: true },
);
}
}

const styles = StyleSheet.create({
Expand All @@ -26,5 +123,20 @@ const styles = StyleSheet.create({
marginVertical: 30,
height: 1,
width: '80%',
color: 'rgba(160, 28, 52, 0.75)',
},
flexColumnContainer: {
flex: 1,
},
flexRowContainer: {
flex: 1,
flexDirection: "row",
},
catImage: {
width: 70,
height: 70,
borderWidth: 4,
borderColor: 'rgba(160, 28, 52, 0.75)',
borderRadius: 7,
},
});
15 changes: 12 additions & 3 deletions types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,21 @@ export type Report = {
reason: string;
};

export type ReportList = {
[key: string]: Report;
}

export type Comment = {
commentID: string;
content: string;
accountID: string;
reports: string;
reports: ReportList;
};

export type CommentList = {
[key: string]: Comment;
}

export type Announcement = {
AnnouncementID: string;
Time: Date;
Expand All @@ -78,7 +86,7 @@ export type Account = {
export type FeedingStation = {
StationID: string;
Media: string;
Comments: string;
Comments: CommentList;
};

export type Cat = {
Expand All @@ -96,7 +104,8 @@ export type Cat = {
time: Date;
votes: number;
accountID: string;
commentList: string;
commentList: CommentList;
reports: ReportList;
};

export type FeedingStations = {
Expand Down