Skip to content

Commit 8066b44

Browse files
[OFF-831]: Add download web file nanoflow action (#415)
2 parents 49957db + 81c187b commit 8066b44

File tree

5 files changed

+47
-2
lines changed

5 files changed

+47
-2
lines changed

configs/e2e/mendix-versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"latest": "11.3.0.80320"
2+
"latest": "11.7.0"
33
}

packages/jsActions/nanoflow-actions-native/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
- Added a "Download web file" nanoflow action that triggers file download for web applications.
10+
- Changed a caption for the existing "Download file" action to "Download native file".
11+
912
## [6.2.1] Nanoflow Commons - 2026-1-22
1013

1114
- We've migrated from using @react-native-community/geolocation to react-native-permissions for handling location permissions.

packages/jsActions/nanoflow-actions-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"url": "https://github.com/mendix/native-widgets.git"
1010
},
1111
"marketplace": {
12-
"minimumMXVersion": "11.3.0.80320",
12+
"minimumMXVersion": "11.7.0",
1313
"marketplaceId": 109515
1414
},
1515
"testProject": {
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// This file was generated by Mendix Studio Pro.
2+
//
3+
// WARNING: Only the following code will be retained when actions are regenerated:
4+
// - the import list
5+
// - the code between BEGIN USER CODE and END USER CODE
6+
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
7+
// Other code you write will be lost the next time you deploy the project.
8+
9+
// BEGIN EXTRA CODE
10+
// END EXTRA CODE
11+
12+
/**
13+
* @param {MxObject} file - File object which will be downloaded.
14+
* @param {boolean} showFileInBrowser - Set to True to let the browser open the file in a new tab.
15+
* Set to False if the file only needs to be downloaded to the device storage.
16+
* @returns {Promise.<void>}
17+
*/
18+
export async function DownloadWebFile(file?: mendix.lib.MxObject, showFileInBrowser?: boolean): Promise<void> {
19+
// BEGIN USER CODE
20+
if (!file) {
21+
return Promise.reject(new Error("Input parameter 'file' is required"));
22+
}
23+
24+
const target = showFileInBrowser ? "window" : "internal";
25+
26+
return new Promise((resolve, reject) => {
27+
mx.ui
28+
.downloadFile({
29+
mxobject: file,
30+
target,
31+
error: (err: Error) => reject(err)
32+
})
33+
.then(resolve)
34+
.catch(reject);
35+
});
36+
// END USER CODE
37+
}

packages/jsActions/nanoflow-actions-native/typings/mx.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
declare namespace mx {
33
interface ui {
44
toggleSidebar: () => void;
5+
downloadFile: (args: {
6+
mxobject: mendix.lib.MxObject;
7+
target: "window" | "internal";
8+
error?: (err: Error) => void;
9+
}) => Promise<void>;
510
}
611
interface data {
712
update: (param: { guid?: string | undefined; entity?: string | undefined; callback?: () => void }) => void;

0 commit comments

Comments
 (0)