Merge branch 'relay_proxy' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into relay_proxy

This commit is contained in:
eehouse@eehouse.org 2010-11-05 05:10:24 -07:00 committed by Andy2
commit 64cc199e1a
13 changed files with 81 additions and 50 deletions

View file

@ -21,8 +21,8 @@
to come from a domain that you own or have control over. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.eehouse.android.xw4"
android:versionCode="9"
android:versionName="4.4 beta 16"
android:versionCode="10"
android:versionName="4.4 beta 17"
>
<uses-permission android:name="android.permission.INTERNET" />

View file

@ -6,27 +6,49 @@
</head>
<body>
<b>Crosswords 4.4 beta 16 release</b>
<b>Crosswords 4.4 beta 17 release</b>
<p>This is a <em>another</em> quick bug-fix release while I continue
work on the new relay connection code -- which is coming along,
BTW. Please email if you're willing to comment on an early version.</p>
<p>This release changes how networked games are created, configured
and connect with each other. It tries to make the process simpler and
should mean it's much more likely to succeed. I've also scattered
"new user hints" around the app, dialogs with tips that you can
dismiss with a "Do not show again" button when you don't need to see
that hint again.</p>
<ul>Bugs fixed:
<li>Dictionary download could be routed to Browser if you weren't careful or
your phone maker hard-coded the type. Now it always routes to Crosswords.
(Thanks B.S.)</li>
</ul>
<p>I'm breaking from tradition and not listing bugs fixed or features
added here -- because there have been well over 300 separate changes
committed since the last beta. Instead I'll outline how you get
started with a two-player networked game.</p>
<ul>(Still) coming soon
<li>builtin hints and help, starting with the Game Settings
screen</li>
<p>Assume you and a friend each have Crosswords on an Android phone.
You both need to
<ul>
<li>Launch Crosswords and tap the "Add networked game" button on
your device</li>
<li>rewrite of gameplay via relay to make connecting easier (no
host/guest stuff or requirement that both be online at the same
time) and allow closed game to receive moves.</li>
<li>When the game appears, long-tap it and choose "Game settings..."
from the menu</li>
<li>Agree on a "room name" -- let's say it's "andy" --and enter it
in the "New room name" text box.</li>
<li>Scroll to the bottom of the window and tap the "Play game" button</li>
<li>Wait as your phones connect. You'll see a status message and
maybe a "new user hint", then the status icon in the upper-right
will go all-green and boards on both phones will get tiles</li>
<li>Now the first player makes a move, commits it, and it shows up
on the other device. Rinse, lather, repeat.</li>
<li>The "relay" server stores moves it receives until it can deliver
them. If you have a bunch of networked games going, choose the
"Check server" menu on the main list-of-games screen. It will
redraw all games for which there are waiting messages. You can then
open them and they will sync up.</li>
</ul>
</p>
<p>Please remember that this is beta software. Letting me know (at
eehouse@eehouse.org) what's broken and what features you'd most like

View file

@ -190,8 +190,6 @@
<string name="summary_sort_tiles">Ordena el faristol en agafar noves fitxes</string>
<string name="ringer_zoom">Zoom amb els botons de volum</string>
<string name="ringer_zoom_summary">Apropa o allunya el tauler fent servir les tecles de volum.</string>
<string name="click_launches">Clic per a jugar</string>
<string name="click_launches_summary">obre la partida en fer-hi clic al llistat de partides, en compte d\'obrir un menú d\'opcions</string>
<string name="hide_title">Amaga la capçalera</string>
<string name="hide_title_summary">Permet que el tauler sigui una mica més gran</string>
@ -266,7 +264,6 @@
<string name="tab_bluetooth">Bluetooth (en desenvolupament)</string>
<string name="msg_relay_waiting">Esteu connectat al repetidor. S\'està esperant a %d jugador/s.</string>
<string name="msg_relay_all_here">Ja hi són tots els jugadors.</string>
<string name="title_relay_status">Estat de la connexió.</string>
<string name="relay_alert">Error en la connexió</string>

View file

@ -237,7 +237,6 @@
<string name="tab_bluetooth">Bluetooth (připravuje se)</string>
<string name="msg_relay_waiting">Připojen na relay. Čekám na %d hráče.</string>
<string name="msg_relay_all_here">Všichni hráči jsou zde.</string>
<string name="title_relay_status">Stav připojení.</string>
<string name="relay_alert">Chyba připojení</string>

View file

@ -235,7 +235,6 @@
<string name="tab_bluetooth">Bluetooth (pripravuje sa)</string>
<string name="msg_relay_waiting">Pripojený na relay. Čakám na %d hráčov.</string>
<string name="msg_relay_all_here">Všetci hráči sú tu.</string>
<string name="title_relay_status">Stav pripojenia.</string>
<string name="relay_alert">Chyba pripojenia</string>

View file

@ -144,6 +144,9 @@ public class CommsTransport extends Thread implements TransportProcs {
try {
m_socketChannel = SocketChannel.open();
m_socketChannel.configureBlocking( false );
Utils.logf( "connecting to %s:%d",
m_addr.ip_relay_hostName,
m_addr.ip_relay_port );
InetSocketAddress isa
= new InetSocketAddress( m_addr.ip_relay_hostName,
m_addr.ip_relay_port );

View file

@ -39,7 +39,7 @@ public class FirstRunDialog {
private static final String HIDDEN_PREFS = "xwprefs_hidden";
private static final String SHOWN_VERSION_KEY = "SHOWN_VERSION_KEY";
static void show( Context context, boolean skipCheck )
static boolean show( Context context, boolean skipCheck )
{
int thisVersion = 0;
int shownVersion = 0;
@ -61,7 +61,8 @@ public class FirstRunDialog {
shownVersion = prefs.getInt( SHOWN_VERSION_KEY, 0 );
}
if ( skipCheck || shownVersion < thisVersion ) {
boolean isUpgrade = shownVersion < thisVersion;
if ( skipCheck || isUpgrade ) {
showDialog( context );
if ( !skipCheck ) {
@ -70,6 +71,7 @@ public class FirstRunDialog {
editor.commit();
}
}
return isUpgrade;
}
private static void showDialog( Context context )

View file

@ -64,10 +64,11 @@ public class GamesList extends XWListActivity
m_handler = new Handler();
PreferenceManager.setDefaultValues( this, R.xml.xwprefs, false );
setContentView(R.layout.game_list);
boolean isUpgrade = FirstRunDialog.show( this, false );
PreferenceManager.setDefaultValues( this, R.xml.xwprefs, isUpgrade );
// setDefaultKeyMode(DEFAULT_KEYS_SHORTCUT);
registerForContextMenu( getListView() );
@ -97,8 +98,6 @@ public class GamesList extends XWListActivity
m_adapter = new GameListAdapter( this );
setListAdapter( m_adapter );
FirstRunDialog.show( this, false );
RelayReceiver.RestartTimer( this );
}

View file

@ -23,5 +23,5 @@ package org.eehouse.android.xw4;
public interface XWConstants {
public static final String GAME_EXTN = ".xwg";
public static final String DICT_EXTN = ".xwd";
public static final String VERSION_STR = "4.4 beta 16";
public static final String VERSION_STR = "4.4 beta 17";
}

View file

@ -1653,8 +1653,8 @@ comms_checkComplete( const CommsAddrRec* addr )
XP_Bool
comms_canChat( const CommsCtxt* const comms )
{
XP_Bool canChat = COMMS_CONN_RELAY == comms_getConType( comms )
&& COMMS_RELAYSTATE_CONNECTED <= comms->r.relayState;
XP_Bool canChat = comms_isConnected( comms )
&& comms->connID != 0;
LOG_RETURNF( "%s", canChat?"true":"false" );
return canChat;
}

View file

@ -528,7 +528,8 @@ server_initClientConnection( ServerCtxt* server, XWStreamCtxt* stream )
static void
sendChatTo( ServerCtxt* server, XP_U16 devIndex, const XP_UCHAR const* msg )
{
XWStreamCtxt* stream = messageStreamWithHeader( server, devIndex, XWPROTO_CHAT );
XWStreamCtxt* stream = messageStreamWithHeader( server, devIndex,
XWPROTO_CHAT );
stringToStream( stream, msg );
stream_destroy( stream );
}
@ -545,7 +546,8 @@ sendChatToClientsExcept( ServerCtxt* server, XP_U16 skip,
}
}
void server_sendChat( ServerCtxt* server, const XP_UCHAR const* msg )
void
server_sendChat( ServerCtxt* server, const XP_UCHAR const* msg )
{
if ( server->vol.gi->serverRole == SERVER_ISCLIENT ) {
sendChatTo( server, SERVER_DEVICE, msg );

View file

@ -503,6 +503,7 @@ createOrLoadObjects( GtkAppGlobals* globals )
#endif
server_do( globals->cGlobals.game.server );
disenable_buttons( globals );
} /* createOrLoadObjects */
/* Create a new backing pixmap of the appropriate size and set up contxt to
@ -880,18 +881,6 @@ handle_resend( GtkWidget* XP_UNUSED(widget), GtkAppGlobals* globals )
}
} /* handle_resend */
#ifdef XWFEATURE_CHAT
static void
handle_chat( GtkWidget* XP_UNUSED(widget), GtkAppGlobals* globals )
{
gchar* msg = gtkGetChatMessage( globals );
if ( NULL != msg ) {
server_sendChat( globals->cGlobals.game.server, msg );
g_free( msg );
}
}
#endif
#ifdef DEBUG
static void
handle_commstats( GtkWidget* XP_UNUSED(widget), GtkAppGlobals* globals )
@ -992,10 +981,6 @@ makeMenus( GtkAppGlobals* globals, int XP_UNUSED(argc),
#ifndef XWFEATURE_STANDALONE_ONLY
(void)createAddItem( fileMenu, "Resend",
GTK_SIGNAL_FUNC(handle_resend), globals );
# ifdef XWFEATURE_CHAT
(void)createAddItem( fileMenu, "Send Chat",
GTK_SIGNAL_FUNC(handle_chat), globals );
# endif
# ifdef DEBUG
(void)createAddItem( fileMenu, "Stats",
GTK_SIGNAL_FUNC(handle_commstats), globals );
@ -1024,6 +1009,10 @@ disenable_buttons( GtkAppGlobals* globals )
XP_Bool canToggle = board_canTogglePending( globals->cGlobals.game.board );
gtk_widget_set_sensitive( globals->toggle_undo_button, canToggle );
XP_Bool canChat = !!globals->cGlobals.game.comms
&& comms_canChat( globals->cGlobals.game.comms );
gtk_widget_set_sensitive( globals->chat_button, canChat );
}
static gboolean
@ -1172,6 +1161,18 @@ handle_zoomout_button( GtkWidget* XP_UNUSED(widget), GtkAppGlobals* globals )
}
} /* handle_done_button */
#ifdef XWFEATURE_CHAT
static void
handle_chat_button( GtkWidget* XP_UNUSED(widget), GtkAppGlobals* globals )
{
gchar* msg = gtkGetChatMessage( globals );
if ( NULL != msg ) {
server_sendChat( globals->cGlobals.game.server, msg );
g_free( msg );
}
}
#endif
static void
scroll_value_changed( GtkAdjustment *adj, GtkAppGlobals* globals )
{
@ -1788,7 +1789,11 @@ makeVerticalBar( GtkAppGlobals* globals, GtkWidget* XP_UNUSED(window) )
gtk_box_pack_start( GTK_BOX(vbox), button, FALSE, TRUE, 0 );
button = makeShowButtonFromBitmap( globals, "../done.xpm", "-",
G_CALLBACK(handle_zoomout_button) );
globals->zoomout_button = button;
#ifdef XWFEATURE_CHAT
button = makeShowButtonFromBitmap( globals, "", "chat",
G_CALLBACK(handle_chat_button) );
globals->chat_button = button;
#endif
gtk_box_pack_start( GTK_BOX(vbox), button, FALSE, TRUE, 0 );
gtk_widget_show( vbox );

View file

@ -91,6 +91,9 @@ typedef struct GtkAppGlobals {
GtkWidget* zoomin_button;
GtkWidget* zoomout_button;
GtkWidget* toggle_undo_button;
#ifdef XWFEATURE_CHAT
GtkWidget* chat_button;
#endif
EngineCtxt* engine;