mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-12 08:05:15 +02:00
Bug fixes
This commit is contained in:
@@ -422,8 +422,8 @@ if (titleInfo && !titleInfo.details.hasTouchSupport && !titleInfo.details.hasFak
|
||||
},
|
||||
|
||||
patchStreamHud(str: string) {
|
||||
let text = 'let{onCollapse';
|
||||
if (!str.includes(text)) {
|
||||
let index = str.indexOf('let{onCollapse');
|
||||
if (index < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -434,7 +434,7 @@ if (titleInfo && !titleInfo.details.hasTouchSupport && !titleInfo.details.hasFak
|
||||
newCode += 'options.canShowTakHUD = false;';
|
||||
}
|
||||
|
||||
str = str.replace(text, newCode + text);
|
||||
str = PatcherUtils.insertAt(str, index, newCode);
|
||||
return str;
|
||||
},
|
||||
|
||||
|
@@ -120,8 +120,9 @@ export class SettingsManager {
|
||||
[StreamPref.STATS_QUICK_GLANCE_ENABLED]: {
|
||||
onChange: () => {
|
||||
const value = getStreamPref(StreamPref.STATS_QUICK_GLANCE_ENABLED);
|
||||
const streamStats = StreamStats.getInstance();
|
||||
value ? streamStats.quickGlanceSetup() : streamStats.quickGlanceStop();
|
||||
if (!value) {
|
||||
StreamStats.getInstance().stop(true);
|
||||
}
|
||||
},
|
||||
},
|
||||
[StreamPref.STATS_POSITION]: {
|
||||
|
@@ -75,6 +75,8 @@ export class StreamStats {
|
||||
BxLogger.info(this.LOG_TAG, 'constructor()');
|
||||
|
||||
this.boundOnStreamHudStateChanged = this.onStreamHudStateChanged.bind(this);
|
||||
BxEventBus.Stream.on('ui.streamHud.expanded', this.boundOnStreamHudStateChanged);
|
||||
|
||||
this.render();
|
||||
}
|
||||
|
||||
@@ -114,7 +116,6 @@ export class StreamStats {
|
||||
|
||||
destroy() {
|
||||
this.stop();
|
||||
this.quickGlanceStop();
|
||||
this.hideSettingsUi();
|
||||
}
|
||||
|
||||
@@ -122,6 +123,10 @@ export class StreamStats {
|
||||
isGlancing = () => this.$container.dataset.display === 'glancing';
|
||||
|
||||
onStreamHudStateChanged({ state }: { state: string }) {
|
||||
if (!getStreamPref(StreamPref.STATS_QUICK_GLANCE_ENABLED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (state === 'expanded') {
|
||||
this.isHidden() && this.start(true);
|
||||
} else {
|
||||
@@ -129,18 +134,6 @@ export class StreamStats {
|
||||
}
|
||||
}
|
||||
|
||||
quickGlanceSetup() {
|
||||
if (!STATES.isPlaying) {
|
||||
return;
|
||||
}
|
||||
|
||||
BxEventBus.Stream.on('ui.streamHud.expanded', this.boundOnStreamHudStateChanged);
|
||||
}
|
||||
|
||||
quickGlanceStop() {
|
||||
BxEventBus.Stream.off('ui.streamHud.expanded', this.boundOnStreamHudStateChanged);
|
||||
}
|
||||
|
||||
private update = async (forceUpdate=false) => {
|
||||
if ((!forceUpdate && this.isHidden()) || !STATES.currentStream.peerConnection) {
|
||||
this.destroy();
|
||||
@@ -232,7 +225,6 @@ export class StreamStats {
|
||||
if (PREF_STATS_SHOW_WHEN_PLAYING) {
|
||||
streamStats.start();
|
||||
} else if (PREF_STATS_QUICK_GLANCE) {
|
||||
streamStats.quickGlanceSetup();
|
||||
// Show stats bar
|
||||
!PREF_STATS_SHOW_WHEN_PLAYING && streamStats.start(true);
|
||||
}
|
||||
|
Reference in New Issue
Block a user