Skip to content

Conversation

@mimosa-ai-bot
Copy link

@mimosa-ai-bot mimosa-ai-bot bot commented Nov 27, 2025

Summary

This PR adds support for detecting when a Flutter webview is blocked by iOS Screen Time restrictions, implementing the feature requested in Linear ticket PRO-2378.

Changes Made

  • Pigeon API Definition: Added getIsBlockedByScreenTime() method to UIViewWKWebView class in pigeons/web_kit.dart
  • Swift Native Implementation: Implemented the native method in WebViewProxyAPIDelegate.swift with iOS 26.0+ availability check
  • Dart Public API: Added isBlockedByScreenTime getter to WebKitWebViewController class with proper error handling
  • Generated Code: Regenerated Pigeon code for both Dart and Swift
  • Documentation: Updated CHANGELOG.md and README.md with usage examples

Implementation Details

The implementation exposes the iOS 26.0+ WKWebView.isBlockedByScreenTime property through a new getter on WebKitWebViewController. The property returns false on iOS versions prior to 26.0, providing graceful fallback behavior.

Usage Example

import 'package:webview_flutter_wkwebview/webview_flutter_wkwebview.dart';

// Check if webview is blocked by Screen Time
if (controller is WebKitWebViewController) {
  final isBlocked = await controller.isBlockedByScreenTime;
  if (isBlocked) {
    // Handle Screen Time blocking, e.g., show user-friendly message
    print('Content is blocked by Screen Time restrictions');
  }
}

Acceptance Criteria

  • ✅ Property accessible on WebKitWebViewController
  • ✅ iOS 26+ requirement with runtime version check
  • ✅ Platform-specific check works via type checking
  • ✅ Returns boolean for Screen Time status
  • ✅ Handles older iOS versions gracefully (returns false)

Files Modified

  • pigeons/web_kit.dart - Pigeon API definition
  • lib/src/common/web_kit.g.dart - Auto-generated Dart code
  • darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebKitLibrary.g.swift - Auto-generated Swift code
  • darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebViewProxyAPIDelegate.swift - Swift implementation
  • lib/src/webkit_webview_controller.dart - Dart public API
  • CHANGELOG.md - Feature documentation
  • README.md - Usage example

Testing

This feature can be manually tested on iOS 26+ devices/simulators with Screen Time restrictions configured. For older iOS versions, the property should return false without errors.

🤖 Generated with Claude Code

Add support for detecting when a Flutter webview is blocked by iOS Screen Time restrictions.
This exposes the iOS 26.0+ WKWebView.isBlockedByScreenTime property through a new getter
on WebKitWebViewController.

Implementation includes:
- Pigeon API definition for getIsBlockedByScreenTime() method
- Swift native implementation with iOS 26.0+ availability check
- Dart public getter on WebKitWebViewController with error handling
- Documentation updates in CHANGELOG.md and README.md

The property returns false on iOS versions prior to 26.0, providing graceful fallback behavior.

Closes: PRO-2378

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants