Skip to content

Commit a18667f

Browse files
committed
Add update dialog and forward to GitHub releases
1 parent 7eea2d8 commit a18667f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

MusicBeam/MusicBeam.pde

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import controlP5.*;
1010
import ddf.minim.*;
1111
import ddf.minim.analysis.*;
1212

13-
String version = "2.5.1";
13+
String version = "2.6.1";
1414

1515
public Boolean debugMode = false;
1616

@@ -48,6 +48,9 @@ int height = 570;
4848
float maxLevel = 0;
4949
float goalMaxLevel=0;
5050
void settings() {
51+
if (! debugMode)
52+
checkForUpdate();
53+
5154
pixelDensity(displayDensity());
5255
initAudioInput();
5356

@@ -69,8 +72,6 @@ void setup() {
6972
colorMode(HSB, 360, 100, 100);
7073

7174
initControls();
72-
if (! debugMode)
73-
checkForUpdate();
7475
}
7576

7677

@@ -280,8 +281,11 @@ void checkForUpdate()
280281
jsonString += lines[i];
281282
}
282283
JSONObject json = parseJSONObject(jsonString);
283-
if (!json.getString("tag_name").toLowerCase().equals(version.toLowerCase()))
284-
launch("http://www.musicbeam.org/#update");
284+
if (!json.getString("tag_name").toLowerCase().equals(version.toLowerCase())) {
285+
int choice = JOptionPane.showConfirmDialog(null, "A newer version of MusicBeam is available. Do you want to download it now?", "Device detection", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
286+
if (choice == JOptionPane.YES_OPTION)
287+
launch("https://github.com/codingjoe/MusicBeam/releases/latest");
288+
}
285289
}
286290
}
287291

0 commit comments

Comments
 (0)