feat: Add iOS Screen Time detection to WebKitWebViewController #5
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.
Summary
Implements iOS Screen Time detection for Flutter webviews by exposing the
isBlockedByScreenTimeproperty from WKWebView (iOS 26.0+).This allows applications to detect when a webview is blocked by Screen Time restrictions and provide user-friendly messaging instead of showing an infinite loader.
Linear Ticket: PRO-2378
Changes Made
Files Modified (7 total)
Pigeon API Definition:
packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart- AddedgetIsBlockedByScreenTime()method to UIViewWKWebView classAuto-generated Platform Code:
packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart- Generated Dart bindingspackages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebKitLibrary.g.swift- Generated Swift bindingsNative Implementation:
packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebViewProxyAPIDelegate.swift- Implemented native method with iOS 26.0+ availability checkDart API:
packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart- Added publicisBlockedByScreenTimegetter with error handlingDocumentation:
packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md- Added changelog entryImplementation Details
iOS Version Handling
isBlockedByScreenTimevalue from WKWebViewfalsegracefully (no crash or error to user)#available(iOS 26.0, *)for runtime version checkingUsage Example
Acceptance Criteria Status
WebKitWebViewControllervia public getterWebKitWebViewController, not base class)Testing
Recommended Manual Testing
truewhen webview is blockedfalsefalsewithout crashingIntegration
flutter_packagesrepositoryNext Steps: This PR is ready for code review. Once approved and merged, the Linear ticket can be closed.
🤖 Generated with Claude Code