Skip to content
This repository was archived by the owner on Sep 2, 2021. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 32 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,30 @@ <h5 data-i18n="footer.in-touch.header">Keep in Touch</h5>
});

$.when(ajaxRequest, i18nLoaded).done(function (data) {
var build = data[0][0],
buildName = build.versionString;
var allBuilds = data[0],
build = data[0][0]; // default initialization with latest build

// Find the applicable build for current platform
// If current platform is unsupported (OTHERS), then take the last common release
// If a build entry doesn't have 'platforms' key -> Older format for all supported OS
for (var buildIndex = 0; buildIndex < allBuilds.length; buildIndex++) {
build = allBuilds[buildIndex];
if (!build.platforms) { // Older format detected - Applicable to all platforms
break;
} else {
if (OS === "OTHER") { // Unsupported platform detected
if (Object.keys(build.platforms).length == 4) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be === . Also what does this check mean?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are avoiding a type check as both the LHS and RHS are know to be numbers.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't (build.platforms[OS]) be the first check ? Also, how does checking for length of keys the build.platforms help ? what if support for another platform is added in future ?

break;
}
} else { // Current platform is one of the supported platforms
if (build.platforms[OS]) { // Build applicable to current platform
break;
}
}
}
}

var buildName = build.versionString;

if (buildName) {
var buildNum = buildName.match(/([\d.]+)/);
Expand All @@ -470,11 +492,16 @@ <h5 data-i18n="footer.in-touch.header">Keep in Touch</h5>

// update button
if (OS !== "OTHER" && buildNum) {
var tag = buildName.toLowerCase().split(" ").join("-"),
var url;
if (build.platforms && build.platforms[OS]) { // Fetch download url from platform entry
url = build.platforms[OS].downloadURL;
} else { // Generate the download URI
var tag = buildName.toLowerCase().split(" ").join("-");
url = "https://github.com/adobe/brackets/releases/" + tag;

if (ext) {
url = "https://github.com/adobe/brackets/releases/download/" + tag + "/Brackets." + buildName.split(" ").join(".") + ext;
if (ext) {
url = "https://github.com/adobe/brackets/releases/download/" + tag + "/Brackets." + buildName.split(" ").join(".") + ext;
}
}

$("#download-brackets-version").text(buildNum);
Expand Down