Skip to content

Commit 0b4f927

Browse files
authored
Merge pull request #125 from mendix/feat/cordova-ios-upgrade
cordova-ios upgrade to 7.0.1
2 parents 53ca032 + f2d6588 commit 0b4f927

File tree

5 files changed

+30
-11
lines changed

5 files changed

+30
-11
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mendix/mendix-hybrid-app-base",
3-
"version": "7.0.1",
3+
"version": "8.0.0",
44
"description": "Mendix PhoneGap Build base package",
55
"scripts": {
66
"appbase": "node ./node_modules/webpack/bin/webpack --config ./webpack.config.appbase.js",

src/config.xml.mustache

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<content src="index.html" />
1111

1212
<engine name="android" spec="12.0.1" />
13-
<engine name="ios" spec="5.1.1" />
13+
<engine name="ios" spec="7.0.1" />
1414

1515
<!-- allow assets to be loaded and open links in the app itself, see: http://phonegap.com/blog/2012/03/20/access-tags/ -->
1616
<!-- Issue 204079: Allow retrieval of any resource. Custom widgets can point to anything. -->
@@ -82,7 +82,7 @@
8282
{{/permissions.microphone}}
8383

8484
{{#permissions.push}}
85-
<plugin name="phonegap-plugin-push" source="npm" spec="2.3.0" />
85+
<plugin name="@havesource/cordova-plugin-push" source="npm" spec="4.0.0" />
8686
{{/permissions.push}}
8787

8888
{{#iosEnabled}}
@@ -103,18 +103,22 @@
103103
<!-- Disable backup to iCloud on iOS. -->
104104
<preference name="BackupWebStorage" value="none" />
105105

106-
<plugin name="@mendix/cordova-plugin-wkwebview-engine" source="npm" spec="1.0.3-mx.1.4.0" />
107-
108106
<preference name="WKWebViewOnly" value="true" />
109107

110108
<!-- Enable WKWebView on iOS -->
111109
<feature name="CDVWKWebViewEngine">
112110
<param name="ios-package" value="CDVWKWebViewEngine" />
113111
</feature>
114112

113+
<plugin name="cordova-plugin-webview-proxy" spec="https://github.com/mendix/cordova-plugin-webview-proxy.git" />
114+
115115
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
116116

117+
<plugin name="@ahovakimyan/cordova-plugin-wkwebviewxhrfix" source="npm" spec="1.0.2" />
118+
117119
<preference name="KeyboardDisplayRequiresUserAction" value="false" />
120+
<preference name="scheme" value="https" />
121+
<preference name="hostname" value="localhost" />
118122

119123
<platform name="ios">
120124
{{#iosImages}}

src/www/scripts/app.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as PinView from "./pinView";
66
import SecureStore from "./secure-store";
77
import FileStore from "./file-store";
88
import LocalStore from "./local-store";
9+
import convertProxyUrl from "./convert-url";
910

1011
export default (function () {
1112
var defaultConfig = {
@@ -33,7 +34,7 @@ export default (function () {
3334
var xhr = new XMLHttpRequest(),
3435
header;
3536

36-
xhr.open(params.method, url);
37+
xhr.open(params.method, convertProxyUrl(url));
3738

3839
if (params.onLoad) {
3940
xhr.onreadystatechange = function () {
@@ -149,8 +150,8 @@ export default (function () {
149150
var _startup = function (config, url, appUrl, enableOffline, requirePin) {
150151
return new Promise(async function (resolve, reject) {
151152
window.dojoConfig = {
152-
appbase: url,
153-
remotebase: appUrl,
153+
appbase: convertProxyUrl(url),
154+
remotebase: convertProxyUrl(url),
154155
baseUrl: url + "mxclientsystem/dojo/",
155156
async: true,
156157
cacheBust: config.cachebust,
@@ -295,7 +296,7 @@ export default (function () {
295296
if (cordova.platformId === "android") {
296297
window.dojoConfig.ui.openUrlFn = async function (url, fileName, windowName) {
297298
try {
298-
let response = await fetch(url);
299+
let response = await fetch(convertProxyUrl(url));
299300
let blob = await response.blob();
300301
await cordova.plugins.saveDialog.saveFile(blob, fileName);
301302
} catch (e) {

src/www/scripts/convert-url.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function convertProxyUrl(url){
2+
if(!window.WebviewProxy){
3+
return url;
4+
}
5+
6+
if(cordova.platformId === "android"){
7+
return url;
8+
}
9+
return window.WebviewProxy.convertProxyUrl(url);
10+
}
11+
12+
export default convertProxyUrl;
13+
14+

0 commit comments

Comments
 (0)