Check file version and update it (if required)


#1

Dear all,

I have a Ionic1 app that provides to the users the possibility to download files (zip, pdf, doc) from a server and store them locally in order to be available off-line.

I need help how to manage files update on the server (no backend API provided by the server-side).

Usecase:
Today a user download a pdf file from the app.
Tomorrow I will updated the same pdf file on the server and what I want is to implement a function that understand that the file needs to be re-downloaded (updated).

Any helps/idea will be much appreciated.
Thank you in advance.

Regards
Claudio


#2

You can maintain metadata of the files on server and manage same in mobile app also. Whenever you update a file just update the metadata on server. On mobile app sync the metadata and trigger a re-download for updated files


#3

Hi saurabhgupta0508,

yes, this could be a good starting point.
Do you mean:
On server: filename.pdf and filename.meta
Into the meta file I put a json-like format with {version: 1.X} that will be manually updated each time I change the filename.pdf.
On the app side I can compare the local filename.meta with the server-one.

Yes, It sounds good.I will let you know as soon as I write some code.
Many thanks
Claudio