ContriHUB / Just-Share

Android app that enables quick transfer of photos, videos, documents, and audio files using WiFiDirect and Bluetooth.
MIT License
0 stars 7 forks source link

Handle Transfer Stoppage: Clear Partial Content and Implement Failure Recovery #5

Open SaiDheerajPeketi opened 1 month ago

SaiDheerajPeketi commented 1 month ago

šŸ›Bug-Report

Expected behavior

When a file transfer is stopped unexpectedly (e.g., forcefully stopping the app or losing connection), the app should automatically clear any partially transferred content and either retry the transfer or notify the user of the failure. If the transfer fails completely, the content should be discarded to avoid incomplete or corrupt files being saved.

Current behavior

Currently, if a transfer is stopped mid-process, the partially transferred file may remain on the receiverā€™s device without any indication that the transfer failed. This can result in incomplete files being stored, causing confusion for the user or even leading to data corruption.

Steps to reproduce

  1. Start a file transfer from one device (preferably the senderā€™s end).
  2. While the transfer is in progress, forcefully stop the process (e.g., close the app or disconnect the device).
  3. Check the receiverā€™s device to see if any partial content is stored.
  4. Restart the app and attempt to resume or handle the incomplete transfer.

Possible Solution

  1. Clear Partial Content: On transfer failure (whether due to disconnection or forceful closure), ensure that any incomplete files on the receiver's side are automatically deleted.

  2. Error Handling and Retry Logic: Implement error handling to detect when the transfer has been interrupted. Notify the user that the transfer failed and give the option to retry the transfer. The app should not save any incomplete content in case of failure.

  3. Progress Checkpointing: If implementing resuming functionality is required, you can store checkpoints of the progress and resume from where the transfer left off. However, this must be tied to a proper validation step to ensure file integrity (e.g., hash digest comparison).

  4. Timeouts and Feedback: Add timeouts for detecting stalled transfers and provide visual or audible feedback to the user, explaining that the transfer has failed and clearing the content accordingly.