Wave 2 = ALLE app-files die in Wave 1 noch hardcoded waren. Komplette App-weit
theme-aware-Migration jetzt durch. Legacy `import { colors }` flat export
vollständig eliminiert.
Migrated this wave:
Top-level Screens:
- app/urge.tsx (makeStyles factory mit ~20 colors)
- app/room.tsx + dm.tsx + games.tsx
- app/(app)/chat.tsx + mail.tsx + coach.tsx + notifications.tsx
- app/profile/[userId].tsx + profile/edit.tsx (INPUT_STYLE in body moved)
- app/debug.tsx + auth/callback.tsx
Blocker (7):
- AddDomainSheet, CooldownBanner, DeactivationExplainerSheet, DomainGrid,
ProtectionCard, ProtectionDetailsSheet, ProtectionLockedCard
Mail (3):
- ConnectMailSheet, EditMailAccountSheet, MailEmptyState
Chat (1):
- ChatBubble, ChatInput
Community/Posts/Notifications:
- PostCard, PostCardSkeleton, ComposeCard, PostCommentsSheet
- NotificationsDropdown
- StreakBadge (Nativewind classes durch inline dynamic styles ersetzt)
Reusable Sheets:
- WheelPickerModal, OptionsBottomSheet, DeviceLimitReachedSheet
Urge subsystem (5):
- InlineRatingDrawer, ShareSuccessDrawer, UrgeStats, SosFeedbackModal,
Breathing
Profile components:
- DigaMissionBanner
Pattern: useColors() hook in component body, makeStyles(colors) factory wo
StyleSheet.create vorher hardcoded war. 11 base-tokens (bg/surface/
surfaceElevated/border/text/textMuted/brandOrange/brandBlue/success/error/
warning) nutzen colors.light vs colors.dark scheme.
Bewusst NICHT migriert (semantic colors):
- DigaMissionBanner amber (#fffbeb, #854d0e) — DiGA-brand, nicht neutral
- Lyra-thinking #3b82f6 in urge.tsx — Lyra-brand-color
- scrollDownBtn #374151 — intentional dark floating-button
TS clean. Test: Settings → Theme → Dark — alle screens sollen jetzt dunkel
werden ohne white-flashes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
59 lines
2.3 KiB
TypeScript
59 lines
2.3 KiB
TypeScript
// Deep-Link Bridge für OAuth-Callback (Google/Apple).
|
|
//
|
|
// Hintergrund: nach erfolgreichem OAuth-Login redirected Supabase zu
|
|
// `rebreak://auth/callback#access_token=...`. Auf iOS schluckt
|
|
// `WebBrowser.openAuthSessionAsync` den Deep-Link bevor expo-router ihn sieht.
|
|
// Auf Android öffnet das System die App via Deep-Link → expo-router routet
|
|
// `/auth/callback` BEVOR openAuthSessionAsync's Listener feuert → 404.
|
|
//
|
|
// Diese Bridge-Page fängt das ab: zeigt einen Loader, extrahiert Tokens als
|
|
// Fallback (falls openAuthSessionAsync den Hash nicht selbst parst), und
|
|
// navigiert nach (app). signin.tsx macht zusätzlich router.replace('/(app)')
|
|
// nach openAuthSessionAsync resolve — diese Bridge ist nur für den Android-
|
|
// 404-Flash da.
|
|
import { useEffect } from 'react';
|
|
import { View, ActivityIndicator } from 'react-native';
|
|
import { useRouter, useLocalSearchParams } from 'expo-router';
|
|
import { supabase } from '../../lib/supabase';
|
|
import { useColors } from '../../lib/theme';
|
|
|
|
export default function AuthCallback() {
|
|
const router = useRouter();
|
|
const colors = useColors();
|
|
const params = useLocalSearchParams<{ access_token?: string; refresh_token?: string }>();
|
|
|
|
useEffect(() => {
|
|
let cancelled = false;
|
|
(async () => {
|
|
const accessToken = typeof params.access_token === 'string' ? params.access_token : undefined;
|
|
const refreshToken = typeof params.refresh_token === 'string' ? params.refresh_token : undefined;
|
|
if (accessToken && refreshToken) {
|
|
try {
|
|
await supabase.auth.setSession({
|
|
access_token: accessToken,
|
|
refresh_token: refreshToken,
|
|
});
|
|
} catch (err) {
|
|
console.warn('[auth-callback] setSession failed:', err);
|
|
}
|
|
}
|
|
// Kurzer Delay → onAuthStateChange propagiert die Session in den Store.
|
|
if (!cancelled) {
|
|
setTimeout(() => {
|
|
router.replace('/(app)' as never);
|
|
}, 60);
|
|
}
|
|
})();
|
|
return () => {
|
|
cancelled = true;
|
|
};
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, []);
|
|
|
|
return (
|
|
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center', backgroundColor: colors.bg }}>
|
|
<ActivityIndicator size="large" color={colors.brandOrange} />
|
|
</View>
|
|
);
|
|
}
|