mirror of
https://github.com/chuot/rdio-scanner.git
synced 2026-08-13 16:33:01 -06:00
Refactor the livefeed stop
This commit is contained in:
parent
d6bc3c8bcf
commit
ec5974cad1
|
|
@ -607,13 +607,26 @@ export class AppRdioScannerService implements OnDestroy {
|
|||
}
|
||||
|
||||
private liveFeedStart(): void {
|
||||
this.liveFeedActive = true;
|
||||
|
||||
this.event.emit({ liveFeed: true });
|
||||
|
||||
this.webSocketSend(WebSocketCommand.LiveFeedMap, this.liveFeedMap);
|
||||
}
|
||||
|
||||
private liveFeedStop(): void {
|
||||
this.webSocketSend(WebSocketCommand.LiveFeedMap, null);
|
||||
this.liveFeedActive = false;
|
||||
|
||||
this.callQueue.splice(0, this.callQueue.length);
|
||||
|
||||
this.event.emit({
|
||||
liveFeed: false,
|
||||
queue: 0,
|
||||
});
|
||||
|
||||
this.stop();
|
||||
|
||||
this.webSocketSend(WebSocketCommand.LiveFeedMap, null);
|
||||
}
|
||||
|
||||
private liveFeedStore(): void {
|
||||
|
|
@ -638,10 +651,14 @@ export class AppRdioScannerService implements OnDestroy {
|
|||
switch (message[2]) {
|
||||
case WebSocketCallFlag.Download:
|
||||
this.download(message[1]);
|
||||
|
||||
break;
|
||||
|
||||
case WebSocketCallFlag.Play:
|
||||
if (this.liveFeedActive) {
|
||||
this.play(message[1]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -679,23 +696,6 @@ export class AppRdioScannerService implements OnDestroy {
|
|||
|
||||
break;
|
||||
|
||||
case WebSocketCommand.LiveFeedMap:
|
||||
this.liveFeedActive = message[1];
|
||||
|
||||
if (this.liveFeedActive) {
|
||||
this.event.emit({ liveFeed: this.liveFeedActive });
|
||||
|
||||
} else {
|
||||
this.callQueue.splice(0, this.callQueue.length);
|
||||
|
||||
this.event.emit({
|
||||
liveFeed: this.liveFeedActive,
|
||||
queue: this.callQueue.length,
|
||||
});
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case WebSocketCommand.Nop:
|
||||
clearTimeout(this.webSocketTimeout);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue