Skip to content

Fix WebView layout, Android insets, and iOS dev server support#1935

Merged
transphorm merged 8 commits intodevfrom
fix/ui-issues
Apr 8, 2026
Merged

Fix WebView layout, Android insets, and iOS dev server support#1935
transphorm merged 8 commits intodevfrom
fix/ui-issues

Conversation

@seshanthS
Copy link
Copy Markdown
Collaborator

@seshanthS seshanthS commented Apr 7, 2026

Summary

android ios
  • Fix Android WebView rendering under status bar/notch by applying system bar insets with edge-to-edge opt-in on both KMP and native-shell Android hosts
  • Fix ProviderLaunchScreen layout overflow and scope CSS overrides to container; use WEB_SAFE_AREA insets for the KYC pending screen
  • Wire up devServerUrl through the full iOS SDK chain (KMP → Swift) so WEBVIEW_DEV_URL works on iOS identically to Android
  • Fix iOS test app build script to use xcworkspace instead of xcodeproj (CocoaPods linkage)

Changes

KMP SDK (Android)

  • SelfVerificationActivity.kt — call WindowCompat.setDecorFitsSystemWindows(window, false), wrap WebView in FrameLayout with WindowInsetsCompat listener for system bars + display cutout, clean up listener on destroy

KMP SDK (iOS)

  • WebViewProvider.kt — add configureDevServer(devServerUrl:) to the interface
  • IosWebViewHost.kt — accept devServerUrl param, pass to provider
  • SelfSdk.ios.kt — pass config.devServerUrl through to IosWebViewHost

Swift SDK

  • WebViewProviderImpl.swift — store devServerUrl, use it in initialContentURL() (priority: devServerUrl → loopback fallback → remote), update isTrustedBridgeURL and isTrustedBridgeFrameInfo to trust dev server origin

KMP Test App

  • SdkLaunchScreen.kt — pass version to SelfSdkConfig based on mock document toggle
  • DevServerUrl.ios.kt — read WEBVIEW_DEV_URL from Info.plist via NSBundle, reject unresolved $(...) placeholders
  • Info.plist — add WEBVIEW_DEV_URL build setting substitution key
  • run-ios.sh — pass WEBVIEW_DEV_URL env var to xcodebuild; fix -project-workspace for CocoaPods linkage

WebView App

  • ProviderLaunchScreen.tsx — constrain root to height: 100vh + overflow: hidden, add position: relative for overlay context, wrap KYC pending screen in absolute overlay, use WEB_SAFE_AREA.insets, scope CSS overrides to #${CONTAINER_ID}

Test Plan

  • yarn lint && yarn types passes
  • cd packages/webview-app && yarn build
  • cd packages/kmp-sdk && ./gradlew :shared:jvmTest && ./gradlew :shared:ktlintCheck
  • cd packages/kmp-sdk-test-app && ./gradlew ktlintCheck
  • WEBVIEW_DEV_URL=http://<ip>:5173 yarn android — verify WebView loads from dev server, content not under status bar
  • WEBVIEW_DEV_URL=http://<ip>:5173 yarn ios — verify WebView loads from dev server
  • Manual: verify ProviderLaunchScreen KYC pending view does not overflow

Native Consolidation Checklist

  • CONTRACTS.md reviewed - no unintended contract changes
  • Layer 1 bridge contract tests pass (cd app && yarn jest:run / yarn workspace @selfxyz/rn-sdk-test-app test)
  • Layer 3 builds pass (app iOS, RN test app iOS, RN test app Android)
  • Layer 4 manual smoke test signed off (if consolidation PR)
  • No new native business logic added (logic belongs in TypeScript)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved fullscreen layout handling to correctly account for system window insets and display cutouts on Android.
    • Constrained onboarding screen content to prevent overflow and ensure consistent overlay behavior.
  • New Features

    • Added development server configuration support for webview-based testing and trusted-debug connections.
    • Added selectable document-mode versioning so the SDK config updates when mock vs. real document mode changes.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
self-webview-app Ready Ready Preview, Comment Apr 8, 2026 6:19am

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cb70cba7-5af3-42bc-a277-87104c69bbdc

📥 Commits

Reviewing files that changed from the base of the PR and between 2cae6bf and e9781e8.

📒 Files selected for processing (2)
  • packages/kmp-sdk-test-app/scripts/run-ios.sh
  • packages/self-sdk-swift/Sources/SelfSdkSwift/Providers/WebViewProviderImpl.swift
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/kmp-sdk-test-app/scripts/run-ios.sh
  • packages/self-sdk-swift/Sources/SelfSdkSwift/Providers/WebViewProviderImpl.swift

📝 Walkthrough

Walkthrough

Adds dev-server wiring across platforms, toggles SDK config version in the KMP test app, wraps Android WebViews with window-insets handling, updates web onboarding layout and scoped CSS, and extends webview provider APIs/implementations to accept and prefer a developer devServerUrl.

Changes

Cohort / File(s) Summary
KMP Test App
packages/kmp-sdk-test-app/composeApp/src/commonMain/kotlin/xyz/self/testapp/screens/SdkLaunchScreen.kt
Adds version to SelfSdkConfig (value 1 for mock document, 2 for real); included in remember(...) so config changes recreate the SDK instance.
Android WebView Activities
packages/kmp-sdk/shared/src/androidMain/kotlin/xyz/self/sdk/webview/SelfVerificationActivity.kt, packages/native-shell-android/src/main/kotlin/xyz/self/sdk/webview/SelfVerificationActivity.kt
Disable decor fitting, wrap created WebView in a FrameLayout container, install OnApplyWindowInsetsListener to apply systemBars+displayCutout padding (consume insets), and clear the insets listener in onDestroy before destroying webview host.
Web App (onboarding)
packages/webview-app/src/screens/onboarding/ProviderLaunchScreen.tsx
Change root style from minHeight: '100vh' to height: '100vh' with position: 'relative'/overflow: 'hidden'; render KycPendingScreen inside an absolutely positioned full-inset overlay during waiting phase; use WEB_SAFE_AREA.insets for insets prop; tighten injected CSS selectors to scope under the SDK container ID.
iOS Dev-server config & build script
packages/kmp-sdk-test-app/composeApp/src/iosMain/kotlin/xyz/self/testapp/screens/DevServerUrl.ios.kt, packages/kmp-sdk-test-app/iosApp/iosApp/Info.plist, packages/kmp-sdk-test-app/scripts/run-ios.sh
iOS actual impl now reads WEBVIEW_DEV_URL from Info.plist (returns null when blank/unexpanded); added WEBVIEW_DEV_URL key to Info.plist using $(WEBVIEW_DEV_URL) substitution; run-ios.sh switched to workspace build and passes WEBVIEW_DEV_URL into xcodebuild (defaults to empty) and extracts build products dir via -showBuildSettings -json + jq.
iOS SDK / shared API changes
packages/kmp-sdk/shared/src/iosMain/kotlin/xyz/self/sdk/SelfSdk.ios.kt, packages/kmp-sdk/shared/src/iosMain/kotlin/xyz/self/sdk/providers/WebViewProvider.kt, packages/kmp-sdk/shared/src/iosMain/kotlin/xyz/self/sdk/webview/IosWebViewHost.kt
Propagate devServerUrl into IosWebViewHost construction; IosWebViewHost constructor now accepts optional devServerUrl; WebViewProvider interface gains configureDevServer(devServerUrl: String?) with a default no-op.
Swift WebView provider implementation
packages/self-sdk-swift/Sources/SelfSdkSwift/Providers/WebViewProviderImpl.swift
Adds devServerUrl stored property and configureDevServer method; in debug mode, initialContentURL(queryParams:) prefers devServerUrl-derived URL and trust checks (isTrustedBridgeURL/isTrustedBridgeFrameInfo) also accept origins/ports derived from devServerUrl when present.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix WebView layout, Android insets, and iOS dev server support' clearly and specifically summarizes the main changes across the changeset.
Description check ✅ Passed The description includes a comprehensive summary of changes, organized by affected package; includes a detailed test plan with multiple verification steps; and provides the full native consolidation checklist.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ui-issues

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bb06e580-1c89-480a-8f7f-43a9d6917c7f

📥 Commits

Reviewing files that changed from the base of the PR and between 147b593 and 3699592.

📒 Files selected for processing (3)
  • packages/kmp-sdk-test-app/composeApp/src/commonMain/kotlin/xyz/self/testapp/screens/SdkLaunchScreen.kt
  • packages/kmp-sdk/shared/src/androidMain/kotlin/xyz/self/sdk/webview/SelfVerificationActivity.kt
  • packages/webview-app/src/screens/onboarding/ProviderLaunchScreen.tsx

Comment thread packages/webview-app/src/screens/onboarding/ProviderLaunchScreen.tsx Outdated
@transphorm transphorm changed the title Fix/UI issues Fix WebView layout overlap with system bars and status bar Apr 8, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7cc1b3d8-06bc-43d6-b31f-17d41e03a766

📥 Commits

Reviewing files that changed from the base of the PR and between 3699592 and 1359338.

📒 Files selected for processing (3)
  • packages/kmp-sdk/shared/src/androidMain/kotlin/xyz/self/sdk/webview/SelfVerificationActivity.kt
  • packages/native-shell-android/src/main/kotlin/xyz/self/sdk/webview/SelfVerificationActivity.kt
  • packages/webview-app/src/screens/onboarding/ProviderLaunchScreen.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/webview-app/src/screens/onboarding/ProviderLaunchScreen.tsx

@transphorm transphorm changed the title Fix WebView layout overlap with system bars and status bar Fix WebView layout, Android insets, and iOS dev server support Apr 8, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fa679af9-5111-494d-a584-c9f87ac2d4bc

📥 Commits

Reviewing files that changed from the base of the PR and between 1359338 and 2cae6bf.

📒 Files selected for processing (8)
  • packages/kmp-sdk-test-app/composeApp/src/iosMain/kotlin/xyz/self/testapp/screens/DevServerUrl.ios.kt
  • packages/kmp-sdk-test-app/iosApp/iosApp/Info.plist
  • packages/kmp-sdk-test-app/scripts/run-ios.sh
  • packages/kmp-sdk/shared/src/androidMain/kotlin/xyz/self/sdk/webview/SelfVerificationActivity.kt
  • packages/kmp-sdk/shared/src/iosMain/kotlin/xyz/self/sdk/api/SelfSdk.ios.kt
  • packages/kmp-sdk/shared/src/iosMain/kotlin/xyz/self/sdk/providers/WebViewProvider.kt
  • packages/kmp-sdk/shared/src/iosMain/kotlin/xyz/self/sdk/webview/IosWebViewHost.kt
  • packages/self-sdk-swift/Sources/SelfSdkSwift/Providers/WebViewProviderImpl.swift
✅ Files skipped from review due to trivial changes (1)
  • packages/kmp-sdk-test-app/iosApp/iosApp/Info.plist
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/kmp-sdk/shared/src/androidMain/kotlin/xyz/self/sdk/webview/SelfVerificationActivity.kt

Comment thread packages/kmp-sdk-test-app/scripts/run-ios.sh Outdated
@transphorm transphorm merged commit 5ead228 into dev Apr 8, 2026
39 checks passed
@transphorm transphorm deleted the fix/ui-issues branch April 8, 2026 06:26
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.

2 participants