Update script in app when clicking on the "Version x available" button

This commit is contained in:
redphx 2024-09-07 16:43:56 +07:00
parent 714178a82d
commit 07ebf3926b
4 changed files with 38 additions and 10 deletions

View File

@ -1,5 +1,5 @@
import { onChangeVideoPlayerType, updateVideoPlayer } from "@/modules/stream/stream-settings-utils";
import { ButtonStyle, CE, createButton, createSvgIcon, removeChildElements } from "@/utils/html";
import { ButtonStyle, CE, createButton, createSvgIcon, removeChildElements, type BxButton } from "@/utils/html";
import { NavigationDialog, NavigationDirection } from "./navigation-dialog";
import { ControllerShortcut } from "@/modules/controller-shortcut";
import { MkbRemapper } from "@/modules/mkb/mkb-remapper";
@ -97,12 +97,19 @@ export class SettingsNavigationDialog extends NavigationDialog {
// "New version available" button
if (!SCRIPT_VERSION.includes('beta') && PREF_LATEST_VERSION && PREF_LATEST_VERSION != SCRIPT_VERSION) {
// Show new version indicator
topButtons.push(createButton({
label: `🌟 Version ${PREF_LATEST_VERSION} available`,
// Show new version button
const opts = {
label: '🌟 ' + t('new-version-available', {version: PREF_LATEST_VERSION}),
style: ButtonStyle.PRIMARY | ButtonStyle.FOCUSABLE | ButtonStyle.FULL_WIDTH,
url: 'https://github.com/redphx/better-xcloud/releases/latest',
}));
} as BxButton;
if (AppInterface && AppInterface.updateLatestScript) {
opts.onClick = e => AppInterface.updateLatestScript();
} else {
opts.url = 'https://github.com/redphx/better-xcloud/releases/latest';
}
topButtons.push(createButton(opts));
}
// Buttons for Android app

View File

@ -32,7 +32,7 @@ const ButtonStyleClass = {
[ButtonStyle.NORMAL_LINK]: 'bx-normal-link',
}
type BxButton = {
export type BxButton = {
style?: ButtonStyle;
url?: string;
classes?: string[];

View File

@ -584,7 +584,7 @@ export class GlobalSettingsStorage extends BaseSettingsStorage {
default: 'default',
options: {
'default': t('default'),
'low-power': t('low-power'),
'low-power': t('battery-saving'),
'high-performance': t('high-performance'),
},
suggest: {

View File

@ -47,6 +47,7 @@ const Texts = {
"badge-playtime": "Playtime",
"badge-server": "Server",
"badge-video": "Video",
"battery-saving": "Battery saving",
"better-xcloud": "Better xCloud",
"bitrate-audio-maximum": "Maximum audio bitrate",
"bitrate-video-maximum": "Maximum video bitrate",
@ -142,7 +143,6 @@ const Texts = {
"load-failed-message": "Failed to run Better xCloud",
"loading-screen": "Loading screen",
"local-co-op": "Local co-op",
"low-power": "Low power",
"lowest-quality": "Lowest quality",
"map-mouse-to": "Map mouse to",
"may-not-work-properly": "May not work properly!",
@ -157,6 +157,27 @@ const Texts = {
"name": "Name",
"native-mkb": "Native Mouse & Keyboard",
"new": "New",
"new-version-available": [
(e: any) => `Version ${e.version} available`,
,
,
,
,
,
,
,
(e: any) => `Ver ${e.version} が利用可能です`,
(e: any) => `${e.version} 버전 사용가능`,
,
,
,
,
,
,
(e: any) => `Đã có phiên bản ${e.version}`,
,
,
],
"no-consoles-found": "No consoles found",
"normal": "Normal",
"off": "Off",
@ -199,7 +220,7 @@ const Texts = {
"recommended": "Recommended",
"recommended-settings-for-device": [
(e: any) => `Recommended settings for ${e.device}`,
,
(e: any) => `Configuració recomanada per a ${e.device}`,
,
(e: any) => `Empfohlene Einstellungen für ${e.device}`,
,