mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-05 20:58:27 +02:00
Migrate Remote Play popup to Navigation dialog
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { BxEvent } from "@utils/bx-event";
|
||||
import { LoadingScreen } from "@modules/loading-screen";
|
||||
import { RemotePlay } from "@modules/remote-play";
|
||||
import { RemotePlayManager } from "@/modules/remote-play-manager";
|
||||
import { HeaderSection } from "@/modules/ui/header";
|
||||
import { NavigationDialogManager } from "@/modules/ui/dialog/navigation-dialog";
|
||||
|
||||
@@ -24,7 +24,7 @@ export function onHistoryChanged(e: PopStateEvent) {
|
||||
return;
|
||||
}
|
||||
|
||||
window.setTimeout(RemotePlay.detect, 10);
|
||||
window.setTimeout(RemotePlayManager.detect, 10);
|
||||
|
||||
// Hide Global settings
|
||||
const $settings = document.querySelector('.bx-settings-container');
|
||||
@@ -35,9 +35,6 @@ export function onHistoryChanged(e: PopStateEvent) {
|
||||
// Hide Navigation dialog
|
||||
NavigationDialogManager.getInstance().hide();
|
||||
|
||||
// Hide Remote Play popup
|
||||
RemotePlay.detachPopup();
|
||||
|
||||
LoadingScreen.reset();
|
||||
window.setTimeout(HeaderSection.watchHeader, 2000);
|
||||
|
||||
|
@@ -254,6 +254,7 @@ export function patchPointerLockApi() {
|
||||
});
|
||||
|
||||
// const nativeRequestPointerLock = HTMLElement.prototype.requestPointerLock;
|
||||
// @ts-ignore
|
||||
HTMLElement.prototype.requestPointerLock = function() {
|
||||
pointerLockElement = document.documentElement;
|
||||
window.dispatchEvent(new Event(BxEvent.POINTER_LOCK_REQUESTED));
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { LoadingScreen } from "@modules/loading-screen";
|
||||
import { RemotePlay } from "@modules/remote-play";
|
||||
import { RemotePlayManager } from "@/modules/remote-play-manager";
|
||||
import { StreamBadges } from "@modules/stream/stream-badges";
|
||||
import { TouchController } from "@modules/touch-controller";
|
||||
import { BxEvent } from "./bx-event";
|
||||
@@ -30,7 +30,7 @@ class XcloudInterceptor {
|
||||
const obj = await response.clone().json();
|
||||
|
||||
// Store xCloud token
|
||||
RemotePlay.XCLOUD_TOKEN = obj.gsToken;
|
||||
RemotePlayManager.getInstance().xcloudToken = obj.gsToken;
|
||||
|
||||
// Get server list
|
||||
const serverEmojis = {
|
||||
|
@@ -1,4 +1,3 @@
|
||||
import { RemotePlay } from "@/modules/remote-play";
|
||||
import { TouchController } from "@/modules/touch-controller";
|
||||
import { BxEvent } from "./bx-event";
|
||||
import { SupportedInputType } from "./bx-exposed";
|
||||
@@ -8,6 +7,7 @@ import { patchIceCandidates } from "./network";
|
||||
import { PrefKey } from "@/enums/pref-keys";
|
||||
import { getPref, StreamResolution, StreamTouchController } from "./settings-storages/global-settings-storage";
|
||||
import type { RemotePlayConsoleAddresses } from "@/types/network";
|
||||
import { RemotePlayManager } from "@/modules/remote-play-manager";
|
||||
|
||||
export class XhomeInterceptor {
|
||||
static #consoleAddrs: RemotePlayConsoleAddresses = {};
|
||||
@@ -111,7 +111,7 @@ export class XhomeInterceptor {
|
||||
for (const pair of (clone.headers as any).entries()) {
|
||||
headers[pair[0]] = pair[1];
|
||||
}
|
||||
headers.authorization = `Bearer ${RemotePlay.XCLOUD_TOKEN}`;
|
||||
headers.authorization = `Bearer ${RemotePlayManager.getInstance().xcloudToken}`;
|
||||
|
||||
const index = request.url.indexOf('.xboxlive.com');
|
||||
request = new Request('https://wus.core.gssv-play-prod' + request.url.substring(index), {
|
||||
@@ -146,10 +146,10 @@ export class XhomeInterceptor {
|
||||
headers[pair[0]] = pair[1];
|
||||
}
|
||||
// Add xHome token to headers
|
||||
headers.authorization = `Bearer ${RemotePlay.XHOME_TOKEN}`;
|
||||
headers.authorization = `Bearer ${RemotePlayManager.getInstance().xhomeToken}`;
|
||||
|
||||
// Patch resolution
|
||||
const deviceInfo = RemotePlay.BASE_DEVICE_INFO;
|
||||
const deviceInfo = RemotePlayManager.BASE_DEVICE_INFO;
|
||||
if (getPref(PrefKey.REMOTE_PLAY_RESOLUTION) === StreamResolution.DIM_720P) {
|
||||
deviceInfo.dev.os.name = 'android';
|
||||
}
|
||||
|
Reference in New Issue
Block a user