From bda50dba72782c787b553de035f56b725bf0bf86 Mon Sep 17 00:00:00 2001 From: crschnick Date: Sat, 2 Mar 2024 13:23:40 +0000 Subject: [PATCH] Fix progress being wrong in some cases --- .../main/java/io/xpipe/app/browser/BrowserTransferModel.java | 5 ++--- app/src/main/java/io/xpipe/app/browser/FileSystemHelper.java | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserTransferModel.java b/app/src/main/java/io/xpipe/app/browser/BrowserTransferModel.java index 93c134355..23c65ca40 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserTransferModel.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserTransferModel.java @@ -152,14 +152,13 @@ public class BrowserTransferModel { this.name = name; this.fileEntry = fileEntry; this.localFile = localFile; - this.progress = - new SimpleObjectProperty<>(BrowserTransferProgress.empty(fileEntry.getName(), fileEntry.getSize())); + this.progress = new SimpleObjectProperty<>(); } public ObservableBooleanValue downloadFinished() { return Bindings.createBooleanBinding( () -> { - return progress.getValue().done(); + return progress.getValue() != null && progress.getValue().done(); }, progress); } diff --git a/app/src/main/java/io/xpipe/app/browser/FileSystemHelper.java b/app/src/main/java/io/xpipe/app/browser/FileSystemHelper.java index ebbe2d8bd..c39b262ad 100644 --- a/app/src/main/java/io/xpipe/app/browser/FileSystemHelper.java +++ b/app/src/main/java/io/xpipe/app/browser/FileSystemHelper.java @@ -335,6 +335,7 @@ public class FileSystemHelper { throw ex; } + progress.accept(BrowserTransferProgress.finished(sourceFile.getName(), transferred.get())); Exception exception = null; try { inputStream.close();