remove dead code; assert other dead

Adding asserts to confirm that code that shouldn't be called in fact
isn't.
This commit is contained in:
Eric House 2022-10-14 10:27:43 -07:00
parent ee6c88b944
commit 848ae6f0f6
4 changed files with 3 additions and 78 deletions

View file

@ -3105,6 +3105,7 @@ public class BoardDelegate extends DelegateBase
showToast( R.string.rematch_sent_toast );
}
Assert.assertTrueNR( !force );
return force;
}

View file

@ -370,42 +370,6 @@ public class DBUtils {
}
} // saveSummary
public static void addRematchInfo( Context context, long rowid,
CommsAddrRec addr )
{
try ( GameLock lock = GameLock.tryLock(rowid) ) {
if ( null != lock ) {
String as64 = Utils.serializableToString64( addr );
GameSummary summary = getSummary( context, lock )
.putStringExtra( GameSummary.EXTRA_REMATCH_ADDR, as64 )
;
saveSummary( context, lock, summary );
} else {
Assert.failDbg();
Log.e( TAG, "addRematchInfo(%d): unable to lock game" );
}
}
}
public static void addRematchInfo( Context context, long rowid, String btAddr,
String phone, String p2pAddr, String mqttDevID )
{
try ( GameLock lock = GameLock.tryLock(rowid) ) {
if ( null != lock ) {
GameSummary summary = getSummary( context, lock )
.putStringExtra( GameSummary.EXTRA_REMATCH_BTADDR, btAddr )
.putStringExtra( GameSummary.EXTRA_REMATCH_PHONE, phone )
.putStringExtra( GameSummary.EXTRA_REMATCH_P2P, p2pAddr )
.putStringExtra( GameSummary.EXTRA_REMATCH_MQTT, mqttDevID )
;
saveSummary( context, lock, summary );
} else {
Assert.failDbg();
Log.e( TAG, "addRematchInfo(%d): unable to lock game" );
}
}
}
public static int countGamesUsingISOCode( Context context, ISOCode isoCode )
{
int result = 0;

View file

@ -2700,47 +2700,6 @@ public class GamesListDelegate extends ListDelegateBase
} else {
launchGame( newid );
}
// long groupID = extras.getLong( REMATCH_GROUPID_EXTRA,
// DBUtils.GROUPID_UNSPEC );
// if ( DBUtils.GROUPID_UNSPEC == groupID ) {
// groupID = DBUtils.getGroupForGame( m_activity, srcRowID );
// }
// // Don't save rematch in Archive group
// if ( groupID == DBUtils.getArchiveGroup( m_activity ) ) {
// groupID = XWPrefs.getDefaultNewGameGroup( m_activity );
// }
// boolean solo = extras.getBoolean( REMATCH_IS_SOLO, true );
// if ( solo ) {
// newid = GameUtils.dupeGame( m_activity, srcRowID, groupID );
// if ( ROWID_NOTFOUND != newid ) {
// DBUtils.setName( m_activity, newid, gameName );
// }
// } else {
// String btAddr = extras.getString( REMATCH_BTADDR_EXTRA );
// String phone = extras.getString( REMATCH_PHONE_EXTRA );
// String p2pMacAddress = extras.getString( REMATCH_P2PADDR_EXTRA );
// String dict = extras.getString( REMATCH_DICT_EXTRA );
// ISOCode isoCode = ISOCode.newIf( extras.getString( REMATCH_LANG_EXTRA ) );
// String mqttDevID = extras.getString( GameSummary.EXTRA_REMATCH_MQTT );
// String json = extras.getString( REMATCH_PREFS_EXTRA );
// newid = GameUtils.makeNewMultiGame4( m_activity, groupID, dict,
// isoCode, json, addrs, gameName );
// DBUtils.addRematchInfo( m_activity, newid, btAddr, phone,
// p2pMacAddress, mqttDevID );
// }
// if ( extras.getBoolean( REMATCH_DELAFTER_EXTRA, false ) ) {
// String name = DBUtils.getName( m_activity, srcRowID );
// makeConfirmThenBuilder( Action.LAUNCH_AFTER_DEL,
// R.string.confirm_del_after_rematch_fmt,
// name )
// .setParams( newid, srcRowID )
// .show();
// } else {
// launchGame( newid );
// }
}
m_rematchExtras = null;
}

View file

@ -527,7 +527,8 @@ public class GameSummary implements Serializable {
break;
}
}
// Log.d( TAG, "hasRematchInfo() => %b", found );
Log.d( TAG, "hasRematchInfo() => %b", found );
Assert.assertTrueNR( !found );
return found;
}