mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-11-01 18:19:43 +00:00
Update
This commit is contained in:
1 parent
d1a2032724
commit
dfcf0ba289
10 files changed
+630
-28
No files matched your search
@@ -145,4 +145,25 @@ export const Events = {
|
||||
// Pack events
|
||||
packEnabled: (packId: string) => logEvent("pack_enabled", { pack_id: packId }),
|
||||
packDisabled: (packId: string) => logEvent("pack_disabled", { pack_id: packId }),
|
||||
|
||||
// App lifecycle events
|
||||
appOpened: (type: "cold" | "warm") => logEvent("app_opened", { type }),
|
||||
|
||||
// Profile events
|
||||
profileUpdated: (fields: string[]) => logEvent("profile_updated", { fields: fields.join(",") }),
|
||||
avatarUploaded: () => logEvent("avatar_uploaded"),
|
||||
|
||||
// Notification events
|
||||
notificationPermissionGranted: () => logEvent("notification_permission_granted"),
|
||||
notificationPermissionDenied: () => logEvent("notification_permission_denied"),
|
||||
|
||||
// Relationship events
|
||||
relationshipEnded: () => logEvent("relationship_ended"),
|
||||
|
||||
// Milestone events
|
||||
firstMatch: () => logEvent("first_match"),
|
||||
milestoneMatch: (count: number) => logEvent("milestone_match", { match_count: count }),
|
||||
|
||||
// Invite events
|
||||
inviteCodeCopied: () => logEvent("invite_code_copied"),
|
||||
};
|
||||
@@ -4,6 +4,7 @@ import { Platform } from "react-native";
|
||||
import { router } from "expo-router";
|
||||
import { supabase } from "./supabase";
|
||||
import { captureError } from "./sentry";
|
||||
import { Events } from "./analytics";
|
||||
|
||||
// Configure notification behavior for foreground
|
||||
// We don't show system alerts since the app handles notifications with in-app toasts
|
||||
@@ -41,6 +42,12 @@ export async function registerForPushNotificationsAsync(): Promise<string | null
|
||||
if (existingStatus !== "granted") {
|
||||
const { status } = await Notifications.requestPermissionsAsync();
|
||||
finalStatus = status;
|
||||
// Track permission result (only when we actually requested)
|
||||
if (status === "granted") {
|
||||
Events.notificationPermissionGranted();
|
||||
} else {
|
||||
Events.notificationPermissionDenied();
|
||||
}
|
||||
}
|
||||
|
||||
if (finalStatus !== "granted") {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { create } from "zustand";
|
||||
import { supabase } from "../lib/supabase";
|
||||
import { Events } from "../lib/analytics";
|
||||
import revenueCatService, {
|
||||
SubscriptionState,
|
||||
PurchasesPackage,
|
||||
@@ -87,6 +88,7 @@ export const useAuthStore = create<AuthState>((set, get) => ({
|
||||
},
|
||||
|
||||
signOut: async () => {
|
||||
Events.signOut();
|
||||
// Clear local state FIRST to ensure UI updates even if Supabase call fails
|
||||
set({
|
||||
user: null,
|
||||
@@ -337,6 +339,13 @@ export const usePacksStore = create<PacksState>((set, get) => ({
|
||||
return { success: false, reason: "error" };
|
||||
}
|
||||
|
||||
// Track pack enable/disable
|
||||
if (newValue) {
|
||||
Events.packEnabled(packId);
|
||||
} else {
|
||||
Events.packDisabled(packId);
|
||||
}
|
||||
|
||||
return { success: true };
|
||||
},
|
||||
|
||||
|
||||
Reference in new issue
Block a user