remove useless debug-only menuitem

This commit is contained in:
Eric House 2024-08-28 20:14:01 -07:00
parent a8554c22d0
commit 4b730cf0b5
10 changed files with 22 additions and 57 deletions

View file

@ -813,7 +813,6 @@ class BoardDelegate(delegator: Delegator) :
enable = netGame && (BuildConfig.DEBUG enable = netGame && (BuildConfig.DEBUG
|| XWPrefs.getDebugEnabled(mActivity)) || XWPrefs.getDebugEnabled(mActivity))
Utils.setItemVisible(menu, R.id.board_menu_game_netstats, enable) Utils.setItemVisible(menu, R.id.board_menu_game_netstats, enable)
Utils.setItemVisible(menu, R.id.board_menu_game_invites, enable)
enable = XWPrefs.getStudyEnabled(mActivity) && null != mGi enable = XWPrefs.getStudyEnabled(mActivity) && null != mGi
&& !DBUtils.studyListWords(mActivity, mGi!!.isoCode()!!).isEmpty() && !DBUtils.studyListWords(mActivity, mGi!!.isoCode()!!).isEmpty()
Utils.setItemVisible(menu, R.id.board_menu_study, enable) Utils.setItemVisible(menu, R.id.board_menu_study, enable)
@ -867,11 +866,6 @@ class BoardDelegate(delegator: Delegator) :
R.string.netstats_title R.string.netstats_title
) )
R.id.board_menu_game_invites -> {
val sentInfo = DBUtils.getInvitesFor(mActivity, mRowid)
makeOkOnlyBuilder(sentInfo.getAsText(mActivity)).show()
}
R.id.board_menu_undo_current -> cmd = JNICmd.CMD_UNDO_CUR R.id.board_menu_undo_current -> cmd = JNICmd.CMD_UNDO_CUR
R.id.board_menu_undo_last -> makeConfirmThenBuilder( R.id.board_menu_undo_last -> makeConfirmThenBuilder(
Action.UNDO_LAST_ACTION, Action.UNDO_LAST_ACTION,

View file

@ -1843,7 +1843,6 @@ class GamesListDelegate(delegator: Delegator) :
enable = (isMultiGame enable = (isMultiGame
&& (BuildConfig.DEBUG || XWPrefs.getDebugEnabled(mActivity))) && (BuildConfig.DEBUG || XWPrefs.getDebugEnabled(mActivity)))
} }
Utils.setItemVisible(menu, R.id.games_game_invites, enable)
Utils.setItemVisible(menu, R.id.games_game_netstats, isMultiGame) Utils.setItemVisible(menu, R.id.games_game_netstats, isMultiGame)
enable = (isMultiGame && BuildConfig.NON_RELEASE enable = (isMultiGame && BuildConfig.NON_RELEASE
&& summary!!.conTypes!!.contains(CommsConnType.COMMS_CONN_MQTT)) && summary!!.conTypes!!.contains(CommsConnType.COMMS_CONN_MQTT))
@ -2036,25 +2035,6 @@ class GamesListDelegate(delegator: Delegator) :
NetUtils.copyAndLaunchGamePage(mActivity, summary.gameID) NetUtils.copyAndLaunchGamePage(mActivity, summary.gameID)
} }
R.id.games_game_invites -> {
val summary = GameUtils.getSummary(mActivity, selRowIDs[0])!!
var msg = summary.conTypes!!.toString(mActivity, true)
msg = getString(R.string.invites_net_fmt, msg)
val info = DBUtils.getInvitesFor(
mActivity,
selRowIDs[0]
)
if (null != info) {
msg += """
${info.getAsText(mActivity)}
""".trimIndent()
}
makeOkOnlyBuilder(msg).show()
}
R.id.games_game_markbad -> Quarantine.markBad(selRowIDs[0]) R.id.games_game_markbad -> Quarantine.markBad(selRowIDs[0])
else -> handled = false else -> handled = false
} }

View file

@ -104,21 +104,22 @@ internal abstract class XWExpListAdapter(childClasses: Array<Class<*>>) :
} }
protected fun removeChildrenOf(groupIndex: Int) { protected fun removeChildrenOf(groupIndex: Int) {
Assert.assertTrueNR(0 <= groupIndex) if (0 <= groupIndex) {
Assert.assertTrue(m_groupClass == m_listObjs!![groupIndex]!!.javaClass) Assert.assertTrue(m_groupClass == m_listObjs!![groupIndex]!!.javaClass)
val end = findGroupEnd(groupIndex) val end = findGroupEnd(groupIndex)
val nChildren = end - groupIndex - 1 // 1: don't remove parent val nChildren = end - groupIndex - 1 // 1: don't remove parent
val newArray = arrayOfNulls<Any>(m_listObjs!!.size - nChildren) val newArray = arrayOfNulls<Any>(m_listObjs!!.size - nChildren)
System.arraycopy(m_listObjs, 0, newArray, 0, groupIndex + 1) // 1: include parent System.arraycopy(m_listObjs, 0, newArray, 0, groupIndex + 1) // 1: include parent
val nAbove = m_listObjs!!.size - (groupIndex + nChildren + 1) val nAbove = m_listObjs!!.size - (groupIndex + nChildren + 1)
if (end < m_listObjs!!.size) { if (end < m_listObjs!!.size) {
System.arraycopy( System.arraycopy(
m_listObjs, end, newArray, groupIndex + 1, m_listObjs, end, newArray, groupIndex + 1,
m_listObjs!!.size - end m_listObjs!!.size - end
) )
}
m_listObjs = newArray as Array<Any>
notifyDataSetChanged()
} }
m_listObjs = newArray as Array<Any>
notifyDataSetChanged()
} }
protected fun addChildrenOf(groupIndex: Int, children: List<Any?>) { protected fun addChildrenOf(groupIndex: Int, children: List<Any?>) {

View file

@ -92,7 +92,5 @@
/> />
<item android:id="@+id/board_menu_game_netstats" <item android:id="@+id/board_menu_game_netstats"
android:title="@string/board_menu_game_netstats" /> android:title="@string/board_menu_game_netstats" />
<item android:id="@+id/board_menu_game_invites"
android:title="@string/board_menu_game_showInvites" />
</menu> </menu>

View file

@ -75,8 +75,6 @@
<item android:id="@+id/board_menu_game_netstats" <item android:id="@+id/board_menu_game_netstats"
android:title="@string/board_menu_game_netstats" /> android:title="@string/board_menu_game_netstats" />
<item android:id="@+id/board_menu_game_invites"
android:title="@string/board_menu_game_showInvites" />
<item android:id="@+id/board_menu_game_pause" <item android:id="@+id/board_menu_game_pause"
android:title="@string/board_menu_game_pause" /> android:title="@string/board_menu_game_pause" />

View file

@ -39,9 +39,6 @@
android:title="@string/list_item_deselect" android:title="@string/list_item_deselect"
/> />
<!-- below here: Debug only --> <!-- below here: Debug only -->
<item android:id="@+id/games_game_invites"
android:title="@string/board_menu_game_showInvites"
/>
<item android:id="@+id/games_game_markbad" <item android:id="@+id/games_game_markbad"
android:title="@string/list_item_markbad" android:title="@string/list_item_markbad"
/> />

View file

@ -1780,8 +1780,6 @@
<string name="button_refresh">Refresh</string> <string name="button_refresh">Refresh</string>
<!-- First line of debug-only Invites list dialog --> <!-- First line of debug-only Invites list dialog -->
<string name="invites_net_fmt">Invitations sent for game connected via
%1$s:</string>
<!-- --> <!-- -->
<string name="connstat_succ">successful</string> <string name="connstat_succ">successful</string>
<!-- --> <!-- -->
@ -2235,7 +2233,6 @@
<string name="debug_features">Enable debug features</string> <string name="debug_features">Enable debug features</string>
<string name="debug_features_summary">Menuitems etc.</string> <string name="debug_features_summary">Menuitems etc.</string>
<string name="board_menu_game_netstats">Network stats</string> <string name="board_menu_game_netstats">Network stats</string>
<string name="board_menu_game_showInvites">Show invites</string>
<string name="netstats_title">Game network stats</string> <string name="netstats_title">Game network stats</string>
<string name="mqtt_port">MQTT port</string> <string name="mqtt_port">MQTT port</string>
<string name="mqtt_qos">MQTT QOS</string> <string name="mqtt_qos">MQTT QOS</string>
@ -2331,7 +2328,7 @@
<string name="not_again_dfltname_fmt">You are using the default <string name="not_again_dfltname_fmt">You are using the default
player name “%1$s”. Would you like to personalize with your own player name “%1$s”. Would you like to personalize with your own
name before you create this game?</string> name before you create this game?</string>
<string name="no_invites">This game has sent no invitations</string> <string name="no_invites">This game has no invitations pending.</string>
<string name="after_restart">This change will take effect after you <string name="after_restart">This change will take effect after you
restart CrossWords.</string> restart CrossWords.</string>
<string name="missing_sms_perms">This game is configured to communicate <string name="missing_sms_perms">This game is configured to communicate

View file

@ -1821,11 +1821,11 @@ getNamesProc( MsgQueueElem* elem, void* closure )
kplr_nameForAddress( gndp->comms->dutil, gndp->xwe, addr ); kplr_nameForAddress( gndp->comms->dutil, gndp->xwe, addr );
InviteeNames* names = gndp->names; InviteeNames* names = gndp->names;
if ( !!name ) { if ( !!name ) {
XP_STRCAT( names->name[names->count], name ); XP_STRCAT( names->name[names->nNames], name );
XP_LOGFF( "copied name %s to pos %d (pos %d)", name, XP_LOGFF( "copied name %s to pos %d (pos %d)", name,
channelNo, names->count ); channelNo, names->nNames );
} }
++names->count; ++names->nNames;
} }
return FEA_OK; return FEA_OK;
} }

View file

@ -209,7 +209,7 @@ void comms_invite( CommsCtxt* comms, XWEnv xwe, const NetLaunchInfo* nli,
void comms_getInvited( RELCONST CommsCtxt* comms, XP_U16* nInvites ); void comms_getInvited( RELCONST CommsCtxt* comms, XP_U16* nInvites );
typedef struct _InviteeNames { typedef struct _InviteeNames {
XP_UCHAR name[4][32]; XP_UCHAR name[4][32];
XP_U16 count; XP_U16 nNames;
} InviteeNames; } InviteeNames;
void comms_inviteeNames( CommsCtxt* comms, XWEnv xwe, InviteeNames* names ); void comms_inviteeNames( CommsCtxt* comms, XWEnv xwe, InviteeNames* names );

View file

@ -4755,13 +4755,13 @@ server_inviteeName( const ServerCtxt* server,
InviteeNames names = {}; InviteeNames names = {};
comms_inviteeNames( comms, xwe, &names ); comms_inviteeNames( comms, xwe, &names );
if ( nameIndx < names.count ) { if ( nameIndx < names.nNames ) {
XP_LOGFF( "got a match: player %d for channel %d; name: \"%s\"", XP_LOGFF( "got a match: player %d for channel %d; name: \"%s\"",
playerPosn, nameIndx, names.name[nameIndx] ); playerPosn, nameIndx, names.name[nameIndx] );
*bufLen = XP_SNPRINTF( buf, *bufLen, names.name[nameIndx], playerPosn ); *bufLen = XP_SNPRINTF( buf, *bufLen, names.name[nameIndx], playerPosn );
} else { } else {
XP_LOGFF( "expected %dth name but found only %d", XP_LOGFF( "expected %dth name but found only %d",
nameIndx, names.count ); nameIndx, names.nNames );
} }
break; break;
} }