Implementation: How should the DesktopWelcomeComponent handle auth for both ...
Documentation for Sessions
⚙️ Implementation: How should the DesktopWelcomeComponent handle auth for both ...
Date: 2026-02-26
Time: 22:12:59 UTC
Session: gspace1-148.3
Agent: angular
Confidence: 95%
Status: ✅ Documented
📋 Decision Context
Question:
How should the DesktopWelcomeComponent handle auth for both Tauri desktop and Capacitor mobile?
Task: Fix auth flow for Capacitor mobile in DesktopWelcomeComponent
🎯 Decision Made
Chosen:
Platform detection with conditional branching: capBridge.isMobileApp() routes to Capacitor's authDeepLink$ (RxJS Subject), tauriBridge.isDesktopApp() routes to Tauri's event listener. Both converge on the same handleAuthCallback() method that calls DesktopOAuthService.restoreFromDeepLinkPayload().
Options Considered:
- Separate MobileWelcomeComponent
- NativeBridgeService abstraction
- Platform branching in existing component
💭 Reasoning
ROOT CAUSE: Session 144 created CapacitorBridgeService with authDeepLink$ Subject but never wired a subscriber. The DesktopWelcomeComponent (Session 141) only imported @tauri-apps/api/event and called listen('vitto:auth-token'). Mobile users would see the welcome screen, click sign-in, complete auth in browser, the deep link would fire, CapacitorBridgeService would emit on authDeepLink$ — but nobody was listening. The token was lost. ALTERNATIVES: (1) Create separate MobileWelcomeComponent — rejected: duplicates 90% of the logic, violates DRY. (2) Create NativeBridgeService abstraction — rejected: over-engineering for two platforms with fundamentally different APIs (Tauri uses named events, Capacitor uses Subjects). (3) Add platform branching in existing component — chosen: minimal change, clear separation, both paths converge on shared handleAuthCallback(). WHY THIS COULD BE WRONG: If a third native platform is added (e.g., Electron), the branching gets messy. At that point, extract a NativeBridgeService. For two platforms, conditional branching is the right complexity level.
📁 Files Involved
apps/gograb-ai/src/app/pages/desktop-welcome/desktop-welcome.component.ts
🔗 Related
- Decision ID:
dev_1772143979358_bvaz684 - Session: 148
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation