Commit ead14d55 authored by Anton Danilov's avatar Anton Danilov Committed by Anton Danilov

#367 Added attributes to game - application version name and code

parent f1385a10
......@@ -35,7 +35,8 @@ task writeTablexiaBuildConfig {
"public class TablexiaBuildConfig {\n" +
"\n" +
" public final static String APP_NAME = \"${tablexiaAppName}\";\n" +
" public final static String VERSION_NAME = \"${tablexiaVersionName}\";\n" +
" public final static String APPLICATION_VERSION_NAME = \"${tablexiaVersionName}\";\n" +
" public final static Integer APPLICATION_VERSION_CODE = ${tablexiaVersionCode};\n" +
" public final static String ASSETS_CHECKSUM = \"${getMapConvertedToString(rootProject.ext.assetsChecksum)}\";\n" +
" public final static String TABLEXIA_ASSETS_URL = ${project.hasProperty('TABLEXIA_ASSETS_DOWNLOAD_URL') ? "\"$TABLEXIA_ASSETS_DOWNLOAD_URL\"" : "null"};\n" +
" public final static String TABLEXIA_SERVER_PROTOCOL = ${project.hasProperty('TABLEXIA_SERVER_PROTOCOL') ? "\"$TABLEXIA_SERVER_PROTOCOL\"" : "null"};\n" +
......
......@@ -95,7 +95,7 @@ public class TablexiaRaven {
Version(InfoType.TAG, "Version", new StringRunnable() {
@Override
public String run() {
return TablexiaBuildConfig.VERSION_NAME;
return TablexiaBuildConfig.APPLICATION_VERSION_NAME;
}
}),
BuildType(InfoType.TAG, "BuildType", new StringRunnable() {
......
......@@ -53,8 +53,9 @@ public class TablexiaSettings {
private static final int WINTER_MODE_END_MONTH = 2;
private static boolean winterMode = false;
private static final String APP_NAME = TablexiaBuildConfig.APP_NAME;
private final String VERSION_NAME = TablexiaBuildConfig.VERSION_NAME;
private static final String APP_NAME = TablexiaBuildConfig.APP_NAME;
private final String APPLICATION_VERSION_NAME = TablexiaBuildConfig.APPLICATION_VERSION_NAME;
private final int APPLICATION_VERSION_CODE = TablexiaBuildConfig.APPLICATION_VERSION_CODE;
private final BuildType BUILD_TYPE;
private final boolean HAS_SOFT_BACK_BUTTON;
private static String hwSerial;
......@@ -209,7 +210,11 @@ public class TablexiaSettings {
}
public String getVersionName() {
return VERSION_NAME;
return APPLICATION_VERSION_NAME;
}
public int getVersionCode() {
return APPLICATION_VERSION_CODE;
}
public boolean hasSoftBackButton() {
......
......@@ -430,7 +430,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
random = TablexiaSettings.GAMES_RANDOM_SEED == null ? new TablexiaRandom() : new TablexiaRandom(TablexiaSettings.GAMES_RANDOM_SEED);
GameDefinition gameDefinition = GameDefinition.getGameDefinitionForClass(AbstractTablexiaGame.this.getClass());
GameDifficulty gameDifficulty = gameDefinition.hasTutorial() && UserDAO.isTutorialForGameDefinition(gameDefinition, getSelectedUser()) ? GameDifficulty.TUTORIAL : getGameDifficulty();
game = GameDAO.createGame(getSelectedUser(), gameDifficulty, gameDefinition, random, TablexiaSettings.getInstance().getHwSerial());
game = GameDAO.createGame(getSelectedUser(), gameDifficulty, gameDefinition, random, TablexiaSettings.getInstance().getHwSerial(), TablexiaSettings.getInstance().getVersionName(), TablexiaSettings.getInstance().getVersionCode());
Log.info(getClass(), "[DB] Created new GAME object: " + game);
} else {
Log.info(getClass(), "[DB] Restored last GAME object: " + game);
......
......@@ -55,7 +55,7 @@ public class GameTrophy {
public static class ThreeStarsReceived implements GameTrophyResolver {
public static final String GAME_SELECT_FOR_GAME_AND_DIFFICULTY = "SELECT id, user_id, difficulty_number, game_number, random_seed, start_time, end_time, hw_serial_number FROM game WHERE game_number = ? AND difficulty_number = ? AND user_id = ? AND end_time IS NOT NULL";
public static final String GAME_SELECT_FOR_GAME_AND_DIFFICULTY = "SELECT id, user_id, difficulty_number, game_number, random_seed, start_time, end_time, hw_serial_number, application_version_name, application_version_code FROM game WHERE game_number = ? AND difficulty_number = ? AND user_id = ? AND end_time IS NOT NULL";
private static List<Game> getGamesForGameAndDifficulty(User user, GameTrophyDefinition trophyDef) {
List<Game> games = new ArrayList<Game>();
......@@ -76,7 +76,9 @@ public class GameTrophy {
resultSet.getLong(5),
startTimeStr != null ? Long.valueOf(startTimeStr) : null,
endTimeStr != null ? Long.valueOf(endTimeStr) : null,
resultSet.getString(8));
resultSet.getString(8),
resultSet.getString(9),
resultSet.getInt(10));
game.setGamePauses(GamePauseDAO.selectGamePausesForGame(game));
game.getGameScoreMap().addAll(GameScoreDAO.selectGameScores(game.getId()));
games.add(game);
......
......@@ -155,8 +155,8 @@ public class UserTrophy {
public static class AllStarsGame implements UserTrophyResolver {
public static final String GAME_SELECT_FOR_USER_AND_DIFFICULTY = "SELECT id, user_id, difficulty_number, game_number, random_seed, start_time, end_time, hw_serial_number FROM game WHERE difficulty_number = ? AND user_id = ? AND end_time IS NOT NULL";
public static final String GAME_SELECT_FOR_USER = "SELECT id, user_id, difficulty_number, game_number, random_seed, start_time, end_time, hw_serial_number FROM game WHERE user_id = ? AND difficulty_number != ? AND start_time IS NOT NULL AND start_time != 0 AND end_time IS NOT NULL AND end_time != 0";
public static final String GAME_SELECT_FOR_USER_AND_DIFFICULTY = "SELECT id, user_id, difficulty_number, game_number, random_seed, start_time, end_time, hw_serial_number, application_version_name, application_version_code FROM game WHERE difficulty_number = ? AND user_id = ? AND end_time IS NOT NULL";
public static final String GAME_SELECT_FOR_USER = "SELECT id, user_id, difficulty_number, game_number, random_seed, start_time, end_time, hw_serial_number, application_version_name, application_version_code FROM game WHERE user_id = ? AND difficulty_number != ? AND start_time IS NOT NULL AND start_time != 0 AND end_time IS NOT NULL AND end_time != 0";
private static List<Game> getGamesForUserAndDifficulty(User user, UserTrophyDefinition trophyDef) throws SQLException {
PreparedStatement statement = TablexiaStorage.getInstance().prepareStatement(GAME_SELECT_FOR_USER_AND_DIFFICULTY);
......@@ -189,7 +189,9 @@ public class UserTrophy {
resultSet.getLong(5),
startTimeStr != null ? Long.valueOf(startTimeStr) : null,
endTimeStr != null ? Long.valueOf(endTimeStr) : null,
resultSet.getString(8));
resultSet.getString(8),
resultSet.getString(9),
resultSet.getInt(10));
game.setGamePauses(GamePauseDAO.selectGamePausesForGame(game));
game.getGameScoreMap().addAll(GameScoreDAO.selectGameScores(game.getId()));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment