From b590e41ec8e8d4364512c7f08100df8e529d7ca8 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Mon, 10 Mar 2025 13:00:54 +0000 Subject: [PATCH] feat: add claim route deep linking support - Add claim route to deep link schema - Add claim view test to deeplink tests - Update build docs for clean web builds - Add rm -rf dist to build steps Technical Changes: - Add claim schema with id parameter - Add claim route test using generated claim ID - Add clean step before web/capacitor builds - Update Android build instructions This adds support for deep linking to claim views and improves the build process reliability by ensuring clean builds. The claim route allows direct navigation to claim details via external links. --- BUILDING.md | 124 +++++++++++++++-------------- src/services/deepLinks.ts | 9 ++- src/types/deepLinks.ts | 21 +++++ test-scripts/run-deeplink-tests.sh | 3 + 4 files changed, 95 insertions(+), 62 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 74854cf..eced705 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -135,6 +135,7 @@ Prerequisites: Android Studio with SDK installed 1. Build the web assets: ```bash + rm -rf dist npm run build:web npm run build:capacitor ``` @@ -163,76 +164,77 @@ Prerequisites: Android Studio with SDK installed You must add the following intent filter to the `android/app/src/main/AndroidManifest.xml` file: -```xml - - - - - - -``` + ```xml + + + + + + + ``` You must also add the following to the `android/app/build.gradle` file: -```gradle -android { - // ... existing config ... - - lintOptions { - disable 'UnsanitizedFilenameFromContentProvider' - abortOnError false - baseline file("lint-baseline.xml") - - // Ignore Capacitor module issues - ignore 'DefaultLocale' - ignore 'UnsanitizedFilenameFromContentProvider' - ignore 'LintBaseline' - ignore 'LintBaselineFixed' - } -} -``` + ```gradle + android { + // ... existing config ... + + lintOptions { + disable 'UnsanitizedFilenameFromContentProvider' + abortOnError false + baseline file("lint-baseline.xml") + + // Ignore Capacitor module issues + ignore 'DefaultLocale' + ignore 'UnsanitizedFilenameFromContentProvider' + ignore 'LintBaseline' + ignore 'LintBaselineFixed' + } + } + ``` Modify `/android/build.gradle` to use a stable version of AGP and make sure Kotlin version is compatible. -```gradle -buildscript { - repositories { - google() - mavenCentral() - } - dependencies { - // Use a stable version of AGP - classpath 'com.android.tools.build:gradle:8.1.0' - - // Make sure Kotlin version is compatible - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0" - } -} - -allprojects { - repositories { - google() - mavenCentral() - } -} - -// Add this to handle version conflicts -configurations.all { - resolutionStrategy { - force 'org.jetbrains.kotlin:kotlin-stdlib:1.8.0' - force 'org.jetbrains.kotlin:kotlin-stdlib-common:1.8.0' - } -} -``` + ```gradle + buildscript { + repositories { + google() + mavenCentral() + } + dependencies { + // Use a stable version of AGP + classpath 'com.android.tools.build:gradle:8.1.0' + + // Make sure Kotlin version is compatible + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0" + } + } + + allprojects { + repositories { + google() + mavenCentral() + } + } + + // Add this to handle version conflicts + configurations.all { + resolutionStrategy { + force 'org.jetbrains.kotlin:kotlin-stdlib:1.8.0' + force 'org.jetbrains.kotlin:kotlin-stdlib-common:1.8.0' + } + } + ``` ## Building Android from the console -```bash -./gradlew clean -./gradlew build -Dlint.baselines.continue=true - -npx cap -``` + ```bash + cd android + ./gradlew clean + ./gradlew build -Dlint.baselines.continue=true + cd .. + npx cap run android + ``` ## Development diff --git a/src/services/deepLinks.ts b/src/services/deepLinks.ts index 08a3081..7f91cfc 100644 --- a/src/services/deepLinks.ts +++ b/src/services/deepLinks.ts @@ -110,11 +110,18 @@ export class DeepLinkHandler { query: Record, ): Promise { const routeMap: Record = { + "user-profile": "user-profile", + "project": "project", + "onboard-meeting-setup": "onboard-meeting-setup", + "invite-one-accept": "invite-one-accept", + "contact-import": "contact-import", + "confirm-gift": "confirm-gift", + "claim": "claim", "claim-cert": "claim-cert", "claim-add-raw": "claim-add-raw", "contact-edit": "contact-edit", "contacts": "contacts", - did: "did" + "did": "did" }; const routeName = routeMap[path]; diff --git a/src/types/deepLinks.ts b/src/types/deepLinks.ts index 379dd8f..472ef95 100644 --- a/src/types/deepLinks.ts +++ b/src/types/deepLinks.ts @@ -36,6 +36,27 @@ export const baseUrlSchema = z.object({ // Parameter validation schemas for each route type export const deepLinkSchemas = { + "user-profile": z.object({ + id: z.string() + }), + "project-details": z.object({ + id: z.string() + }), + "onboard-meeting-setup": z.object({ + id: z.string() + }), + "invite-one-accept": z.object({ + id: z.string() + }), + "contact-import": z.object({ + jwt: z.string() + }), + "confirm-gift": z.object({ + id: z.string() + }), + "claim": z.object({ + id: z.string() + }), "claim-cert": z.object({ id: z.string() }), diff --git a/test-scripts/run-deeplink-tests.sh b/test-scripts/run-deeplink-tests.sh index e20dd1e..e9d79c7 100755 --- a/test-scripts/run-deeplink-tests.sh +++ b/test-scripts/run-deeplink-tests.sh @@ -104,6 +104,9 @@ main() { CONTACTS=$(cat .generated/contacts.json) # 1. Claim-based deeplinks + execute_deeplink "timesafari://claim/$(jq -r .claim_id <<< "$CLAIM_DETAILS")" \ + "Testing claim view" + execute_deeplink "timesafari://claim-cert/$(jq -r .claim_id <<< "$CLAIM_DETAILS")" \ "Testing claim certificate view"