feat(mobile): add deep linking support for Capacitor apps

Adds native deep linking capabilities:
- Configure timesafari:// URL scheme for iOS and Android
- Add @capacitor/app dependency and configuration
- Implement deep link handler with improved error logging
- Support parameterized routes like claim/:id
- Add debug logging for native platforms
- Handle app mounting state for deep links

Technical changes:
- Update AndroidManifest.xml with intent filters
- Add URL scheme to iOS Info.plist
- Add @capacitor/app to Podfile and Gradle
- Enhance main.capacitor.ts with robust deep link handling
This commit is contained in:
Matthew Raymer
2025-02-19 13:07:08 +00:00
parent 3135062c08
commit 1e22cdec82
13 changed files with 580 additions and 222 deletions

13
src/services/api.ts Normal file
View File

@@ -0,0 +1,13 @@
export const handleApiError = (error: any, endpoint: string) => {
if (process.env.VITE_PLATFORM === 'capacitor') {
console.error(`[Capacitor API Error] ${endpoint}:`, error);
}
// Specific handling for rate limits
if (error.response?.status === 400) {
console.warn(`[Rate Limit] ${endpoint}`);
return null;
}
throw error;
};

19
src/services/plan.ts Normal file
View File

@@ -0,0 +1,19 @@
export const loadPlanWithRetry = async (handle: string, retries = 3) => {
for (let i = 0; i < retries; i++) {
try {
const plan = await loadPlan(handle);
if (plan) return plan;
} catch (err) {
console.warn(`[Plan Load] Attempt ${i + 1} failed for ${handle}`);
if (i === retries - 1) throw err;
await new Promise(resolve => setTimeout(resolve, 1000 * (i + 1)));
}
}
};
const loadPlan = async (handle: string) => {
// Implement your plan loading logic here
// This is a placeholder - replace with actual implementation
const response = await fetch(`/api/plans/${handle}`);
return response.json();
};