Fix echo handling and show a barebones toast on error

The EchoTransaction was wrongly assuming that it knew better than the caller for when the success condition was met, so the echo marking has been left an exercise for the caller. In this case, we mark when we finally receive the sync with the updated rules.

We also have to cancel previous transactions otherwise if the user mashes buttons we could forever show the toast, and that would be bad.
This commit is contained in:
Travis Ralston 2020-07-29 19:11:24 -06:00
parent 0f1b9937a9
commit 14b0def143
7 changed files with 104 additions and 16 deletions

View file

@ -53,6 +53,11 @@ export class EchoTransaction extends Whenable<TransactionStatus> {
.catch(() => this.setStatus(TransactionStatus.DoneError));
}
public cancel() {
// Success basically means "done"
this.setStatus(TransactionStatus.DoneSuccess);
}
private setStatus(status: TransactionStatus) {
this._status = status;
if (status === TransactionStatus.DoneError) {