Currently, the MessageManager and FileManager both listen for the FileUploadService.INTENT_ACTION_FILE_UPLOAD_COMPLETE broadcast to perform their own tasks.
The MessageManager modifies the annotations of all messages dependent on the file and deletes pending file attachments from the db.
The FileManager removes the pending file from the db.
It's possible that the pending file could be removed from the db right before a crash/termination, leaving the Messages in an unrecoverable state (i.e. with pending message attachments pointing to a pending file id that doesn't exist).
Currently, the MessageManager and FileManager both listen for the FileUploadService.INTENT_ACTION_FILE_UPLOAD_COMPLETE broadcast to perform their own tasks.
The MessageManager modifies the annotations of all messages dependent on the file and deletes pending file attachments from the db.
The FileManager removes the pending file from the db.
It's possible that the pending file could be removed from the db right before a crash/termination, leaving the Messages in an unrecoverable state (i.e. with pending message attachments pointing to a pending file id that doesn't exist).
Fix this.