feat: turbostarter boilerplate
Production-ready Next.js boilerplate with: - Runtime env validation (fail-fast on missing vars) - Feature-gated config (S3, Stripe, email, OAuth) - Docker + Coolify deployment pipeline - PostgreSQL + pgvector, MinIO S3, Better Auth - TypeScript strict mode (no ignoreBuildErrors) - i18n (en/es), AI modules, billing, monitoring Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1
packages/analytics/mobile/src/hooks/index.ts
Normal file
1
packages/analytics/mobile/src/hooks/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./use-tracking-permissions";
|
||||
@@ -0,0 +1,32 @@
|
||||
import { requestTrackingPermissionsAsync } from "expo-tracking-transparency";
|
||||
import { useEffect, useState, useCallback } from "react";
|
||||
import { AppState } from "react-native";
|
||||
|
||||
export const useTrackingPermissions = () => {
|
||||
const [granted, setGranted] = useState(false);
|
||||
|
||||
const checkPermission = useCallback(async () => {
|
||||
const { granted: isGranted } = await requestTrackingPermissionsAsync();
|
||||
setGranted(isGranted);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
void checkPermission();
|
||||
}, [checkPermission]);
|
||||
|
||||
useEffect(() => {
|
||||
const subscription = AppState.addEventListener("change", (status) => {
|
||||
if (status !== "active") {
|
||||
return;
|
||||
}
|
||||
|
||||
void checkPermission();
|
||||
});
|
||||
|
||||
return () => {
|
||||
subscription.remove();
|
||||
};
|
||||
}, [checkPermission]);
|
||||
|
||||
return granted;
|
||||
};
|
||||
Reference in New Issue
Block a user