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

Auth #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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 app/.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: 7 additions & 3 deletions app/.expo/packager-info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"devToolsPort": 19002,
"expoServerPort": 19000,
"packagerPort": 19001,
"packagerPid": 7177
"expoServerPort": null,
"packagerPort": null,
"packagerPid": null,
"expoServerNgrokUrl": null,
"packagerNgrokUrl": null,
"ngrokPid": null,
"webpackServerPort": null
}
8 changes: 5 additions & 3 deletions app/.expo/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"hostType": "lan",
"hostType": "tunnel",
"lanType": "ip",
"dev": true,
"minify": false,
"urlRandomness": null,
"https": false
"urlRandomness": "jg-mdx",
"https": false,
"scheme": null,
"devClient": false
}
17 changes: 15 additions & 2 deletions app/App.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { StyleSheet, Text, View, Button } from 'react-native';
import TextInputs from './components/auth';
import * as WebBrowser from 'expo-web-browser';

export default function App() {
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<Text>Don't Open up App.js to start working on your app!</Text>
<TextInputs />
<StatusBar style="auto" />
<Button
title="Redeem Gems"
transparent
onPress={()=>
WebBrowser.openBrowserAsync(
"https://api.echo3d.co/webar?key=quiet-pond-7565&entry=6b674fdd-db79-409a-8afc-86f4a0ea5f60"
)
}
>
</Button>
</View>
);
}
Expand Down
62 changes: 62 additions & 0 deletions app/components/auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import React from "react";
import { SafeAreaView, StyleSheet, TextInput, Button } from "react-native";
import Firebase from './firebase.js'

const TextInputs = () => {
const [username, onChangeU] = React.useState(null);
const [password, onChangeP] = React.useState(null);



const auth = Firebase.auth();



return (
<SafeAreaView>
<TextInput
style={styles.input}
onChangeText={onChangeU}
value={username}
placeholder="username"
/>
<TextInput
style={styles.input}
onChangeText={onChangeP}
value={password}
placeholder="password"
/>
<Button
onPress={async () => {
alert('username: ' + username);
try {
if (username !== '' && password !== '') {
await auth.signInWithEmailAndPassword(username, password);
}
} catch (error) {
alert("Account not found, creating account");
try {
let res = await auth.createUserWithEmailAndPassword(username, password);
}
catch(error2){
alert("account not able to be created");
}
alert("account: " + username + " " + password + " has been created");
};
}}
title="Login"
/>
</SafeAreaView>
);
};

const styles = StyleSheet.create({
input: {
height: 40,
margin: 12,
borderWidth: 1,
padding: 10,
},
});

export default TextInputs;
16 changes: 16 additions & 0 deletions app/components/firebase.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import firebase from 'firebase/app';
import 'firebase/auth';


const firebaseConfig = {

};

let Firebase;

if (firebase.apps.length === 0) {
Firebase = firebase.initializeApp(firebaseConfig);
}


export default Firebase;
Loading