MOBILE-3401 android: Revert Android changes for webview plugin

main
Dani Palou 2020-06-16 14:18:20 +02:00
parent 7b3cffa07f
commit 2bcf3e2e14
4 changed files with 6 additions and 10 deletions

View File

@ -25,7 +25,6 @@ import { CoreIframeUtilsProvider } from '@providers/utils/iframe';
import { CoreUtilsProvider } from '@providers/utils/utils';
import { CoreSplitViewComponent } from '@components/split-view/split-view';
import { CoreUrl } from '@singletons/url';
import { WKWebViewCookiesWindow } from 'cordova-plugin-wkwebview-cookies';
@Component({
selector: 'core-iframe',
@ -102,7 +101,7 @@ export class CoreIframeComponent implements OnInit, OnChanges {
if (this.platform.is('ios') && !this.urlUtils.isLocalFileUrl(url)) {
// Save a "fake" cookie for the iframe's domain to fix a bug in WKWebView.
try {
const win = <WKWebViewCookiesWindow> window;
const win = <any> window;
const urlParts = CoreUrl.parse(url);
await win.WKWebViewCookies.setCookie({

View File

@ -1251,7 +1251,7 @@ export class CoreFileProvider {
* @return Converted src.
*/
convertFileSrc(src: string): string {
return this.appProvider.isMobile() ? (<any> window).Ionic.WebView.convertFileSrc(src) : src;
return this.appProvider.isIOS() ? (<any> window).Ionic.WebView.convertFileSrc(src) : src;
}
/**
@ -1261,13 +1261,11 @@ export class CoreFileProvider {
* @return Unconverted src.
*/
unconvertFileSrc(src: string): string {
if (!this.appProvider.isMobile()) {
if (!this.appProvider.isIOS()) {
return src;
}
const scheme = this.platform.is('ios') ? CoreConfigConstants.ioswebviewscheme : 'http';
return src.replace(scheme + '://localhost/_app_file_', 'file://');
return src.replace(CoreConfigConstants.ioswebviewscheme + '://localhost/_app_file_', 'file://');
}
}

View File

@ -453,8 +453,7 @@ export class CoreUrlUtilsProvider {
return scheme == 'cdvfile' ||
scheme == 'file' ||
scheme == 'filesystem' ||
scheme == CoreConfigConstants.ioswebviewscheme ||
(scheme == 'http' && domain == 'localhost');
scheme == CoreConfigConstants.ioswebviewscheme;
}
/**

View File

@ -978,7 +978,7 @@ export class CoreWSProvider {
options.responseType = options.responseType || 'json';
options.timeout = typeof options.timeout == 'undefined' ? this.getRequestTimeout() : options.timeout;
if (this.appProvider.isMobile()) {
if (this.appProvider.isIOS()) {
// Use the cordova plugin.
if (url.indexOf('file://') === 0) {
// We cannot load local files using the http native plugin. Use file provider instead.