mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-04 20:46:28 +01:00
add two ways to launch web view of game traffic
This'll should it a lot easier to look at what's going on e.g. for a stalled game
This commit is contained in:
parent
881d600b9b
commit
3d1ec565b0
5 changed files with 51 additions and 14 deletions
|
@ -448,22 +448,34 @@ public abstract class DelegateBase implements DlgClickNotify,
|
|||
final CommsConnTypeSet conTypes = summary.conTypes;
|
||||
ab.setMessage( msg )
|
||||
.setPositiveButton( android.R.string.ok, null );
|
||||
if ( BuildConfig.DEBUG && null != conTypes
|
||||
&& (conTypes.contains( CommsConnType.COMMS_CONN_RELAY )
|
||||
|| conTypes.contains( CommsConnType.COMMS_CONN_P2P )) ) {
|
||||
OnClickListener lstnr = new OnClickListener() {
|
||||
public void onClick( DialogInterface dlg,
|
||||
int whichButton ) {
|
||||
NetStateCache.reset( m_activity );
|
||||
if ( conTypes.contains( CommsConnType.COMMS_CONN_RELAY ) ) {
|
||||
RelayService.reset( getActivity() );
|
||||
|
||||
if ( BuildConfig.NON_RELEASE && null != conTypes ) {
|
||||
if ( conTypes.contains( CommsConnType.COMMS_CONN_RELAY )
|
||||
|| conTypes.contains( CommsConnType.COMMS_CONN_P2P ) ) {
|
||||
OnClickListener lstnr = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick( DialogInterface dlg,
|
||||
int whichButton ) {
|
||||
NetStateCache.reset( m_activity );
|
||||
if ( conTypes.contains( CommsConnType.COMMS_CONN_RELAY ) ) {
|
||||
RelayService.reset( getActivity() );
|
||||
}
|
||||
if ( conTypes.contains( CommsConnType.COMMS_CONN_P2P ) ) {
|
||||
WiDirService.reset( getActivity() );
|
||||
}
|
||||
}
|
||||
if ( conTypes.contains( CommsConnType.COMMS_CONN_P2P ) ) {
|
||||
WiDirService.reset( getActivity() );
|
||||
};
|
||||
ab.setNegativeButton( R.string.button_reconnect, lstnr );
|
||||
} else if ( conTypes.contains( CommsConnType.COMMS_CONN_MQTT ) ) {
|
||||
final int gameID = summary.gameID;
|
||||
OnClickListener lstnr = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick( DialogInterface dlg, int whichButton ) {
|
||||
NetUtils.showGamePage( m_activity, gameID );
|
||||
}
|
||||
}
|
||||
};
|
||||
ab.setNegativeButton( R.string.button_reconnect, lstnr );
|
||||
};
|
||||
ab.setNegativeButton( R.string.list_item_relaypage, lstnr );
|
||||
}
|
||||
}
|
||||
dialog = ab.create();
|
||||
}
|
||||
|
|
|
@ -1911,6 +1911,8 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
}
|
||||
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_relaypage,
|
||||
BuildConfig.NON_RELEASE && isMultiGame );
|
||||
|
||||
enable = BuildConfig.DEBUG || XWPrefs.getDebugEnabled( m_activity );
|
||||
Utils.setItemVisible( menu, R.id.games_game_markbad, enable );
|
||||
|
@ -2123,6 +2125,11 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
onStatusClicked( selRowIDs[0] );
|
||||
break;
|
||||
|
||||
case R.id.games_game_relaypage:
|
||||
GameSummary summary = GameUtils.getSummary( m_activity, selRowIDs[0] );
|
||||
NetUtils.showGamePage( m_activity, summary.gameID );
|
||||
break;
|
||||
|
||||
// DEBUG only
|
||||
case R.id.games_game_invites:
|
||||
String msg = GameUtils.getSummary( m_activity, selRowIDs[0] )
|
||||
|
|
|
@ -125,6 +125,17 @@ public class NetUtils {
|
|||
}
|
||||
}
|
||||
|
||||
static void showGamePage( Context context, int gameID )
|
||||
{
|
||||
// Requires a login, so only of use to me right now....
|
||||
String url = String.format( "https://eehouse.org/xw4/ui/games?gameid=%d",
|
||||
gameID );
|
||||
Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( url ) );
|
||||
if ( null != intent.resolveActivity( context.getPackageManager() ) ) {
|
||||
context.startActivity( intent );
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[][][] queryRelay( Context context, String[] ids )
|
||||
{
|
||||
byte[][][] msgs = null;
|
||||
|
|
|
@ -28,6 +28,10 @@
|
|||
<item android:id="@+id/games_game_netstats"
|
||||
android:title="@string/list_item_netstats"
|
||||
/>
|
||||
<!-- Debug only -->
|
||||
<item android:id="@+id/games_game_relaypage"
|
||||
android:title="@string/list_item_relaypage"
|
||||
/>
|
||||
<item android:id="@+id/games_game_select"
|
||||
android:title="@string/list_item_select"
|
||||
/>
|
||||
|
|
|
@ -126,6 +126,9 @@
|
|||
list_item_rename) -->
|
||||
<!-- long-tap game list menuitem for showing info about game's connectivity -->
|
||||
<string name="list_item_netstats">Connections…</string>
|
||||
<!-- Debug-only menuitem that shows mqtt broker's awareness of
|
||||
devices in game -->
|
||||
<string name="list_item_relaypage">Game traffic…</string>
|
||||
<!-- If you try to copy a networked game you get this error
|
||||
message. -->
|
||||
<string name="no_copy_network">Games that have already connected
|
||||
|
|
Loading…
Add table
Reference in a new issue