Skip to content

Commit

Permalink
Fix iOS Airplane mode adrianflutur#95
Browse files Browse the repository at this point in the history
  • Loading branch information
gquarles committed Jan 11, 2023
1 parent e10be27 commit b1ebadd
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/src/view/impl/mobile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,25 @@ class _WebViewXState extends State<WebViewX> {
? wf.AutoMediaPlaybackPolicy.always_allow
: wf.AutoMediaPlaybackPolicy.require_user_action_for_all_media_types;

void onWebResourceError(wf_pi.WebResourceError err) =>
void onWebResourceError(wf_pi.WebResourceError err) {
WebResourceErrorType? errorType;
try {
errorType = WebResourceErrorType.values.singleWhere(
(value) => value.toString() == err.errorType.toString(),
);
} catch (error) {
errorType = null;
}
widget.onWebResourceError!(
WebResourceError(
description: err.description,
errorCode: err.errorCode,
domain: err.domain,
errorType: WebResourceErrorType.values.singleWhere(
(value) => value.toString() == err.errorType.toString(),
),
errorType: errorType,
failingUrl: err.failingUrl,
),
);
}

FutureOr<wf.NavigationDecision> navigationDelegate(
wf.NavigationRequest request,
Expand Down

0 comments on commit b1ebadd

Please sign in to comment.