[fixes #825] Tie new update checker at startup
Check for updates at startup
This commit is contained in:
		
							parent
							
								
									448da9d0df
								
							
						
					
					
						commit
						f36ce5840b
					
				@ -15,6 +15,7 @@ import net.sf.openrocket.arch.SystemInfo;
 | 
			
		||||
import net.sf.openrocket.arch.SystemInfo.Platform;
 | 
			
		||||
import net.sf.openrocket.communication.UpdateInfo;
 | 
			
		||||
import net.sf.openrocket.communication.UpdateInfoRetriever;
 | 
			
		||||
import net.sf.openrocket.communication.UpdateInfoRetriever.ReleaseStatus;
 | 
			
		||||
import net.sf.openrocket.database.Databases;
 | 
			
		||||
import net.sf.openrocket.gui.dialogs.UpdateInfoDialog;
 | 
			
		||||
import net.sf.openrocket.gui.main.BasicFrame;
 | 
			
		||||
@ -230,22 +231,13 @@ public class SwingStartup {
 | 
			
		||||
			public void actionPerformed(ActionEvent e) {
 | 
			
		||||
				if (!updateRetriever.isRunning()) {
 | 
			
		||||
					timer.stop();
 | 
			
		||||
					
 | 
			
		||||
					String current = BuildProperties.getVersion();
 | 
			
		||||
					String last = Application.getPreferences().getString(Preferences.LAST_UPDATE, "");
 | 
			
		||||
					
 | 
			
		||||
 | 
			
		||||
					UpdateInfo info = updateRetriever.getUpdateInfo();
 | 
			
		||||
					if (info != null && info.getLatestVersion() != null &&
 | 
			
		||||
							!current.equals(info.getLatestVersion()) &&
 | 
			
		||||
							!last.equals(info.getLatestVersion())) {
 | 
			
		||||
						
 | 
			
		||||
 | 
			
		||||
					// Only display something when an update is found
 | 
			
		||||
					if (info != null && info.getException() == null && info.getReleaseStatus() == ReleaseStatus.OLDER) {
 | 
			
		||||
						UpdateInfoDialog infoDialog = new UpdateInfoDialog(info);
 | 
			
		||||
						infoDialog.setVisible(true);
 | 
			
		||||
						if (infoDialog.isReminderSelected()) {
 | 
			
		||||
							Application.getPreferences().putString(Preferences.LAST_UPDATE, "");
 | 
			
		||||
						} else {
 | 
			
		||||
							Application.getPreferences().putString(Preferences.LAST_UPDATE, info.getLatestVersion());
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				count--;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user