handleDebugModeInspectableWebView static method

Future<void> handleDebugModeInspectableWebView(
  1. TblBaseWebviewController webviewController,
  2. String? extraPropertyValue,
  3. TBLExtraPropertyLevel? extraPropertyOriginLevel,
  4. String tag,
)

Handles the debugModeInspectableWebView extra property for webviewController: parses the raw value, validates it, checks platform support, and applies it (enabling Safari Web Inspector debugging on iOS, requires iOS 16.4+; no-op on Android). Shared by the Classic and Web integrations so the parse/guard/log logic exists once.

Implementation

static Future<void> handleDebugModeInspectableWebView(TblBaseWebviewController webviewController,
    String? extraPropertyValue, TBLExtraPropertyLevel? extraPropertyOriginLevel, String tag) async {
  final debugModeInspectableWebView = stringToBool(extraPropertyValue);
  if (debugModeInspectableWebView == null) {
    TBLLogger.log(
        '$tag | WARNING: Invalid value for $DEBUG_MODE_INSPECTABLE_WEBVIEW_KEY: "$extraPropertyValue" (expected "true" or "false").');
    return;
  }
  if (!Platform.isIOS) {
    TBLLogger.log(
        '$tag | WARNING: debugModeInspectableWebView is not supported on Android; ignoring.');
    return;
  }
  await webviewController.setInspectable(debugModeInspectableWebView);
  TBLLogger.log('$tag | Set debugModeInspectableWebView: $debugModeInspectableWebView (from $extraPropertyOriginLevel)');
}