Skip to content

Commit

Permalink
Merge pull request #12 from Maker-PI/issue#10
Browse files Browse the repository at this point in the history
Issue Close #10
  • Loading branch information
williamanjo authored Jun 7, 2021
2 parents f3fc8e4 + 4848134 commit 516dc43
Show file tree
Hide file tree
Showing 21 changed files with 7,060 additions and 87 deletions.
4 changes: 1 addition & 3 deletions App.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import React, { setState, useState, useEffect } from 'react';
import React, { useState, useEffect } from 'react';
import 'react-native-gesture-handler';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import AsyncStorage from '@react-native-community/async-storage';
import { Image, Text, View, StyleSheet } from 'react-native';
import firebase from './firebase/fire';
import getGithubTokenAsync from './getGithubTokenAsync';
import AfterLogin from './view/AfterLogin';
import Rotas from './Rotas';
import SignInScreen, { signInAsync } from './view/SignIn';
Expand Down
5 changes: 1 addition & 4 deletions Rotas.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React from 'react';
import { View, Button, Text, Image, StyleSheet } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { View, Text, Image, StyleSheet } from 'react-native';
import { createStackNavigator } from '@react-navigation/stack';
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
import { HeaderBackButton } from '@react-navigation/stack';
import { Octicons,Entypo,EvilIcons} from '@expo/vector-icons';
import 'react-native-gesture-handler';

Expand All @@ -17,7 +15,6 @@ import ReposSearch from './view/ReposSearch';
import ReposRotas from './view/Repo/RepoRotas'
import IssueSearch from './view/IssueSearch';
import Minha_Conta from './view/MyAccountList';
import signOutAsync from './view/AfterLogin';

const Stack = createStackNavigator();
const Tab = createMaterialTopTabNavigator();
Expand Down
2 changes: 1 addition & 1 deletion getGithubTokenAsync.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as AuthSession from 'expo-auth-session';
import {AsyncStorage } from '@react-native-community/async-storage';
import {AsyncStorage } from '@react-native-async-storage/async-storage';

// Make an app https://github.com/settings/applications/new
// Firebase Docs: https://firebase.google.com/docs/auth/web/github-auth
Expand Down
47 changes: 22 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,35 @@
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",
"react-native-web": "~0.13.12",
"yup": "*",
"dayjs": "*",
"lodash": "*",
"moment": "*",
"firebase": "7.9.0",
"react-native-gesture-handler": "~1.8.0",
"@react-navigation/native": "*",
"@react-navigation/stack": "*",
"@react-native-community/masked-view": "0.1.10",
"react-native-safe-area-context": "3.1.9",
"react-native-screens": "~2.15.2",
"expo-auth-session": "~3.0.0",
"expo-random": "~10.0.0",
"expo-linking": "~2.0.1",
"@firebase/app": "0.x.0",
"@firebase/auth": "*",
"expo-constants": "~9.3.3",
"expo-linking": "~2.0.1",
"expo-web-browser": "~8.6.0",
"@firebase/storage": "*",
"expo-auth-session": "~3.0.0",
"@react-navigation/material-top-tabs": "*",
"react-native-reanimated": "~1.13.0",
"react-native-tab-view": "^2.0.0",
"@expo/vector-icons": "^12.0.0",
"@firebase/database": "*",
"@react-native-async-storage/async-storage": "*",
"react-native-paper": "*",
"@firebase/app-types": "0.x.0",
"@firebase/firestore": "*",
"react-native-screens": "~2.15.2",
"moment": "*",
"react-native-gifted-chat": "*",
"dayjs": "*",
"react-native-elements": "*",
"react-native-tab-view": "^2.0.0",
"yup": "*",
"lodash": "4.17.21",
"react-native-calendars": "*",
"@react-navigation/stack": "*",
"react-native-reanimated": "~1.13.0",
"@react-navigation/native": "*",
"react-native-gifted-chat": "*",
"react-native-gesture-handler": "~1.8.0",
"react-native-safe-area-context": "3.1.9",
"@react-native-community/masked-view": "0.1.10",
"@react-navigation/material-top-tabs": "*",
"@react-native-community/async-storage": "~1.12.0",
"@react-native-async-storage/async-storage": "*"
"@firebase/app": "*",
"@firebase/firestore": "*",
"@firebase/auth": "*",
"@firebase/app-types": "0.x.0",
"@firebase/database": "*"
},
"devDependencies": {
"@babel/core": "^7.9.0"
Expand Down
4 changes: 2 additions & 2 deletions view/AfterLogin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { setState, useState, useEffect } from 'react';
import React, { useState, useEffect } from 'react';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { View, Button, Image, Text, StyleSheet } from 'react-native';
import { View, Image, Text, StyleSheet } from 'react-native';
import IconButton from '../components/IconButton';
import signOutAsync from '../firebase/signOut';
import firebase from '../firebase/fire';
Expand Down
4 changes: 2 additions & 2 deletions view/Chat.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { setState, useState, useEffect } from 'react';
import { Text, View } from 'react-native';
import React, { useState, useEffect } from 'react';
import { View } from 'react-native';
import { GiftedChat, Send } from 'react-native-gifted-chat';
import { FontAwesome as Icon } from '@expo/vector-icons';
import firebase from '../firebase/fire';
Expand Down
23 changes: 12 additions & 11 deletions view/Chats.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import React, { setState, useState, useEffect } from 'react';
import React, { setState, useState, useEffect,useCallback } from 'react';
import {
StyleSheet,
Text,
View,
Image,
TouchableOpacity,
Alert,
ScrollView,
FlatList,
} from 'react-native';
import Loading from '../components/Loading';
import { AntDesign as Icon } from '@expo/vector-icons';
import { FAB } from 'react-native-paper';
import { StatusBar } from 'expo-status-bar';
import moment from 'moment';
Expand Down Expand Up @@ -70,7 +67,7 @@ const Chats = ({ route, navigation }) => {
}
}

async function fetchChats() {
const fetchChats = useCallback(() => {
const unsubscribe = db
.collection('CHATS')
.where('members', 'array-contains', firebase.auth().currentUser.uid)
Expand Down Expand Up @@ -115,15 +112,19 @@ const Chats = ({ route, navigation }) => {
* unsubscribe listener
*/
return () => unsubscribe();
}
},[loading,currentUserGit.id])

useEffect(() => {
if (currentUserGit.login == null) {
console.log('Atualizando User');
UserData(setCurrentUserGit);
async function fetchData(){
if (currentUserGit.login == null) {
console.log('Atualizando User');
await UserData(setCurrentUserGit);
} else {
fetchChats(currentUserGit);
await fetchChats(currentUserGit);
}
}
}, [currentUserGit]);
fetchData();
}, [fetchChats,currentUserGit]);

if (loading) {
return <Loading />;
Expand Down
3 changes: 0 additions & 3 deletions view/IssueSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import {
StyleSheet,
Text,
View,
Image,
TouchableOpacity,
Alert,
ScrollView,
FlatList,
} from 'react-native';
import { AntDesign as Icon } from '@expo/vector-icons';
Expand Down
2 changes: 0 additions & 2 deletions view/Issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import {
Text,
View,
TouchableOpacity,
Alert,
ScrollView,
FlatList,
} from 'react-native';
import { FAB } from 'react-native-paper';
Expand Down
2 changes: 0 additions & 2 deletions view/MyAccountList.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import {
Text,
View,
TouchableOpacity,
Alert,
ScrollView,
FlatList,
} from 'react-native';
import { AntDesign as Icon } from '@expo/vector-icons';
Expand Down
20 changes: 12 additions & 8 deletions view/NewChat.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import React, { useState, useEffect } from 'react';
import React, { useState, useEffect , useCallback } from 'react';
import {
StyleSheet,
Text,
View,
Image,
TouchableOpacity,
Alert,
ScrollView,
FlatList,
} from 'react-native';
import { AntDesign as Icon } from '@expo/vector-icons';
Expand All @@ -22,7 +20,6 @@ const Issues = ({ route, navigation }) => {
const [filteredDataSource, setFilteredDataSource] = useState([]);
const [masterDataSource, setMasterDataSource] = useState([]);
const [chatName, setChatName] = useState('');
const [chats, setChats] = useState({});
const [loading, setLoading] = useState(true);
const db = firebase.firestore();
const [currentUserGit, setCurrentUserGit] = useState({});
Expand Down Expand Up @@ -92,7 +89,7 @@ const Issues = ({ route, navigation }) => {
navigation.navigate('Chats');
});
}
async function fetchUSERS() {
const fetchUSERS = useCallback(() => {
db.collection('USERS')
.where('uid', '!=', firebase.auth().currentUser.uid)
.get()
Expand All @@ -111,11 +108,18 @@ const Issues = ({ route, navigation }) => {
.catch((error) => {
console.log('Error getting documents: ', error);
});
}
},[db,loading])

useEffect(() => {
fetchUSERS();
}, []);
async function fetchData(){
await fetchUSERS();
}
fetchData()
}, [fetchUSERS]);

if (loading) {
return <Loading />;
}

const searchFilterFunction = (text) => {
// Check if searched text is not blank
Expand Down
1 change: 0 additions & 1 deletion view/Repo/RepoCreateIssue.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
TextInput,
Text,
StyleSheet,
TouchableOpacity,
} from 'react-native';
import * as yup from 'yup';
import { Button, Colors } from 'react-native-paper';
Expand Down
3 changes: 0 additions & 3 deletions view/Repo/RepoIssueSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import {
StyleSheet,
Text,
View,
Image,
TouchableOpacity,
Alert,
ScrollView,
FlatList,
} from 'react-native';
import { AntDesign as Icon } from '@expo/vector-icons';
Expand Down
2 changes: 0 additions & 2 deletions view/Repo/RepoIssues.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import {
Text,
View,
TouchableOpacity,
Alert,
ScrollView,
FlatList,
} from 'react-native';
import { FAB } from 'react-native-paper';
Expand Down
3 changes: 0 additions & 3 deletions view/Repo/RepoPullRequestSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import {
StyleSheet,
Text,
View,
Image,
TouchableOpacity,
Alert,
ScrollView,
FlatList,
} from 'react-native';
import { StatusBar } from 'expo-status-bar';
Expand Down
2 changes: 0 additions & 2 deletions view/Repo/RepoPullRequests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import {
Text,
View,
TouchableOpacity,
Alert,
ScrollView,
FlatList,
} from 'react-native';
import { FAB } from 'react-native-paper';
Expand Down
5 changes: 1 addition & 4 deletions view/Repo/RepoRotas.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React from 'react';
import { View, Button, Text, Image, StyleSheet } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { View, Text, StyleSheet } from 'react-native';
import { createStackNavigator } from '@react-navigation/stack';
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
import { HeaderBackButton } from '@react-navigation/stack';
import { Octicons } from '@expo/vector-icons';
import 'react-native-gesture-handler';

Expand All @@ -12,7 +10,6 @@ import PullRequest from './RepoPullRequests';
import IssueSearch from './RepoIssueSearch';
import IssueCreate from './RepoCreateIssue';
import RepoPullRequestSearch from './RepoPullRequestSearch';
import signOutAsync from '../AfterLogin';

const Stack = createStackNavigator();
const Tab = createMaterialTopTabNavigator();
Expand Down
2 changes: 0 additions & 2 deletions view/Repos.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import {
Text,
View,
TouchableOpacity,
Alert,
ScrollView,
FlatList,
} from 'react-native';
import { FAB } from 'react-native-paper';
Expand Down
3 changes: 0 additions & 3 deletions view/ReposSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import {
StyleSheet,
Text,
View,
Image,
TouchableOpacity,
Alert,
ScrollView,
FlatList,
} from 'react-native';
import { AntDesign as Icon } from '@expo/vector-icons';
Expand Down
4 changes: 0 additions & 4 deletions view/SignIn.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import React from 'react';
import {
View,
Button,
Text,
StyleSheet,
TouchableOpacity,
} from 'react-native';
import AsyncStorage from '@react-native-community/async-storage';
import IconButton from '../components/IconButton';
import getGithubTokenAsync from '../getGithubTokenAsync';
const GithubStorageKey = '@Expo:GithubToken';
import signInAsync from '../firebase/signIn';

const SignIn = ({ route, navigation }) => (
Expand Down
Loading

0 comments on commit 516dc43

Please sign in to comment.