Skip to content

feat(portal): WebView clean-arch slice + two-finger map gestures#35

Merged
luisguzman-adfa merged 2 commits into
mainfrom
feat/portal-webview-slice
Jun 24, 2026
Merged

feat(portal): WebView clean-arch slice + two-finger map gestures#35
luisguzman-adfa merged 2 commits into
mainfrom
feat/portal-webview-slice

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

Strangler-fig refactor of the portal WebView (the only WebView; opened from Usage), plus two-finger gesture support so map tilt works.

New slice org.iiab.controller.portal

  • domain (pure JVM, unit-tested): NavigationPolicy (internal box/localhost/127.0.0.1 stays in the WebView vs. external → system browser) and PortalUrlResolver (target URL with local fallback).
  • data: WebViewProxyConfigurator — SOCKS proxy override extracted out of the activity.
  • presentation: PortalUiState + PortalViewModel (load state survives rotation) and GestureWebView.

Two-finger gestures (map tilt)

GestureWebView calls requestDisallowInterceptTouchEvent(true) while 2+ pointers are down, so a multi-finger drag (MapLibre pitch/rotate) is never stolen by an ancestor. The map itself is served by the IIAB server (/maps/, MapLibre GL), so the fix lives on the Android side.

Built-in diagnostics

Because the map is external, the exact gesture path is verified on-device via logcat:

  • GestureWebView.onTouchEvent logs action + pointer count (debug builds) — shows whether the WebView receives two fingers.
  • A small JS probe injected on page load logs touches.length on touchstart/touchmove, surfaced through onConsoleMessage → logcat — shows whether the map receives two fingers. It also best-effort enables MapLibre touchPitch if a map instance is exposed.

Filter with: adb logcat -s IIAB-Portal IIAB-GestureWV chromium. If Android sees 2 pointers but the page sees 1 → propagation; if the page sees 2 but no tilt → MapLibre config.

Refactor impact

PortalActivity slims onto the slice; navigation, URL fallback and proxy logic move out. Behavior preserved (nav bar, file chooser, error page, proxy lifecycle).

Verified locally: brace/paren balance, layout parses, BuildConfig available (buildConfig enabled), and NavigationPolicyTest / PortalUrlResolverTest cover the domain.

New org.iiab.controller.portal slice (no behavior change until wired):
- domain: NavigationPolicy (internal vs external host) + PortalUrlResolver
  (target URL with local fallback). Pure JVM, unit-tested.
- data: WebViewProxyConfigurator (SOCKS proxy override adapter).
- presentation: PortalUiState + PortalViewModel (load state survives rotation),
  and GestureWebView — a WebView that guarantees multi-finger delivery
  (requestDisallowInterceptTouchEvent on 2+ pointers) for map tilt, with
  optional gesture logging for diagnostics.
…re support

- layout uses GestureWebView; PortalActivity slims down onto the slice
  (NavigationPolicy, PortalUrlResolver, WebViewProxyConfigurator, PortalViewModel).
- two-finger gestures (map tilt) now reach the map; debug gesture logging on.
- inject a touch probe on page load: logs touch-point counts via onConsoleMessage
  (-> logcat) to diagnose lost gestures, and best-effort enables MapLibre pitch.
@luisguzman-adfa luisguzman-adfa force-pushed the feat/portal-webview-slice branch from 2a5c21b to 5370d81 Compare June 24, 2026 01:39
@luisguzman-adfa luisguzman-adfa merged commit abd8635 into main Jun 24, 2026
1 check passed
@luisguzman-adfa luisguzman-adfa deleted the feat/portal-webview-slice branch June 24, 2026 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant