docs: add comprehensive deep linking documentation

Changes:
- Add detailed JSDoc headers to deep linking files
- Document type system and validation strategy
- Add architecture overview and error handling docs
- Include usage examples and integration points
- Improve code organization comments

This improves maintainability by documenting the deep linking
system's architecture, type safety, and integration points.
This commit is contained in:
Matthew Raymer
2025-02-26 09:45:08 +00:00
parent 64a04ec9a5
commit 5bc2f19bc4
4 changed files with 130 additions and 44 deletions

View File

@@ -1,47 +1,31 @@
/**
* @file Capacitor Platform Entry Point
* @description Initializes the application for Capacitor platform (iOS/Android)
* @file Capacitor Main Entry Point
* @author Matthew Raymer
* @version 0.4.4
*
* Process Flow:
* 1. Initialization
* - Logs start of initialization
* - Logs current platform
* - Initializes core application via main.common
*
* 2. Error Handling Setup
* - Registers global unhandled promise rejection handler
* - Routes API errors to error handling system
*
* 3. Deep Linking Configuration
* - Registers URL scheme handler (timesafari://)
* - Supports 11 parameterized routes:
* * claim-add-raw
* * claim-cert
* * claim
* * confirm-gift
* * contact-edit
* * contact-import
* * did
* * invite-one-accept
* * offer-details
* * project
* * userProfile
*
* 4. Application Mounting
* - Mounts Vue application to DOM
* - Logs completion of mounting process
*
* Security Measures:
* - URL validation before processing
* - Type-safe error handling
* - Parameterized route pattern matching
* - Comprehensive error logging
*
* @example Deep Link Format
* timesafari://<route>/<parameter>
* timesafari://claim/01JMAAFZRNSRTQ0EBSD70A8E1H
*
* This file initializes the deep linking system for the TimeSafari app.
* It sets up the connection between Capacitor's URL handling and our deep link processor.
*
* Deep Linking Flow:
* 1. Capacitor receives URL open event
* 2. Event is passed to DeepLinkHandler
* 3. URL is validated and processed
* 4. Router navigates to appropriate view
*
* Integration Points:
* - Capacitor App plugin for URL handling
* - Vue Router for navigation
* - Error handling system
* - Logging system
*
* Type Safety:
* - Uses DeepLinkHandler for type-safe parameter processing
* - Ensures type safety between Capacitor events and app routing
* - Maintains type checking through the entire deep link flow
*
* @example
* // URL open event from OS
* timesafari://claim/123?view=details
* // Processed and routed to appropriate view with type-safe parameters
*/
import { initializeApp } from "./main.common";
@@ -88,7 +72,9 @@ const handleDeepLink = async (data: { url: string }) => {
await deepLinkHandler.handleDeepLink(data.url);
} catch (error) {
logConsoleAndDb("[DeepLink] Error handling deep link: " + error, true);
handleApiError(error, "deep-link");
handleApiError({
message: error instanceof Error ? error.message : String(error)
} as AxiosError, "deep-link");
}
};