Skip to content

Commit 28a4a6d

Browse files
authored
Merge branch 'main' into moo/MOO-2308-replace-notifee-library-11.13
2 parents d67c095 + dfa7823 commit 28a4a6d

3 files changed

Lines changed: 23 additions & 4 deletions

File tree

packages/jsActions/mobile-resources-native/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1313
- The Play sound action now plays audio files from online (network) documents on Android by downloading them to a version-based cache before playback.
1414
- We have fixed the biometric authentication issue where it was not working on Android and crashing on iOS.
1515
- Fixed an issue where the `TakePicture` and `TakePictureAdvanced` actions failed to capture photos on Android.
16+
- Fixed an issue where the `TakePicture` and `TakePictureAdvanced` actions did not properly clean up temporary files.
1617

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

packages/jsActions/mobile-resources-native/src/camera/TakePicture.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,15 @@ export async function TakePicture(
116116
});
117117
}
118118

119+
async function safeRemove(filePath: string): Promise<void> {
120+
try {
121+
await NativeModules.MxFileSystem.remove(filePath);
122+
} catch (error) {
123+
console.warn(`Failed to remove file at ${filePath}. Error: ${error}`);
124+
// ignore error
125+
}
126+
}
127+
119128
function storeFile(imageObject: mendix.lib.MxObject, uri: string): Promise<boolean> {
120129
return new Promise((resolve, reject) => {
121130
NativeModules.MxFileSystem.read(uri.replace("file://", ""))
@@ -138,7 +147,7 @@ export async function TakePicture(
138147
{},
139148
blob,
140149
async () => {
141-
await NativeModules.MendixNative.fsRemove(filePathWithoutFileScheme);
150+
await safeRemove(filePathWithoutFileScheme);
142151

143152
imageObject.set("Name", filename);
144153

@@ -149,7 +158,7 @@ export async function TakePicture(
149158
});
150159
},
151160
async (error: Error) => {
152-
await NativeModules.MendixNative.fsRemove(filePathWithoutFileScheme);
161+
await safeRemove(filePathWithoutFileScheme);
153162

154163
reject(error);
155164
}

packages/jsActions/mobile-resources-native/src/camera/TakePictureAdvanced.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,15 @@ export async function TakePictureAdvanced(
169169
});
170170
}
171171

172+
async function safeRemove(filePath: string): Promise<void> {
173+
try {
174+
await NativeModules.MxFileSystem.remove(filePath);
175+
} catch (error) {
176+
console.warn(`Failed to remove file at ${filePath}. Error: ${error}`);
177+
// ignore error
178+
}
179+
}
180+
172181
function storeFile(imageObject: mendix.lib.MxObject, uri: string): Promise<boolean> {
173182
return new Promise((resolve, reject) => {
174183
NativeModules.MxFileSystem.read(uri.replace("file://", ""))
@@ -191,7 +200,7 @@ export async function TakePictureAdvanced(
191200
{},
192201
blob,
193202
async () => {
194-
await NativeModules.MendixNative.fsRemove(filePathWithoutFileScheme);
203+
await safeRemove(filePathWithoutFileScheme);
195204

196205
imageObject.set("Name", filename);
197206

@@ -202,7 +211,7 @@ export async function TakePictureAdvanced(
202211
});
203212
},
204213
async (error: Error) => {
205-
await NativeModules.MendixNative.fsRemove(filePathWithoutFileScheme);
214+
await safeRemove(filePathWithoutFileScheme);
206215

207216
reject(error);
208217
}

0 commit comments

Comments
 (0)