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;
|
final CommsConnTypeSet conTypes = summary.conTypes;
|
||||||
ab.setMessage( msg )
|
ab.setMessage( msg )
|
||||||
.setPositiveButton( android.R.string.ok, null );
|
.setPositiveButton( android.R.string.ok, null );
|
||||||
if ( BuildConfig.DEBUG && null != conTypes
|
|
||||||
&& (conTypes.contains( CommsConnType.COMMS_CONN_RELAY )
|
if ( BuildConfig.NON_RELEASE && null != conTypes ) {
|
||||||
|| conTypes.contains( CommsConnType.COMMS_CONN_P2P )) ) {
|
if ( conTypes.contains( CommsConnType.COMMS_CONN_RELAY )
|
||||||
OnClickListener lstnr = new OnClickListener() {
|
|| conTypes.contains( CommsConnType.COMMS_CONN_P2P ) ) {
|
||||||
public void onClick( DialogInterface dlg,
|
OnClickListener lstnr = new OnClickListener() {
|
||||||
int whichButton ) {
|
@Override
|
||||||
NetStateCache.reset( m_activity );
|
public void onClick( DialogInterface dlg,
|
||||||
if ( conTypes.contains( CommsConnType.COMMS_CONN_RELAY ) ) {
|
int whichButton ) {
|
||||||
RelayService.reset( getActivity() );
|
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.list_item_relaypage, lstnr );
|
||||||
ab.setNegativeButton( R.string.button_reconnect, lstnr );
|
}
|
||||||
}
|
}
|
||||||
dialog = ab.create();
|
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_invites, enable );
|
||||||
Utils.setItemVisible( menu, R.id.games_game_netstats, isMultiGame );
|
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 );
|
enable = BuildConfig.DEBUG || XWPrefs.getDebugEnabled( m_activity );
|
||||||
Utils.setItemVisible( menu, R.id.games_game_markbad, enable );
|
Utils.setItemVisible( menu, R.id.games_game_markbad, enable );
|
||||||
|
@ -2123,6 +2125,11 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
onStatusClicked( selRowIDs[0] );
|
onStatusClicked( selRowIDs[0] );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case R.id.games_game_relaypage:
|
||||||
|
GameSummary summary = GameUtils.getSummary( m_activity, selRowIDs[0] );
|
||||||
|
NetUtils.showGamePage( m_activity, summary.gameID );
|
||||||
|
break;
|
||||||
|
|
||||||
// DEBUG only
|
// DEBUG only
|
||||||
case R.id.games_game_invites:
|
case R.id.games_game_invites:
|
||||||
String msg = GameUtils.getSummary( m_activity, selRowIDs[0] )
|
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 )
|
public static byte[][][] queryRelay( Context context, String[] ids )
|
||||||
{
|
{
|
||||||
byte[][][] msgs = null;
|
byte[][][] msgs = null;
|
||||||
|
|
|
@ -28,6 +28,10 @@
|
||||||
<item android:id="@+id/games_game_netstats"
|
<item android:id="@+id/games_game_netstats"
|
||||||
android:title="@string/list_item_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"
|
<item android:id="@+id/games_game_select"
|
||||||
android:title="@string/list_item_select"
|
android:title="@string/list_item_select"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -126,6 +126,9 @@
|
||||||
list_item_rename) -->
|
list_item_rename) -->
|
||||||
<!-- long-tap game list menuitem for showing info about game's connectivity -->
|
<!-- long-tap game list menuitem for showing info about game's connectivity -->
|
||||||
<string name="list_item_netstats">Connections…</string>
|
<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
|
<!-- If you try to copy a networked game you get this error
|
||||||
message. -->
|
message. -->
|
||||||
<string name="no_copy_network">Games that have already connected
|
<string name="no_copy_network">Games that have already connected
|
||||||
|
|
Loading…
Add table
Reference in a new issue