tidev / titanium-sdk

🚀 Native iOS and Android Apps with JavaScript
https://titaniumsdk.com/
Other
2.76k stars 1.21k forks source link

fix(ios): fix privacy-related Filesystem APIs #14062

Closed hansemannn closed 5 months ago

hansemannn commented 5 months ago

This fixes an issue from the RC where the privacy-guards for createdAt, modifiedAt and spaceAvailable would be compiled out. With this approach, the privacy error is fixed, as the APIs are only accessed when directly being called by the user.

const win = Ti.UI.createWindow({
    backgroundColor: '#fff'
});

const btn = Ti.UI.createButton({
    title: 'Trigger'
});

btn.addEventListener('click', () => {
    const file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'test.txt');
    file.write('Test');

    console.warn('createdAt', file.createdAt());
    console.warn('modifiedAt', file.modifiedAt());
    console.warn('spaceAvailable', file.spaceAvailable());
    console.warn('uptime', Ti.Platform.uptime);
});

win.add(btn);
win.open();