Skip to content

Commit fd7af7d

Browse files
author
Srirang.Kalantri
committed
fix: change the depricated function and fix updated api
1 parent 938b7c5 commit fd7af7d

4 files changed

Lines changed: 9 additions & 4 deletions

File tree

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

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

77
## [Unreleased]
88

9+
### Changed
10+
11+
- We replaced the depricated CameraRoll.saveToCameraRoll with CameraRoll.saveAsset in SaveToPictureLibrary activity.
12+
- Add await to API calls updated to async in recent update
13+
914
## [11.4.1] Native Mobile Resources - 2026-3-14
1015

1116
## [2.0.2] GalleryTextFilter

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ export async function SaveToPictureLibrary(picture?: mendix.lib.MxObject): Promi
2929

3030
const guid = picture.getGuid();
3131
const changedDate = picture.get("changedDate") as number;
32-
const url = mx.data.getDocumentUrl(guid, changedDate);
32+
const url = await mx.data.getDocumentUrl(guid, changedDate);
3333

3434
// Save the file as a photo to the camera roll.
3535
try {
36-
const savedUri = await CameraRoll.saveToCameraRoll(url, "auto");
36+
const savedUri = await CameraRoll.saveAsset(url);
3737
return Promise.resolve(savedUri.node.image.uri);
3838
} catch (error) {
3939
return Promise.reject(error);

packages/jsActions/mobile-resources-native/src/file-download/DownloadFile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export async function DownloadFile(file: mendix.lib.MxObject, openWithOS: boolea
6969
const fileName = file.get("Name") as string;
7070
const sanitizedFileName = sanitizeFileName(fileName);
7171
const baseDir = Platform.OS === "ios" ? dirs.DocumentDir : dirs.DownloadDir;
72-
const filePath = mx.data.getDocumentUrl(file.getGuid(), Number(file.get("changedDate")));
72+
const filePath = await mx.data.getDocumentUrl(file.getGuid(), Number(file.get("changedDate")));
7373
let accessiblePath;
7474

7575
if (Platform.OS === "ios") {

packages/jsActions/mobile-resources-native/src/platform/PlaySound.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export async function PlaySound(audioFile?: mendix.lib.MxObject): Promise<void>
3232

3333
const guid = audioFile.getGuid();
3434
const changedDate = audioFile.get("changedDate") as number;
35-
const url = mx.data.getDocumentUrl(guid, changedDate);
35+
const url = await mx.data.getDocumentUrl(guid, changedDate);
3636

3737
try {
3838
// Initialize the player if it hasn't been set up yet

0 commit comments

Comments
 (0)