From 848ae6f0f6759f2ee0ea6c2b02a217d721a45f68 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 14 Oct 2022 10:27:43 -0700 Subject: [PATCH] remove dead code; assert other dead Adding asserts to confirm that code that shouldn't be called in fact isn't. --- .../eehouse/android/xw4/BoardDelegate.java | 1 + .../java/org/eehouse/android/xw4/DBUtils.java | 36 ---------------- .../android/xw4/GamesListDelegate.java | 41 ------------------- .../eehouse/android/xw4/jni/GameSummary.java | 3 +- 4 files changed, 3 insertions(+), 78 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java index 9b463d0fa..4839eac7c 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java @@ -3105,6 +3105,7 @@ public class BoardDelegate extends DelegateBase showToast( R.string.rematch_sent_toast ); } + Assert.assertTrueNR( !force ); return force; } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java index 0b536a07c..3604d5824 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java @@ -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; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java index 09e357313..f70a5cdc0 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java @@ -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; } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/GameSummary.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/GameSummary.java index 719f208bc..735f5db51 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/GameSummary.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/GameSummary.java @@ -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; }