New state for Update Dialog
This commit is contained in:
parent
5949cc11b1
commit
a1ab62f878
8 changed files with 93 additions and 29 deletions
|
@ -2196,7 +2196,7 @@
|
||||||
"message": "Relink"
|
"message": "Relink"
|
||||||
},
|
},
|
||||||
"autoUpdateNewVersionTitle": {
|
"autoUpdateNewVersionTitle": {
|
||||||
"message": "Update available"
|
"message": "Update Available"
|
||||||
},
|
},
|
||||||
"autoUpdateRetry": {
|
"autoUpdateRetry": {
|
||||||
"message": "Retry update"
|
"message": "Retry update"
|
||||||
|
@ -5599,6 +5599,14 @@
|
||||||
"message": "Update to version $version$ available",
|
"message": "Update to version $version$ available",
|
||||||
"description": "Tooltip for new update available"
|
"description": "Tooltip for new update available"
|
||||||
},
|
},
|
||||||
|
"icu:DialogUpdate__downloading": {
|
||||||
|
"messageformat": "Downloading Update...",
|
||||||
|
"description": "The title of update dialog when update download is in progress."
|
||||||
|
},
|
||||||
|
"icu:DialogUpdate__downloaded": {
|
||||||
|
"messageformat": "Update Downloaded",
|
||||||
|
"description": "The title of update dialog when update download is completed."
|
||||||
|
},
|
||||||
"NSIS__retry-dialog--first-line": {
|
"NSIS__retry-dialog--first-line": {
|
||||||
"message": "Signal cannot be closed.",
|
"message": "Signal cannot be closed.",
|
||||||
"description": "First line of the dialog displayed when Windows installer can't close application automatically and needs user intervention to complete the installation."
|
"description": "First line of the dialog displayed when Windows installer can't close application automatically and needs user intervention to complete the installation."
|
||||||
|
|
|
@ -24,10 +24,15 @@
|
||||||
cursor: inherit;
|
cursor: inherit;
|
||||||
display: flex;
|
display: flex;
|
||||||
min-height: 64px;
|
min-height: 64px;
|
||||||
padding: 12px 18px;
|
padding: 12px 14px 12px 16px;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 18px;
|
||||||
|
letter-spacing: -0.0025em;
|
||||||
|
font-weight: 400;
|
||||||
|
|
||||||
.module-left-pane--width-narrow & {
|
.module-left-pane--width-narrow & {
|
||||||
padding-left: 36px;
|
padding-left: 36px;
|
||||||
}
|
}
|
||||||
|
@ -108,6 +113,7 @@
|
||||||
&__action-text {
|
&__action-text {
|
||||||
@include button-reset;
|
@include button-reset;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
color: $color-white-alpha-80;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__close-button {
|
&__close-button {
|
||||||
|
@ -115,8 +121,8 @@
|
||||||
|
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
float: right;
|
float: right;
|
||||||
height: 24px;
|
height: 20px;
|
||||||
width: 24px;
|
width: 20px;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
-webkit-mask: url('../images/icons/v2/x-24.svg') no-repeat center;
|
-webkit-mask: url('../images/icons/v2/x-24.svg') no-repeat center;
|
||||||
|
@ -174,7 +180,6 @@
|
||||||
@include font-body-1-bold;
|
@include font-body-1-bold;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
}
|
||||||
span {
|
span {
|
||||||
@include font-body-1;
|
@include font-body-1;
|
||||||
|
@ -193,6 +198,10 @@
|
||||||
a {
|
a {
|
||||||
color: $error-text-color;
|
color: $error-text-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.LeftPaneDialog__action-text {
|
||||||
|
color: $error-text-color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&--warning {
|
&--warning {
|
||||||
|
@ -218,6 +227,10 @@
|
||||||
background-color: WindowText;
|
background-color: WindowText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.LeftPaneDialog__action-text {
|
||||||
|
color: $warning-text-color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__progress {
|
&__progress {
|
||||||
|
@ -228,6 +241,7 @@
|
||||||
max-width: 210px;
|
max-width: 210px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
margin: 10px 0 6px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
&--bar {
|
&--bar {
|
||||||
|
|
|
@ -37,7 +37,7 @@ export function KnobsPlayground(): JSX.Element {
|
||||||
WidthBreakpoint,
|
WidthBreakpoint,
|
||||||
WidthBreakpoint.Wide
|
WidthBreakpoint.Wide
|
||||||
);
|
);
|
||||||
const dialogType = select('dialogType', DialogType, DialogType.Update);
|
const dialogType = select('dialogType', DialogType, DialogType.AutoUpdate);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FakeLeftPaneContainer containerWidthBreakpoint={containerWidthBreakpoint}>
|
<FakeLeftPaneContainer containerWidthBreakpoint={containerWidthBreakpoint}>
|
||||||
|
@ -57,7 +57,7 @@ export function UpdateWide(): JSX.Element {
|
||||||
<DialogUpdate
|
<DialogUpdate
|
||||||
{...defaultProps}
|
{...defaultProps}
|
||||||
containerWidthBreakpoint={WidthBreakpoint.Wide}
|
containerWidthBreakpoint={WidthBreakpoint.Wide}
|
||||||
dialogType={DialogType.Update}
|
dialogType={DialogType.AutoUpdate}
|
||||||
currentVersion="5.24.0"
|
currentVersion="5.24.0"
|
||||||
/>
|
/>
|
||||||
</FakeLeftPaneContainer>
|
</FakeLeftPaneContainer>
|
||||||
|
@ -68,6 +68,23 @@ UpdateWide.story = {
|
||||||
name: 'Update (Wide)',
|
name: 'Update (Wide)',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function DownloadedWide(): JSX.Element {
|
||||||
|
return (
|
||||||
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Wide}>
|
||||||
|
<DialogUpdate
|
||||||
|
{...defaultProps}
|
||||||
|
containerWidthBreakpoint={WidthBreakpoint.Wide}
|
||||||
|
dialogType={DialogType.DownloadedUpdate}
|
||||||
|
currentVersion="5.24.0"
|
||||||
|
/>
|
||||||
|
</FakeLeftPaneContainer>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
DownloadedWide.story = {
|
||||||
|
name: 'Downloaded (Wide)',
|
||||||
|
};
|
||||||
|
|
||||||
export function DownloadReadyWide(): JSX.Element {
|
export function DownloadReadyWide(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Wide}>
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Wide}>
|
||||||
|
@ -248,7 +265,7 @@ export function UpdateNarrow(): JSX.Element {
|
||||||
<DialogUpdate
|
<DialogUpdate
|
||||||
{...defaultProps}
|
{...defaultProps}
|
||||||
containerWidthBreakpoint={WidthBreakpoint.Narrow}
|
containerWidthBreakpoint={WidthBreakpoint.Narrow}
|
||||||
dialogType={DialogType.Update}
|
dialogType={DialogType.AutoUpdate}
|
||||||
currentVersion="5.24.0"
|
currentVersion="5.24.0"
|
||||||
/>
|
/>
|
||||||
</FakeLeftPaneContainer>
|
</FakeLeftPaneContainer>
|
||||||
|
@ -259,6 +276,23 @@ UpdateNarrow.story = {
|
||||||
name: 'Update (Narrow)',
|
name: 'Update (Narrow)',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function DownloadedNarrow(): JSX.Element {
|
||||||
|
return (
|
||||||
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Narrow}>
|
||||||
|
<DialogUpdate
|
||||||
|
{...defaultProps}
|
||||||
|
containerWidthBreakpoint={WidthBreakpoint.Narrow}
|
||||||
|
dialogType={DialogType.DownloadedUpdate}
|
||||||
|
currentVersion="5.24.0"
|
||||||
|
/>
|
||||||
|
</FakeLeftPaneContainer>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
DownloadedNarrow.story = {
|
||||||
|
name: 'Downloaded (Narrow)',
|
||||||
|
};
|
||||||
|
|
||||||
export function DownloadReadyNarrow(): JSX.Element {
|
export function DownloadReadyNarrow(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Narrow}>
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Narrow}>
|
||||||
|
|
|
@ -162,17 +162,6 @@ export function DialogUpdate({
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
let title = i18n('autoUpdateNewVersionTitle');
|
|
||||||
|
|
||||||
if (
|
|
||||||
downloadSize &&
|
|
||||||
(dialogType === DialogType.DownloadReady ||
|
|
||||||
dialogType === DialogType.FullDownloadReady ||
|
|
||||||
dialogType === DialogType.Downloading)
|
|
||||||
) {
|
|
||||||
title += ` (${formatFileSize(downloadSize, { round: 0 })})`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const versionTitle = version
|
const versionTitle = version
|
||||||
? i18n('DialogUpdate--version-available', [version])
|
? i18n('DialogUpdate--version-available', [version])
|
||||||
: undefined;
|
: undefined;
|
||||||
|
@ -186,7 +175,7 @@ export function DialogUpdate({
|
||||||
<LeftPaneDialog
|
<LeftPaneDialog
|
||||||
containerWidthBreakpoint={containerWidthBreakpoint}
|
containerWidthBreakpoint={containerWidthBreakpoint}
|
||||||
icon="update"
|
icon="update"
|
||||||
title={title}
|
title={i18n('icu:DialogUpdate__downloading')}
|
||||||
hoverText={versionTitle}
|
hoverText={versionTitle}
|
||||||
>
|
>
|
||||||
<div className="LeftPaneDialog__progress--container">
|
<div className="LeftPaneDialog__progress--container">
|
||||||
|
@ -199,15 +188,25 @@ export function DialogUpdate({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let clickLabel: string;
|
let title = i18n('autoUpdateNewVersionTitle');
|
||||||
|
|
||||||
|
if (
|
||||||
|
downloadSize &&
|
||||||
|
(dialogType === DialogType.DownloadReady ||
|
||||||
|
dialogType === DialogType.FullDownloadReady)
|
||||||
|
) {
|
||||||
|
title += ` (${formatFileSize(downloadSize, { round: 0 })})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
let clickLabel = i18n('autoUpdateNewVersionMessage');
|
||||||
let type: 'warning' | undefined;
|
let type: 'warning' | undefined;
|
||||||
if (dialogType === DialogType.DownloadReady) {
|
if (dialogType === DialogType.DownloadReady) {
|
||||||
clickLabel = i18n('downloadNewVersionMessage');
|
clickLabel = i18n('downloadNewVersionMessage');
|
||||||
} else if (dialogType === DialogType.FullDownloadReady) {
|
} else if (dialogType === DialogType.FullDownloadReady) {
|
||||||
clickLabel = i18n('downloadFullNewVersionMessage');
|
clickLabel = i18n('downloadFullNewVersionMessage');
|
||||||
type = 'warning';
|
type = 'warning';
|
||||||
} else {
|
} else if (dialogType === DialogType.DownloadedUpdate) {
|
||||||
clickLabel = i18n('autoUpdateNewVersionMessage');
|
title = i18n('icu:DialogUpdate__downloaded');
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -205,7 +205,7 @@ const useProps = (overrideProps: OverridePropsType = {}): PropsType => {
|
||||||
<DialogUpdate
|
<DialogUpdate
|
||||||
i18n={i18n}
|
i18n={i18n}
|
||||||
dialogType={
|
dialogType={
|
||||||
isUpdateDownloaded ? DialogType.Update : DialogType.DownloadReady
|
isUpdateDownloaded ? DialogType.AutoUpdate : DialogType.DownloadReady
|
||||||
}
|
}
|
||||||
dismissDialog={action('dismissUpdate')}
|
dismissDialog={action('dismissUpdate')}
|
||||||
snoozeUpdate={action('snoozeUpdate')}
|
snoozeUpdate={action('snoozeUpdate')}
|
||||||
|
|
|
@ -33,7 +33,9 @@ export const isUpdateDialogVisible = createSelector(
|
||||||
|
|
||||||
export const isUpdateDownloaded = createSelector(
|
export const isUpdateDownloaded = createSelector(
|
||||||
getUpdatesState,
|
getUpdatesState,
|
||||||
({ dialogType }) => dialogType === DialogType.Update
|
({ dialogType }) =>
|
||||||
|
dialogType === DialogType.AutoUpdate ||
|
||||||
|
dialogType === DialogType.DownloadedUpdate
|
||||||
);
|
);
|
||||||
|
|
||||||
export const isOSUnsupported = createSelector(
|
export const isOSUnsupported = createSelector(
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
export enum DialogType {
|
export enum DialogType {
|
||||||
None = 'None',
|
None = 'None',
|
||||||
Update = 'Update',
|
AutoUpdate = 'AutoUpdate',
|
||||||
Cannot_Update = 'Cannot_Update',
|
Cannot_Update = 'Cannot_Update',
|
||||||
Cannot_Update_Require_Manual = 'Cannot_Update_Require_Manual',
|
Cannot_Update_Require_Manual = 'Cannot_Update_Require_Manual',
|
||||||
UnsupportedOS = 'UnsupportedOS',
|
UnsupportedOS = 'UnsupportedOS',
|
||||||
|
@ -11,4 +11,5 @@ export enum DialogType {
|
||||||
DownloadReady = 'DownloadReady',
|
DownloadReady = 'DownloadReady',
|
||||||
FullDownloadReady = 'FullDownloadReady',
|
FullDownloadReady = 'FullDownloadReady',
|
||||||
Downloading = 'Downloading',
|
Downloading = 'Downloading',
|
||||||
|
DownloadedUpdate = 'DownloadedUpdate',
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,9 +260,15 @@ export abstract class Updater {
|
||||||
const mainWindow = this.getMainWindow();
|
const mainWindow = this.getMainWindow();
|
||||||
if (mainWindow) {
|
if (mainWindow) {
|
||||||
logger.info('downloadAndInstall: showing update dialog...');
|
logger.info('downloadAndInstall: showing update dialog...');
|
||||||
mainWindow.webContents.send('show-update-dialog', DialogType.Update, {
|
mainWindow.webContents.send(
|
||||||
|
'show-update-dialog',
|
||||||
|
mode === DownloadMode.Automatic
|
||||||
|
? DialogType.AutoUpdate
|
||||||
|
: DialogType.DownloadedUpdate,
|
||||||
|
{
|
||||||
version: this.version,
|
version: this.version,
|
||||||
});
|
}
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
'downloadAndInstall: no mainWindow, cannot show update dialog'
|
'downloadAndInstall: no mainWindow, cannot show update dialog'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue