fix: clear persistent Laya warning and apply language selection immediately (#12)

Two fixes: the ChannelList local-AI warning kept showing after the
runtime became available because status changes were not re-evaluated
on refresh; and selecting a language in the player did not switch the
stream variant immediately. Refresh warning visibility from the
latest laya status and apply the chosen variant/language on
selection, with tests for both behaviors.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
blomios
2026-10-02 15:15:06 +02:00
parent cb4939daae
commit 4d662369c9
7 changed files with 63 additions and 8 deletions

View File

@ -346,9 +346,11 @@ class ChannelList {
async refreshLayaLanguages(mode = window.app?.player?.settings?.languageDetectionMode || 'algo') {
const requestId = ++this._languageDetectionRequest;
if (mode === 'algo') {
const hadWarning = Boolean(this.languageDetectionNotice || this.languageDetectionFallback);
this.layaLanguageResults.clear();
this.languageDetectionNotice = '';
this.languageDetectionFallback = false;
if (hadWarning) this.render();
return;
}
@ -1403,10 +1405,17 @@ class ChannelList {
this.render();
const logicalChannel = this.logicalChannels.find(channel => channel.fingerprint === fingerprint);
if (!logicalChannel) return;
const variant = ChannelVariantGrouping.selectVariantByLanguage(logicalChannel, languageCode, {
isFavorite: item => this.isFavorite(item.sourceId, item.id),
isHidden: item => this.isHidden('channel', item.sourceId, item.streamId || item.id)
});
if (!variant) return;
await this.selectChannel({
logicalId: fingerprint,
variantId: logicalChannel.preferredVariant.id,
sourceId: logicalChannel.preferredVariant.sourceId
variantId: variant.id,
sourceId: variant.sourceId,
renderId: this.currentRenderId,
renderGroup: this.currentRenderGroup
});
}