Skip to content

Commit 1ba7269

Browse files
authored
Merge pull request #1203 from catilac/beta-welcome-logic
Display Welcome to Beta once per revision
2 parents 15aba90 + 673c222 commit 1ba7269

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

app/src/processing/app/UpdateCheck.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import processing.core.PApplet;
3636

3737

38+
3839
/**
3940
* Threaded class to check for updates in the background.
4041
* <p/>
@@ -112,6 +113,7 @@ public void updateCheck() throws IOException {
112113
System.getProperty("os.arch"));
113114

114115
int latest = readInt(LATEST_URL + "?" + info);
116+
int revision = Base.getRevision();
115117

116118
String lastString = Preferences.get("update.last");
117119
long now = System.currentTimeMillis();
@@ -125,18 +127,19 @@ public void updateCheck() throws IOException {
125127
Preferences.set("update.last", String.valueOf(now));
126128

127129
if (base.activeEditor != null) {
128-
// boolean offerToUpdateContributions = true;
129130

130-
if (latest > Base.getRevision()) {
131+
if (latest > revision) {
131132
System.out.println("You are running Processing revision 0" +
132-
Base.getRevision() + ", the latest build is 0" +
133+
revision + ", the latest build is 0" +
133134
latest + ".");
134135
// Assume the person is busy downloading the latest version
135136
// offerToUpdateContributions = !promptToVisitDownloadPage();
136137
promptToVisitDownloadPage();
137138
}
138-
if(latest < Base.getRevision()){
139-
WelcomeToBeta.showWelcomeToBeta();
139+
140+
int lastBetaWelcomeSeen = Preferences.getInteger("update.beta_welcome");
141+
if(latest < revision && revision != lastBetaWelcomeSeen ) {
142+
WelcomeToBeta.showWelcomeToBeta();
140143
}
141144

142145
/*

app/src/processing/app/ui/WelcomeToBeta.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import com.mikepenz.markdown.m2.markdownColor
3535
import com.mikepenz.markdown.m2.markdownTypography
3636
import com.mikepenz.markdown.model.MarkdownColors
3737
import com.mikepenz.markdown.model.MarkdownTypography
38+
import processing.app.Preferences
3839
import processing.app.Base.getRevision
3940
import processing.app.Base.getVersionName
4041
import processing.app.ui.theme.LocalLocale
@@ -61,7 +62,10 @@ class WelcomeToBeta {
6162
val mac = SystemInfo.isMacFullWindowContentSupported
6263
SwingUtilities.invokeLater {
6364
JFrame(windowTitle).apply {
64-
val close = { dispose() }
65+
val close = {
66+
Preferences.set("update.beta_welcome", getRevision().toString())
67+
dispose()
68+
}
6569
rootPane.putClientProperty("apple.awt.transparentTitleBar", mac)
6670
rootPane.putClientProperty("apple.awt.fullWindowContent", mac)
6771
defaultCloseOperation = JFrame.DISPOSE_ON_CLOSE

build/shared/lib/defaults.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ theme.gradient.method = rgb
7676
# on how many people are using Processing)
7777
update.check = true
7878

79+
# default value for beta_welcome
80+
# -1 means no beta has been run
81+
update.beta_welcome = -1
82+
7983
# on windows, automatically associate .pde files with processing.exe
8084
platform.auto_file_type_associations = true
8185

0 commit comments

Comments
 (0)