Search code examples
iosobjective-cdownloadbadgefileprovider-extension

NSFileProviderItem download badge always visible


I'm developing an NSFileProvider. In the Files app, in the folder view, the download badge appears next to every file, independently by the value returned by the isDownloaded function in the corresponding file provider item, as shown in the figure below:

The download badge (always visible!)

The interesting things I noticed are:

  • If I do not implement the isDownloaded function at all, the badge doesn't appear.
  • If I implement the function, the badge is present no matter the return value of the isDownloaded function.
  • Also implemented the isDownloading function and it works fine (the moving circle appears during the download operation, but then reverts to the 'download' badge instead of the white space as on the other providers).

Can you help me hide the badge for the files which were downloaded?

I checked Drive and Dropbox, and the badge works as expected, so I'm missing something for sure.

To double check, I tried to implement isDownloaded to always return true, but the badges still appear. They disappear just when I remove the implementation.


Solution

  • I came across the same problem and although the question is already a "little" old, it might help others. Setting the isDownloaded property to yes, gives your item the correct state as you can see in the info popup:

    [download information in popup]

    The solution is to set the property isMostRecentVersionDownloaded to true if the local file (if existent) is the most recent version on the server. This does not check if the file is really available on the device.

    From the docs:

    A Boolean value that indicates whether the item is the most recent version downloaded from the server.