Skip to content
Snippets Groups Projects
Commit 5259b7c7 authored by Anton Danilov's avatar Anton Danilov
Browse files

Merge branch 'devel' into feature-halloffame

parents e96ea1eb 924a4b70
Branches
Tags
No related merge requests found
......@@ -34,10 +34,11 @@ task writeTablexiaBuildConfig {
" */\n" +
"public class TablexiaBuildConfig {\n" +
"\n" +
" public final static String VERSION_NAME = \"${tablexiaVersionName}\";\n" +
" public final static String ASSETS_CHECKSUM = \"${getMapConvertedToString(rootProject.ext.assetsChecksum)}\";\n" +
" public final static String TABLEXIA_SERVER_ADDRESS = ${project.hasProperty('TABLEXIA_SERVER_ADDRESS') ? "\"$TABLEXIA_SERVER_ADDRESS\"" : "null"};\n" +
" public final static String FLURRY_KEY = ${project.hasProperty('TABLEXIA_FLURRY_KEY') ? "\"$TABLEXIA_FLURRY_KEY\"" : "null"};\n" +
" public final static String VERSION_NAME = \"${tablexiaVersionName}\";\n" +
" public final static String ASSETS_CHECKSUM = \"${getMapConvertedToString(rootProject.ext.assetsChecksum)}\";\n" +
" public final static String TABLEXIA_SERVER_HOST = ${project.hasProperty('TABLEXIA_SERVER_HOST') ? "\"$TABLEXIA_SERVER_HOST\"" : "null"};\n" +
" public final static Integer TABLEXIA_SERVER_PORT = ${project.hasProperty('TABLEXIA_SERVER_PORT') ? "$TABLEXIA_SERVER_PORT" : "null"};\n" +
" public final static String FLURRY_KEY = ${project.hasProperty('TABLEXIA_FLURRY_KEY') ? "\"$TABLEXIA_FLURRY_KEY\"" : "null"};\n" +
"\n" +
"}", BUILD_CONFIG_FILE_ENCODING)
}
......
......@@ -21,8 +21,16 @@ public class RestSynchronizationService {
INCREMENT,
}
private static final String LOCALHOST_REST_URL = "http://localhost:8080";
public static final String REST_URL = TablexiaBuildConfig.TABLEXIA_SERVER_ADDRESS != null ? TablexiaBuildConfig.TABLEXIA_SERVER_ADDRESS : LOCALHOST_REST_URL;
private static final String PROTOCOL = "http://";
private static final String PORT_DIVIDER = ":";
private static final String FALLBACK_REST_HOST = "localhost";
private static final int FALLBACK_REST_PORT = 8080;
public static final String REST_ADDRESS = PROTOCOL +
(TablexiaBuildConfig.TABLEXIA_SERVER_HOST != null ? TablexiaBuildConfig.TABLEXIA_SERVER_HOST : FALLBACK_REST_HOST) +
PORT_DIVIDER +
(TablexiaBuildConfig.TABLEXIA_SERVER_PORT != null ? TablexiaBuildConfig.TABLEXIA_SERVER_PORT : FALLBACK_REST_PORT);
private HttpRequestBuilder builder;
private Net.HttpResponseListener listener;
......@@ -59,18 +67,18 @@ public class RestSynchronizationService {
}
public static String getCreateUserUrl() {
return REST_URL + UserRestPath.USER_PATH + UserRestPath.USER_CREATE;
return REST_ADDRESS + UserRestPath.USER_PATH + UserRestPath.USER_CREATE;
}
public static String getConfirmUserUrl(String uuid) {
return REST_URL + UserRestPath.USER_PATH + UserRestPath.USER_CONFIRM.replace("{" + UserRestPath.USER_UUID + "}", uuid);
return REST_ADDRESS + UserRestPath.USER_PATH + UserRestPath.USER_CONFIRM.replace("{" + UserRestPath.USER_UUID + "}", uuid);
}
public static String getDownloadUserUrl(String uuid) {
return REST_URL + UserRestPath.USER_PATH + UserRestPath.USER_GET.replace("{" + UserRestPath.USER_UUID + "}", uuid);
return REST_ADDRESS + UserRestPath.USER_PATH + UserRestPath.USER_GET.replace("{" + UserRestPath.USER_UUID + "}", uuid);
}
public static String getDeleteUserUrl(String uuid) {
return REST_URL + UserRestPath.USER_PATH + UserRestPath.USER_DELETE.replace("{" + UserRestPath.USER_UUID + "}", uuid);
return REST_ADDRESS + UserRestPath.USER_PATH + UserRestPath.USER_DELETE.replace("{" + UserRestPath.USER_UUID + "}", uuid);
}
}
......@@ -7,15 +7,24 @@ import org.robovm.apple.foundation.NSAutoreleasePool;
import org.robovm.apple.foundation.NSBundle;
import org.robovm.apple.foundation.NSDictionary;
import org.robovm.apple.foundation.NSString;
import org.robovm.apple.systemconfiguration.SCNetworkReachability;
import org.robovm.apple.systemconfiguration.SCNetworkReachabilityFlags;
import org.robovm.apple.uikit.UIApplication;
import java.net.InetSocketAddress;
import java.util.Locale;
import cz.nic.tablexia.screen.loader.IConnectionManager;
public class IOSLauncher extends IOSApplication.Delegate {
public static final Tablexia.SQLConnectionType SQL_CONNECTION_TYPE = new Tablexia.SQLConnectionType("SQLite.JDBCDriver", "jdbc:sqlite:");
public static final Tablexia.SQLConnectionType SQL_CONNECTION_TYPE = new Tablexia.SQLConnectionType("SQLite.JDBCDriver", "jdbc:sqlite:");
private static final String FALLBACK_CONNECTION_CHECK_HOST = "nic.cz";
private static final Integer FALLBACK_CONNECTION_CHECK_PORT = 80;
private static final String CONNECTION_CHECK_HOST = TablexiaBuildConfig.TABLEXIA_SERVER_HOST != null ? TablexiaBuildConfig.TABLEXIA_SERVER_HOST : FALLBACK_CONNECTION_CHECK_HOST;
private static final Integer CONNECTION_CHECK_PORT = TablexiaBuildConfig.TABLEXIA_SERVER_PORT != null ? TablexiaBuildConfig.TABLEXIA_SERVER_PORT : FALLBACK_CONNECTION_CHECK_PORT;
@Override
protected IOSApplication createApplication() {
......@@ -42,8 +51,8 @@ public class IOSLauncher extends IOSApplication.Delegate {
private static class IOSConnectionManager implements IConnectionManager {
@Override
public boolean isUsingMobileData() {
//TODO - Use RoboVM to decide whether user is currently using mobile data
return false;
SCNetworkReachabilityFlags flags = SCNetworkReachability.create(new InetSocketAddress(CONNECTION_CHECK_HOST, CONNECTION_CHECK_PORT)).getFlags();
return flags.compareTo(SCNetworkReachabilityFlags.IsWWAN) == 1;
}
}
}
\ No newline at end of file
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