fix(taildrop): restore incoming file progress notifications
The io.Copy in PutFile was writing directly to wc, bypassing the incomingFile wrapper whose Write method increments f.copied and fires a throttled sendFileNotify on progress. As a result, notifyIncomingFiles on the JS side only ever fired once (on completion) with received=0, making progress UI impossible. The original inFile wrapping was lost during the Android SAF refactor. Also surface the PartialFile.Done flag through jsIncomingFile so JS can distinguish the final "transfer complete" notification from in-progress updates. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit was merged in pull request #1.
This commit is contained in:
@@ -405,6 +405,7 @@ func (i *jsIPN) run(jsCallbacks js.Value) {
|
||||
Started: f.Started.UnixMilli(),
|
||||
DeclaredSize: f.DeclaredSize,
|
||||
Received: f.Received,
|
||||
Done: f.Done,
|
||||
}
|
||||
}
|
||||
if b, err := json.Marshal(files); err == nil {
|
||||
@@ -967,6 +968,7 @@ type jsIncomingFile struct {
|
||||
Started int64 `json:"started"` // Unix milliseconds; use new Date(started) in JS
|
||||
DeclaredSize int64 `json:"declaredSize"` // -1 if unknown
|
||||
Received int64 `json:"received"` // bytes received so far
|
||||
Done bool `json:"done"` // true once the file has been fully received
|
||||
}
|
||||
|
||||
// jsOutgoingFile is the JSON representation of an outgoing file transfer
|
||||
|
||||
Reference in New Issue
Block a user