You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1003 B
43 lines
1003 B
package net.sector.threads;
|
|
|
|
|
|
import static net.sector.threads.EThreadStatus.*;
|
|
import net.sector.level.SuperContext;
|
|
import net.sector.network.communication.LeaderboardClient;
|
|
import net.sector.network.communication.ServerError;
|
|
import net.sector.network.responses.ObjInfoTable;
|
|
import net.sector.util.Log;
|
|
|
|
|
|
/**
|
|
* Thread checking version of the latest release.
|
|
*
|
|
* @author Ondřej Hruška (MightyPork)
|
|
*/
|
|
public class ThreadCheckLatestVersion extends Thread {
|
|
|
|
/** Thread status */
|
|
public static EThreadStatus status = UNSTARTED;
|
|
|
|
@Override
|
|
public void run() {
|
|
status = WORKING;
|
|
|
|
try {
|
|
ObjInfoTable tbl = LeaderboardClient.getInfoTable();
|
|
|
|
SuperContext.latestVersionName = tbl.latest_version;
|
|
SuperContext.latestVersionNumber = tbl.latest_version_num;
|
|
|
|
Log.f1("THREAD: Downloaded information table.");
|
|
Log.f2(tbl.toString());
|
|
|
|
status = SUCCESS;
|
|
|
|
} catch (ServerError e) {
|
|
status = FAILURE;
|
|
Log.w("THREAD: Could not get info table: " + e.getMessage());
|
|
}
|
|
|
|
}
|
|
}
|
|
|