Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DDW-405] Wait Daedalus to quit before launching app update #2195

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

## vNext

### Features

- Changed the way the update installer is launched, waiting first for the app to quit ([PR 2195](https://github.com/input-output-hk/daedalus/pull/2195))

## 2.3.0-FC2

### Chores
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "daedalus",
"productName": "Daedalus",
"version": "2.3.0-FC2",
"version": "2.1.0",
thedanheller marked this conversation as resolved.
Show resolved Hide resolved
"description": "Cryptocurrency Wallet",
"main": "./dist/main/index.js",
"scripts": {
Expand Down
12 changes: 4 additions & 8 deletions source/main/ipc/manageAppUpdateChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,10 @@ export const handleManageAppUpdateRequests = (window: BrowserWindow) => {
// For linux we execute the installer file
if (environment.isLinux) return installUpdate(filePath);

// For other OS we launch the installer file
const openInstaller: boolean = shell.openItem(filePath);
if (!openInstaller)
nikolaglumac marked this conversation as resolved.
Show resolved Hide resolved
return response(
false,
functionPrefix,
'Not able to launch the installer'
);
// For other OS we launch the installer file after the app was closed
app.on('quit', () => {
shell.openItem(filePath);
});
app.quit();
return response(true, functionPrefix);
});
Expand Down
43 changes: 43 additions & 0 deletions source/renderer/app/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1675,12 +1675,55 @@ export default class AdaApi {
getNews = async (): Promise<GetNewsResponse> => {
logger.debug('AdaApi::getNews called');

const UPDATE_VERSION = '2.2.0';
const DARWIN_INSTALLER_URL =
'https://update-cardano-mainnet.iohk.io/daedalus-2.2.0-mainnet-14276.pkg';
const WIN32_INSTALLER_URL =
'https://update-cardano-mainnet.iohk.io/daedalus-2.2.0-mainnet-14276.exe';
const LINUX_INSTALLER_URL =
'https://update-cardano-mainnet.iohk.io/daedalus-2.2.0-mainnet-14276.bin';
const DARWIN_HASH =
'b546db6f06065ddce601b1dd6b9afdce8a3b46c01e0058503207be99f3e4976b';
const WIN32_HASH =
'a3826e1b05d211c1c21de4a28a967d46530a1c318ae970bb024001ad05684f74';
const LINUX_HASH =
'e8d3879b6402062f2626e0fe16ea452992c68f70c639adbf083015d3b24c1f03';

// Fetch news json
let rawNews: string;
let news: GetNewsResponse;
try {
rawNews = await getNews();
news = JSON.parse(rawNews);
news = {
updatedAt: 1598569200000,
items: [
news.items[0],
{
...news.items[1],
type: 'software-update',
softwareUpdate: {
darwin: {
version: UPDATE_VERSION,
hash: DARWIN_HASH,
url: DARWIN_INSTALLER_URL,
},
win32: {
version: UPDATE_VERSION,
hash: WIN32_HASH,
url: WIN32_INSTALLER_URL,
},
linux: {
version: UPDATE_VERSION,
hash: LINUX_HASH,
url: LINUX_INSTALLER_URL,
},
},
},
],
};

console.log('news', news);
} catch (error) {
logger.error('AdaApi::getNews error', { error });
throw new Error('Unable to fetch news');
Expand Down