Merge pull request #2410 from dpalou/MOBILE-3401

MOBILE-3401 android: Revert Android changes for webview plugin
main
Juan Leyva 2020-06-16 14:20:37 +02:00 committed by GitHub
commit 0bb0fd9162
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 { CoreUtilsProvider } from '@providers/utils/utils';
import { CoreSplitViewComponent } from '@components/split-view/split-view'; import { CoreSplitViewComponent } from '@components/split-view/split-view';
import { CoreUrl } from '@singletons/url'; import { CoreUrl } from '@singletons/url';
import { WKWebViewCookiesWindow } from 'cordova-plugin-wkwebview-cookies';
@Component({ @Component({
selector: 'core-iframe', selector: 'core-iframe',
@ -102,7 +101,7 @@ export class CoreIframeComponent implements OnInit, OnChanges {
if (this.platform.is('ios') && !this.urlUtils.isLocalFileUrl(url)) { if (this.platform.is('ios') && !this.urlUtils.isLocalFileUrl(url)) {
// Save a "fake" cookie for the iframe's domain to fix a bug in WKWebView. // Save a "fake" cookie for the iframe's domain to fix a bug in WKWebView.
try { try {
const win = <WKWebViewCookiesWindow> window; const win = <any> window;
const urlParts = CoreUrl.parse(url); const urlParts = CoreUrl.parse(url);
await win.WKWebViewCookies.setCookie({ await win.WKWebViewCookies.setCookie({

View File

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

View File

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

View File

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