MohamedRejeb / Calf

Calf is a library that allows you to easily create adaptive UIs and access platform specific APIs with Compose Multiplatform (Adaptive UI, File Picker, WebView, Permissions...).
https://mohamedrejeb.github.io/Calf/
Apache License 2.0
907 stars 41 forks source link

Temporary file breaks stored directory opening on iOS. #90

Closed zhelenskiy closed 3 months ago

zhelenskiy commented 3 months ago

The change introduced by 0.4.1 after 0.4.0 breaks the following use case:

Expected behaviour (0.4.0):

image

Actual behaviour:

MohamedRejeb commented 3 months ago

Hi, Thanks for opening this issue, maybe keeping a reference to the original path in KmpFile for iOS should fix this?

zhelenskiy commented 3 months ago

By the way why do you need to create a temporary file?

MohamedRejeb commented 3 months ago

Here's the full discussion: #54 I'm using iOS PHPicker and it return an NSURL valid only inside the picker lambda so you can't keep a reference of the file and use it later to upload or something, that's why we need the temporary file so we can keep using it later. It's possible to store the NSData instead of NSURL but it's not ideal, we only need to get NSData or ByteArray when we have to, we shouldn't keep it in the memory for so long.

zhelenskiy commented 3 months ago

How am I expected to save to the original file then?

MohamedRejeb commented 3 months ago

As I said, I will add a reference to the original file path for iOS: KmpFile.originalPath something like that.

MohamedRejeb commented 3 months ago

This should be fixed in 0.5.0, you don't need to change anything in your code.