Settings Tab: Show updates dialog in all states but None

This commit is contained in:
Scott Nonnenberg
2025-06-11 06:36:50 +10:00
committed by GitHub
parent c3b2c7af27
commit 3570653172
4 changed files with 26 additions and 28 deletions

View File

@@ -216,7 +216,6 @@ export default {
hasMinimizeToSystemTray: true,
hasNotificationAttention: false,
hasNotifications: true,
hasPendingUpdate: false,
hasReadReceipts: true,
hasRelayCalls: false,
hasSpellCheck: true,
@@ -234,7 +233,6 @@ export default {
isContentProtectionSupported: true,
isContentProtectionNeeded: true,
isMinimizeToAndStartInSystemTraySupported: true,
isUpdateDownloaded: false,
lastSyncTime: Date.now(),
localeOverride: null,
localBackupFolder: undefined,
@@ -255,6 +253,7 @@ export default {
selectedMicrophone: availableMicrophones[0],
selectedSpeaker: availableSpeakers[1],
sentMediaQualitySetting: 'standard',
shouldShowUpdateDialog: false,
themeSetting: 'system',
theme: ThemeType.light,
universalExpireTimer: DurationInSeconds.HOUR,
@@ -539,14 +538,9 @@ LocalBackupsSetupViewBackupKey.args = {
localBackupFolder: '/home/signaluser/Signal Backups/',
};
export const UpdateAvailable = Template.bind({});
UpdateAvailable.args = {
hasPendingUpdate: true,
};
export const UpdateDownloaded = Template.bind({});
UpdateDownloaded.args = {
isUpdateDownloaded: true,
export const ShowingUpdateDialog = Template.bind({});
ShowingUpdateDialog.args = {
shouldShowUpdateDialog: true,
};
export const NavTabsCollapsed = Template.bind({});

View File

@@ -149,16 +149,15 @@ export type PropsDataType = {
resolvedLocale: string;
// Other props
badge: BadgeType | undefined;
hasFailedStorySends: boolean;
hasPendingUpdate: boolean;
initialSpellCheckSetting: boolean;
isUpdateDownloaded: boolean;
me: ConversationType;
navTabsCollapsed: boolean;
otherTabsUnreadStats: UnreadStats;
me: ConversationType;
badge: BadgeType | undefined;
theme: ThemeType;
preferredWidthFromStorage: number;
shouldShowUpdateDialog: boolean;
theme: ThemeType;
// Limited support features
isAutoDownloadUpdatesSupported: boolean;
@@ -365,7 +364,6 @@ export function Preferences({
hasMinimizeToSystemTray,
hasNotificationAttention,
hasNotifications,
hasPendingUpdate,
hasReadReceipts,
hasRelayCalls,
hasSpellCheck,
@@ -384,7 +382,6 @@ export function Preferences({
isSystemTraySupported,
isMinimizeToAndStartInSystemTraySupported,
isInternalUser,
isUpdateDownloaded,
lastSyncTime,
localBackupFolder,
makeSyncRequest,
@@ -451,6 +448,7 @@ export function Preferences({
sentMediaQualitySetting,
setGlobalDefaultConversationColor,
setPage,
shouldShowUpdateDialog,
showToast,
localeOverride,
theme,
@@ -500,7 +498,7 @@ export function Preferences({
}
let maybeUpdateDialog: JSX.Element | undefined;
if (hasPendingUpdate || isUpdateDownloaded) {
if (shouldShowUpdateDialog) {
maybeUpdateDialog = renderUpdateDialog({
containerWidthBreakpoint: WidthBreakpoint.Wide,
});

View File

@@ -55,10 +55,7 @@ import { sendSyncRequests } from '../../textsecure/syncRequests';
import { SmartUpdateDialog } from './UpdateDialog';
import { Page, Preferences } from '../../components/Preferences';
import { useUpdatesActions } from '../ducks/updates';
import {
getHasPendingUpdate,
isUpdateDownloaded as getIsUpdateDownloaded,
} from '../selectors/updates';
import { getUpdateDialogType } from '../selectors/updates';
import { getHasAnyFailedStorySends } from '../selectors/stories';
import { getOtherTabsUnreadStats, getSelectedLocation } from '../selectors/nav';
import { getPreferredBadgeSelector } from '../selectors/badges';
@@ -74,6 +71,7 @@ import { isLocalBackupsEnabledForRedux } from '../../util/isLocalBackupsEnabled'
import type { StorageAccessType, ZoomFactorType } from '../../types/Storage';
import type { ThemeType } from '../../util/preload';
import type { WidthBreakpoint } from '../../components/_util';
import { DialogType } from '../../types/Dialogs';
const DEFAULT_NOTIFICATION_SETTING = 'message';
@@ -150,8 +148,7 @@ export function SmartPreferences(): JSX.Element | null {
const i18n = useSelector(getIntl);
const items = useSelector(getItems);
const hasFailedStorySends = useSelector(getHasAnyFailedStorySends);
const hasPendingUpdate = useSelector(getHasPendingUpdate);
const isUpdateDownloaded = useSelector(getIsUpdateDownloaded);
const dialogType = useSelector(getUpdateDialogType);
const me = useSelector(getMe);
const navTabsCollapsed = useSelector(getNavTabsCollapsed);
const otherTabsUnreadStats = useSelector(getOtherTabsUnreadStats);
@@ -159,6 +156,7 @@ export function SmartPreferences(): JSX.Element | null {
const theme = useSelector(getTheme);
const badge = useSelector(getPreferredBadgeSelector)(me.badges);
const shouldShowUpdateDialog = dialogType !== DialogType.None;
// The weird ones
@@ -714,7 +712,6 @@ export function SmartPreferences(): JSX.Element | null {
hasMinimizeToSystemTray={hasMinimizeToSystemTray}
hasNotificationAttention={hasNotificationAttention}
hasNotifications={hasNotifications}
hasPendingUpdate={hasPendingUpdate}
hasReadReceipts={hasReadReceipts}
hasRelayCalls={hasRelayCalls}
hasSpellCheck={hasSpellCheck}
@@ -735,7 +732,6 @@ export function SmartPreferences(): JSX.Element | null {
isSyncSupported={isSyncSupported}
isSystemTraySupported={isSystemTraySupported}
isInternalUser={isInternalUser}
isUpdateDownloaded={isUpdateDownloaded}
lastSyncTime={lastSyncTime}
localBackupFolder={localBackupFolder}
localeOverride={localeOverride}
@@ -798,13 +794,14 @@ export function SmartPreferences(): JSX.Element | null {
resetAllChatColors={resetAllChatColors}
resetDefaultChatColor={resetDefaultChatColor}
resolvedLocale={resolvedLocale}
savePreferredLeftPaneWidth={savePreferredLeftPaneWidth}
selectedCamera={selectedCamera}
selectedMicrophone={selectedMicrophone}
selectedSpeaker={selectedSpeaker}
sentMediaQualitySetting={sentMediaQualitySetting}
setGlobalDefaultConversationColor={setGlobalDefaultConversationColor}
setPage={setPage}
savePreferredLeftPaneWidth={savePreferredLeftPaneWidth}
shouldShowUpdateDialog={shouldShowUpdateDialog}
showToast={showToast}
theme={theme}
themeSetting={themeSetting}

View File

@@ -13,6 +13,7 @@ import {
getUpdateDownloadedSize,
getUpdateVersion,
} from '../selectors/updates';
import { DialogType } from '../../types/Dialogs';
type SmartUpdateDialogProps = Readonly<{
containerWidthBreakpoint: WidthBreakpoint;
@@ -29,6 +30,14 @@ export const SmartUpdateDialog = memo(function SmartUpdateDialog({
const downloadSize = useSelector(getUpdateDownloadSize);
const downloadedSize = useSelector(getUpdateDownloadedSize);
const version = useSelector(getUpdateVersion);
const shouldDisableDismiss =
disableDismiss &&
dialogType !== DialogType.Cannot_Update &&
dialogType !== DialogType.Cannot_Update_Require_Manual &&
dialogType !== DialogType.MacOS_Read_Only &&
dialogType !== DialogType.UnsupportedOS;
return (
<DialogUpdate
i18n={i18n}
@@ -39,7 +48,7 @@ export const SmartUpdateDialog = memo(function SmartUpdateDialog({
version={version}
currentVersion={window.getVersion()}
dismissDialog={dismissDialog}
disableDismiss={disableDismiss}
disableDismiss={shouldDisableDismiss}
snoozeUpdate={snoozeUpdate}
startUpdate={startUpdate}
/>