From b1ebaddd6df44d24576c5a0ca0ba90c7c89f70a2 Mon Sep 17 00:00:00 2001 From: Griffin Quarles Date: Wed, 11 Jan 2023 14:20:39 -0500 Subject: [PATCH] Fix iOS Airplane mode #95 --- lib/src/view/impl/mobile.dart | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/src/view/impl/mobile.dart b/lib/src/view/impl/mobile.dart index dc92ccd..f42919b 100644 --- a/lib/src/view/impl/mobile.dart +++ b/lib/src/view/impl/mobile.dart @@ -163,18 +163,25 @@ class _WebViewXState extends State { ? 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 navigationDelegate( wf.NavigationRequest request,