Skip to content

Commit

Permalink
WORKS
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatXliner authored and DragonXDev committed Feb 26, 2024
1 parent 626238c commit 7c7cf5c
Show file tree
Hide file tree
Showing 8 changed files with 270 additions and 38 deletions.
2 changes: 1 addition & 1 deletion apps/WarriorHappy/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"expo": {
"name": "WarriorHappy",
"slug": "WarriorHappy",
"version": "3.0.7",
"version": "3.1.1",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"scheme": "myapp",
Expand Down
64 changes: 64 additions & 0 deletions apps/WarriorHappy/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ PODS:
- ExpoModulesCore
- ExpoHead (3.4.7):
- ExpoModulesCore
- ExpoImage (1.10.6):
- ExpoModulesCore
- SDWebImage (~> 5.17.0)
- SDWebImageAVIFCoder (~> 0.10.1)
- SDWebImageSVGCoder (~> 1.7.0)
- SDWebImageWebPCoder (~> 0.13.0)
- ExpoKeepAwake (12.8.2):
- ExpoModulesCore
- ExpoModulesCore (1.11.9):
Expand Down Expand Up @@ -48,7 +54,28 @@ PODS:
- hermes-engine (0.73.4):
- hermes-engine/Pre-built (= 0.73.4)
- hermes-engine/Pre-built (0.73.4)
- libaom (3.0.0):
- libvmaf (>= 2.2.0)
- libavif (0.11.1):
- libavif/libaom (= 0.11.1)
- libavif/core (0.11.1)
- libavif/libaom (0.11.1):
- libaom (>= 2.0.0)
- libavif/core
- libevent (2.1.12)
- libvmaf (2.3.1)
- libwebp (1.3.2):
- libwebp/demux (= 1.3.2)
- libwebp/mux (= 1.3.2)
- libwebp/sharpyuv (= 1.3.2)
- libwebp/webp (= 1.3.2)
- libwebp/demux (1.3.2):
- libwebp/webp
- libwebp/mux (1.3.2):
- libwebp/demux
- libwebp/sharpyuv (1.3.2)
- libwebp/webp (1.3.2):
- libwebp/sharpyuv
- RCT-Folly (2022.05.16.00):
- boost
- DoubleConversion
Expand Down Expand Up @@ -1089,6 +1116,8 @@ PODS:
- React-jsi (= 0.73.4)
- React-logger (= 0.73.4)
- React-perflogger (= 0.73.4)
- RNCAsyncStorage (1.21.0):
- React-Core
- RNFlashList (1.6.3):
- React-Core
- RNReanimated (3.7.1):
Expand All @@ -1102,6 +1131,17 @@ PODS:
- React-Core
- RNSVG (14.1.0):
- React-Core
- SDWebImage (5.17.0):
- SDWebImage/Core (= 5.17.0)
- SDWebImage/Core (5.17.0)
- SDWebImageAVIFCoder (0.10.1):
- libavif (>= 0.11.0)
- SDWebImage (~> 5.10)
- SDWebImageSVGCoder (1.7.0):
- SDWebImage/Core (~> 5.6)
- SDWebImageWebPCoder (0.13.0):
- libwebp (~> 1.0)
- SDWebImage/Core (~> 5.17)
- SocketRocket (0.6.1)
- Yoga (1.14.0)

Expand All @@ -1115,6 +1155,7 @@ DEPENDENCIES:
- ExpoCrypto (from `../../../node_modules/expo-crypto/ios`)
- ExpoFileSystem (from `../../../node_modules/expo-file-system/ios`)
- ExpoHead (from `../../../node_modules/expo-router/ios`)
- ExpoImage (from `../../../node_modules/expo-image/ios`)
- ExpoKeepAwake (from `../../../node_modules/expo-keep-awake/ios`)
- ExpoModulesCore (from `../../../node_modules/expo-modules-core`)
- ExpoSecureStore (from `../../../node_modules/expo-secure-store/ios`)
Expand Down Expand Up @@ -1170,6 +1211,7 @@ DEPENDENCIES:
- React-runtimescheduler (from `../../../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler`)
- React-utils (from `../../../node_modules/react-native/ReactCommon/react/utils`)
- ReactCommon/turbomodule/core (from `../../../node_modules/react-native/ReactCommon`)
- "RNCAsyncStorage (from `../../../node_modules/@react-native-async-storage/async-storage`)"
- "RNFlashList (from `../../../node_modules/@shopify/flash-list`)"
- RNReanimated (from `../../../node_modules/react-native-reanimated`)
- RNScreens (from `../../../node_modules/react-native-screens`)
Expand All @@ -1179,7 +1221,15 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- fmt
- libaom
- libavif
- libevent
- libvmaf
- libwebp
- SDWebImage
- SDWebImageAVIFCoder
- SDWebImageSVGCoder
- SDWebImageWebPCoder
- SocketRocket

EXTERNAL SOURCES:
Expand All @@ -1201,6 +1251,8 @@ EXTERNAL SOURCES:
:path: "../../../node_modules/expo-file-system/ios"
ExpoHead:
:path: "../../../node_modules/expo-router/ios"
ExpoImage:
:path: "../../../node_modules/expo-image/ios"
ExpoKeepAwake:
:path: "../../../node_modules/expo-keep-awake/ios"
ExpoModulesCore:
Expand Down Expand Up @@ -1306,6 +1358,8 @@ EXTERNAL SOURCES:
:path: "../../../node_modules/react-native/ReactCommon/react/utils"
ReactCommon:
:path: "../../../node_modules/react-native/ReactCommon"
RNCAsyncStorage:
:path: "../../../node_modules/@react-native-async-storage/async-storage"
RNFlashList:
:path: "../../../node_modules/@shopify/flash-list"
RNReanimated:
Expand All @@ -1327,6 +1381,7 @@ SPEC CHECKSUMS:
ExpoCrypto: b6428f48599c007676dc81a9b5f72c07e62fdccc
ExpoFileSystem: a9273932e69a9a1e1a8d01b6ba895bb8294bbea2
ExpoHead: 5aa4ef0a18a83f323e21cf83ff29b94d3c53e050
ExpoImage: 8cf2d51de3d03b7e984e9b0ba8f19c0c22057001
ExpoKeepAwake: 0f5cad99603a3268e50af9a6eb8b76d0d9ac956c
ExpoModulesCore: e3935209adc73469033e62992a504077def5bd40
ExpoSecureStore: c84ae37d1c36f38524d289c67c3a2e3fc56f1108
Expand All @@ -1338,7 +1393,11 @@ SPEC CHECKSUMS:
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
hermes-engine: b2669ce35fc4ac14f523b307aff8896799829fe2
libaom: 144606b1da4b5915a1054383c3a4459ccdb3c661
libavif: 84bbb62fb232c3018d6f1bab79beea87e35de7b7
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
libvmaf: 27f523f1e63c694d14d534cd0fddd2fab0ae8711
libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009
RCT-Folly: 7169b2b1c44399c76a47b5deaaba715eeeb476c0
RCTRequired: ab7f915c15569f04a49669e573e6e319a53f9faa
RCTTypeSafety: 63b97ced7b766865057e7154db0e81ce4ee6cf1e
Expand Down Expand Up @@ -1381,10 +1440,15 @@ SPEC CHECKSUMS:
React-runtimescheduler: 1c054b58fef2ce74cdcbdcd70db190e10f56a617
React-utils: 21a798438d45e70ed9c2e2fe0894ee32ba7b7c5b
ReactCommon: dcc65c813041388dead6c8b477444757425ce961
RNCAsyncStorage: 618d03a5f52fbccb3d7010076bc54712844c18ef
RNFlashList: 4b4b6b093afc0df60ae08f9cbf6ccd4c836c667a
RNReanimated: 68be24ba590b9136af90698bb01527387c8061da
RNScreens: 2b73f5eb2ac5d94fbd61fa4be0bfebd345716825
RNSVG: ba3e7232f45e34b7b47e74472386cf4e1a676d0a
SDWebImage: 750adf017a315a280c60fde706ab1e552a3ae4e9
SDWebImageAVIFCoder: 8348fef6d0ec69e129c66c9fe4d74fbfbf366112
SDWebImageSVGCoder: 15a300a97ec1c8ac958f009c02220ac0402e936c
SDWebImageWebPCoder: af09429398d99d524cae2fe00f6f0f6e491ed102
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
Yoga: 1b901a6d6eeba4e8a2e8f308f708691cdb5db312

Expand Down
10 changes: 8 additions & 2 deletions apps/WarriorHappy/ios/WarriorHappy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,10 @@
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "$(inherited)";
OTHER_CPLUSPLUSFLAGS = "$(inherited)";
OTHER_LDFLAGS = "$(inherited) ";
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;
Expand Down Expand Up @@ -522,7 +525,10 @@
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_CFLAGS = "$(inherited)";
OTHER_CPLUSPLUSFLAGS = "$(inherited)";
OTHER_LDFLAGS = "$(inherited) ";
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;
Expand Down
2 changes: 1 addition & 1 deletion apps/WarriorHappy/ios/WarriorHappy/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>3.0.7</string>
<string>3.1.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand Down
5 changes: 4 additions & 1 deletion apps/WarriorHappy/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "warriorhappy",
"main": "index.ts",
"version": "3.0.7",
"version": "3.1.1",
"scripts": {
"start": "expo start",
"android": "expo run:android",
Expand All @@ -17,6 +17,7 @@
"@acme/tamagui-config": "workspace:^",
"@expo/metro-runtime": "~3.1.3",
"@expo/vector-icons": "^14.0.0",
"@react-native-async-storage/async-storage": "1.21.0",
"@react-navigation/native": "^6.0.2",
"@shopify/flash-list": "1.6.3",
"@supabase/auth-helpers-react": "^0.4.2",
Expand All @@ -29,6 +30,7 @@
"expo-build-properties": "~0.11.1",
"expo-crypto": "^12.8.1",
"expo-font": "~11.10.3",
"expo-image": "^1.10.6",
"expo-linking": "~6.2.2",
"expo-router": "~3.4.7",
"expo-secure-store": "~12.8.1",
Expand All @@ -40,6 +42,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-native": "0.73.4",
"react-native-elements": "^3.4.3",
"react-native-reanimated": "^3.6.3",
"react-native-safe-area-context": "4.8.2",
"react-native-screens": "~3.29.0",
Expand Down
44 changes: 34 additions & 10 deletions apps/WarriorHappy/src/app/profile.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
import { useState } from "react";
import { Alert, Pressable, Text, TextInput, View } from "react-native";
import { useEffect, useState } from "react";
import {
Alert,
AppState,
Pressable,
Text,
TextInput,
View,
} from "react-native";
import * as AppleAuthentication from "expo-apple-authentication";
import { AntDesign } from "@expo/vector-icons";
import { useSupabaseClient, useUser } from "@supabase/auth-helpers-react";

import { initiateAppleSignIn } from "../utils/auth";
import { supabase } from "../utils/supabase";

// Tells Supabase Auth to continuously refresh the session automatically if
// the app is in the foreground. When this is added, you will continue to receive
// `onAuthStateChange` events with the `TOKEN_REFRESHED` or `SIGNED_OUT` event
// if the user's session is terminated. This should only be registered once.
AppState.addEventListener("change", (state) => {
if (state === "active") {
supabase.auth.startAutoRefresh();
} else {
supabase.auth.stopAutoRefresh();
}
});

export default function Profile() {
const user = useUser();
let user = null;
useEffect(() => {
supabase.auth.getUser().then((u) => {
user = u.data.user;
});
});
return (
<View className="flex-1 bg-zinc-800 p-4">
{user ? <SignedInView /> : <SignedOutView />}
Expand All @@ -16,8 +40,12 @@ export default function Profile() {
}

function SignedInView() {
const supabase = useSupabaseClient();
const user = useUser();
let user = null;
useEffect(() => {
supabase.auth.getUser().then((u) => {
user = u.data.user;
});
});

return (
<View className="flex gap-4">
Expand All @@ -33,8 +61,6 @@ function SignedInView() {
}

function SignedOutView() {
const supabase = useSupabaseClient();

const signInWithApple = async () => {
try {
const { token, nonce } = await initiateAppleSignIn();
Expand Down Expand Up @@ -105,8 +131,6 @@ function SignedOutView() {
}

function EmailForm() {
const supabase = useSupabaseClient();

const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [showPassword, setShowPassword] = useState(false);
Expand Down
38 changes: 15 additions & 23 deletions apps/WarriorHappy/src/utils/supabase.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
import * as SecureStore from "expo-secure-store";
import { createClient } from "@supabase/supabase-js";

import "react-native-url-polyfill/auto";
import AsyncStorage from "@react-native-async-storage/async-storage";
import { createClient } from "@supabase/supabase-js";

const ExpoSecureStoreAdapter = {
getItem: (key: string) => SecureStore.getItemAsync(key),
setItem: (key: string, value: string) => SecureStore.setItemAsync(key, value),
removeItem: (key: string) => SecureStore.deleteItemAsync(key),
};

export const supabase = createClient(
// App Throws if these are not defined, so we can safely cast
const supabaseUrl =
process.env.EXPO_PUBLIC_SUPABASE_URL ??
"https://nbyhwzvwvpwikgzoyank.supabase.co",
"https://nbyhwzvwvpwikgzoyank.supabase.co";

const supabaseAnonKey =
process.env.EXPO_PUBLIC_SUPABASE_ANON_KEY ??
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im5ieWh3enZ3dnB3aWtnem95YW5rIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDQwMDQyNTIsImV4cCI6MjAxOTU4MDI1Mn0.ytShtlo0sjKyGCeyqzdVXWpGe-9frCevLXAq1gdjG0w",
{
auth: {
storage: ExpoSecureStoreAdapter,
autoRefreshToken: true,
persistSession: true,
// detectSessionInUrl: true,
detectSessionInUrl: false, // set to false bc https://supabase.com/blog/react-native-authentication#OAuth
// flowType: "pkce", // no. pita to implement
},
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im5ieWh3enZ3dnB3aWtnem95YW5rIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDQwMDQyNTIsImV4cCI6MjAxOTU4MDI1Mn0.ytShtlo0sjKyGCeyqzdVXWpGe-9frCevLXAq1gdjG0w";

export const supabase = createClient(supabaseUrl, supabaseAnonKey, {
auth: {
storage: AsyncStorage,
autoRefreshToken: true,
persistSession: true,
detectSessionInUrl: false,
},
);
});
Loading

0 comments on commit 7c7cf5c

Please sign in to comment.