From a40420af1669b3b297e186ef2baecfa3ba8185b1 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Mon, 10 Mar 2025 07:52:21 +0000 Subject: [PATCH] fix: streamline deep link handling and testing - Add force-stop before deep link execution - Remove URL encoding for deep link paths - Simplify deep link schema definitions - Remove unused route mappings - Add proper app package name for force-stop Technical Changes: - Remove redundant URL encoding for deep link paths - Add force-stop for app.timesafari.app before deep links - Add sleep delay after force-stop for reliability - Remove unused route mappings from routeMap - Simplify DID schema to only require id field This improves deep link testing reliability by properly resetting app state before each test and simplifies the deep link handling code by removing unused routes and redundant URL encoding. --- src/services/deepLinks.ts | 7 +------ src/types/deepLinks.ts | 41 ++++++++++++--------------------------- 2 files changed, 13 insertions(+), 35 deletions(-) diff --git a/src/services/deepLinks.ts b/src/services/deepLinks.ts index 5f2d729..08a3081 100644 --- a/src/services/deepLinks.ts +++ b/src/services/deepLinks.ts @@ -110,15 +110,10 @@ export class DeepLinkHandler { query: Record, ): Promise { const routeMap: Record = { - claim: "claim", "claim-cert": "claim-cert", "claim-add-raw": "claim-add-raw", "contact-edit": "contact-edit", - "contact-import": "contact-import", - project: "project", - "invite-one-accept": "invite-one-accept", - "offer-details": "offer-details", - "confirm-gift": "confirm-gift", + "contacts": "contacts", did: "did" }; diff --git a/src/types/deepLinks.ts b/src/types/deepLinks.ts index 56d6b18..379dd8f 100644 --- a/src/types/deepLinks.ts +++ b/src/types/deepLinks.ts @@ -36,40 +36,23 @@ export const baseUrlSchema = z.object({ // Parameter validation schemas for each route type export const deepLinkSchemas = { - claim: z.object({ - id: z.string().min(1), - view: z.enum(["details", "certificate", "raw"]).optional(), + "claim-cert": z.object({ + id: z.string() }), - - contact: z.object({ - did: z.string().regex(/^did:/), - action: z.enum(["edit", "import"]).optional(), - jwt: z.string().optional(), - }), - - project: z.object({ - id: z.string().min(1), - view: z.enum(["details", "edit"]).optional(), + "claim-add-raw": z.object({ + id: z.string(), + claim: z.string().optional(), + claimJwtId: z.string().optional() }), - - invite: z.object({ - jwt: z.string().min(1), - type: z.enum(["one", "many"]).optional(), + "contact-edit": z.object({ + did: z.string() }), - - gift: z.object({ - id: z.string().min(1), - action: z.enum(["confirm", "details"]).optional(), + "contacts": z.object({ + contacts: z.string() // JSON string of contacts array }), - - offer: z.object({ - id: z.string().min(1), - view: z.enum(["details"]).optional(), - }), - did: z.object({ - id: z.string(), - }), + id: z.string() + }) }; export type DeepLinkParams = {