Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/jsActions/nanoflow-actions-native/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

- Added a "Download web file" nanoflow action that triggers file download for web applications.
- Changed a caption for the existing "Download file" action to "Download native file".
- We've migrated from using @react-native-community/geolocation to react-native-permissions for handling location permissions.

## [6.1.1] Nanoflow Commons - 2025-10-7
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// This file was generated by Mendix Studio Pro.
//
// WARNING: Only the following code will be retained when actions are regenerated:
// - the import list
// - the code between BEGIN USER CODE and END USER CODE
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.

// BEGIN EXTRA CODE
// END EXTRA CODE

/**
* @param {MxObject} file - File object which will be downloaded.
* @param {boolean} showFileInBrowser - Set to True to let the browser open the file in a new tab.
* Set to False if the file only needs to be downloaded to the device storage.
* @returns {Promise.<void>}
*/
export async function DownloadWebFile(file?: mendix.lib.MxObject, showFileInBrowser?: boolean) {

Check warning on line 18 in packages/jsActions/nanoflow-actions-native/src/client/DownloadWebFile.ts

View workflow job for this annotation

GitHub Actions / Unit tests

Missing return type on function
// BEGIN USER CODE
if (!file) {
return Promise.reject(new Error("Input parameter 'file' is required"));
}

const target = showFileInBrowser ? "window" : "internal";

return new Promise((resolve, reject) => {
mx.ui
.downloadFile({
mxobject: file,
target,
error: (err: Error) => reject(err)
})
.then(resolve)
.catch(reject);
});
// END USER CODE
}
5 changes: 5 additions & 0 deletions packages/jsActions/nanoflow-actions-native/typings/mx.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
declare namespace mx {
interface ui {
toggleSidebar: () => void;
downloadFile: (args: {
mxobject: mendix.lib.MxObject;
target: "window" | "internal";
error?: (err: Error) => void;
}) => Promise<void>;
}
interface data {
update: (param: { guid?: string | undefined; entity?: string | undefined; callback?: () => void }) => void;
Expand Down
Loading