Skip to content

Commit

Permalink
update expo sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
in-mai-space committed Nov 28, 2024
1 parent 1df8b22 commit 786d1c9
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 27 deletions.
3 changes: 2 additions & 1 deletion frontend/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
{
"locationAlwaysAndWhenInUsePermission": "Allow Snapper to use your location."
}
]
],
"expo-router"
],
"packagerOpts": {
"config": "metro.config.js"
Expand Down
25 changes: 19 additions & 6 deletions frontend/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,31 @@ import { InfoPopupProvider } from '../contexts/info-popup-context';
import { NotificationProvider } from '../contexts/notification';
import { useNotificationPermission } from '../hooks/notification';
import { useLocationPermission } from '../hooks/location';
import {
configureReanimatedLogger,
ReanimatedLogLevel,
} from 'react-native-reanimated';

configureReanimatedLogger({
level: ReanimatedLogLevel.warn,
strict: false,
});

const queryClient = new QueryClient();

const InitialLayout = () => {
const { isAuthenticated, mongoDBId } = useAuth();
const { isAuthenticated, mongoDBId, refreshSession } = useAuth();

useEffect(() => {
if (isAuthenticated) {
router.push('/(app)');
} else {
router.push('/(auth)/');
}
const refresh = async () => {
await refreshSession();
if (isAuthenticated) {
router.push('/(app)');
} else {
router.push('/(auth)/');
}
};
refresh();
}, [isAuthenticated]);

useNotificationPermission({ isAuthenticated, mongoDBId });
Expand Down
7 changes: 5 additions & 2 deletions frontend/auth/authProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ import { useAuthStore } from './authStore';
interface AuthContextType {
isAuthenticated: boolean;
mongoDBId: string | null;
refreshSession: () => Promise<void>;
}

const AuthContext = createContext<AuthContextType | undefined>(undefined);

export const AuthProvider = ({ children }: { children: ReactNode }) => {
const { isAuthenticated, mongoDBId } = useAuthStore();
const { isAuthenticated, mongoDBId, refreshSession } = useAuthStore();

return (
<AuthContext.Provider value={{ isAuthenticated, mongoDBId }}>
<AuthContext.Provider
value={{ isAuthenticated, mongoDBId, refreshSession }}
>
{children}
</AuthContext.Provider>
);
Expand Down
1 change: 1 addition & 0 deletions frontend/auth/authStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const useAuthStore = create<AuthState>(
const tokenExpiresAt = parseInt(expiresAt, 10);

if (currentTime < tokenExpiresAt) {
console.log('Token still valid, no need to refresh');
return; // Token is still valid; no need to refresh
}

Expand Down
37 changes: 19 additions & 18 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,37 @@
"@hookform/resolvers": "^3.9.0",
"@react-native-async-storage/async-storage": "^1.23.1",
"@react-native-community/cli-server-api": "^15.1.2",
"@shopify/flash-list": "^1.6.4",
"@shopify/flash-list": "1.7.1",
"@tanstack/react-query": "^5.59.0",
"axios": "^1.7.7",
"expo": "~51.0.39",
"expo-clipboard": "~6.0.3",
"expo-device": "^6.0.2",
"expo-image": "~1.13.0",
"expo-image-picker": "~15.0.7",
"expo-linear-gradient": "~13.0.2",
"expo-linking": "~6.3.1",
"expo-location": "^17.0.1",
"expo-notifications": "^0.28.19",
"expo-router": "~3.5.24",
"expo": "^52.0.0",
"expo-clipboard": "~7.0.0",
"expo-device": "~7.0.1",
"expo-image": "~2.0.2",
"expo-image-picker": "~16.0.3",
"expo-linear-gradient": "~14.0.1",
"expo-linking": "~7.0.3",
"expo-location": "~18.0.2",
"expo-notifications": "~0.29.8",
"expo-router": "~4.0.9",
"expo-server-sdk": "^3.11.0",
"expo-status-bar": "^1.12.1",
"expo-status-bar": "~2.0.0",
"nativewind": "^2.0.11",
"prettier": "^3.3.3",
"react": "^18.2.0",
"react": "18.3.1",
"react-hook-form": "^7.53.0",
"react-native": "^0.74.5",
"react-native": "0.76.3",
"react-native-extra-dimensions-android": "^1.2.5",
"react-native-fast-image": "^8.6.3",
"react-native-image-size": "^1.1.6",
"react-native-maps": "1.14.0",
"react-native-maps": "1.18.0",
"react-native-modal": "^13.0.1",
"react-native-parsed-text": "^0.0.22",
"react-native-reanimated": "^3.10.1",
"react-native-reanimated": "~3.16.1",
"react-native-reanimated-carousel": "^3.5.1",
"react-native-safe-area-context": "^4.12.0",
"react-native-share": "^11.0.4",
"react-native-svg": "15.2.0",
"react-native-svg": "15.8.0",
"react-native-svg-transformer": "^0.20.0",
"zod": "^3.23.8",
"zustand": "^3.7.2",
Expand All @@ -58,7 +59,7 @@
"devDependencies": {
"@babel/core": "^7.20.0",
"@tanstack/eslint-plugin-query": "^5.59.1",
"@types/react": "^18.2.79",
"@types/react": "~18.3.12",
"@types/react-native-dotenv": "^0.2.2",
"react-native-dotenv": "^3.4.11",
"react-native-svg-transformer": "^1.5.0",
Expand Down

0 comments on commit 786d1c9

Please sign in to comment.