mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-10-28 16:54:11 +08:00
[feat] add system language support across desktop and mobile
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { tr } from './Localization';
|
||||
export interface PrivacyStatus {
|
||||
state: number; supported: boolean; input_block_supported: boolean;
|
||||
overlay_active: boolean; input_blocked: boolean; remote_paused: boolean;
|
||||
@@ -44,10 +45,10 @@ export class RemotePrivacyScreen {
|
||||
return s !== undefined && this.fresh(now) && s.state === 3 && s.overlay_active && !s.remote_paused;
|
||||
}
|
||||
buttonTitle(now: number): string {
|
||||
if (this.enabled(now)) return '隐私屏已开启';
|
||||
if (this.enabled(now)) return tr("隐私屏已开启");
|
||||
const s = this.snapshot;
|
||||
if (this.fresh(now) && s?.supported && s.state === 1 && !this.active()) return '隐私屏已关闭';
|
||||
return '隐私屏';
|
||||
if (this.fresh(now) && s?.supported && s.state === 1 && !this.active()) return tr("隐私屏已关闭");
|
||||
return tr("隐私屏");
|
||||
}
|
||||
feedback(now: number): string {
|
||||
if (!this.desktopAvailable) return '';
|
||||
@@ -73,26 +74,26 @@ export class RemotePrivacyScreen {
|
||||
return this.requestId;
|
||||
}
|
||||
failed(id: number): void {
|
||||
if (this.pending && this.requestId === id) { this.pending = false; this.failure = '指令发送失败,请重试'; }
|
||||
if (this.pending && this.requestId === id) { this.pending = false; this.failure = tr("指令发送失败,请重试"); }
|
||||
}
|
||||
tick(now: number): void {
|
||||
if (this.pending && now - this.requestedAt >= 15000) {
|
||||
this.pending = false; this.failure = '请求超时,尚未确认电脑的隐私屏状态';
|
||||
this.pending = false; this.failure = tr("请求超时,尚未确认电脑的隐私屏状态");
|
||||
}
|
||||
}
|
||||
status(now: number): string {
|
||||
if (this.failure) return this.failure;
|
||||
const s = this.snapshot;
|
||||
if (!s) return '等待电脑返回隐私屏状态;旧版电脑端可能不支持';
|
||||
if (!this.fresh(now)) return '隐私屏状态已过期,等待电脑确认';
|
||||
if (s.state === 2) return '正在开启隐私屏…';
|
||||
if (s.state === 4) return '正在关闭隐私屏…';
|
||||
if (this.pending) return '指令已发送,等待电脑确认…';
|
||||
if (s.state === 5) return '隐私屏异常';
|
||||
if (!s.supported || s.state === 0) return '隐私屏暂不可用';
|
||||
if (!s) return tr("等待电脑返回隐私屏状态;旧版电脑端可能不支持");
|
||||
if (!this.fresh(now)) return tr("隐私屏状态已过期,等待电脑确认");
|
||||
if (s.state === 2) return tr("正在开启隐私屏…");
|
||||
if (s.state === 4) return tr("正在关闭隐私屏…");
|
||||
if (this.pending) return tr("指令已发送,等待电脑确认…");
|
||||
if (s.state === 5) return tr("隐私屏异常");
|
||||
if (!s.supported || s.state === 0) return tr("隐私屏暂不可用");
|
||||
if (s.state === 3 && s.overlay_active && !s.remote_paused)
|
||||
return '隐私屏已开启';
|
||||
return s.state === 1 && !this.active() ? '隐私屏已关闭' : '隐私屏状态待确认';
|
||||
return tr("隐私屏已开启");
|
||||
return s.state === 1 && !this.active() ? tr("隐私屏已关闭") : tr("隐私屏状态待确认");
|
||||
}
|
||||
detail(now: number): string {
|
||||
const s = this.snapshot;
|
||||
|
||||
Reference in New Issue
Block a user