@@ -8254,7 +8254,8 @@ define("command/Commands", function (require, exports, module) {
82548254 exports.HELP_HOMEPAGE = "help.homepage"; // HelpCommandHandlers.js _handleLinkMenuItem()
82558255 exports.HELP_TWITTER = "help.twitter"; // HelpCommandHandlers.js _handleLinkMenuItem()
82568256 exports.HELP_TOGGLE_SHORTCUTS_PANEL = "help.toggleShortcuts"; // shortcuts integrated extension
8257- exports.HELP_CHECK_UPDATES = "help.checkUpdates"; // shortcuts integrated extension
8257+ exports.HELP_CHECK_UPDATES = "help.checkUpdates"; // shortcuts integrated extension
8258+ exports.HELP_AUTO_UPDATE = "help.autoUpdate"; // shortcuts integrated extension
82588259
82598260 // Working Set Configuration
82608261 exports.CMD_WORKINGSET_SORT_BY_ADDED = "cmd.sortWorkingSetByAdded"; // WorkingSetSort.js _handleSort()
@@ -39226,6 +39227,8 @@ define("extensionsIntegrated/appUpdater/main", function (require, exports, modul
3922639227 KEY_LAST_UPDATE_CHECK_TIME = "PH_LAST_UPDATE_CHECK_TIME",
3922739228 KEY_UPDATE_AVAILABLE = "PH_UPDATE_AVAILABLE";
3922839229
39230+ const PREFS_AUTO_UPDATE = "autoUpdate";
39231+
3922939232 function showOrHideUpdateIcon() {
3923039233 if(!updaterWindow){
3923139234 updaterWindow = window.__TAURI__.window.WebviewWindow.getByLabel(TAURI_UPDATER_WINDOW_LABEL);
@@ -39381,51 +39384,70 @@ define("extensionsIntegrated/appUpdater/main", function (require, exports, modul
3938139384 return true;
3938239385 }
3938339386
39387+ function _getButtons(isUpgradableLoc) {
39388+ const updateLater =
39389+ {className: Dialogs .DIALOG_BTN_CLASS_NORMAL, id: Dialogs .DIALOG_BTN_CANCEL, text: Strings.UPDATE_LATER };
39390+ const getItNow =
39391+ { className: Dialogs .DIALOG_BTN_CLASS_PRIMARY, id: Dialogs .DIALOG_BTN_OK, text: Strings.GET_IT_NOW };
39392+ const updateOnExit =
39393+ { className: Dialogs .DIALOG_BTN_CLASS_PRIMARY, id: Dialogs .DIALOG_BTN_OK, text: Strings.UPDATE_ON_EXIT };
39394+ if(!isUpgradableLoc) {
39395+ return [updateLater, getItNow];
39396+ }
39397+ return [updateLater, updateOnExit];
39398+ }
39399+
3938439400 async function checkForUpdates(isAutoUpdate) {
3938539401 showOrHideUpdateIcon();
3938639402 if(updateTask){
3938739403 $("#status-tasks .btn-dropdown").click();
3938839404 return;
3938939405 }
39390- const updateDetails = await getUpdateDetails();
39406+ const updateDetails = await getUpdateDetails(); // this will also show update icon if update present
3939139407 if(updateFailed) {
3939239408 Dialogs.showInfoDialog(Strings.UPDATE_FAILED_TITLE, Strings.UPDATE_FAILED_MESSAGE);
3939339409 return;
3939439410 }
3939539411 if(updatePendingRestart || updateDetails.updatePendingRestart){
39396- Dialogs.showInfoDialog(Strings.UPDATE_READY_RESTART_TITLE, Strings.UPDATE_READY_RESTART_MESSAGE);
39412+ if(!isAutoUpdate){
39413+ Dialogs.showInfoDialog(Strings.UPDATE_READY_RESTART_TITLE, Strings.UPDATE_READY_RESTART_MESSAGE);
39414+ // the dialog will only be shown in explicit check for updates, else its annoying that this comes
39415+ // up at every new window create from app.
39416+ }
3939739417 return;
3939839418 }
3939939419 if(!updateDetails.shouldUpdate){
3940039420 (!isAutoUpdate) && Dialogs.showInfoDialog(Strings.UPDATE_NOT_AVAILABLE_TITLE, Strings.UPDATE_UP_TO_DATE);
3940139421 return;
3940239422 }
39403- const buttons = [
39404- { className: Dialogs .DIALOG_BTN_CLASS_NORMAL, id: Dialogs .DIALOG_BTN_CANCEL, text: Strings.UPDATE_LATER },
39405- { className: Dialogs .DIALOG_BTN_CLASS_PRIMARY, id: Dialogs .DIALOG_BTN_OK, text: Strings.GET_IT_NOW }
39406- ];
39423+ const autoUpdateEnabled = PreferencesManager.get(PREFS_AUTO_UPDATE);
39424+ if(isAutoUpdate && !autoUpdateEnabled){
39425+ // the update icon is lit at this time for the user to hint that an update is available
39426+ // but, we don't show the dialog if auto update is off.
39427+ return;
39428+ }
39429+
39430+ const isUpgradableLoc = await isUpgradableLocation();
39431+ const buttons = _getButtons(isUpgradableLoc);
3940739432 let markdownHtml = marked.parse(updateDetails.releaseNotesMarkdown || "");
3940839433 Metrics.countEvent(Metrics.EVENT_TYPE.UPDATES, 'dialog', "shown"+Phoenix.platform);
3940939434 Dialogs.showModalDialog(DefaultDialogs.DIALOG_ID_INFO, Strings.UPDATE_AVAILABLE_TITLE, markdownHtml, buttons)
3941039435 .done(option=>{
39411- isUpgradableLocation().then(isUpgradableLoc=>{
39412- if(option === Dialogs.DIALOG_BTN_CANCEL){
39413- Metrics.countEvent(Metrics.EVENT_TYPE.UPDATES, 'dialog', "cancel"+Phoenix.platform);
39414- return;
39415- }
39416- if(!isUpgradableLoc) {
39417- // user installed linux as binary without installer, we just open phcode.io
39418- const downloadPage = brackets.config.homepage_url || "https://phcode.io";
39419- NativeApp.openURLInDefaultBrowser(downloadPage);
39420- Metrics.countEvent(Metrics.EVENT_TYPE.UPDATES, 'dialog', "nonUpgradable"+Phoenix.platform);
39421- return;
39422- }
39423- if(option === Dialogs.DIALOG_BTN_OK && !updaterWindow){
39424- Metrics.countEvent(Metrics.EVENT_TYPE.UPDATES, 'dialog', "okUpdate"+Phoenix.platform);
39425- doUpdate(updateDetails.downloadURL);
39426- return;
39427- }
39428- });
39436+ if(option === Dialogs.DIALOG_BTN_CANCEL){
39437+ Metrics.countEvent(Metrics.EVENT_TYPE.UPDATES, 'dialog', "cancel"+Phoenix.platform);
39438+ return;
39439+ }
39440+ if(!isUpgradableLoc) {
39441+ // user installed linux as binary without installer, we just open phcode.io
39442+ const downloadPage = brackets.config.homepage_url || "https://phcode.io";
39443+ NativeApp.openURLInDefaultBrowser(downloadPage);
39444+ Metrics.countEvent(Metrics.EVENT_TYPE.UPDATES, 'dialog', "nonUpgradable"+Phoenix.platform);
39445+ return;
39446+ }
39447+ if(option === Dialogs.DIALOG_BTN_OK && !updaterWindow){
39448+ Metrics.countEvent(Metrics.EVENT_TYPE.UPDATES, 'dialog', "okUpdate"+Phoenix.platform);
39449+ doUpdate(updateDetails.downloadURL);
39450+ }
3942939451 });
3943039452 }
3943139453
@@ -39719,12 +39741,21 @@ define("extensionsIntegrated/appUpdater/main", function (require, exports, modul
3971939741 $("#update-notification").click(()=>{
3972039742 checkForUpdates();
3972139743 });
39722- const commandID = Commands.HELP_CHECK_UPDATES;
39723- CommandManager.register(Strings.CMD_CHECK_FOR_UPDATE, commandID, ()=>{
39744+ CommandManager.register(Strings.CMD_CHECK_FOR_UPDATE, Commands.HELP_CHECK_UPDATES, ()=>{
3972439745 checkForUpdates();
3972539746 });
39747+ CommandManager.register(Strings.CMD_AUTO_UPDATE, Commands.HELP_AUTO_UPDATE, ()=>{
39748+ PreferencesManager.set(PREFS_AUTO_UPDATE, !PreferencesManager.get(PREFS_AUTO_UPDATE));
39749+ });
3972639750 const helpMenu = Menus.getMenu(Menus.AppMenuBar.HELP_MENU);
39727- helpMenu.addMenuItem(commandID, "", Menus.AFTER, Commands.HELP_GET_INVOLVED);
39751+ helpMenu.addMenuItem(Commands.HELP_CHECK_UPDATES, "", Menus.AFTER, Commands.HELP_GET_INVOLVED);
39752+ // auto update is not added to help menu toggle as it will lead to install base version
39753+ // fragmentation, and we don't want an android version fragment situation. By default, all platforms
39754+ // are supported at latest version. User still has option to edit preferences manually to disable the auto
39755+ // update option.
39756+ PreferencesManager.definePreference(PREFS_AUTO_UPDATE, "boolean", true, {
39757+ description: Strings.DESCRIPTION_AUTO_UPDATE
39758+ });
3972839759 showOrHideUpdateIcon();
3972939760 _refreshUpdateStatus();
3973039761 // check for updates at boot
@@ -83842,7 +83873,8 @@ define("nls/root/strings", {
8384283873
8384383874 // Help menu commands
8384483875 "HELP_MENU": "Help",
83845- "CMD_CHECK_FOR_UPDATE": "Check for Updates",
83876+ "CMD_CHECK_FOR_UPDATE": "Check for Updates\u2026",
83877+ "CMD_AUTO_UPDATE": "Auto Update",
8384683878 "CMD_HOW_TO_USE_BRACKETS": "How to Use {APP_NAME}",
8384783879 "CMD_SUPPORT": "{APP_NAME} Support",
8384883880 "CMD_SUGGEST": "Suggest a Feature",
@@ -83888,6 +83920,7 @@ define("nls/root/strings", {
8388883920 "UPDATE_FAILED_VISIT_SITE_MESSAGE": "To retry, please exit all instances of {APP_NAME} and restart the application. <br>You will be directed to our download page shortly, where you can manually download the latest version.",
8388983921 "UPDATE_MESSAGE": "Hey, there's a new build of {APP_NAME} available. Here are some of the new features:",
8389083922 "GET_IT_NOW": "Get it now!",
83923+ "UPDATE_ON_EXIT": "Update On Exit",
8389183924 "UPDATE_LATER": "Remind Me Later",
8389283925 "UPDATE_DONE": "Restart to Update {APP_NAME}",
8389383926 "UPDATE_RESTART": "Restart to apply updates",
@@ -84309,7 +84342,7 @@ define("nls/root/strings", {
8430984342 "NETWORK_SLOW_OR_DISCONNECTED": "Network is disconnected or too slow.",
8431084343 "RESTART_BUTTON": "Restart",
8431184344 "LATER_BUTTON": "Later",
84312- "DESCRIPTION_AUTO_UPDATE": "Enable/disable Brackets Auto-update",
84345+ "DESCRIPTION_AUTO_UPDATE": "Enable/disable {APP_NAME} Auto-update",
8431384346 "AUTOUPDATE_ERROR": "Error!",
8431484347 "AUTOUPDATE_IN_PROGRESS": "An update is already in progress.",
8431584348
0 commit comments