hide mqtt but couple it to relay

Idea is that if you have relay you have MQTT too. Eventually relay
should go away.
This commit is contained in:
Eric House 2020-06-10 09:53:26 -07:00
parent 28ff1022c3
commit 4508192a3a
3 changed files with 18 additions and 7 deletions

View file

@ -101,9 +101,9 @@ public class ConnViaViewLayout extends LinearLayout {
if ( isChecked ) {
showNotAgainTypeTip( typf );
enabledElseWarn( typf );
m_curSet.add( typf );
m_curSet.addWithCheck( typf );
} else {
m_curSet.remove( typf );
m_curSet.removeWithCheck( typf );
if ( null != m_emptyWarner && 0 == m_curSet.size()) {
m_emptyWarner.typeSetEmpty();
}

View file

@ -527,10 +527,7 @@ public class XWPrefs {
if ( -1 == flags ) {
result = new CommsConnTypeSet();
if ( getRelayEnabled( context ) ) {
result.add( CommsConnType.COMMS_CONN_RELAY );
}
if ( BuildConfig.OFFER_MQTT ) {
result.add( CommsConnType.COMMS_CONN_MQTT );
result.addWithCheck( CommsConnType.COMMS_CONN_RELAY );
}
if ( BTService.BTEnabled() ) {
result.add( CommsConnType.COMMS_CONN_BT );

View file

@ -55,7 +55,7 @@ public class CommsAddrRec {
COMMS_CONN_SMS,
COMMS_CONN_P2P,
COMMS_CONN_NFC(false),
COMMS_CONN_MQTT;
COMMS_CONN_MQTT(false);
private boolean mIsSelectable = true;
@ -199,6 +199,20 @@ public class CommsAddrRec {
return result;
}
public void addWithCheck( CommsConnType typ ) {
add( typ );
if ( BuildConfig.OFFER_MQTT && typ == CommsConnType.COMMS_CONN_RELAY ) {
add( CommsConnType.COMMS_CONN_MQTT );
}
}
public void removeWithCheck( CommsConnType typ ) {
remove( typ );
if ( typ == CommsConnType.COMMS_CONN_RELAY ) {
remove( CommsConnType.COMMS_CONN_MQTT );
}
}
public String toString( Context context, boolean longVersion )
{
String result;