mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-08 05:57:02 +09:00
Change update logic and show release notes on major/minor updates
This commit is contained in:
parent
89213958c7
commit
b956807e84
4 changed files with 47 additions and 16 deletions
|
@ -41,7 +41,7 @@ class UpdateManager {
|
|||
this.clearTimeout();
|
||||
|
||||
Util.log('info', 'Update available: ' + JSON.stringify(info, null, 3));
|
||||
Util.send(this.win, 'update-available', this.autoUpdate);
|
||||
Util.send(this.win, 'update-available', this.autoUpdate, info);
|
||||
|
||||
if (this.autoUpdate) {
|
||||
this.download();
|
||||
|
@ -87,7 +87,7 @@ class UpdateManager {
|
|||
if (!this.autoUpdate) {
|
||||
Api.exit(this.win, '', true);
|
||||
} else {
|
||||
Util.send(this.win, 'update-confirm', info);
|
||||
Util.send(this.win, 'update-confirm', this.autoUpdate, info);
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "anytype",
|
||||
"version": "0.45.12-beta",
|
||||
"version": "0.45.11-beta",
|
||||
"description": "Anytype",
|
||||
"main": "electron.js",
|
||||
"scripts": {
|
||||
|
@ -734,4 +734,4 @@
|
|||
"pre-commit": "npm run precommit && git add licenses.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -143,7 +143,6 @@ class App extends React.Component<object, State> {
|
|||
};
|
||||
node: any = null;
|
||||
timeoutMaximize = 0;
|
||||
updateInfo = null;
|
||||
|
||||
constructor (props: any) {
|
||||
super(props);
|
||||
|
@ -235,12 +234,7 @@ class App extends React.Component<object, State> {
|
|||
Renderer.on('update-available', this.onUpdateAvailable);
|
||||
Renderer.on('update-confirm', this.onUpdateConfirm);
|
||||
Renderer.on('update-not-available', this.onUpdateUnavailable);
|
||||
Renderer.on('update-downloaded', info => {
|
||||
this.updateInfo = info;
|
||||
console.log('INFO', info);
|
||||
|
||||
S.Progress.delete('update');
|
||||
});
|
||||
Renderer.on('update-downloaded', () => S.Progress.delete('update'));
|
||||
Renderer.on('update-error', this.onUpdateError);
|
||||
Renderer.on('download-progress', this.onUpdateProgress);
|
||||
Renderer.on('spellcheck', this.onSpellcheck);
|
||||
|
@ -409,24 +403,33 @@ class App extends React.Component<object, State> {
|
|||
};
|
||||
};
|
||||
|
||||
onUpdateConfirm (e: any, auto: boolean) {
|
||||
onUpdateConfirm (e: any, auto: boolean, info: any) {
|
||||
S.Progress.delete(I.ProgressType.UpdateCheck);
|
||||
Storage.setHighlight('whatsNew', true);
|
||||
|
||||
if (auto) {
|
||||
return;
|
||||
};
|
||||
|
||||
console.log('[App.onUpdateConfirm]', info);
|
||||
|
||||
const title = [ translate('popupConfirmUpdatePromptTitle') ];
|
||||
const version = info?.releaseName;
|
||||
|
||||
if (version) {
|
||||
title.push(version);
|
||||
};
|
||||
|
||||
S.Popup.open('confirm', {
|
||||
data: {
|
||||
icon: 'update',
|
||||
bgColor: 'green',
|
||||
title: translate('popupConfirmUpdatePromptTitle'),
|
||||
title: title.join(' - '),
|
||||
text: translate('popupConfirmUpdatePromptText'),
|
||||
textConfirm: translate('popupConfirmUpdatePromptRestartOk'),
|
||||
textCancel: translate('popupConfirmUpdatePromptCancel'),
|
||||
onConfirm: () => {
|
||||
Renderer.send('updateConfirm');
|
||||
this.checkUpdateVersion(version);
|
||||
},
|
||||
onCancel: () => {
|
||||
Renderer.send('updateCancel');
|
||||
|
@ -435,23 +438,33 @@ class App extends React.Component<object, State> {
|
|||
});
|
||||
};
|
||||
|
||||
onUpdateAvailable (e: any, auto: boolean) {
|
||||
onUpdateAvailable (e: any, auto: boolean, info: any) {
|
||||
S.Progress.delete(I.ProgressType.UpdateCheck);
|
||||
|
||||
if (auto) {
|
||||
return;
|
||||
};
|
||||
|
||||
console.log('[App.onUpdateAvailable]', info);
|
||||
|
||||
const title = [ translate('popupConfirmUpdatePromptTitle') ];
|
||||
const version = info?.version;
|
||||
|
||||
if (version) {
|
||||
title.push(version);
|
||||
};
|
||||
|
||||
S.Popup.open('confirm', {
|
||||
data: {
|
||||
icon: 'update',
|
||||
bgColor: 'green',
|
||||
title: translate('popupConfirmUpdatePromptTitle'),
|
||||
title: title.join(' - '),
|
||||
text: translate('popupConfirmUpdatePromptText'),
|
||||
textConfirm: translate('commonUpdate'),
|
||||
textCancel: translate('popupConfirmUpdatePromptCancel'),
|
||||
onConfirm: () => {
|
||||
Renderer.send('updateDownload');
|
||||
this.checkUpdateVersion(version);
|
||||
},
|
||||
onCancel: () => {
|
||||
Renderer.send('updateCancel');
|
||||
|
@ -515,6 +528,18 @@ class App extends React.Component<object, State> {
|
|||
});
|
||||
};
|
||||
|
||||
checkUpdateVersion (v: string) {
|
||||
v = String(v || '');
|
||||
|
||||
const update = v.split('.');
|
||||
const current = String(electron.version.app || '').split('.');
|
||||
|
||||
if ((update[0] != current[0]) || (update[1] != current[1])) {
|
||||
Storage.set('whatsNew', true);
|
||||
Storage.setHighlight('whatsNew', true);
|
||||
};
|
||||
};
|
||||
|
||||
onRoute (route: string) {
|
||||
if (keyboard.isMain()) {
|
||||
U.Router.go(route, {});
|
||||
|
|
|
@ -208,6 +208,7 @@ const Page = observer(class Page extends React.Component<I.PageComponent> {
|
|||
const Component = Components[path];
|
||||
const routeParam = { replace: true };
|
||||
const refSidebar = sidebar.rightPanelRef(isPopup);
|
||||
const whatsNew = Storage.get('whatsNew');
|
||||
|
||||
Preview.tooltipHide(true);
|
||||
Preview.previewHide(true);
|
||||
|
@ -248,6 +249,11 @@ const Page = observer(class Page extends React.Component<I.PageComponent> {
|
|||
keyboard.setMatch(match);
|
||||
};
|
||||
|
||||
if (whatsNew && !S.Popup.isOpen()) {
|
||||
S.Popup.open('help', { data: { document: 'whatsNew' } });
|
||||
Storage.set('whatsNew', false);
|
||||
};
|
||||
|
||||
Onboarding.start(U.Common.toCamelCase([ page, action ].join('-')), isPopup);
|
||||
Highlight.showAll();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue