mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-10-31 18:19:43 +00:00
Update
This commit is contained in:
1 parent
dfcf0ba289
commit
71667d6104
3 files changed
+22
-3
No files matched your search
@@ -159,6 +159,7 @@ export default function OnboardingScreen() {
|
||||
console.log('[Onboarding] Profile updated successfully, fetching user...');
|
||||
await fetchUser();
|
||||
console.log('[Onboarding] User fetched, navigating to home...');
|
||||
Events.profileUpdated(["name", "gender", "usage_reason", "show_explicit_content"]);
|
||||
Events.onboardingComplete();
|
||||
router.replace('/');
|
||||
} catch (err: any) {
|
||||
|
||||
@@ -121,6 +121,7 @@ export default function ProfileScreen() {
|
||||
// Refresh user data and packs to reflect the change
|
||||
await fetchUser();
|
||||
await fetchPacks();
|
||||
Events.profileUpdated(["show_explicit_content"]);
|
||||
} catch (error) {
|
||||
// Revert on error
|
||||
setShowExplicit(!value);
|
||||
@@ -174,6 +175,7 @@ export default function ProfileScreen() {
|
||||
|
||||
await fetchUser();
|
||||
setIsEditingName(false);
|
||||
Events.profileUpdated(["name"]);
|
||||
} catch (error) {
|
||||
Alert.alert("Error", "Failed to update name. Please try again.");
|
||||
setNewName(user.name || "");
|
||||
|
||||
@@ -6,9 +6,12 @@ import { initSentry, setUserContext, clearUserContext } from "../src/lib/sentry"
|
||||
initSentry();
|
||||
|
||||
// Initialize Analytics
|
||||
import { initAnalytics, setUserId, clearUserId, logScreenView } from "../src/lib/analytics";
|
||||
import { initAnalytics, setUserId, clearUserId, logScreenView, Events } from "../src/lib/analytics";
|
||||
initAnalytics();
|
||||
|
||||
// Track cold start immediately
|
||||
Events.appOpened("cold");
|
||||
|
||||
// Import push notification utilities
|
||||
import {
|
||||
clearPushToken,
|
||||
@@ -17,8 +20,8 @@ import {
|
||||
handleNotificationResponse,
|
||||
} from "../src/lib/notifications";
|
||||
|
||||
import React, { useEffect } from "react";
|
||||
import { Platform, View } from "react-native";
|
||||
import React, { useEffect, useRef } from "react";
|
||||
import { Platform, View, AppState, AppStateStatus } from "react-native";
|
||||
|
||||
// Suppress useLayoutEffect warning on server-side rendering
|
||||
if (Platform.OS === "web" && typeof window === "undefined") {
|
||||
@@ -50,6 +53,7 @@ const queryClient = new QueryClient();
|
||||
export default function RootLayout() {
|
||||
const { fetchUser, setUser } = useAuthStore();
|
||||
const pathname = usePathname();
|
||||
const appState = useRef(AppState.currentState);
|
||||
|
||||
// Track screen views
|
||||
useEffect(() => {
|
||||
@@ -58,6 +62,18 @@ export default function RootLayout() {
|
||||
}
|
||||
}, [pathname]);
|
||||
|
||||
// Track warm starts when app comes back from background
|
||||
useEffect(() => {
|
||||
const subscription = AppState.addEventListener("change", (nextAppState: AppStateStatus) => {
|
||||
if (appState.current.match(/inactive|background/) && nextAppState === "active") {
|
||||
Events.appOpened("warm");
|
||||
}
|
||||
appState.current = nextAppState;
|
||||
});
|
||||
|
||||
return () => subscription.remove();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
// Fetch user on mount
|
||||
fetchUser();
|
||||
|
||||
Reference in new issue
Block a user