move constant from XWApp to build.gradle

This commit is contained in:
Eric House 2019-02-06 10:44:21 -08:00
parent f92b0d7ac0
commit 895b19a097
5 changed files with 14 additions and 14 deletions

View file

@ -69,6 +69,7 @@ android {
buildConfigField "boolean", "IS_TAGGED_BUILD", "${CURTAG}" == '' ? "false" : "true"
resValue "string", "invite_prefix", "/and/"
buildConfigField "int[]", "SMS_BANNED_EXPL", "null"
buildConfigField "boolean", "UDP_ENABLED", "true"
}
xw4 {

View file

@ -80,7 +80,7 @@ public class CommsTransport implements TransportProcs,
@Override
public void run()
{
if ( !XWApp.UDP_ENABLED ) {
if ( !BuildConfig.UDP_ENABLED ) {
m_done = false;
boolean failed = true;
try {
@ -111,7 +111,7 @@ public class CommsTransport implements TransportProcs,
private boolean loop()
{
boolean failed = false;
if ( !XWApp.UDP_ENABLED ) {
if ( !BuildConfig.UDP_ENABLED ) {
outer_loop:
while ( !m_done ) {
try {
@ -237,7 +237,7 @@ public class CommsTransport implements TransportProcs,
private synchronized void putOut( final byte[] buf )
{
if ( !XWApp.UDP_ENABLED ) {
if ( !BuildConfig.UDP_ENABLED ) {
int len = buf.length;
ByteBuffer netbuf = ByteBuffer.allocate( len + 2 );
netbuf.putShort( (short)len );
@ -254,7 +254,7 @@ public class CommsTransport implements TransportProcs,
private synchronized void closeSocket()
{
if ( !XWApp.UDP_ENABLED && null != m_socketChannel ) {
if ( !BuildConfig.UDP_ENABLED && null != m_socketChannel ) {
try {
m_socketChannel.close();
} catch ( Exception e ) {
@ -294,7 +294,7 @@ public class CommsTransport implements TransportProcs,
private void addIncoming( )
{
if ( !XWApp.UDP_ENABLED ) {
if ( !BuildConfig.UDP_ENABLED ) {
m_bytesIn.flip();
for ( ; ; ) {
@ -330,7 +330,7 @@ public class CommsTransport implements TransportProcs,
private void waitToStopImpl()
{
if ( !XWApp.UDP_ENABLED ) {
if ( !BuildConfig.UDP_ENABLED ) {
m_done = true; // this is in a race!
if ( null != m_selector ) {
m_selector.wakeup(); // getting NPE inside here -- see below
@ -363,13 +363,13 @@ public class CommsTransport implements TransportProcs,
Assert.assertNotNull( addr );
Assert.assertTrue( addr.contains( conType ) );
if ( !XWApp.UDP_ENABLED && conType == CommsConnType.COMMS_CONN_RELAY
if ( !BuildConfig.UDP_ENABLED && conType == CommsConnType.COMMS_CONN_RELAY
&& null == m_relayAddr ) {
m_relayAddr = new CommsAddrRec( addr );
m_useHost = NetUtils.forceHost( m_relayAddr.ip_relay_hostName );
}
if ( !XWApp.UDP_ENABLED && conType == CommsConnType.COMMS_CONN_RELAY ) {
if ( !BuildConfig.UDP_ENABLED && conType == CommsConnType.COMMS_CONN_RELAY ) {
if ( NetStateCache.netAvail( m_context ) ) {
putOut( buf ); // add to queue
if ( null == m_thread ) {
@ -422,7 +422,7 @@ public class CommsTransport implements TransportProcs,
int nSent = -1;
switch ( conType ) {
case COMMS_CONN_RELAY:
Assert.assertTrue( XWApp.UDP_ENABLED );
Assert.assertTrue( BuildConfig.UDP_ENABLED );
nSent = RelayService.sendPacket( context, rowID, buf );
break;
case COMMS_CONN_SMS:

View file

@ -58,7 +58,7 @@ public class MultiMsgSink implements TransportProcs {
// can just insert a message into its queue
public int sendViaRelay( byte[] buf, int gameID )
{
Assert.assertTrue( XWApp.UDP_ENABLED );
Assert.assertTrue( BuildConfig.UDP_ENABLED );
return RelayService.sendPacket( m_context, getRowID(), buf );
}

View file

@ -567,7 +567,7 @@ public class RelayService extends JobIntentService
private boolean startFetchThreadIfNotUDP()
{
// DbgUtils.logf( "startFetchThreadIfNotUDP()" );
boolean handled = relayEnabled( this ) && !XWApp.UDP_ENABLED;
boolean handled = relayEnabled( this ) && !BuildConfig.UDP_ENABLED;
if ( handled && null == m_fetchThread ) {
Assert.assertFalse( BuildConfig.DEBUG ); // NOT using this now!
@ -600,7 +600,7 @@ public class RelayService extends JobIntentService
private UDPThreads startUDPThreadsOnce()
{
UDPThreads threads = null;
if ( XWApp.UDP_ENABLED && relayEnabled( this ) ) {
if ( BuildConfig.UDP_ENABLED && relayEnabled( this ) ) {
synchronized ( sUDPThreadsRef ) {
threads = sUDPThreadsRef.get();
if ( null == threads ) {
@ -1613,7 +1613,7 @@ public class RelayService extends JobIntentService
Log.d( TAG, "startThreads()" );
if ( !relayEnabled( this ) || !NetStateCache.netAvail( this ) ) {
stopThreads();
} else if ( XWApp.UDP_ENABLED ) {
} else if ( BuildConfig.UDP_ENABLED ) {
stopFetchThreadIf();
startUDPThreadsOnce();
registerWithRelay( -1 );

View file

@ -45,7 +45,6 @@ public class XWApp extends Application implements LifecycleObserver {
public static final boolean ATTACH_SUPPORTED = false;
public static final boolean LOG_LIFECYLE = false;
public static final boolean DEBUG_EXP_TIMERS = false;
public static final boolean UDP_ENABLED = true;
public static final boolean SMS_INVITE_ENABLED = true;
public static final boolean LOCUTILS_ENABLED = false;
public static final boolean CONTEXT_MENUS_ENABLED = true;