()
| 102 | |
| 103 | |
| 104 | public void updateCheck() throws IOException { |
| 105 | String info = PApplet.urlEncode(getUpdateID() + "\t" + |
| 106 | PApplet.nf(Base.getRevision(), 4) + "\t" + |
| 107 | System.getProperty("java.version") + "\t" + |
| 108 | System.getProperty("java.vendor") + "\t" + |
| 109 | System.getProperty("os.name") + "\t" + |
| 110 | System.getProperty("os.version") + "\t" + |
| 111 | System.getProperty("os.arch")); |
| 112 | |
| 113 | int latest = readInt(LATEST_URL + "?" + info); |
| 114 | |
| 115 | String lastString = Preferences.get("update.last"); |
| 116 | long now = System.currentTimeMillis(); |
| 117 | if (lastString != null) { |
| 118 | long when = Long.parseLong(lastString); |
| 119 | if (now - when < ONE_DAY) { |
| 120 | // don't annoy the shit outta people |
| 121 | return; |
| 122 | } |
| 123 | } |
| 124 | Preferences.set("update.last", String.valueOf(now)); |
| 125 | |
| 126 | if (base.activeEditor != null) { |
| 127 | // boolean offerToUpdateContributions = true; |
| 128 | |
| 129 | if (latest > Base.getRevision()) { |
| 130 | System.out.println("You are running Processing revision 0" + |
| 131 | Base.getRevision() + ", the latest build is 0" + |
| 132 | latest + "."); |
| 133 | // Assume the person is busy downloading the latest version |
| 134 | // offerToUpdateContributions = !promptToVisitDownloadPage(); |
| 135 | promptToVisitDownloadPage(); |
| 136 | } |
| 137 | |
| 138 | /* |
| 139 | if (offerToUpdateContributions) { |
| 140 | // Wait for xml file to be downloaded and updates to come in. |
| 141 | // (this should really be handled better). |
| 142 | Thread.sleep(5 * 1000); |
| 143 | if ((!base.contributionManagerFrame.hasAlreadyBeenOpened() |
| 144 | && (base.contributionManagerFrame.hasUpdates(base)))){ |
| 145 | promptToOpenContributionManager(); |
| 146 | } |
| 147 | } |
| 148 | */ |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | |
| 153 | protected void promptToVisitDownloadPage() { |
no test coverage detected