functionland / fx-fotos

"Fx Fotos" is an opensource gallery app in react native with the same smoothness and features of Google Photos and Apple Photos. It is backend gnostic and connects to decentralized backends like "box", "Dfinity", "Filecoin" and "Crust".
https://t.me/functionland
MIT License
669 stars 73 forks source link

Implementation of successful upload check #377

Open ehsan6sha opened 12 months ago

ehsan6sha commented 12 months ago

Right now when an asset is sent to be uploaded, it assumes the upload is completed. It needs to check and ensure upload is done and retry if not.

inprogress_cidlist = [] when app starts: fula.checkFailedActions(false, 15) => If not false => failedCids = fula.listFailedActions() => inprogress_cidlist.push(failedCids) :just make sure we do not double add a cid and it is unique inside inprogress_cidlist

when we upload: (The part after 5 second delay should still wait for more time if the procedure in "Now during the app" is running at the same time so a shared flag is needed) if writeFile is true => show file as in progress => get the rootCid of latest uploaded file in that batch => after 5 seconds delay to give it some time to upload: fula.listFailedActions([rootCid]) => If not false => inprogress_cidlist .push(root_cid) :just make sure we do not double add a cid and it is unique inside inprogress_cidlist

Now during the app: (This should be skipped on the cycle when the upload is running at the same time so a shared flag is needed) If inprogress_cidlist.length>0 => activate a timer every 30 sec => {fula.connectionCheck => if true => checkFailedActions(true, 15) => if true => inprogress_cidlist=await fula.listFailedActions()}

In checkFailedActions age avalin input true bashe khodesh ham check mikone va ham upload. dovomin parametresham timeoute listFailedActions ham age input dashte bashe ke faghat oona ro check mikone va age bi inut bashe hameye failed ha ro barmigardoone

--- Want to back this issue? **[Post a bounty on it!](https://app.bountysource.com/issues/123772721-implementation-of-successful-upload-check?utm_campaign=plugin&utm_content=tracker%2F206746002&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://app.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F206746002&utm_medium=issues&utm_source=github).