mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-05-08 08:58:38 +01:00
Add backup validation to settings
This commit is contained in:
@@ -14,6 +14,7 @@ import classNames from 'classnames';
|
||||
import * as LocaleMatcher from '@formatjs/intl-localematcher';
|
||||
|
||||
import type { MediaDeviceSettings } from '../types/Calling';
|
||||
import type { ExportResultType as BackupExportResultType } from '../services/backups';
|
||||
import type {
|
||||
AutoDownloadAttachmentType,
|
||||
NotificationSettingType,
|
||||
@@ -75,6 +76,7 @@ import {
|
||||
SettingsRow,
|
||||
} from './PreferencesUtil';
|
||||
import { PreferencesBackups } from './PreferencesBackups';
|
||||
import { PreferencesInternal } from './PreferencesInternal';
|
||||
import { FunEmojiLocalizationProvider } from './fun/FunEmojiLocalizationProvider';
|
||||
|
||||
type CheckboxChangeHandlerType = (value: boolean) => unknown;
|
||||
@@ -145,6 +147,7 @@ export type PropsDataType = {
|
||||
isSyncSupported: boolean;
|
||||
isSystemTraySupported: boolean;
|
||||
isMinimizeToAndStartInSystemTraySupported: boolean;
|
||||
isInternalUser: boolean;
|
||||
|
||||
availableCameras: Array<
|
||||
Pick<MediaDeviceInfo, 'deviceId' | 'groupId' | 'kind' | 'label'>
|
||||
@@ -175,6 +178,7 @@ type PropsFunctionType = {
|
||||
value: CustomColorType;
|
||||
}
|
||||
) => unknown;
|
||||
validateBackup: () => Promise<BackupExportResultType>;
|
||||
|
||||
// Change handlers
|
||||
onAudioNotificationsChange: CheckboxChangeHandlerType;
|
||||
@@ -232,6 +236,7 @@ export enum Page {
|
||||
Privacy = 'Privacy',
|
||||
DataUsage = 'DataUsage',
|
||||
Backups = 'Backups',
|
||||
Internal = 'Internal',
|
||||
|
||||
// Sub pages
|
||||
ChatColor = 'ChatColor',
|
||||
@@ -319,6 +324,7 @@ export function Preferences({
|
||||
isSyncSupported,
|
||||
isSystemTraySupported,
|
||||
isMinimizeToAndStartInSystemTraySupported,
|
||||
isInternalUser,
|
||||
lastSyncTime,
|
||||
makeSyncRequest,
|
||||
notificationContent,
|
||||
@@ -373,6 +379,7 @@ export function Preferences({
|
||||
localeOverride,
|
||||
themeSetting,
|
||||
universalExpireTimer = DurationInSeconds.ZERO,
|
||||
validateBackup,
|
||||
whoCanFindMe,
|
||||
whoCanSeeMe,
|
||||
zoomFactor,
|
||||
@@ -410,6 +417,9 @@ export function Preferences({
|
||||
if (page === Page.Backups && !shouldShowBackupsPage) {
|
||||
setPage(Page.General);
|
||||
}
|
||||
if (page === Page.Internal && !isInternalUser) {
|
||||
setPage(Page.General);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (page === Page.Backups) {
|
||||
@@ -1728,6 +1738,10 @@ export function Preferences({
|
||||
locale={resolvedLocale}
|
||||
/>
|
||||
);
|
||||
} else if (page === Page.Internal) {
|
||||
settings = (
|
||||
<PreferencesInternal i18n={i18n} validateBackup={validateBackup} />
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -1829,6 +1843,19 @@ export function Preferences({
|
||||
{i18n('icu:Preferences__button--backups')}
|
||||
</button>
|
||||
) : null}
|
||||
{isInternalUser ? (
|
||||
<button
|
||||
type="button"
|
||||
className={classNames({
|
||||
Preferences__button: true,
|
||||
'Preferences__button--internal': true,
|
||||
'Preferences__button--selected': page === Page.Internal,
|
||||
})}
|
||||
onClick={() => setPage(Page.Internal)}
|
||||
>
|
||||
{i18n('icu:Preferences__button--internal')}
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="Preferences__settings-pane" ref={settingsPaneRef}>
|
||||
{settings}
|
||||
|
||||
Reference in New Issue
Block a user