This repository has been archived by the owner on Nov 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'electron' into desktop-v3.22.1
- Loading branch information
Showing
28 changed files
with
1,989 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
owner: gnosis | ||
repo: safe-react | ||
provider: github | ||
updaterCacheDirName: safe-react-updater |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,10 +16,15 @@ | |
"email": "[email protected]" | ||
}, | ||
"homepage": "/app", | ||
"main": "public/electron.js", | ||
"scripts": { | ||
"analyze": "source-map-explorer 'build/static/js/*.js'", | ||
"build-desktop": "yarn compile-electron && cross-env REACT_APP_BUILD_FOR_DESKTOP=true REACT_APP_ENV=production yarn build", | ||
"build": "cross-env REACT_APP_APP_VERSION=$npm_package_version rescripts --max-old-space-size=8192 build", | ||
"compile-electron": "tsc --project tsconfig.electron.json", | ||
"eject": "rescripts eject", | ||
"electron-build": "yarn compile-electron && electron-builder --mac", | ||
"electron-dev": "yarn compile-electron && concurrently \"cross-env BROWSER=none REACT_APP_BUILD_FOR_DESKTOP=true yarn start\" \"wait-on http://localhost:3000 && ELECTRON_ENV=development electron .\"", | ||
"format:staged": "lint-staged", | ||
"generate-types": "yarn generate-types:spendingLimit && yarn generate-types:safeDeployments && yarn generate-types:erc20 && yarn generate-types:erc721", | ||
"generate-types:erc20": "cross-env typechain --target=web3-v1 --out-dir './src/types/contracts' './node_modules/@openzeppelin/contracts/build/contracts/ERC20.json'", | ||
|
@@ -28,10 +33,12 @@ | |
"generate-types:safeDeployments": "cross-env typechain --target=web3-v1 --out-dir './src/types/contracts' ./node_modules/@gnosis.pm/safe-deployments/dist/assets/**/*.json", | ||
"lint:check": "eslint './src/**/*.{js,jsx,ts,tsx}'", | ||
"lint:fix": "yarn lint:check --fix", | ||
"postinstall": "patch-package && yarn generate-types", | ||
"postinstall": "patch-package && electron-builder install-app-deps && yarn generate-types", | ||
"preelectron-pack": "yarn build", | ||
"prettier:check": "yarn prettier --check", | ||
"prettier:fix": "yarn prettier --write", | ||
"prettier": "prettier './src/**/*.{js,jsx,ts,tsx}'", | ||
"release": "electron-builder --mac --linux --windows -p always", | ||
"start": "rescripts start", | ||
"start:docker": "docker-compose build && docker-compose up", | ||
"test": "REACT_APP_ENV=test rescripts test --env=jsdom", | ||
|
@@ -63,7 +70,82 @@ | |
"!src/**/assets/**" | ||
] | ||
}, | ||
"productName": "Safe", | ||
"productName": "Safe Multisig", | ||
"build": { | ||
"appId": "io.gnosis.safe", | ||
"afterSign": "scripts/notarize.js", | ||
"extends": null, | ||
"productName": "Safe", | ||
"asar": true, | ||
"publish": [ | ||
{ | ||
"provider": "github", | ||
"owner": "gnosis", | ||
"repo": "safe-react" | ||
} | ||
], | ||
"dmg": { | ||
"sign": false, | ||
"contents": [ | ||
{ | ||
"x": 110, | ||
"y": 150 | ||
}, | ||
{ | ||
"x": 240, | ||
"y": 150, | ||
"type": "link", | ||
"path": "/Applications" | ||
} | ||
] | ||
}, | ||
"files": [ | ||
"build", | ||
"patches", | ||
"public", | ||
"scripts", | ||
"dev-app-update.yml", | ||
"package.json" | ||
], | ||
"directories": { | ||
"buildResources": "public/resources" | ||
}, | ||
"mac": { | ||
"category": "public.app-category.productivity", | ||
"hardenedRuntime": true, | ||
"entitlements": "public/resources/entitlements.mac.plist", | ||
"gatekeeperAssess": false, | ||
"entitlementsInherit": "public/resources/entitlements.mac.plist", | ||
"target": [ | ||
"dmg", | ||
"zip" | ||
], | ||
"publish": [ | ||
{ | ||
"provider": "github", | ||
"owner": "gnosis", | ||
"repo": "safe-react" | ||
} | ||
] | ||
}, | ||
"nsis": { | ||
"deleteAppDataOnUninstall": true | ||
}, | ||
"linux": { | ||
"category": "Finance", | ||
"target": [ | ||
"AppImage", | ||
"deb", | ||
"zip" | ||
] | ||
}, | ||
"win": { | ||
"target": [ | ||
"nsis" | ||
], | ||
"icon": "public/resources/icon.ico" | ||
} | ||
}, | ||
"resolutions": { | ||
"@babel/core": "^7.14.0", | ||
"sass-loader": "^9.0.0" | ||
|
@@ -89,6 +171,7 @@ | |
"@gnosis.pm/safe-react-components": "^1.1.2", | ||
"@gnosis.pm/safe-react-gateway-sdk": "^2.10.1", | ||
"@gnosis.pm/safe-web3-lib": "^1.0.0", | ||
"@ledgerhq/hw-transport-node-hid-singleton": "6.20.0", | ||
"@material-ui/core": "^4.12.3", | ||
"@material-ui/icons": "^4.11.0", | ||
"@material-ui/lab": "4.0.0-alpha.60", | ||
|
@@ -103,10 +186,15 @@ | |
"classnames": "^2.2.6", | ||
"currency-flags": "3.2.1", | ||
"date-fns": "^2.20.2", | ||
"detect-port": "^1.3.0", | ||
"electron-log": "^4.4.3", | ||
"electron-settings": "^4.0.2", | ||
"electron-updater": "4.6.1", | ||
"eth-sig-util": "^2.5.3", | ||
"ethereumjs-abi": "0.6.8", | ||
"ethereumjs-util": "^7.0.10", | ||
"exponential-backoff": "^3.1.0", | ||
"express": "^4.17.3", | ||
"final-form": "^4.20.2", | ||
"final-form-calculate": "^1.3.2", | ||
"framer-motion": "^4.1.17", | ||
|
@@ -153,6 +241,8 @@ | |
"@testing-library/react": "^12.1.2", | ||
"@testing-library/react-hooks": "^7.0.2", | ||
"@typechain/web3-v1": "^3.0.0", | ||
"@types/detect-port": "^1.3.2", | ||
"@types/express": "^4.17.13", | ||
"@types/history": "4.6.2", | ||
"@types/jest": "^27.0.1", | ||
"@types/js-cookie": "^2.2.7", | ||
|
@@ -171,6 +261,9 @@ | |
"cross-env": "^7.0.3", | ||
"dotenv": "^10.0.0", | ||
"dotenv-expand": "^5.1.0", | ||
"electron": "13.6.9", | ||
"electron-builder": "22.14.13", | ||
"electron-notarize": "1.1.1", | ||
"eslint": "^7.32.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-import": "^2.24.2", | ||
|
@@ -188,6 +281,7 @@ | |
"sass": "^1.32.0", | ||
"typechain": "^5.1.2", | ||
"typescript": "^4.3.5", | ||
"usb-detection": "^4.10.0", | ||
"wait-on": "^6.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { dialog } from 'electron' | ||
import settings from 'electron-settings' | ||
import log from 'electron-log' | ||
import { autoUpdater } from 'electron-updater' | ||
|
||
// This logging setup is not required for auto-updates to work, | ||
// but it sure makes debugging easier :) | ||
//------------------------------------------------------------------- | ||
|
||
autoUpdater.autoDownload = false | ||
autoUpdater.logger = log | ||
log.info('App starting...') | ||
|
||
let initialized = false | ||
let downloadProgress = 0 | ||
|
||
function init() { | ||
if (initialized) return | ||
|
||
initialized = true | ||
|
||
autoUpdater.on('error', (error) => { | ||
log.error(error == null ? 'unknown' : (error.stack || error).toString()) | ||
}) | ||
|
||
autoUpdater.on('update-available', (info) => { | ||
if (info.version === settings.get('release.version')) { | ||
log.info(`Skipped version ${info.version}`) | ||
return | ||
} | ||
dialog | ||
.showMessageBox({ | ||
type: 'info', | ||
title: 'Found Updates', | ||
message: 'There is a newer version of this app available. Do you want to update now?', | ||
detail: info.releaseNotes.replace(/(<([^>]+)>)/g, ''), | ||
buttons: ['Install Update', 'Remind me later', 'Skip this version'], | ||
cancelId: 1, | ||
}) | ||
.then((result) => { | ||
if (result.response === 0) { | ||
autoUpdater.downloadUpdate() | ||
} | ||
if (result.response === 2) { | ||
settings.set('release', { version: info.version }) | ||
} | ||
}) | ||
|
||
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => { | ||
autoUpdater.logger?.info('Update Downloaded...') | ||
dialog | ||
.showMessageBox({ | ||
title: 'Install Updates', | ||
message: releaseName, | ||
detail: 'A new version has been downloaded. Restart the application to apply the updates.', | ||
buttons: ['Restart', 'Cancel'], | ||
cancelId: 1, | ||
}) | ||
.then((result) => { | ||
if (result.response === 0) { | ||
autoUpdater.quitAndInstall() | ||
} | ||
}) | ||
}) | ||
}) | ||
|
||
autoUpdater.on('download-progress', (d) => { | ||
downloadProgress = d.percent | ||
autoUpdater.logger?.info(downloadProgress) | ||
}) | ||
|
||
autoUpdater.checkForUpdates() | ||
} | ||
|
||
module.exports = { | ||
init, | ||
} |
Oops, something went wrong.