Skip to content

File Import/Export: Properly clean up content hub state

Flo Lee requested to merge cleanup-contenthub into ubports/xenial

Content-Hub operations state that one must call finish at the end of everything, so that content hub can remove the temp files again. This was not followed in TELEports so far. Magically it seems though that files get cleaned up somehow else.

As we are good UT citizens lets make this possible!

Basic workflow:

  • Incoming file name(s) put to a map with a boolean, indicating if processing is finished
  • Telling tdlib we want an inputFileGenerated type, not local file type anymore
  • tdlib creates its own temp file and replies back with updateInputFileGenerationStart
  • We reuse code from voice note generation to simply copy or move the data file into tdlib´s temp file
  • We signal to tdlib that file generation is finished
  • We update the map, set the corresponding boolean to true
  • We check all entries in the map, if all are true, we signal to Content-Hub that finally it can finish ;)

This is highly asynchronous but shows the power of signal/slot once more, even involving C++ in its path pretty nicely...

Edited by Flo Lee

Merge request reports