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
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
ios

# dependencies
node_modules/
Expand Down Expand Up @@ -38,4 +39,8 @@ yarn-error.*
# The following patterns were generated by expo-cli

expo-env.d.ts
# @end expo-cli
# @end expo-cli
# Expo
.expo
dist/
web-build/
5 changes: 5 additions & 0 deletions additional.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module "*.png";
declare module "*.jpg";
declare module "*.jpeg";
declare module "*.svg";
declare module "*.gif";
38 changes: 30 additions & 8 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"expo": {
"name": "freedo",
"slug": "freedo",
"name": "freedu",
"slug": "freedu",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/images/test-png-fox.png",
"scheme": "myapp",
"scheme": "com.willybeans.freedu",
"userInterfaceStyle": "automatic",
"assetBundlePatterns": ["**/*"],
"ios": {
Expand All @@ -15,15 +15,26 @@
"resizeMode": "contain",
"backgroundColor": "#E3C0FF",
"dark": {
"image": "./assets/images/splash.png",
"image": "./assets/images/test-png-med-fox.png",
"resizeMode": "contain",
"backgroundColor": "#7C2EDB"
}
}
},
"infoPlist": {
"CFBundleURLTypes": [
{
"CFBundleURLSchemes": [
"com.googleusercontent.apps.877799132108-3kvno9kifo9nh6mtl398btl2ljespudr",
"com.googleusercontent.apps.877799132108-s1l5qr0koi0ddqt075130fjhnk5boevh"
]
}
]
},
"bundleIdentifier": "com.willybeans.freedu"
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/images/adaptive-icon.png",
"foregroundImage": "./assets/images/test-png-fox.png",
"backgroundColor": "#ffffff"
},
"splash": {
Expand All @@ -35,7 +46,9 @@
"resizeMode": "contain",
"backgroundColor": "#7C2EDB"
}
}
},
"permissions": ["android.permission.RECORD_AUDIO"],
"package": "com.willybeans.freedu"
},
"web": {
"bundler": "metro",
Expand All @@ -49,10 +62,19 @@
"photosPermission": "The app accesses your photos to let you share them with your friends."
}
],
"expo-router"
"expo-router",
"@react-native-google-signin/google-signin"
],
"experiments": {
"typedRoutes": true
},
"extra": {
"router": {
"origin": false
},
"eas": {
"projectId": "6c5a3f1a-6d04-4c28-870a-1af1f9d13db5"
}
}
}
}
2 changes: 1 addition & 1 deletion app/(app)/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default function TabLayout() {
<FontAwesome
name="plus"
size={25}
color={Colors[colorScheme ?? "light"].matchTint}
color={pallatte.colorDarkPurple}
style={{ marginRight: 16, opacity: pressed ? 0.5 : 1 }}
/>
)}
Expand Down
4 changes: 2 additions & 2 deletions app/(app)/(tabs)/chats/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ChatProvider } from "../../../../context/Chats";
import { useLocalSearchParams } from "expo-router";
import { useWebSocketContext } from "../../../../context/WebSocket";
import { useEffect, useState } from "react";
import Colors from "../../../../constants/Colors";
import Colors, { pallatte } from "../../../../constants/Colors";
import { Pressable, useColorScheme } from "react-native";
import { FontAwesome } from "@expo/vector-icons";

Expand Down Expand Up @@ -47,7 +47,7 @@ export default function ChatsLayout() {
<FontAwesome
name="plus"
size={25}
color={Colors[colorScheme ?? "light"].matchTint}
color={pallatte.colorDarkPurple}
style={{ opacity: pressed ? 0.5 : 1 }}
/>
)}
Expand Down
134 changes: 120 additions & 14 deletions app/sign-in.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,128 @@
import { router } from "expo-router";
import { HrefObject, Link, router } from "expo-router";
// import { Text, View } from "react-native";
import { useSession } from "../context/Auth/ctx";
import { Text, View } from "../components/Themed";
import { Text, TextInput, View } from "../components/Themed";
// import GithubLoginComponent from "../components/GithubLogin";
import { ScrollView, StyleSheet, useColorScheme } from "react-native";
import { useState } from "react";
import Colors from "../constants/Colors";
import { Button } from "../components/Button";

import CuriousFox from "../svgs/curious_fox.svg";
import GoogleLogin from "../components/GoogleLogin";
import GithubLoginComponent from "../components/GithubLogin";

type Url = {
pathname: string;
params?: { id: string };
};

export default function SignIn() {
const [userName, setUserName] = useState("");
const [password, setPassword] = useState("");
const colorScheme = useColorScheme();
const { signIn } = useSession();

const handleRegister = () => {
router.replace("/register");
};

const handleSignIn = () => {
// api stuff here
// userName, password
//on res:
signIn();
// Navigate after signing in. You may want to tweak this to ensure sign-in is
// successful before navigating.
router.replace("/");
};
return (
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
<Text
onPress={() => {
signIn();
// Navigate after signing in. You may want to tweak this to ensure sign-in is
// successful before navigating.
router.replace("/");
}}
>
Sign In
</Text>
</View>
<ScrollView contentContainerStyle={styles.container}>
<CuriousFox
height={250}
width={250}
style={{ color: Colors[colorScheme ?? "light"].tint }}
/>

<View style={styles.headerContainer}>
<Text style={styles.header}>Welcome to Freedu!</Text>
<Text style={styles.header}>Please login to continue</Text>
</View>
<View style={styles.loginContainer}>
<TextInput
onChangeText={setUserName}
placeholder="Username"
style={[
styles.inputs,
{
borderColor: Colors[colorScheme ?? "light"].border,
},
]}
/>
<TextInput
onChangeText={setPassword}
secureTextEntry
placeholder="Password"
style={[
styles.inputs,
{
borderColor: Colors[colorScheme ?? "light"].border,
},
]}
/>
<Button
onPress={handleSignIn}
title="Login"
style={{ width: "50%", marginBottom: 10 }}
/>

<Button
onPress={handleRegister}
title="Register"
style={{ width: "50%" }}
/>
</View>

<View
lightColor="#eee"
darkColor="rgba(255,255,255,0.1)"
style={styles.separator}
/>
<GoogleLogin />
{/* <GithubLoginComponent /> */}
</ScrollView>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
alignItems: "center",
},
headerContainer: {
justifyContent: "center",
alignItems: "center",
marginBottom: 20,
},
header: {
fontFamily: "Helvetica",
fontWeight: "700",
fontSize: 24,
},
loginContainer: {
width: "100%",
justifyContent: "center",
alignItems: "center",
},
inputs: {
height: 40,
width: "80%",
marginBottom: 10,
},
separator: {
marginVertical: 20,
height: 1,
width: "80%",
},
});
49 changes: 49 additions & 0 deletions components/GithubLogin.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import * as React from "react";
import * as WebBrowser from "expo-web-browser";
import { makeRedirectUri, useAuthRequest } from "expo-auth-session";
import { Button } from "react-native";
import * as Linking from "expo-linking";

WebBrowser.maybeCompleteAuthSession();
const redirectUri = makeRedirectUri();

console.log("#$^%&^*%&^$#%@$!#%^%&^*&$@", redirectUri);
// console.log(AuthSession.getRedirectUrl())

// Endpoint
const discovery = {
authorizationEndpoint: "https://github.com/login/oauth/authorize",
tokenEndpoint: "https://github.com/login/oauth/access_token",
revocationEndpoint:
"https://github.com/settings/connections/applications/8b9c0875bc67e9e797c2",
};

export default function GithubLoginComponent() {
const [request, response, promptAsync] = useAuthRequest(
{
clientId: "8b9c0875bc67e9e797c2",
scopes: ["identity"], // what is this?
// redirectUri,
redirectUri: makeRedirectUri({
// scheme: "com.willybeans.freedu",
}),
},
discovery
);

React.useEffect(() => {
if (response?.type === "success") {
const { code } = response.params;
}
}, [response]);

return (
<Button
disabled={!request}
title="Login Using Github"
onPress={() => {
promptAsync();
}}
/>
);
}
Loading