Skip to content

Commit

Permalink
Merge pull request #121 from mendix/moo/fix-open-file-issue
Browse files Browse the repository at this point in the history
[MOO-1291] fix for file opening issue, and new version number.
  • Loading branch information
stelselim authored Dec 15, 2023
2 parents 2313ad1 + 1f21d99 commit 53ca032
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 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.0",
"version": "7.0.1",
"description": "Mendix PhoneGap Build base package",
"scripts": {
"appbase": "node ./node_modules/webpack/bin/webpack --config ./webpack.config.appbase.js",
Expand Down
2 changes: 1 addition & 1 deletion src/config.xml.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<plugin name="cordova-plugin-device-orientation" source="npm" spec="2.0.1" />
<plugin name="cordova-plugin-dialogs" source="npm" spec="2.0.1" />
<plugin name="cordova-plugin-file" source="npm" spec="8.0.0" />
<plugin name="cordova-plugin-file-opener2" source="npm" spec="4.0.0" />
<plugin name="cordova-plugin-save-dialog" source="npm" spec="2.0.0" />
<plugin name="cordova-plugin-ns0m-file-transfer" source="npm" spec="2.0.0-7" />
<plugin name="cordova-plugin-globalization" source="npm" spec="1.11.0" />
<plugin name="cordova-plugin-inappbrowser" spec="https://github.com/mendix/cordova-plugin-inappbrowser.git" />
Expand Down
18 changes: 8 additions & 10 deletions src/www/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,16 +293,14 @@ export default (function () {
window.dojoConfig.offline = enableOffline;

if (cordova.platformId === "android") {
window.dojoConfig.ui.openUrlFn = function (url, fileName, windowName) {
download(url, cordova.file.externalCacheDirectory + fileName, false, {}, null)
.then(function (fe) {
fe.file(function (file) {
cordova.plugins.fileOpener2.open(fe.toInternalURL(), file.type);
});
})
.catch(function (e) {
window.mx.ui.exception(__("Could not download file"));
});
window.dojoConfig.ui.openUrlFn = async function (url, fileName, windowName) {
try {
let response = await fetch(url);
let blob = await response.blob();
await cordova.plugins.saveDialog.saveFile(blob, fileName);
} catch (e) {
window.mx.ui.exception(__("Could not download file"));
}
};
}

Expand Down

0 comments on commit 53ca032

Please sign in to comment.