Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions packages/jsActions/mobile-resources-native/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- The Play sound action now plays audio files from online (network) documents on Android by downloading them to a version-based cache before playback.
- We have fixed the biometric authentication issue where it was not working on Android and crashing on iOS.
- Fixed an issue where the `TakePicture` and `TakePictureAdvanced` actions failed to capture photos on Android.
- Fixed an issue where the `TakePicture` and `TakePictureAdvanced` actions did not properly clean up temporary files.

## [12.1.0] Native Mobile Resources - 2026-6-10

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@
});
}

async function safeRemove(filePath: string): Promise<void> {
try {
await NativeModules.MxFileSystem.remove(filePath);
} catch (error) {
console.warn(`Failed to remove file at ${filePath}. Error: ${error}`);
// ignore error
}
}

function storeFile(imageObject: mendix.lib.MxObject, uri: string): Promise<boolean> {
return new Promise((resolve, reject) => {
NativeModules.MxFileSystem.read(uri.replace("file://", ""))
Expand All @@ -138,7 +147,7 @@
{},
blob,
async () => {
await NativeModules.MendixNative.fsRemove(filePathWithoutFileScheme);
await safeRemove(filePathWithoutFileScheme);

imageObject.set("Name", filename);

Expand All @@ -149,7 +158,7 @@
});
},
async (error: Error) => {
await NativeModules.MendixNative.fsRemove(filePathWithoutFileScheme);
await safeRemove(filePathWithoutFileScheme);

reject(error);
}
Expand Down Expand Up @@ -329,7 +338,7 @@
);
}

function handleImagePickerV4Error(errorCode: ErrorCode, errorMessage?: string) {

Check warning on line 341 in packages/jsActions/mobile-resources-native/src/camera/TakePicture.ts

View workflow job for this annotation

GitHub Actions / Unit tests

Missing return type on function
switch (errorCode) {
case "camera_unavailable":
showAlert("The camera is unavailable", "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@
});
}

async function safeRemove(filePath: string): Promise<void> {
try {
await NativeModules.MxFileSystem.remove(filePath);
} catch (error) {
console.warn(`Failed to remove file at ${filePath}. Error: ${error}`);
// ignore error
}
}

function storeFile(imageObject: mendix.lib.MxObject, uri: string): Promise<boolean> {
return new Promise((resolve, reject) => {
NativeModules.MxFileSystem.read(uri.replace("file://", ""))
Expand All @@ -191,7 +200,7 @@
{},
blob,
async () => {
await NativeModules.MendixNative.fsRemove(filePathWithoutFileScheme);
await safeRemove(filePathWithoutFileScheme);

imageObject.set("Name", filename);

Expand All @@ -202,7 +211,7 @@
});
},
async (error: Error) => {
await NativeModules.MendixNative.fsRemove(filePathWithoutFileScheme);
await safeRemove(filePathWithoutFileScheme);

reject(error);
}
Expand Down Expand Up @@ -392,7 +401,7 @@
});
}

function handleImagePickerV4Error(errorCode: ErrorCode, errorMessage?: string) {

Check warning on line 404 in packages/jsActions/mobile-resources-native/src/camera/TakePictureAdvanced.ts

View workflow job for this annotation

GitHub Actions / Unit tests

Missing return type on function
switch (errorCode) {
case "camera_unavailable":
showAlert("The camera is unavailable.", "");
Expand Down
Loading