feat(android): add trigger() for onFunction custom-function rules#127
Merged
ethanpschoen merged 11 commits intoJul 15, 2026
Merged
Conversation
Expose headless bootstrap/config/profile/consent endpoints via HeadlessApiClient, wire Ketch/KetchSdk surface APIs, refresh index HTML init, and add unit plus integration test coverage.
Remove tap-outside dismiss plumbing and index HTML touch handlers from this branch; those belong in run-sample-skills. Branch is off main only (no native storage commits).
Drop Index.kt, KetchWebView.kt, Events.kt, and WebView flow changes from the headless branch. Keep HeadlessApiClient, models, KetchSdk/Ketch REST methods, data center wiring, and integration tests.
…/feat/headless-sdk
ketch_samples/android is only provisioned on the production CDN (global.ketchcdn.com / KetchDataCenter.US), not the dev/UAT CDN (dev.ketchcdn.com). testGetBootstrapConfiguration and testHeadlessColdStartConsentRoundTrip 404 on org-specific endpoints (/config/ketch_samples/android/boot.json) against UAT, while testGetLocationReturnsGeoIP incidentally passes since /ip carries no org/property path segment. Every other reference to this org/property in the repo (sample apps, WebView-based integration tests, SDK doc comments) already targets the production CDN. Introduced in 30c83c7 with no stated rationale for UAT; verified via git blame and a live re-run against the real CDN (32/34 -> 34/34).
Mirrors the showConsent/showPreferences warm/cold WebView dispatch
pattern to fire ketch-tag's onFunction rule trigger
(ketch('trigger', 'custom', '<name>', options)). Cold boots defer
the trigger command until the tag finishes loading, since a custom
function has no boot URL param the way consent/preferences do.
- KetchWebView.trigger() / Ketch.trigger() with functionName validation
- Unit tests for functionName validation
- Integration test covering warm/cold dispatch and invalid-name rejection
- Demo button wired into both sample apps
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit ff649d3. Configure here.
jboileau99
approved these changes
Jul 14, 2026
Base automatically changed from
ethanpschoen/feat/headless-sdk
to
justin/feat/cross-activity-lifecycle
July 15, 2026 00:43
…/feat/onfunction-trigger
ethanpschoen
merged commit Jul 15, 2026
05ed820
into
justin/feat/cross-activity-lifecycle
3 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description of this change
Why is this change being made?
How was this tested? How can the reviewer verify your testing?
Added integration tests, tested using sample app
Related issues
KD-17712
Checklist
Note
Medium Risk
New WebView JS bridge path with validated function names reduces injection risk, but cold-boot deferral and experience-gating still touch core SDK WebView lifecycle.
Overview
Adds
Ketch.trigger(functionName, options)so apps can fire ketch-tag onFunction rules viaketch('trigger', 'custom', …)on the WebView, using the same warm/cold WebView flow as consent and preferences.On a warm WebView it calls
KetchWebView.triggerimmediately. On a cold boot it loads the tag without a show-type URL param, stores apendingTrigger, and runs the JS trigger inonConfigUpdatedafter the tag loads. Invalid names are rejected up front with a strict allowlist (quotes, whitespace, etc.) so nothing unsafe is interpolated into the JS call.pendingTriggeris cleared on WebView cleanup.Unit tests cover name validation; integration tests cover invalid rejection, warm dispatch, and cold deferred dispatch. Compose and standard sample apps add demo buttons for
demoFunction.Reviewed by Cursor Bugbot for commit ff649d3. Configure here.