Skip to content

Commit

Permalink
Merge pull request #125 from mendix/feat/cordova-ios-upgrade
Browse files Browse the repository at this point in the history
cordova-ios upgrade to 7.0.1
  • Loading branch information
stelselim authored Feb 8, 2024
2 parents 53ca032 + f2d6588 commit 0b4f927
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mendix/mendix-hybrid-app-base",
"version": "7.0.1",
"version": "8.0.0",
"description": "Mendix PhoneGap Build base package",
"scripts": {
"appbase": "node ./node_modules/webpack/bin/webpack --config ./webpack.config.appbase.js",
Expand Down
12 changes: 8 additions & 4 deletions src/config.xml.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<content src="index.html" />

<engine name="android" spec="12.0.1" />
<engine name="ios" spec="5.1.1" />
<engine name="ios" spec="7.0.1" />

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

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

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

<plugin name="@mendix/cordova-plugin-wkwebview-engine" source="npm" spec="1.0.3-mx.1.4.0" />

<preference name="WKWebViewOnly" value="true" />

<!-- Enable WKWebView on iOS -->
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>

<plugin name="cordova-plugin-webview-proxy" spec="https://github.com/mendix/cordova-plugin-webview-proxy.git" />

<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />

<plugin name="@ahovakimyan/cordova-plugin-wkwebviewxhrfix" source="npm" spec="1.0.2" />

<preference name="KeyboardDisplayRequiresUserAction" value="false" />
<preference name="scheme" value="https" />
<preference name="hostname" value="localhost" />

<platform name="ios">
{{#iosImages}}
Expand Down
9 changes: 5 additions & 4 deletions src/www/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as PinView from "./pinView";
import SecureStore from "./secure-store";
import FileStore from "./file-store";
import LocalStore from "./local-store";
import convertProxyUrl from "./convert-url";

export default (function () {
var defaultConfig = {
Expand Down Expand Up @@ -33,7 +34,7 @@ export default (function () {
var xhr = new XMLHttpRequest(),
header;

xhr.open(params.method, url);
xhr.open(params.method, convertProxyUrl(url));

if (params.onLoad) {
xhr.onreadystatechange = function () {
Expand Down Expand Up @@ -149,8 +150,8 @@ export default (function () {
var _startup = function (config, url, appUrl, enableOffline, requirePin) {
return new Promise(async function (resolve, reject) {
window.dojoConfig = {
appbase: url,
remotebase: appUrl,
appbase: convertProxyUrl(url),
remotebase: convertProxyUrl(url),
baseUrl: url + "mxclientsystem/dojo/",
async: true,
cacheBust: config.cachebust,
Expand Down Expand Up @@ -295,7 +296,7 @@ export default (function () {
if (cordova.platformId === "android") {
window.dojoConfig.ui.openUrlFn = async function (url, fileName, windowName) {
try {
let response = await fetch(url);
let response = await fetch(convertProxyUrl(url));
let blob = await response.blob();
await cordova.plugins.saveDialog.saveFile(blob, fileName);
} catch (e) {
Expand Down
14 changes: 14 additions & 0 deletions src/www/scripts/convert-url.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function convertProxyUrl(url){
if(!window.WebviewProxy){
return url;
}

if(cordova.platformId === "android"){
return url;
}
return window.WebviewProxy.convertProxyUrl(url);
}

export default convertProxyUrl;


0 comments on commit 0b4f927

Please sign in to comment.