Update locale files for English, Traditional Chinese, and Simplified Chinese to include new confirmation prompts for enabling audio effects; refactor EffectsPage and EQPage to integrate FeatureGate for managing effect states and user interactions.
This commit is contained in:
@@ -11,6 +11,7 @@ import { ChevronLeft, ChevronRight } from "lucide-react";
|
||||
import { useLocation } from "wouter";
|
||||
import { useState, useEffect, useRef, useMemo } from "react";
|
||||
import BottomNav from "@/components/BottomNav";
|
||||
import { FeatureGate } from "@/components/FeatureGate";
|
||||
import { navigateToSelect } from "./SelectPage";
|
||||
import localeZh from "@/locales/data-zh.json";
|
||||
import localeZhHK from "@/locales/data-zh-HK.json";
|
||||
@@ -85,7 +86,9 @@ export default function EffectsPage() {
|
||||
);
|
||||
|
||||
const ds = deviceState;
|
||||
const effectOn = (ds?.audio_enable ?? 0) === 1;
|
||||
const bypassOn = (ds?.dsp_enable ?? 0) === 0;
|
||||
const audioOn = (ds?.audio_enable ?? 0) === 1;
|
||||
const effectOn = audioOn && !bypassOn;
|
||||
const widthOn = (ds?.width_enable ?? 0) === 1;
|
||||
const widthVal = ds?.width_value ?? 50;
|
||||
const crossfeedOn = (ds?.crossfeed_enable ?? 0) === 1;
|
||||
@@ -152,10 +155,34 @@ export default function EffectsPage() {
|
||||
<ChevronLeft size={24} />
|
||||
</button>
|
||||
<h1 className="flex-1 text-center text-[17px] font-semibold text-white">{effectText.pageTitle}</h1>
|
||||
<IOSToggle checked={effectOn} onChange={(v) => updateSetting({ audio_enable: v ? 1 : 0 })} />
|
||||
<IOSToggle
|
||||
checked={effectOn}
|
||||
onChange={(v) => {
|
||||
if (v) {
|
||||
void updateSetting(
|
||||
bypassOn ? { audio_enable: 1, dsp_enable: 1 } : { audio_enable: 1 },
|
||||
);
|
||||
} else {
|
||||
void updateSetting({ audio_enable: 0 });
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="px-4 pb-32 pt-3 space-y-3">
|
||||
<FeatureGate
|
||||
enabled={effectOn}
|
||||
className="px-4 pb-32 pt-3 space-y-3"
|
||||
labels={{
|
||||
title: effectText.enableConfirmTitle ?? "音效未开启",
|
||||
description: effectText.enableConfirmDesc ?? "当前 Effect 功能已关闭,是否开启?",
|
||||
cancel: effectText.enableConfirmCancel ?? "取消",
|
||||
confirm: effectText.enableConfirmOk ?? "开启",
|
||||
}}
|
||||
onEnable={() => {
|
||||
const bypass = (ds?.dsp_enable ?? 0) === 0;
|
||||
return updateSetting(bypass ? { audio_enable: 1, dsp_enable: 1 } : { audio_enable: 1 });
|
||||
}}
|
||||
>
|
||||
{/* ── Style ── */}
|
||||
<div className="ios-list-group p-4">
|
||||
<div className="flex items-center justify-between mb-3">
|
||||
@@ -362,7 +389,7 @@ export default function EffectsPage() {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</FeatureGate>
|
||||
</div>
|
||||
|
||||
<BottomNav />
|
||||
|
||||
Reference in New Issue
Block a user