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: 17 additions & 0 deletions .expo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
> Why do I have a folder named ".expo" in my project?
The ".expo" folder is created when an Expo project is started using "expo start" command.

> What does the "packager-info.json" file contain?
The "packager-info.json" file contains port numbers and process PIDs that are used to serve the application to the mobile device/simulator.

> What does the "settings.json" file contain?
The "settings.json" file contains the server configuration that is used to serve the application manifest.

> Should I commit the ".expo" folder?
No, you should not share the ".expo" folder. It does not contain any information that is relevant for other developers working on the project, it is specific to your machine.

Upon project creation, the ".expo" folder is already added to your ".gitignore" file.
10 changes: 10 additions & 0 deletions .expo/packager-info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"devToolsPort": 19002,
"expoServerPort": null,
"packagerPort": 19000,
"packagerPid": null,
"expoServerNgrokUrl": null,
"packagerNgrokUrl": null,
"ngrokPid": null,
"webpackServerPort": null
}
10 changes: 10 additions & 0 deletions .expo/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"hostType": "lan",
"lanType": "ip",
"dev": true,
"minify": false,
"urlRandomness": null,
"https": false,
"scheme": null,
"devClient": false
}
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "skiptheline-3b2bd"
}
}
66 changes: 66 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
firebase-debug.log*
firebase-debug.*.log*

# Firebase cache
.firebase/

# Firebase config

# Uncomment this if you'd like others to create their own Firebase project.
# For a team working on the same Firebase project(s), it is recommended to leave
# it commented so all members can deploy to the same project(s) in .firebaserc.
# .firebaserc

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/firebase-v9-crud.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"git.ignoreLimitWarning": true
}
164 changes: 39 additions & 125 deletions App.js
Original file line number Diff line number Diff line change
@@ -1,132 +1,46 @@
import { StatusBar } from 'expo-status-bar';
import { deleteDoc, doc, getDoc, setDoc } from 'firebase/firestore';
import { useState } from 'react';
import { Button, StyleSheet, Text, TextInput, View } from 'react-native';
// Using DB Reference
import { db } from './Core/Config'
// In App.js in a new project

export default function App() {
import * as React from "react";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { MenuProvider } from "react-native-popup-menu";

// Storing User Data
const [userDoc, setUserDoc] = useState(null)
// Update Text
const [text, setText] = useState("")
import LoginScreen from "./screens/LoginScreen";
import HomeScreen from "./screens/HomeScreen";
import ClientHomeScreen from "./screens/client/ClientHomeScreen";
import ClientGeneralSettingsScreen from "./screens/client/ClientGeneralSettingsScreen";
import ClientSkipSettings from "./screens/client/ClientSkipSettings";
import Podcast from "./screens/podcast/Podcast";

// MARK: CRUD Functions
const Create = () => {
// MARK: Creating New Doc in Firebase
// Before that enable Firebase in Firebase Console
const myDoc = doc(db, "MyCollection", "MyDocument")

// Your Document Goes Here
const docData = {
"name": "iJustine",
"bio": "YouTuber"
}

setDoc(myDoc, docData)
// Handling Promises
.then(() => {
// MARK: Success
alert("Document Created!")
})
.catch((error) => {
// MARK: Failure
alert(error.message)
})
}

const Read = () => {
// MARK: Reading Doc
// You can read what ever document by changing the collection and document path here
const myDoc = doc(db, "MyCollection", "MyDocument")

getDoc(myDoc)
// Handling Promises
.then((snapshot) => {
// MARK: Success
if (snapshot.exists) {
setUserDoc(snapshot.data())
}
else {
alert("No Doc Found")
}
})
.catch((error) => {
// MARK: Failure
alert(error.message)
})

}

const Update = (value, merge) => {
// MARK: Updating Doc
const myDoc = doc(db, "MyCollection", "MyDocument")

// If you set merge true then it will merge with existing doc otherwise it will be a fresh one
setDoc(myDoc, value, { merge: merge })
// Handling Promises
.then(() => {
// MARK: Success
alert("Updated Successfully!")
setText("")
})
.catch((error) => {
// MARK: Failure
alert(error.message)
})
}

const Delete = () => {
// MARK: Deleting Doc
const myDoc = doc(db, "MyCollection", "MyDocument")

deleteDoc(myDoc)
// Handling Promises
.then(() => {
// MARK: Success
alert("Deleted Successfully!")
})
.catch((error) => {
// MARK: Failure
alert(error.message)
})

}
const Stack = createNativeStackNavigator();

const App = () => {
return (
<View style={styles.container}>
<Button title='Create New Doc' onPress={Create}></Button>
<Button title='Read Doc' onPress={Read}></Button>
{
userDoc != null &&
<Text>Bio: {userDoc.bio}</Text>
}
<TextInput style={{
width: '95%',
fontSize: 18,
padding: 12,
borderColor: 'gray',
borderWidth: 0.2,
borderRadius: 10,
marginVertical: 20
}} placeholder='Type Here' onChangeText={(text) => { setText(text) }} value={text}></TextInput>

<Button title='Update Doc' onPress={() => {
Update({
"bio": text
}, true)
}} disabled={text == ""}></Button>
<Button title='Delete Doc' onPress={Delete}></Button>
</View>
<MenuProvider>
<NavigationContainer>
<Stack.Navigator initialRouteName="Podcast">
<Stack.Screen name="Home" component={HomeScreen} options={{ headerShown: false }} />
<Stack.Screen name="Login" component={LoginScreen} options={{ headerShown: false }} />
<Stack.Screen
name="ClientHome"
component={ClientHomeScreen}
options={{ headerShown: false }}
/>
<Stack.Screen
name="ClientGeneralSettings"
component={ClientGeneralSettingsScreen}
options={{ headerShown: false }}
/>
<Stack.Screen
name="ClientSkipSettings"
component={ClientSkipSettings}
options={{ headerShown: false }}
/>
<Stack.Screen name="Podcast" component={Podcast} options={{ headerShown: false }} />
</Stack.Navigator>
</NavigationContainer>
</MenuProvider>
);
}
};

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
export default App;
13 changes: 9 additions & 4 deletions Core/Config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { initializeApp } from 'firebase/app';
import { getFirestore } from 'firebase/firestore'
import { initializeApp } from "firebase/app";
import { getFirestore } from "firebase/firestore";

// TODO: Replace the following with your app's Firebase project configuration
const firebaseConfig = {

apiKey: "AIzaSyABIEdo0NRCB6ShtiH8xEEXVxKq18BigfA",
authDomain: "skiptheline-3b2bd.firebaseapp.com",
projectId: "skiptheline-3b2bd",
storageBucket: "skiptheline-3b2bd.appspot.com",
messagingSenderId: "119643639082",
appId: "1:119643639082:web:100ae436b39e3e85de2253",
};

export const app = initializeApp(firebaseConfig);
// MARK: Firestore Reference
export const db = getFirestore(app);
export const db = getFirestore(app);
Binary file added android/app/src/main/res/raw/chime.mp3
Binary file not shown.
31 changes: 1 addition & 30 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,3 @@
{
"expo": {
"name": "firebase-crud",
"slug": "firebase-crud",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
}
},
"web": {
"favicon": "./assets/favicon.png"
}
}
"name": "SkipLine01"
}
File renamed without changes
File renamed without changes
Binary file added assets/icons/human-queue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
14 changes: 14 additions & 0 deletions components/HomeScreen/ClearButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { StyleSheet, Text, TouchableOpacity } from "react-native";
import React from "react";

const ClearButton = () => {
return (
<TouchableOpacity>
<Text>X</Text>
</TouchableOpacity>
);
};

export default ClearButton;

const styles = StyleSheet.create({});
Loading