Skip to main content
Glama
HandleIntentChooser.ts1.78 kB
import { DeepLinkManager } from "../../utils/deepLinkManager"; import { BootedDevice, IntentChooserResult, ObserveResult } from "../../models"; import { BaseVisualChange } from "./BaseVisualChange"; import { AdbUtils } from "../../utils/android-cmdline-tools/adb"; import { Axe } from "../../utils/ios-cmdline-tools/axe"; export class HandleIntentChooser extends BaseVisualChange { private deepLinkManager: DeepLinkManager; /** * Create an TerminateApp instance * @param device - Optional device * @param adb - Optional AdbUtils instance for testing * @param idb - Optional IdbPython instance for testing */ constructor(device: BootedDevice, adb: AdbUtils | null = null, axe: Axe | null = null) { super(device, adb, axe); this.device = device; this.deepLinkManager = new DeepLinkManager(device); } /** * Execute intent chooser handling * @param preference - User preference for handling ("always", "just_once", or "custom") * @param customAppPackage - Optional specific app package to select for custom preference * @returns Promise with intent chooser handling results */ async execute( preference: "always" | "just_once" | "custom" = "just_once", customAppPackage?: string ): Promise<IntentChooserResult> { return this.observedInteraction( async (observeResult: ObserveResult) => { const viewHierarchy = observeResult.viewHierarchy; if (!viewHierarchy) { return { success: false, error: "View hierarchy not found" }; } return await this.deepLinkManager.handleIntentChooser( viewHierarchy, preference, customAppPackage ); }, { changeExpected: false, timeoutMs: 500, } ); } }

Implementation Reference

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zillow/auto-mobile'

If you have feedback or need assistance with the MCP directory API, please join our Discord server