From 51d1946d94aabe3bdc097f4cbcdc3fe195d3f362 Mon Sep 17 00:00:00 2001 From: Thomas Wilburn Date: Sat, 11 Apr 2015 19:22:40 -0700 Subject: [PATCH] Adds a "no updates" message if checking and nothing is found. Fixes #368 --- _locales/en/messages.json | 9 ++++++++- js/main.js | 16 +++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 3ab9a1c..fb24ff4 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -110,5 +110,12 @@ "recordingMacro": { "message": "Recording macro..." }, "setSyntax": { "message": "Set Syntax: $1" }, - "setTheme": { "message": "Set Theme: $1" } + "setTheme": { "message": "Set Theme: $1" }, + + "notificationUpdateAvailable": { "message": "Caret: Update available" }, + "notificationUpdateDetail": { "message": "An update to version $1 is available. Would you like to update and restart now?" }, + "notificationNoUpdateTitle": { "message": "No updates available" }, + "notificationNoUpdateDetail": { "message": "There aren't any updates for Caret at this time." }, + "notificationUpdateOK": { "message": "Yes, update and restart" }, + "notificationUpdateWait": { "message": "No thanks" } } diff --git a/js/main.js b/js/main.js index 433c2d2..93accb9 100644 --- a/js/main.js +++ b/js/main.js @@ -70,12 +70,22 @@ require([ chrome.notifications.create(updateID, { type: "basic", iconUrl: "icon-128.png", - title: "Caret: Update Available", - message: "An update to Caret version " + details.version + " is available. Would you like to update and restart now?", - buttons: [ { title: "Yes, update and restart" }, { title: "No thanks" }] + title: i18n.get("notificationUpdateAvailable"), + message: i18n.get("notificationUpdateDetail", details.version), + buttons: [ + { title: i18n.get("notificationUpdateOK") }, + { title: i18n.get("notificationUpdateWait") } + ] }, function(id) { updateID = id }); }); }); + } else { + if (isManual) chrome.notifications.create(updateID, { + type: "basic", + iconUrl: "icon-128.png", + title: i18n.get("notificationNoUpdateTitle"), + message: i18n.get("notificationNoUpdateDetail") + }, function(id) { updateID = id }); } }); };