Skip to content

Commit 0bb0fd9

Browse files
authored
Merge pull request #2410 from dpalou/MOBILE-3401
MOBILE-3401 android: Revert Android changes for webview plugin
2 parents 7b3cffa + 2bcf3e2 commit 0bb0fd9

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

src/components/iframe/iframe.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import { CoreIframeUtilsProvider } from '@providers/utils/iframe';
2525
import { CoreUtilsProvider } from '@providers/utils/utils';
2626
import { CoreSplitViewComponent } from '@components/split-view/split-view';
2727
import { CoreUrl } from '@singletons/url';
28-
import { WKWebViewCookiesWindow } from 'cordova-plugin-wkwebview-cookies';
2928

3029
@Component({
3130
selector: 'core-iframe',
@@ -102,7 +101,7 @@ export class CoreIframeComponent implements OnInit, OnChanges {
102101
if (this.platform.is('ios') && !this.urlUtils.isLocalFileUrl(url)) {
103102
// Save a "fake" cookie for the iframe's domain to fix a bug in WKWebView.
104103
try {
105-
const win = <WKWebViewCookiesWindow> window;
104+
const win = <any> window;
106105
const urlParts = CoreUrl.parse(url);
107106

108107
await win.WKWebViewCookies.setCookie({

src/providers/file.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ export class CoreFileProvider {
12511251
* @return Converted src.
12521252
*/
12531253
convertFileSrc(src: string): string {
1254-
return this.appProvider.isMobile() ? (<any> window).Ionic.WebView.convertFileSrc(src) : src;
1254+
return this.appProvider.isIOS() ? (<any> window).Ionic.WebView.convertFileSrc(src) : src;
12551255
}
12561256

12571257
/**
@@ -1261,13 +1261,11 @@ export class CoreFileProvider {
12611261
* @return Unconverted src.
12621262
*/
12631263
unconvertFileSrc(src: string): string {
1264-
if (!this.appProvider.isMobile()) {
1264+
if (!this.appProvider.isIOS()) {
12651265
return src;
12661266
}
12671267

1268-
const scheme = this.platform.is('ios') ? CoreConfigConstants.ioswebviewscheme : 'http';
1269-
1270-
return src.replace(scheme + '://localhost/_app_file_', 'file://');
1268+
return src.replace(CoreConfigConstants.ioswebviewscheme + '://localhost/_app_file_', 'file://');
12711269
}
12721270
}
12731271

src/providers/utils/url.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,7 @@ export class CoreUrlUtilsProvider {
453453
return scheme == 'cdvfile' ||
454454
scheme == 'file' ||
455455
scheme == 'filesystem' ||
456-
scheme == CoreConfigConstants.ioswebviewscheme ||
457-
(scheme == 'http' && domain == 'localhost');
456+
scheme == CoreConfigConstants.ioswebviewscheme;
458457
}
459458

460459
/**

src/providers/ws.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ export class CoreWSProvider {
978978
options.responseType = options.responseType || 'json';
979979
options.timeout = typeof options.timeout == 'undefined' ? this.getRequestTimeout() : options.timeout;
980980

981-
if (this.appProvider.isMobile()) {
981+
if (this.appProvider.isIOS()) {
982982
// Use the cordova plugin.
983983
if (url.indexOf('file://') === 0) {
984984
// We cannot load local files using the http native plugin. Use file provider instead.

0 commit comments

Comments
 (0)