on receipt of invitation, remove address modes the device doesn't

support.
This commit is contained in:
Eric House 2015-06-18 08:48:03 -07:00
parent f93f0cd926
commit d89c0d2847

View file

@ -185,6 +185,8 @@ public class NetLaunchInfo {
} }
} }
removeUnsupported( supported );
dict = data.getQueryParameter( WORDLIST_KEY ); dict = data.getQueryParameter( WORDLIST_KEY );
String langStr = data.getQueryParameter( LANG_KEY ); String langStr = data.getQueryParameter( LANG_KEY );
lang = Integer.decode( langStr ); lang = Integer.decode( langStr );
@ -369,6 +371,7 @@ public class NetLaunchInfo {
private void init( Context context, String data ) private void init( Context context, String data )
{ {
CommsConnTypeSet supported = CommsConnTypeSet.getSupported( context );
try { try {
JSONObject json = new JSONObject( data ); JSONObject json = new JSONObject( data );
@ -386,7 +389,6 @@ public class NetLaunchInfo {
m_gameID = json.optInt( MultiService.GAMEID, 0 ); m_gameID = json.optInt( MultiService.GAMEID, 0 );
// Try each type // Try each type
CommsConnTypeSet supported = CommsConnTypeSet.getSupported( context );
for ( CommsConnType typ : supported.getTypes() ) { for ( CommsConnType typ : supported.getTypes() ) {
if ( hasAddrs && !m_addrs.contains( typ ) ) { if ( hasAddrs && !m_addrs.contains( typ ) ) {
continue; continue;
@ -422,6 +424,8 @@ public class NetLaunchInfo {
DbgUtils.loge( jse ); DbgUtils.loge( jse );
} }
removeUnsupported( supported );
calcValid(); calcValid();
} }
@ -529,6 +533,16 @@ public class NetLaunchInfo {
&& 0 != gameID(); && 0 != gameID();
} }
private void removeUnsupported( CommsConnTypeSet supported )
{
for ( Iterator<CommsConnType> iter = m_addrs.iterator();
iter.hasNext(); ) {
if ( !supported.contains( iter.next() ) ) {
iter.remove();
}
}
}
private void calcValid() private void calcValid()
{ {
boolean valid = hasCommon() && null != m_addrs; boolean valid = hasCommon() && null != m_addrs;