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