diff --git a/src/html/modals/error.pug b/src/html/modals/error.pug index 65675e37..c0dd138e 100644 --- a/src/html/modals/error.pug +++ b/src/html/modals/error.pug @@ -11,7 +11,9 @@ p If your problem is not yet known, klick the button below to report a new bug. pre#error-body. \n - p#not-latest-stable(hidden='hidden') You are not using the latest stable version of the UBports Installer. You can #[a(onclick="openurl.open('https://github.com/ubports/ubports-installer/releases/latest')") download the latest stable release on GitHub]. + p#not-latest-stable(hidden='hidden') You are not using the latest stable version of the UBports Installer. + #generic-update-instructions-error.p(hidden='hidden') You can #[a(onclick="openurl.open('https://github.com/ubports/ubports-installer/issues')") download the latest version from GitHub]. + #snap-update-instructions-error.p(hidden='hidden') Run #[code snap refresh ubports-installer --stable] in your terminal to install the latest version. .modal-footer button.btn.btn-default(type='button', hidden='hidden', data-dismiss='modal', onclick="location.reload()") Try again button.btn.btn-default(type='button', hidden='hidden', data-dismiss='modal') Ignore diff --git a/src/html/modals/new-update.pug b/src/html/modals/new-update.pug index 02400b30..3813d641 100644 --- a/src/html/modals/new-update.pug +++ b/src/html/modals/new-update.pug @@ -7,7 +7,8 @@ h4.modal-title Update available! .modal-body p You are not running the latest stable version. Using the latest stable release is recommended for most users. You can still use this version, but there might be bugs and issues that do not affect the stable release. - p Click the button below to download the latest version or dismiss to continue using this version. + #generic-update-instructions.p(hidden='hidden') Click the button below to download the latest version. + #snap-update-instructions.p(hidden='hidden') Run #[code snap refresh ubports-installer --stable] in your terminal to install the latest version. .modal-footer button.btn.btn-default(type='button', data-dismiss='modal') Dismiss - button#btn-update.btn.btn-primary(type='button', onclick="openurl.open('https://github.com/ubports/ubports-installer/releases/latest')") Download + button#btn-update-installer.btn.btn-primary(type='button', onclick="openurl.open('https://github.com/ubports/ubports-installer/releases/latest')") Download diff --git a/src/html/scripts/main.pug b/src/html/scripts/main.pug index 185931e0..53c1afd2 100644 --- a/src/html/scripts/main.pug +++ b/src/html/scripts/main.pug @@ -1,8 +1,14 @@ script. // CATCH ANY ERRORS! var onErr = (err) => { - if(utils.getUpdateAvailable() && !utils.isSnap()) + if(utils.getUpdateAvailable()) { $("#not-latest-stable").show(); + if (utils.isSnap()) { + $("#snap-update-instructions-error").show(); + } else { + $("#generic-update-instructions-error").show(); + } + } $("#error-body").text(err); $("#errorModal").modal("show"); modals.hide("password"); @@ -13,7 +19,6 @@ script. openurl.open("https://github.com/ubports/ubports-installer/issues/new?title="+title+"&body="+body); }); }) - window.onerror = (err, url, line) => { onErr(err+" (MainRenderer:"+line+")"); } @@ -47,6 +52,12 @@ script. $('#windows-drivers-modal').modal('show'); if (utils.getUpdateAvailable()) { utils.log.warn("This is not the latest stable release!") + if (utils.isSnap()) { + $("#snap-update-instructions").show(); + $("#btn-update-installer").hide(); + } else { + $("#generic-update-instructions").show(); + } $('#new-update-modal').modal('show'); } else { utils.log.info("Running latest stable version."); diff --git a/src/utils.js b/src/utils.js index 9038cd8a..7a6d125b 100644 --- a/src/utils.js +++ b/src/utils.js @@ -342,11 +342,11 @@ const getFallbackPlatformTools = () => { } var isSnap = () => { - return process.env.SNAP_NAME != null + return process.env.SNAP_NAME } var needRoot = () => { - if (os.platform() === "win32") return false; + if ((os.platform() === "win32") || isSnap()) return false; return !process.env.SUDO_UID }