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-269] Automatic Daedalus updates #2056

Merged
merged 153 commits into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
dc821fa
[DDW-269] init
thedanheller Jul 6, 2020
6d1906e
[DDW-269] CHANGELOG
thedanheller Jul 6, 2020
9a7dd60
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
thedanheller Jul 7, 2020
10f9c1c
[DDW-269] NewsFeedIcon
thedanheller Jul 7, 2020
fb60e56
[DDW-269] NewsFeed item - init
thedanheller Jul 7, 2020
f460dda
[DDW-269] Update container - init
thedanheller Jul 7, 2020
9591f75
[DDW-269] Progress
thedanheller Jul 9, 2020
cdf483c
[DDW-269] Download progress working
thedanheller Jul 10, 2020
324d58c
[DDW-269] Download progress - adjustments
thedanheller Jul 10, 2020
16ff6bc
[DDW-269] Update management - progress
thedanheller Jul 10, 2020
a564485
[DDW-269] Progress
thedanheller Jul 14, 2020
bee73d5
[DDW-269] Progress
thedanheller Jul 14, 2020
3e2f18e
[DDW-269] Progress
thedanheller Jul 15, 2020
c7e0754
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
thedanheller Jul 17, 2020
8642518
[DDW-269] Progress
thedanheller Jul 19, 2020
4c2b5ff
[DDW-269] Progress
thedanheller Jul 20, 2020
946ba3d
[DDW-269] Progress
thedanheller Jul 21, 2020
8ed3105
[DDW-269] Progress
thedanheller Jul 21, 2020
6fc09b2
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
thedanheller Jul 22, 2020
9a75dfa
[DDW-269] Progress
thedanheller Jul 22, 2020
178950f
[DDW-269] Rename DownloadData into DownloadInfo
thedanheller Jul 22, 2020
a13f28d
[DDW-269] Rename DownloadProgress into DownloadData
thedanheller Jul 22, 2020
450062e
[DDW-269] Download progress information in the Overlay
thedanheller Jul 22, 2020
43e7081
[DDW-269] Flow issues
thedanheller Jul 22, 2020
d1deed9
[DDW-269] Triggering App Update
thedanheller Jul 22, 2020
b5e64af
[DDW-269] Persistent Automatic Update Failed flag
thedanheller Jul 23, 2020
45e0123
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
thedanheller Jul 23, 2020
f032969
[DDW-269] Progress
thedanheller Jul 24, 2020
3f9160e
[DDW-269] Remove unused files
thedanheller Jul 24, 2020
5d6b377
[DDW-269] Unifying Manual Update into the new App Update
thedanheller Jul 24, 2020
e8cea73
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
thedanheller Jul 27, 2020
143d78e
[DDW-269] Colors progress
thedanheller Jul 27, 2020
95c065c
[DDW-269] Remove unused methods
thedanheller Jul 27, 2020
d4ad364
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
thedanheller Jul 27, 2020
fd50c13
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
thedanheller Jul 29, 2020
03f5290
[DDW-269] Progress
thedanheller Jul 29, 2020
7d5fc23
[DDW-269] New screens for manual update scenarios
thedanheller Jul 30, 2020
d654c81
[DDW-269] Progress - finish update process
thedanheller Jul 30, 2020
512cad8
[DDW-269] Improve security when opening the installer file
thedanheller Jul 31, 2020
258337b
Revert "[DDW-269] Improve security when opening the installer file"
thedanheller Jul 31, 2020
132044c
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
thedanheller Aug 3, 2020
01e7e33
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
thedanheller Aug 10, 2020
4e164ff
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
thedanheller Aug 12, 2020
722c8dd
[DDW-269] Preparation for QA testing - init
thedanheller Aug 12, 2020
9be1ffa
[DDW-269] Preparation for QA testing - progress
thedanheller Aug 12, 2020
a63f8bb
[DDW-269] Preparation for QA testing - progress
thedanheller Aug 13, 2020
6a002b4
[DDW-269] Different versions for testing purposes
thedanheller Aug 13, 2020
1ce1f69
[DDW-269] Fix storybook styling
thedanheller Aug 13, 2020
02d9a4e
[DDW-269] Preparing to copy theme variables
thedanheller Aug 13, 2020
51a4930
[DDW-269] Color adjustments
thedanheller Aug 13, 2020
5acaa3b
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
thedanheller Aug 17, 2020
5ba02b3
[DDW-269] Build for test - SHOULD UPDATE
thedanheller Aug 18, 2020
ce138c5
[DDW-269] Build for test - IS UP TO DATE
thedanheller Aug 18, 2020
ffc4f94
[DDW-269] Adjustments
thedanheller Aug 18, 2020
5b34954
[DDW-269] Adjustments and missing translation
thedanheller Aug 19, 2020
ed56918
[DDW-269] Styling adjustments
thedanheller Aug 19, 2020
cf4b18d
[DDW-269] Styling adjustments
thedanheller Aug 19, 2020
ad92cd0
[DDW-269] Temporary testing bits
thedanheller Aug 19, 2020
0a087d9
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
thedanheller Aug 19, 2020
2f41dd5
Merge branch 'feature/ddw-269-handle-app-automatic-update' of https:/…
thedanheller Aug 19, 2020
ae822a4
[DDW-269] Styling adjustment
thedanheller Aug 19, 2020
9514112
[DDW-269] Temporary testing bits
thedanheller Aug 19, 2020
3a18307
[DDW-269] Temporary testing bits
thedanheller Aug 20, 2020
e35eadb
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
thedanheller Aug 20, 2020
6d4013a
[DDW-269] Testing version
thedanheller Aug 21, 2020
894eb7e
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
thedanheller Aug 31, 2020
98fd05e
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
thedanheller Aug 31, 2020
e6fa825
fix yarn.lock
cleverca22 Aug 31, 2020
6fbac2f
[DDW-269] TEST - Should Update
thedanheller Aug 31, 2020
826a602
Merge branch 'feature/ddw-269-handle-app-automatic-update' of https:/…
thedanheller Aug 31, 2020
e8c3e9a
[DDW-269] Remove react-syntax-highlighter from yark.lock
thedanheller Aug 31, 2020
e316034
[DDW-269] TEST - SHOULD UPDATE
thedanheller Sep 1, 2020
48cc58a
[DDW-269] yark lock things
thedanheller Sep 1, 2020
75bc75e
[DDW-269] Acceptance tests
thedanheller Sep 1, 2020
c88a8f4
fix yarn.lock
cleverca22 Sep 2, 2020
73a116c
[DDW-269] Fixed shasum version
thedanheller Sep 3, 2020
a543d89
[DDW-269] yarn.lock
thedanheller Sep 3, 2020
caeaa4f
[DDW-269] Fix yarn.lock
thedanheller Sep 3, 2020
14a798b
[DDW-269] Improve error when the Installer is missing
thedanheller Sep 3, 2020
e049419
[DDW-269] After installing
thedanheller Sep 3, 2020
03acf02
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
thedanheller Sep 4, 2020
eec1f89
[DDW-269] Translation manager
thedanheller Sep 4, 2020
2a0cfb4
[DDW-269] Fix switched installers
thedanheller Sep 5, 2020
4f1828c
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
nikolaglumac Sep 7, 2020
0bef81c
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
thedanheller Sep 8, 2020
d2d61e8
Merge branch 'feature/ddw-269-handle-app-automatic-update' of https:/…
thedanheller Sep 8, 2020
8079335
[DDW-269] Handle app closing
thedanheller Sep 8, 2020
c283f81
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
nikolaglumac Sep 9, 2020
da2a056
[DDW-269] Merges develop
nikolaglumac Sep 9, 2020
4d622d1
[DDW-269] Minor adjustment
thedanheller Sep 9, 2020
694719d
Merge branch 'feature/ddw-269-handle-app-automatic-update' of https:/…
thedanheller Sep 9, 2020
bf7b913
[DDW-269] Move scroll into the news items
thedanheller Sep 9, 2020
2ab8a4d
[DDW-269] Color variable and close newsfeed after download update
thedanheller Sep 9, 2020
623f90b
[DDW-269] Handle app closing - fixing
thedanheller Sep 9, 2020
21df763
[DDW-269] Adjustments and remove consoles
thedanheller Sep 9, 2020
8f23f98
[DDW-269] Fix total download size not being displayed
thedanheller Sep 9, 2020
c9b2e01
[DDW-269] Missing JP translation
thedanheller Sep 9, 2020
ae06822
[DDW-269] Inconsistent colors for the white theme
thedanheller Sep 9, 2020
120c7f2
[DDW-269] Remove update overlay when Daedalus is quitting
thedanheller Sep 9, 2020
67eb42a
[DDW-269] Fix localstorage theme key declaration
nikolaglumac Sep 10, 2020
734ef34
[DDW-269] Handle file deleted while downloading
thedanheller Sep 10, 2020
4dd94af
Merge branch 'feature/ddw-269-handle-app-automatic-update' of https:/…
thedanheller Sep 10, 2020
570e2fb
[DDW-269] Checks if the file exists on app loading
thedanheller Sep 10, 2020
1995241
[DDW-269] Correct green dot color
thedanheller Sep 10, 2020
4fcb31c
[DDW-269] Prevent close button on error scenario
thedanheller Sep 10, 2020
8ee48ca
[DDW-269] Prevent error message to be improperly shown
thedanheller Sep 10, 2020
3292a7a
[DDW-269] Fix japanese link
thedanheller Sep 10, 2020
c0b259d
[DDW-269] Different action for Linux
thedanheller Sep 10, 2020
4c1a485
[DDW-269] Logging errors
thedanheller Sep 11, 2020
4632c26
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
nikolaglumac Sep 11, 2020
216ff24
[DDW-269] Supports link inside the markdown content
thedanheller Sep 11, 2020
129dcc5
Merge branch 'feature/ddw-269-handle-app-automatic-update' of https:/…
thedanheller Sep 11, 2020
027e5c7
[DDW-269] Handles error when changing to Japanese
thedanheller Sep 11, 2020
c3f7040
[DDW-269] Handle multiple download requests
thedanheller Sep 13, 2020
546c86b
[DDW-269] Allow installation postpone
thedanheller Sep 14, 2020
6e84c8a
[DDW-269] Linux/postpone copy/translation
thedanheller Sep 15, 2020
46f1288
[DDW-269] Linux installation
thedanheller Sep 15, 2020
0a7ffe9
[DDW-269] Logging errors
thedanheller Sep 16, 2020
5d54e9a
[DDW-269] Logging errors - 2
thedanheller Sep 16, 2020
3e94c50
[DDW-269] Test without update-runner
thedanheller Sep 16, 2020
b0c286e
[DDW-269] Test without update-runner - chmod
thedanheller Sep 16, 2020
d797fdf
[DDW-269] Test without update-runner - quit after install
thedanheller Sep 16, 2020
9f2d5a9
[DDW-269] Revert logging
thedanheller Sep 17, 2020
028b10b
[DDW-269] Test Update Runner
thedanheller Sep 17, 2020
a3b9e95
[DDW-269] Test 2 Update Runner
thedanheller Sep 17, 2020
409e76b
[DDW-269] Test 3 Update Runner
thedanheller Sep 17, 2020
d19e6af
[DDW-269] Test 4 Update Runner - synchronous
thedanheller Sep 17, 2020
b6d6c9a
[DDW-269] [DDW-269] Test 4 Update Runner - asynchronous messages
thedanheller Sep 17, 2020
021be9a
[DDW-269] Progress
thedanheller Sep 18, 2020
9d4e891
[DDW-269] spawn env
thedanheller Sep 18, 2020
6a2dc0d
[DDW-269] [DDW-269] spawn env 2
thedanheller Sep 18, 2020
dcb699d
[DDW-269] [DDW-269] spawn env 2
thedanheller Sep 18, 2020
c86ea32
Merge branch 'feature/ddw-269-handle-app-automatic-update' of https:/…
thedanheller Sep 18, 2020
05107a3
Revert "[DDW-269] [DDW-269] spawn env 2"
thedanheller Sep 18, 2020
f1081a5
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
thedanheller Sep 21, 2020
b1b52d9
[DDW-269] Checkbox checked when installing
thedanheller Sep 21, 2020
47a47cd
[DDW-269] Adjustments
thedanheller Sep 21, 2020
5709b0d
[DDW-269] Fix Update description not changing locale
thedanheller Sep 21, 2020
de91d56
[DDW-269] Postpone/Installing update link adjustments
thedanheller Sep 21, 2020
8bd9f29
dont treat stderr as fatal
cleverca22 Sep 22, 2020
8f6e1c7
fix the missing username
cleverca22 Sep 22, 2020
b06c090
fix the on function and the global unhandledRejection handler
cleverca22 Sep 22, 2020
cd7fa15
[DDW-269] Styling adjustments
thedanheller Sep 22, 2020
8cc51cf
clean up arx temp files after execution
cleverca22 Sep 23, 2020
a21d47c
[DDW-269] Fix issue when deleting the temporaty file
thedanheller Sep 23, 2020
f3c9697
[DDW-269] Fix issue when deleting the temporaty file
thedanheller Sep 23, 2020
b17d33e
[DDW-269] Linux installation progress
thedanheller Sep 23, 2020
7e05475
[DDW-269] Small adjustment
thedanheller Sep 23, 2020
c37ed8e
[DDW-269] Styling adjustments
thedanheller Sep 24, 2020
2d1f9ad
Merge branch 'develop' into feature/ddw-269-handle-app-automatic-update
thedanheller Sep 24, 2020
69038d1
[DDW-269] Remove typos and console log
thedanheller Sep 24, 2020
22335b1
[DDW-269] Remove dummy data
thedanheller Sep 24, 2020
43c24b7
[DDW-269] Cleanup
nikolaglumac Sep 24, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ Changelog

## 2.0.0-RC1

### Features

- Implemented Daedalus app automatic update ([PR 2056](https://github.com/input-output-hk/daedalus/pull/2056))

### Fixes

- Fixed the epoch duration copy ([PR 2107](https://github.com/input-output-hk/daedalus/pull/2107))
Expand Down
7 changes: 1 addition & 6 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,7 @@ let
runLint = self.callPackage ./tests/lint.nix {};
runShellcheck = self.callPackage ./tests/shellcheck.nix { src = ./.;};
};
nix-bundle = import (pkgs.fetchFromGitHub {
owner = "matthewbauer";
repo = "nix-bundle";
rev = "7f12322399fd87d937355d0fc263d37d798496fc";
sha256 = "07wnmdadchf73p03wk51abzgd3zm2xz5khwadz1ypbvv3cqlzp5m";
}) { nixpkgs = pkgs; };
nix-bundle = import sources.nix-bundle { nixpkgs = pkgs; };
iconPath = self.launcherConfigs.installerConfig.iconPath;
# used for name of profile, binary and the desktop shortcut
linuxClusterBinName = cluster;
Expand Down
31 changes: 24 additions & 7 deletions installers/nix/nix-installer.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ let
target = "${installer}";
run = "/bin/installer";
nixUserChrootFlags = "-c -m /home:/home -p HOME";
rmStyle = "-rm_";
shared = false;
};
utils = pkgs.writeText "utils.sh" ''
function rmrf {
Expand All @@ -29,24 +31,38 @@ let
pwd
id
UNPACK=$(mktemp -d)
cd $UNPACK
echo "$@"
bash "$1" --extract
ls -ltrh dat/nix/store/*-tarball/tarball/tarball.tar.xz
UNPACK2=$(mktemp -d)
tar --delay-directory-restore -C $UNPACK2 -xf dat/nix/store/*-tarball/tarball/tarball.tar.xz
cd
pushd $UNPACK
echo "$@"
echo STATUS decompressing
echo PROG 1/6
bash "$1" --extract
ls -ltrh dat/nix/store/*-tarball/tarball/tarball.tar.xz
UNPACK2=$(mktemp -d)
echo STATUS unpacking
echo PROG 2/6
tar --delay-directory-restore -C $UNPACK2 -xf dat/nix/store/*-tarball/tarball/tarball.tar.xz
popd
echo STATUS removing temp files
echo PROG 3/6
rmrf $UNPACK
ls -ltrh $UNPACK2
echo STATUS copying files
echo PROG 3/6
NIX_REMOTE=local?root=$UNPACK2 nix-store --load-db < $UNPACK2/nix-path-registration
NIX_REMOTE=local?root=$UNPACK2 nix-store --verify --check-contents
nix copy --no-check-sigs --from local?root=$UNPACK2 $(readlink $UNPACK2/firstGeneration)
export NIX_PROFILE=/nix/var/nix/profiles/profile
nix-env --set $(readlink $UNPACK2/firstGeneration)
nix-env -p /nix/var/nix/profiles/profile-${linuxClusterBinName} --set $(readlink $UNPACK2/firstGeneration)
echo STATUS cleaning up
echo PROG 4/6
rmrf $UNPACK2

echo STATUS post-install
echo PROG 5/6
post-install || true
echo STATUS done
echo PROG 6/6
'';
enter = pkgs.writeScriptBin "enter-chroot" ''
#!/usr/bin/env bash
Expand Down Expand Up @@ -86,6 +102,7 @@ let
ln -svf ${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt /etc/ssl/certs/ca-certificates.crt
ln -svf ${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt /etc/ssl/certs/ca-bundle.crt
unset NIX_SSL_CERT_FILE
export USER=daedalus

if [ -z "$@" ]; then
exec bash
Expand Down
1 change: 1 addition & 0 deletions nix/launcher-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ let
inherit logsPrefix launcherLogsPrefix tlsConfig;
walletLogging = false;
daedalusBin = mkBinPath "frontend";
updateRunnerBin = mkBinPath "update-runner";
# TODO: set when update system is complete
updaterArgs = [];
updaterPath = "";
Expand Down
12 changes: 12 additions & 0 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@
"url": "https://github.com/input-output-hk/niv/archive/4229fbcf62997467c34283a2f353702359e78e5a.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nix-bundle": {
"branch": "rm-style",
"description": "Bundle Nix derivations to run anywhere!",
"homepage": "",
"owner": "input-output-hk",
"repo": "nix-bundle",
"rev": "acf3b142c1fa332d4f9050e7cdfb3c3f8091e78b",
"sha256": "0pcc8bh1x3shr6k2h8zw05n0apm5ppx6nk07xp89ljldah4mmc6c",
"type": "tarball",
"url": "https://github.com/input-output-hk/nix-bundle/archive/acf3b142c1fa332d4f9050e7cdfb3c3f8091e78b.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs-nsis": {
"branch": "nsis",
"description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@
"rust-cardano-crypto": "0.2.0",
"safe-buffer": "5.2.0",
"semver": "7.1.3",
"shasum": "1.0.2",
"source-map-support": "0.5.16",
"spectron-fake-dialog": "0.0.1",
"unorm": "1.6.0",
Expand Down
12 changes: 12 additions & 0 deletions source/common/config/appupdateConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// @flow
import type { UpdateInstallationStatus } from '../types/app-update.types';

export const APP_UPDATE_DOWNLOAD_ID = 'appUpdate';

export const UPDATE_INSTALLATION_STATUSES: {
[key: string]: UpdateInstallationStatus,
} = {
PROGRESS: 'progress',
ERROR: 'error',
SUCCESS: 'success',
};
6 changes: 5 additions & 1 deletion source/common/config/downloadManagerConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export const DOWNLOAD_EVENT_TYPES: {
PROGRESS: 'progress',
END: 'end',
TIMEOUT: 'timeout',
STOP: 'stop',
PAUSE: 'pause',
ERROR: 'error',
};

Expand All @@ -49,7 +51,7 @@ export const TEMPORARY_FILENAME = {
extension: 'crdownload',
};

export const DOWNLOAD_PROGRESS_DEFAULT = {
export const DOWNLOAD_DATA_DEFAULT = {
state: DOWNLOAD_STATES.IDLE,
remainingSize: 0,
serverFileSize: 0,
Expand All @@ -60,3 +62,5 @@ export const DOWNLOAD_PROGRESS_DEFAULT = {
incomplete: false,
isResumed: false,
};

export const ERROR_TIME_AFTER_NO_END_EVENT = 10 * 1000; // 10 seconds | unit: milliseconds
2 changes: 2 additions & 0 deletions source/common/config/electron-store.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ export const STORAGE_KEYS: {
WALLETS: 'WALLETS',
WALLET_MIGRATION_STATUS: 'WALLET-MIGRATION-STATUS',
DOWNLOAD_MANAGER: 'DOWNLOAD-MANAGER',
APP_AUTOMATIC_UPDATE_FAILED: 'APP-AUTOMATIC-UPDATE-FAILED',
APP_UPDATE_COMPLETED: 'APP-UPDATE-COMPLETED',
};
61 changes: 53 additions & 8 deletions source/common/ipc/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ import type {
DownloadResponse,
ResumeDownloadRequest,
ResumeDownloadResponse,
ClearDownloadLocalDataRequest,
ClearDownloadLocalDataResponse,
DeleteDownloadedFileRequest,
DeleteDownloadedFileResponse,
CheckFileExistsRequest,
} from '../types/downloadManager.types';
import type { StoreMessage } from '../types/electron-store.types';
import type {
Expand Down Expand Up @@ -297,6 +302,27 @@ export type ShowSaveDialogMainResponse = SaveFileDialogResponseParams;
export const ELECTRON_STORE_CHANNEL = 'ELECTRON_STORE_CHANNEL';
export type ElectronStoreMessage = StoreMessage;

/**
* Channel for requesting a new download
*/
export const REQUEST_DOWNLOAD = 'REQUEST_DOWNLOAD';
export type DownloadRendererRequest = DownloadRequest;
export type DownloadMainResponse = DownloadResponse;

/**
* Channel for resuming an existing download
*/
export const RESUME_DOWNLOAD = 'RESUME_DOWNLOAD';
export type ResumeDownloadRendererRequest = ResumeDownloadRequest;
export type ResumeDownloadMainResponse = ResumeDownloadResponse | void;

/**
* Channel for resuming an existing download
*/
export const DELETE_DOWNLOADED_FILE = 'DELETE_DOWNLOADED_FILE';
export type DeleteDownloadedFileRendererRequest = DeleteDownloadedFileRequest;
export type DeleteDownloadedFileMainResponse = DeleteDownloadedFileResponse | void;

/**
* Channel for initiating the download manager
*/
Expand All @@ -312,18 +338,37 @@ export type DownloadsLocalDataRendererRequest = DownloadsLocalDataRequest | void
export type DownloadsLocalDataMainResponse = DownloadsLocalDataResponse | void;

/**
* Channel for requesting a new download
* Channel for initiating the download manager
*/
export const REQUEST_DOWNLOAD = 'REQUEST_DOWNLOAD';
export type DownloadRendererRequest = DownloadRequest;
export type DownloadMainResponse = DownloadResponse;
export const CLEAR_DOWNLOAD_LOCAL_DATA = 'CLEAR_DOWNLOAD_LOCAL_DATA';
export type ClearDownloadLocalDataRendererRequest = ClearDownloadLocalDataRequest;
export type ClearDownloadLocalDataMainResponse = ClearDownloadLocalDataResponse;

/**
* Channel for requesting a new download
* Channel for checking if the downloaded file still exists
*/
export const RESUME_DOWNLOAD = 'RESUME_DOWNLOAD';
export type ResumeDownloadRendererRequest = ResumeDownloadRequest;
export type ResumeDownloadMainResponse = ResumeDownloadResponse | void;
export const CHECK_FILE_EXISTS = 'CHECK_FILE_EXISTS';
export type CheckFileExistsRendererRequest = CheckFileExistsRequest;
export type CheckFileExistsMainResponse = boolean;

/**
* Channel for quitting Daedalus and installing update
*/
export const MANAGE_APP_UPDATE = 'MANAGE_APP_UPDATE';
export type ManageAppUpdateRendererRequest = {
filePath: string,
hash: string,
};
export type ManageAppUpdateMainResponse = {
status: 'progress' | 'success' | 'error',
data: {
message?: string,
progress?: number,
code?: number,
error?: Error,
info?: Object,
},
};

/**
* Channel for introspecting an address
Expand Down
3 changes: 3 additions & 0 deletions source/common/types/app-update.types.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// @flow

export type UpdateInstallationStatus = 'progress' | 'error' | 'success';
42 changes: 26 additions & 16 deletions source/common/types/downloadManager.types.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export type DownloadRequestOptions = {
override?: boolean, // if true it will override the file, otherwise will append '(number)' to the end of file
httpRequestOptions?: Object, // Override the http request options
httpsRequestOptions?: Object, // Override the https request options, ex: to add SSL Certs
progressIsThrottled?: boolean, // by default, the progress is sent every second. if `false` it will be sent every milisecond
persistLocalData?: boolean, // by default, the localdata information is deleted after the end of the download
};

// https://www.npmjs.com/package/node-downloader-helper
Expand All @@ -55,26 +57,28 @@ export type DownloadEventType =
| 'progress'
| 'end'
| 'timeout'
| 'stop'
| 'pause'
| 'error';

export type DownloadResponse = {
eventType: DownloadEventType,
info: DownloadInfo,
data: DownloadData,
progress: DownloadProgress,
error?: string,
};

export type DownloadData = {
export type DownloadInfo = {
downloadId: string,
fileUrl: string,
originalFilename: string,
temporaryFilename: string,
destinationDirectoryName: AllowedDownloadDirectories,
destinationPath: string,
options: DownloadRequestOptions,
persistLocalData?: boolean,
};

export type DownloadProgress = {
export type DownloadData = {
state: DownloadState,
remainingSize: number,
serverFileSize: number,
Expand All @@ -87,7 +91,7 @@ export type DownloadProgress = {
error?: string,
};

export type DownloadProgressUpdate = {
export type DownloadDataUpdate = {
state?: DownloadState,
remainingSize?: number,
serverFileSize?: number,
Expand All @@ -104,7 +108,7 @@ export type DownloadProgressUpdate = {
*
* Each event has a different response
* which is formatted and so the Main IPC
* response has always the DownloadProgress shape
* response has always the DownloadData shape
*
*/

Expand Down Expand Up @@ -133,31 +137,37 @@ export type DownloadInfoEnd = {
};
export type DownloadInfoError = {
message: string, // Error message
status: string, // Http status response if available
body: string, // Http body response if available
status?: string, // Http status response if available
body?: string, // Http body response if available
};

export type DownloadLocalDataRequest = {
fileName?: string,
id?: string,
};

export type DownloadLocalDataResponse = {
data: DownloadData,
progress: DownloadProgress,
info?: DownloadInfo,
data?: DownloadData,
};

export type DownloadsLocalDataRequest = {
state: DownloadState,
};

export type DownloadsLocalDataResponse = {
[key: string]: DownloadsLocalDataResponse,
[key: string]: DownloadLocalDataResponse,
};

export type ResumeDownloadRequest = {
fileName?: string,
export type ResumeDownloadRequest = DownloadLocalDataRequest;
export type ResumeDownloadResponse = DownloadResponse | void;

export type ClearDownloadLocalDataRequest = DownloadLocalDataRequest;
export type ClearDownloadLocalDataResponse = void;

export type DeleteDownloadedFileRequest = {
id?: string,
};
export type DeleteDownloadedFileResponse = void;

export type ResumeDownloadResponse = DownloadResponse | void;
export type CheckFileExistsRequest = {
id?: string,
};
4 changes: 3 additions & 1 deletion source/common/types/electron-store.types.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export type StorageKey =
| 'READ-NEWS'
| 'WALLETS'
| 'WALLET-MIGRATION-STATUS'
| 'DOWNLOAD-MANAGER';
| 'DOWNLOAD-MANAGER'
| 'APP-AUTOMATIC-UPDATE-FAILED'
| 'APP-UPDATE-COMPLETED';

export type StoreMessage = {
type: StorageType,
Expand Down
2 changes: 2 additions & 0 deletions source/common/types/environment.types.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ export const OS_NAMES = {
[LINUX]: 'Linux',
};

export type Platform = 'darwin' | 'win32' | 'linux';

export type Network =
| 'mainnet'
| 'mainnet_flight'
Expand Down
7 changes: 7 additions & 0 deletions source/common/types/locales.types.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ export const humanizedDurationLanguages = {
'en-US': 'en',
'ja-JP': 'ja',
};

export const momentLocales: {
[key: Locale]: string,
} = {
'en-US': 'en-us',
'ja-JP': 'ja',
};
Loading