mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-26 01:36:18 -04:00
Replace status: null with status: idle; Set status to processing immediately after receiving is done
This commit is contained in:
parent
e29ea44025
commit
8592499d22
2 changed files with 13 additions and 15 deletions
|
@ -756,7 +756,7 @@ class Peer {
|
|||
if (message.reason === 'ram-exceed-ios') {
|
||||
Events.fire('notify-user', Localization.getTranslation('notifications.ram-exceed-ios'));
|
||||
}
|
||||
Events.fire('set-progress', {peerId: this._peerId, progress: 0, status: null});
|
||||
Events.fire('set-progress', {peerId: this._peerId, progress: 0, status: 'idle'});
|
||||
this._reset();
|
||||
return;
|
||||
}
|
||||
|
@ -844,7 +844,7 @@ class Peer {
|
|||
|
||||
if (!message.success) {
|
||||
Logger.warn('File could not be sent');
|
||||
Events.fire('set-progress', {peerId: this._peerId, progress: 0, status: null});
|
||||
Events.fire('set-progress', {peerId: this._peerId, progress: 0, status: 'idle'});
|
||||
this._reset();
|
||||
return;
|
||||
}
|
||||
|
@ -1024,6 +1024,7 @@ class Peer {
|
|||
|
||||
// We are done receiving
|
||||
Events.fire('set-progress', {peerId: this._peerId, progress: 1, status: 'receive'});
|
||||
Events.fire('set-progress', {peerId: this._peerId, progress: 0, status: 'process'});
|
||||
this._allFilesReceiveComplete();
|
||||
}
|
||||
|
||||
|
|
|
@ -423,8 +423,8 @@ class PeerUI {
|
|||
this._connected = false;
|
||||
|
||||
this._currentProgress = 0;
|
||||
this._currentStatus = null
|
||||
this._oldStatus = null;
|
||||
this._currentStatus = 'idle';
|
||||
this._oldStatus = 'idle';
|
||||
|
||||
this._progressQueue = [];
|
||||
|
||||
|
@ -461,8 +461,6 @@ class PeerUI {
|
|||
|
||||
this.updateTypesClassList();
|
||||
|
||||
this.setStatus("connect");
|
||||
|
||||
this._evaluateShareMode();
|
||||
this._bindListeners();
|
||||
}
|
||||
|
@ -602,7 +600,7 @@ class PeerUI {
|
|||
if (connected) {
|
||||
this._connected = true;
|
||||
|
||||
// on reconnect
|
||||
// on reconnect: reset status to saved status
|
||||
this.setStatus(this._oldStatus);
|
||||
this._oldStatus = null;
|
||||
|
||||
|
@ -611,11 +609,11 @@ class PeerUI {
|
|||
else {
|
||||
this._connected = false;
|
||||
|
||||
// when connecting: / connection is lost: save old status
|
||||
if (!this._oldStatus && this._currentStatus !== "connect") {
|
||||
// save old status when reconnecting
|
||||
this._oldStatus = this._currentStatus;
|
||||
this.setStatus("connect");
|
||||
}
|
||||
this.setStatus("connect");
|
||||
|
||||
this._connectionHash = "";
|
||||
}
|
||||
|
@ -755,12 +753,12 @@ class PeerUI {
|
|||
return;
|
||||
}
|
||||
|
||||
if (progress === 0) {
|
||||
if (progress < 0.5) {
|
||||
this.$progress.classList.remove('animate');
|
||||
this.$progress.classList.remove('over50');
|
||||
this.$progress.classList.add('animate');
|
||||
}
|
||||
else if (this._currentProgress === 0.5) {
|
||||
else if (progress > 0.5 && this._currentProgress === 0.5) {
|
||||
this.$progress.classList.remove('animate');
|
||||
this.$progress.classList.add('over50');
|
||||
this.$progress.classList.add('animate');
|
||||
|
@ -773,14 +771,13 @@ class PeerUI {
|
|||
this.$progress.classList.remove('animate');
|
||||
}
|
||||
|
||||
this.$progress.style.setProperty('--progress', `rotate(${360 * progress}deg)`);
|
||||
|
||||
if (progress === 1) {
|
||||
// reset progress
|
||||
this._progressQueue.unshift({progress: 0, status: status});
|
||||
}
|
||||
|
||||
this._currentProgress = progress;
|
||||
this.$progress.style.setProperty('--progress', `rotate(${360 * progress}deg)`);
|
||||
|
||||
this.setNextProgress();
|
||||
}
|
||||
|
@ -792,7 +789,7 @@ class PeerUI {
|
|||
|
||||
clearTimeout(this.statusTimeout);
|
||||
|
||||
if (!status) {
|
||||
if (status === 'idle') {
|
||||
this.$el.removeAttribute('status');
|
||||
this.$el.querySelector('.status').innerText = '';
|
||||
return;
|
||||
|
@ -820,7 +817,7 @@ class PeerUI {
|
|||
|
||||
if (status.endsWith("-complete") || status === "error") {
|
||||
this.statusTimeout = setTimeout(() => {
|
||||
this.setProgress(0, null);
|
||||
this.setStatus("idle");
|
||||
}, 10000);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue