1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-01 17:34:10 +02:00

Add unsupported system notification

Closes 
This commit is contained in:
chylex 2016-09-04 20:30:35 +02:00
parent b2cc5d50bd
commit 339da2f1a9
2 changed files with 39 additions and 5 deletions
Resources/Scripts
Updates

View File

@ -18,6 +18,8 @@
// Function: Creates the update notification element. Removes the old one if already exists. // Function: Creates the update notification element. Removes the old one if already exists.
// //
var createUpdateNotificationElement = function(version, download){ var createUpdateNotificationElement = function(version, download){
var outdated = version === "unsupported";
var ele = $("#tweetdck-update"); var ele = $("#tweetdck-update");
var existed = ele.length > 0; var existed = ele.length > 0;
@ -25,13 +27,22 @@
ele.remove(); ele.remove();
} }
var html = [ var html = outdated ? [
"<div id='tweetdck-update'>",
"<p class='tdu-title'>Unsupported System</p>",
"<p class='tdu-info'>You will not receive updates.</p>",
"<div class='tdu-buttons'>",
"<button class='btn btn-positive tdu-btn-unsupported'><span class='label'>Read More</span></button>",
"<button class='btn btn-negative tdu-btn-dismiss'><span class='label'>Dismiss</span></button>",
"</div>",
"</div>"
] : [
"<div id='tweetdck-update'>", "<div id='tweetdck-update'>",
"<p class='tdu-title'>"+$TDU.brandName+" Update</p>", "<p class='tdu-title'>"+$TDU.brandName+" Update</p>",
"<p class='tdu-info'>Version "+version+" is now available.</p>", "<p class='tdu-info'>Version "+version+" is now available.</p>",
"<div class='tdu-buttons'>", "<div class='tdu-buttons'>",
"<button class='btn btn-positive tdu-btn-download'><span class='label'>Download</button>", "<button class='btn btn-positive tdu-btn-download'><span class='label'>Download</span></button>",
"<button class='btn btn-negative tdu-btn-dismiss'><span class='label'>Dismiss</button>", "<button class='btn btn-negative tdu-btn-dismiss'><span class='label'>Dismiss</span></button>",
"</div>", "</div>",
"</div>" "</div>"
]; ];
@ -60,7 +71,7 @@
fontWeight: "bold", fontWeight: "bold",
textAlign: "center", textAlign: "center",
letterSpacing: "0.2px", letterSpacing: "0.2px",
margin: "4px auto 2px" margin: "5px auto 2px"
}); });
ele.children("p.tdu-info").first().css({ ele.children("p.tdu-info").first().css({
@ -93,7 +104,11 @@
$TDU.onUpdateAccepted(version, download); $TDU.onUpdateAccepted(version, download);
}); });
buttonDiv.children(".tdu-btn-dismiss").click(function(){ buttonDiv.children(".tdu-btn-unsupported").click(function(){
$TDU.openBrowser("https://github.com/chylex/TweetDuck/wiki/Supported-Systems");
});
buttonDiv.children(".tdu-btn-dismiss,.tdu-btn-unsupported").click(function(){
$TDU.onUpdateDismissed(version); $TDU.onUpdateDismissed(version);
ele.slideUp(function(){ ele.remove(); }); ele.slideUp(function(){ ele.remove(); });
}); });
@ -109,6 +124,14 @@
// Function: Runs an update check and updates all DOM elements appropriately. // Function: Runs an update check and updates all DOM elements appropriately.
// //
var runUpdateCheck = function(force, eventID){ var runUpdateCheck = function(force, eventID){
if (!$TDU.isSystemSupported){
if ($TDU.dismissedVersionTag !== "unsupported"){
createUpdateNotificationElement("unsupported");
}
return;
}
clearTimeout(updateCheckTimeoutID); clearTimeout(updateCheckTimeoutID);
updateCheckTimeoutID = setTimeout(runUpdateCheck, 1000*60*60); // 1 hour updateCheckTimeoutID = setTimeout(runUpdateCheck, 1000*60*60); // 1 hour

View File

@ -3,6 +3,7 @@
using CefSharp.WinForms; using CefSharp.WinForms;
using TweetDck.Core; using TweetDck.Core;
using TweetDck.Core.Controls; using TweetDck.Core.Controls;
using TweetDck.Core.Utils;
using TweetDck.Resources; using TweetDck.Resources;
namespace TweetDck.Updates{ namespace TweetDck.Updates{
@ -70,6 +71,12 @@ public string DismissedVersionTag{
} }
} }
public bool IsSystemSupported{
get{
return Environment.OSVersion.Version >= new Version("6.1"); // 6.1 NT version = Windows 7
}
}
private readonly UpdateHandler owner; private readonly UpdateHandler owner;
public Bridge(UpdateHandler owner){ public Bridge(UpdateHandler owner){
@ -90,6 +97,10 @@ public void OnUpdateDismissed(string versionTag){
Program.UserConfig.Save(); Program.UserConfig.Save();
}); });
} }
public void OpenBrowser(string url){
BrowserUtils.OpenExternalBrowser(url);
}
} }
} }
} }