Notalib / nativescript-webview-ext

Nativescript plugin with extended WebView functionality
Apache License 2.0
76 stars 37 forks source link

Service Workers support #123

Closed eighteight closed 2 years ago

eighteight commented 3 years ago

Angular offers a service workers support https://angular.io/guide/service-worker-intro which vastly improves user experience.

I am loading in webview-ext a web-app which is implemented in angular and uses service workers for caching data and the assets.

However, I am not seeing any caching using webview-ext on ios 14.5 simulator or device even after configuring App–Bound Domains. Would be nice to have a comment on support of this feature in webview-ext

Thanks

m-abs commented 3 years ago

We're not actively developing this plugin at the moment, @farfromrefug has a fork @nativescript-community/ui-webview maybe he can help.

eighteight commented 3 years ago

@m-abs Thanks for your input. Unfortunately, I can't switch to @nativescript-community/ui-webview because of the angular incompatibility issues. However, what I've found is that service workers get disabled because the assignment

this.webviewExt.ios.configuration.limitsNavigationsToAppBoundDomains = true;

does not in fact set limitsNavigationsToAppBoundDomains to true –– it remains unchanged from the default value of false.

Also, I cannot create a new WKWebViewConfiguration instance and set it along the lines of

const myWKWebViewConfiguration = WKWebViewConfiguration.new();
myWKWebViewConfiguration.limitsNavigationsToAppBoundDomains = true;
this.webviewExt.ios.configuration = myWKWebViewConfiguration;

since this.webviewExt.ios.configuration is readonly.

Any suggestion short of modifying the source code of this plugin to set the properties of the WebViewExt's configuration?

Thanks.

gusev-genotek commented 3 years ago

@m-abs I created a pull request, which fixes this issue. Please accept https://github.com/Notalib/nativescript-webview-ext/pull/125

m-abs commented 2 years ago

PR have been merged and released with v8.0.2.