A few peculiarities in Download file component

Hi there!

I was trying to show an image in the app based on a dynamic URL. My dynamic URL is built on an Integromat webhook, which returns file with header (Content-Type: image/png and Content-Disposition: inline; filename="file.png), but itself does not look like image URL - no .png extension

Likely due the URL looking strange, the Image module does not recognize it as an Image. I have decided to use the Download file component instead. The “testerVariable” was linked to Image and was displaying the file.

I noticed however:

1 Format of path property
Download returns following path
“/data/user/0/com.appgyver.agclient/files/RNFetchBlobTmp_y2663ldedjp15jde3rbn87”

In e.g. Take Photo component, the path is returned as:
“file:///data/user/0/com.appgyver.agclient/…”

I am not sure if the lack of “file://” is affecting anything down the line.

2. Download component not fetching file name

One of the inputs to Download component is “Name” of the file to be downloaded, which probably should work this way that if it is empty, it receives the name of the file (via filename or header) from the download link.
Currently download returns “path”(local storage), size and mimeType. No name ( I have also tested download on simple links … like /cat.png)

3. Move/rename file/directory is always in overwrite mode
Moving a file, regardless of setting True or False, the target file was always overwritten. There might be a bug there.
image

4. Cashing of files by Image component.
I was moving the downloaded files to a local folder, where I wanted to have them always overwrite filename.png. This works, I could see the file content change via separate File explorer app. In my app however the Image element showing filename.png was showing the same picture as the first image I have downloaded. If I changed to filename2.png , I could see new image, but only for the first download. Looks like everytime I need to change the file name.

Does the Image component has some internal cashing for local files?

5. Keeping files in default download directory

Finally, I figured out that I can just keep the file in the default download directory and only rename it to UUID.png (using relative patch = True in the “Move/rename file/directory”)

How long are the downloaded files staying in the /com.appgyver.agclient/ folder? Will I end up with a bunch of files in that location after a longer use?

Maybe a better option to download files for a single time use is Cache files as described below?

1.) We’ll take a look at the filenames. Most likely if its missing the protocol it’s not working as it’s supposed to.

2.) Looking at the source code there is no filename when downloading elsewhere. It’s most likely there just to maintain the “file” schema.

3.) :grimacing: thanks for reporting.

4.) I suppose this has to do the runtime not realising something is changing and thus is not re-rendering the image.

5.) This is persistant storage which is cleaned when you delete your app and data with it.

Could you please share your exact inputs of your project. I still can’t download. I just want to play a short sound if somebody tap on a button. This seems to be very tedious. Normally you should be able to embed those sounds in the app.

Since this is obviously not possible I would be grateful if someone could show me how to do this with download.

Hi @gzah, have you tried the Play audio flow function?

yes, i can play audio files… i tried it with the following url: “https://www2.cs.uic.edu/~i101/SoundFiles/ImperialMarch60.wav

I also tried to preload this file at appstart. It seems to work but i don’t no how to play the preloaded file. Play only works if i insert the above url. Therefore it works very slow because it reloads it each time.

I would like to preload and play the preloaded file.

Even better would be to download the file local on the device. Each time the app starts i would like to check if the audio is already downloaded. If already downloaded no more download needed. After that i would like to play the downloaded file each time i press a button. But i got no idea how this works!

In the Download files flow function put the sound URL in the downloadUrl field:

The file path comes out as an output of the node:

image

When you know the file name and path that the file will be saved to, you can check if that file exists with File/directory exists? (docs) flow function and if yes, use that filepath as the source in Play audio.

still struggling with downloading files. Preloading does also not work. Is that even possible with the preview app?

I can play audio with a url. that works, but delayed.

Any App needs to play audio. Why audio can’t be embedded in the app like thunkable and all the others do? I really like appgyver and was surprised that such a basic feature seems to be missing.

If you could provide some examples for workarounds. That would be great.

2014 the first user asked “is there a way of creating an alert sound in appgyver?”

7 years later there it is still the same tinkering solution where you need to stream audio from another server. that is a great pity.

Actually, I think appgyver is very good. But if an absolute must-have feature is missing and it seems as if this feature will never be implemented, then it becomes difficult.

Since SAP bought up the store at the beginning of the year, it certainly won’t get any better. The average response time of the apparently completely overloaded or inexistent support does not make the whole thing any better. It seems to me that they don’t know how to store and play audio locally.

In the meantime I have rebuilt the app in thunkable. There you can simply upload assets and they are immediately available in the app, even without internet. Simply as it should be!