diff --git a/.travis.yml b/.travis.yml index bb43aad6c..e723a675a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,6 +45,6 @@ addons: artifacts: working_dir: dist paths: - - $(git ls-files -o dist/{*.dmg,*.exe,*.AppImage} | tr "\n" ":") + - $(git ls-files -o dist/{*.dmg,*.exe,*.deb} | tr "\n" ":") target_paths: - /app/build-${TRAVIS_BUILD_NUMBER}_commit-${TRAVIS_COMMIT:0:7}$([ ! -z ${TRAVIS_TAG} ] && echo "_tag-${TRAVIS_TAG}") \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f61c91b80..e4dbd468e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,6 @@ Web UI version numbers should always match the corresponding version of LBRY App ### Changed * Improved privacy by allowing users to turn off the file view counter and better understand privacy settings ([#1074](https://github.com/lbryio/lbry-app/pull/1074)) * Disabled auto dark mode if dark mode is selected ([#1006](https://github.com/lbryio/lbry-app/pull/1006)) - * AppImage support for Linux instead of .deb ([#1010](https://github.com/lbryio/lbry-app/pull/1010)) * Refactor Electron's main process ([#951](https://github.com/lbryio/lbry-app/pull/951)) * Refactor lbryuri.js into separate named exports ([#957](https://github.com/lbryio/lbry-app/pull/957)) * Keep node_modules up-to-date when yarn.lock changes due to git ([#955](https://github.com/lbryio/lbry-app/pull/955)) diff --git a/electron-builder.json b/electron-builder.json index 3d4ec527b..3681e146d 100644 --- a/electron-builder.json +++ b/electron-builder.json @@ -1,12 +1,15 @@ { "appId": "io.lbry.LBRY", "productName": "LBRY", - "publish": [{ - "provider": "s3", - "bucket": "build.lbry.io", - "path": "app/release", - "region": "us-east-1" - }, "github"], + "publish": [ + { + "provider": "s3", + "bucket": "build.lbry.io", + "path": "app/release", + "region": "us-east-1" + }, + "github" + ], "mac": { "target": "dmg", "category": "public.app-category.entertainment" @@ -41,12 +44,23 @@ } ], "linux": { - "target": "AppImage", + "target": "deb", "category": "AudioVideo;Video", "desktop": { "MimeType": "x-scheme-handler/lbry;" } }, + "deb": { + "depends": [ + "gconf2", + "gconf-service", + "libnotify4", + "libappindicator1", + "libxtst6", + "libnss3", + "libsecret-1-0" + ] + }, "nsis": { "perMachine": true }, diff --git a/src/renderer/index.js b/src/renderer/index.js index b4225577a..d75505200 100644 --- a/src/renderer/index.js +++ b/src/renderer/index.js @@ -100,17 +100,18 @@ const init = () => { app.store.dispatch(doAutoUpdate()); }); - autoUpdater.on('update-available', () => { - console.log('Update available'); - }); - autoUpdater.on('update-not-available', () => { - console.log('Update not available'); - }); - autoUpdater.on('update-downloaded', () => { - console.log('Update downloaded'); - app.store.dispatch(doAutoUpdate()); - }); - + if (['win32', 'darwin'].includes(process.platform)) { + autoUpdater.on('update-available', () => { + console.log('Update available'); + }); + autoUpdater.on('update-not-available', () => { + console.log('Update not available'); + }); + autoUpdater.on('update-downloaded', () => { + console.log('Update downloaded'); + app.store.dispatch(doAutoUpdate()); + }); + } app.store.dispatch(doUpdateIsNightAsync()); app.store.dispatch(doDownloadLanguages()); diff --git a/src/renderer/redux/actions/app.js b/src/renderer/redux/actions/app.js index e67a5827e..6a1f138ba 100644 --- a/src/renderer/redux/actions/app.js +++ b/src/renderer/redux/actions/app.js @@ -21,6 +21,7 @@ import { selectUpgradeDownloadPath, selectUpgradeFilename, selectAutoUpdateDeclined, + selectRemoteVersion, } from 'redux/selectors/app'; import { lbrySettings as config } from 'package.json'; @@ -70,37 +71,6 @@ export function doStartUpgrade() { }; } -export function doDownloadUpgradeRequested() { - // This means the user requested an upgrade by clicking the "upgrade" button in the navbar. - // If on Mac and Windows, we do some new behavior for the auto-update system. - // This will probably be reorganized once we get auto-update going on Linux and remove - // the old logic. - - return (dispatch, getState) => { - const state = getState(); - - // Pause video if needed - dispatch(doPause()); - - const autoUpdateDeclined = selectAutoUpdateDeclined(state); - - if (autoUpdateDeclined) { - // The user declined an update before, so show the "confirm" dialog - dispatch({ - type: ACTIONS.OPEN_MODAL, - data: { modal: MODALS.AUTO_UPDATE_CONFIRM }, - }); - } else { - // The user was never shown the original update dialog (e.g. because they were - // watching a video). So show the initial "update downloaded" dialog. - dispatch({ - type: ACTIONS.OPEN_MODAL, - data: { modal: MODALS.AUTO_UPDATE_DOWNLOADED }, - }); - } - }; -} - export function doDownloadUpgrade() { return (dispatch, getState) => { const state = getState(); @@ -140,6 +110,43 @@ export function doDownloadUpgrade() { }; } +export function doDownloadUpgradeRequested() { + // This means the user requested an upgrade by clicking the "upgrade" button in the navbar. + // If on Mac and Windows, we do some new behavior for the auto-update system. + // This will probably be reorganized once we get auto-update going on Linux and remove + // the old logic. + + return (dispatch, getState) => { + const state = getState(); + + // Pause video if needed + dispatch(doPause()); + + const autoUpdateDeclined = selectAutoUpdateDeclined(state); + + if (['win32', 'darwin'].includes(process.platform)) { + // electron-updater behavior + if (autoUpdateDeclined) { + // The user declined an update before, so show the "confirm" dialog + dispatch({ + type: ACTIONS.OPEN_MODAL, + data: { modal: MODALS.AUTO_UPDATE_CONFIRM }, + }); + } else { + // The user was never shown the original update dialog (e.g. because they were + // watching a video). So show the inital "update downloaded" dialog. + dispatch({ + type: ACTIONS.OPEN_MODAL, + data: { modal: MODALS.AUTO_UPDATE_DOWNLOADED }, + }); + } + } else { + // Old behavior for Linux + dispatch(doDownloadUpgrade()); + } + }; +} + export function doAutoUpdate() { return dispatch => { dispatch({ @@ -192,11 +199,47 @@ export function doCheckUpgradeAvailable() { type: ACTIONS.CHECK_UPGRADE_START, }); - const autoUpdateDeclined = selectAutoUpdateDeclined(state); + if (['win32', 'darwin'].includes(process.platform)) { + // On Windows and Mac, updates happen silently through + // electron-updater. + const autoUpdateDeclined = selectAutoUpdateDeclined(state); - if (!autoUpdateDeclined && !isDev) { - autoUpdater.checkForUpdates(); + if (!autoUpdateDeclined && !isDev) { + autoUpdater.checkForUpdates(); + } + return; } + + const success = ({ remoteVersion, upgradeAvailable }) => { + dispatch({ + type: ACTIONS.CHECK_UPGRADE_SUCCESS, + data: { + upgradeAvailable, + remoteVersion, + }, + }); + + if ( + upgradeAvailable && + !selectCurrentModal(state) && + (!selectIsUpgradeSkipped(state) || remoteVersion !== selectRemoteVersion(state)) + ) { + dispatch({ + type: ACTIONS.OPEN_MODAL, + data: { + modal: MODALS.UPGRADE, + }, + }); + } + }; + + const fail = () => { + dispatch({ + type: ACTIONS.CHECK_UPGRADE_FAIL, + }); + }; + + Lbry.getAppVersionInfo().then(success, fail); }; }