From 9fd4bb2a11faa6f2deac029cd4f278c730bf3d3e Mon Sep 17 00:00:00 2001 From: Eric House Date: Sat, 11 Apr 2020 19:54:02 -0700 Subject: [PATCH] enable relayid-invites for non-tagged release builds Too useful for testing --- xwords4/android/app/build.gradle | 5 ----- .../eehouse/android/xw4/InviteChoicesAlert.java | 2 +- .../eehouse/android/xw4/RelayInviteDelegate.java | 16 +++++++++------- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/xwords4/android/app/build.gradle b/xwords4/android/app/build.gradle index 8539c7b41..f9fcf68ee 100644 --- a/xwords4/android/app/build.gradle +++ b/xwords4/android/app/build.gradle @@ -96,7 +96,6 @@ android { resValue "string", "app_name", "CrossWords" resValue "string", "nbs_port", "3344" buildConfigField "boolean", "WIDIR_ENABLED", "false" - buildConfigField "boolean", "RELAYINVITE_SUPPORTED", "false" buildConfigField "String", "VARIANT_NAME", "\"Google Play Store\"" buildConfigField "int", "VARIANT_CODE", "1" buildConfigField "String", "NFC_AID", "\"${NFC_AID_XW4}\"" @@ -112,7 +111,6 @@ android { resValue "string", "app_name", "CrossWords" resValue "string", "nbs_port", "3344" buildConfigField "boolean", "WIDIR_ENABLED", "false" - buildConfigField "boolean", "RELAYINVITE_SUPPORTED", "false" buildConfigField "String", "VARIANT_NAME", "\"F-Droid\"" buildConfigField "int", "VARIANT_CODE", "2" buildConfigField "boolean", "FOR_FDROID", "true" @@ -129,7 +127,6 @@ android { resValue "string", "app_name", "CrossDbg" resValue "string", "nbs_port", "3345" buildConfigField "boolean", "WIDIR_ENABLED", "true" - buildConfigField "boolean", "RELAYINVITE_SUPPORTED", "true" buildConfigField "String", "VARIANT_NAME", "\"Dev/Debug\"" buildConfigField "int", "VARIANT_CODE", "3" buildConfigField "boolean", "REPORT_LOCKS", "true" @@ -148,7 +145,6 @@ android { resValue "string", "app_name", "CrossDbg" resValue "string", "nbs_port", "3345" buildConfigField "boolean", "WIDIR_ENABLED", "true" - buildConfigField "boolean", "RELAYINVITE_SUPPORTED", "true" buildConfigField "String", "VARIANT_NAME", "\"Dev/Debug NoSMS\"" buildConfigField "int", "VARIANT_CODE", "4" buildConfigField "boolean", "REPORT_LOCKS", "true" @@ -165,7 +161,6 @@ android { resValue "string", "app_name", "CrossWords" resValue "string", "nbs_port", "3344" buildConfigField "boolean", "WIDIR_ENABLED", "false" - buildConfigField "boolean", "RELAYINVITE_SUPPORTED", "false" buildConfigField "String", "VARIANT_NAME", "\"FOSS\"" buildConfigField "int", "VARIANT_CODE", "5" buildConfigField "String", "NFC_AID", "\"${NFC_AID_XW4}\"" diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteChoicesAlert.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteChoicesAlert.java index 5810233c3..b9a532bfb 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteChoicesAlert.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteChoicesAlert.java @@ -65,7 +65,7 @@ public class InviteChoicesAlert extends DlgDelegateAlert { if ( Utils.deviceSupportsNBS(context) ) { add( items, means, R.string.invite_choice_data_sms, InviteMeans.SMS_DATA ); } - if ( BuildConfig.RELAYINVITE_SUPPORTED ) { + if ( BuildConfig.DEBUG || !BuildConfig.IS_TAGGED_BUILD ) { add( items, means, R.string.invite_choice_relay, InviteMeans.RELAY ); } if ( WiDirWrapper.enabled() ) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayInviteDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayInviteDelegate.java index 8dd4709af..1a42739f9 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayInviteDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayInviteDelegate.java @@ -57,6 +57,8 @@ import org.eehouse.android.xw4.DlgDelegate.Action; public class RelayInviteDelegate extends InviteDelegate { private static final String TAG = RelayInviteDelegate.class.getSimpleName(); private static final String RECS_KEY = "TAG" + "/recs"; + private static final boolean RELAYINVITE_SUPPORTED + = BuildConfig.DEBUG || !BuildConfig.IS_TAGGED_BUILD; private static int[] BUTTONIDS = { R.id.button_relay_add, @@ -77,7 +79,7 @@ public class RelayInviteDelegate extends InviteDelegate { SentInvitesInfo info, RequestCode requestCode ) { - if ( BuildConfig.RELAYINVITE_SUPPORTED ) { + if ( RELAYINVITE_SUPPORTED ) { Intent intent = InviteDelegate.makeIntent( activity, RelayInviteActivity.class, nMissing, info ); @@ -94,7 +96,7 @@ public class RelayInviteDelegate extends InviteDelegate { @Override protected void init( Bundle savedInstanceState ) { - if ( BuildConfig.RELAYINVITE_SUPPORTED ) { + if ( RELAYINVITE_SUPPORTED ) { super.init( savedInstanceState ); String msg = getString( R.string.button_invite ); @@ -137,7 +139,7 @@ public class RelayInviteDelegate extends InviteDelegate { @Override protected void onBarButtonClicked( int id ) { - if ( BuildConfig.RELAYINVITE_SUPPORTED ) { + if ( RELAYINVITE_SUPPORTED ) { switch( id ) { case R.id.button_relay_add: Utils.notImpl( m_activity ); @@ -189,7 +191,7 @@ public class RelayInviteDelegate extends InviteDelegate { protected Dialog makeDialog( DBAlert alert, Object[] params ) { Dialog dialog = null; - if ( BuildConfig.RELAYINVITE_SUPPORTED ) { + if ( RELAYINVITE_SUPPORTED ) { DialogInterface.OnClickListener lstnr; switch( alert.getDlgID() ) { case GET_NUMBER: { @@ -334,7 +336,7 @@ public class RelayInviteDelegate extends InviteDelegate { @Override protected void tryEnable() { - if ( BuildConfig.RELAYINVITE_SUPPORTED ) { + if ( RELAYINVITE_SUPPORTED ) { super.tryEnable(); Button button = (Button)findViewById( R.id.button_clear ); @@ -353,7 +355,7 @@ public class RelayInviteDelegate extends InviteDelegate { public boolean onPosButton( Action action, Object[] params ) { boolean handled = true; - if ( BuildConfig.RELAYINVITE_SUPPORTED ) { + if ( RELAYINVITE_SUPPORTED ) { switch( action ) { case CLEAR_ACTION: clearSelectedImpl(); @@ -373,7 +375,7 @@ public class RelayInviteDelegate extends InviteDelegate { public boolean onDismissed( Action action, Object[] params ) { boolean handled = true; - if ( BuildConfig.RELAYINVITE_SUPPORTED ) { + if ( RELAYINVITE_SUPPORTED ) { if ( Action.USE_IMMOBILE_ACTION == action && m_immobileConfirmed ) { makeConfirmThenBuilder( R.string.warn_unlimited, Action.POST_WARNING_ACTION )