diff --git a/xwords4/android/XWords4/jni/Android.mk b/xwords4/android/XWords4/jni/Android.mk index 3c94de08e..29d4c6565 100644 --- a/xwords4/android/XWords4/jni/Android.mk +++ b/xwords4/android/XWords4/jni/Android.mk @@ -19,7 +19,6 @@ local_DEFINES += \ -DXWFEATURE_SMS \ -DXWFEATURE_COMMSACK \ -DXWFEATURE_TURNCHANGENOTIFY \ - -DXWFEATURE_CHAT \ -DCOMMS_XPORT_FLAGSPROC \ -DKEY_SUPPORT \ -DXWFEATURE_CROSSHAIRS \ diff --git a/xwords4/android/XWords4/jni/utilwrapper.c b/xwords4/android/XWords4/jni/utilwrapper.c index f4eaf283b..1da05d0c9 100644 --- a/xwords4/android/XWords4/jni/utilwrapper.c +++ b/xwords4/android/XWords4/jni/utilwrapper.c @@ -446,6 +446,7 @@ and_util_warnIllegalWord( XW_UtilCtxt* uc, BadWordInfo* bwi, return result; } +#ifdef XWFEATURE_CHAT static void and_util_showChat( XW_UtilCtxt* uc, const XP_UCHAR const* msg ) { @@ -455,6 +456,7 @@ and_util_showChat( XW_UtilCtxt* uc, const XP_UCHAR const* msg ) deleteLocalRef( env, jmsg ); UTIL_CBK_TAIL(); } +#endif static void and_util_remSelected(XW_UtilCtxt* uc) @@ -691,7 +693,9 @@ makeUtil( MPFORMAL JNIEnv** envp, jobject jutil, CurGameInfo* gi, SET_PROC(makeEmptyDict); SET_PROC(getUserString); SET_PROC(warnIllegalWord); +#ifdef XWFEATURE_CHAT SET_PROC(showChat); +#endif SET_PROC(remSelected); #ifndef XWFEATURE_MINIWIN diff --git a/xwords4/android/XWords4/jni/xwjni.c b/xwords4/android/XWords4/jni/xwjni.c index 5fd1b4844..164125d0a 100644 --- a/xwords4/android/XWords4/jni/xwjni.c +++ b/xwords4/android/XWords4/jni/xwjni.c @@ -1375,6 +1375,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1endGame XWJNI_END(); } +#ifdef XWFEATURE_CHAT JNIEXPORT void JNICALL Java_org_eehouse_android_xw4_jni_XwJNI_server_1sendChat ( JNIEnv* env, jclass C, jint gamePtr, jstring jmsg ) @@ -1386,6 +1387,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1sendChat (*env)->ReleaseStringUTFChars( env, jmsg, msg ); XWJNI_END(); } +#endif #ifdef XWFEATURE_WALKDICT //////////////////////////////////////////////////////////// diff --git a/xwords4/android/XWords4/res/raw/changes b/xwords4/android/XWords4/res/raw/changes index 34f5ebf1f..7019c3ddc 100644 --- a/xwords4/android/XWords4/res/raw/changes +++ b/xwords4/android/XWords4/res/raw/changes @@ -10,6 +10,12 @@

New with this release

Next up

diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java index a6064c1bf..e3da64269 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -130,7 +130,7 @@ public class BoardActivity extends XWActivity private Button m_exchCommmitButton; private Button m_exchCancelButton; - private ArrayList m_pendingChats = new ArrayList(); + private ArrayList m_pendingChats; private String m_dlgBytes = null; private EditText m_passwdEdit = null; @@ -541,6 +541,10 @@ public class BoardActivity extends XWActivity requestWindowFeature( Window.FEATURE_NO_TITLE ); } + if ( XWApp.CHAT_SUPPORTED ) { + m_pendingChats = new ArrayList(); + } + m_utils = new BoardUtilCtxt(); m_jniu = JNIUtilsImpl.get( this ); setContentView( R.layout.board ); @@ -625,10 +629,12 @@ public class BoardActivity extends XWActivity if ( Activity.RESULT_CANCELED != resultCode ) { switch ( requestCode ) { case CHAT_REQUEST: - String msg = data.getStringExtra( INTENT_KEY_CHAT ); - if ( null != msg && msg.length() > 0 ) { - m_pendingChats.add( msg ); - trySendChats(); + if ( XWApp.CHAT_SUPPORTED ) { + String msg = data.getStringExtra( INTENT_KEY_CHAT ); + if ( null != msg && msg.length() > 0 ) { + m_pendingChats.add( msg ); + trySendChats(); + } } break; case BT_INVITE_RESULT: @@ -831,13 +837,11 @@ public class BoardActivity extends XWActivity break; case R.id.board_menu_game_history: - m_jniThread.handle( JNICmd.CMD_HISTORY, - R.string.history_title ); + m_jniThread.handle( JNICmd.CMD_HISTORY, R.string.history_title ); break; case R.id.board_menu_game_resign: - m_jniThread.handle( JNICmd.CMD_FINAL, - R.string.history_title ); + m_jniThread.handle( JNICmd.CMD_FINAL, R.string.history_title ); break; case R.id.board_menu_game_resend: @@ -1710,13 +1714,15 @@ public class BoardActivity extends XWActivity @Override public void showChat( final String msg ) { - post( new Runnable() { - public void run() { - DBUtils.appendChatHistory( BoardActivity.this, - m_rowid, msg, false ); - startChatActivity(); - } - } ); + if ( XWApp.CHAT_SUPPORTED ) { + post( new Runnable() { + public void run() { + DBUtils.appendChatHistory( BoardActivity.this, + m_rowid, msg, false ); + startChatActivity(); + } + } ); + } } } // class BoardUtilCtxt @@ -1901,10 +1907,12 @@ public class BoardActivity extends XWActivity R.string.not_again_undo, R.string.key_notagain_undo, UNDO_ACTION ); - m_toolbar.setListener( Toolbar.BUTTON_CHAT, - R.string.not_again_chat, - R.string.key_notagain_chat, - CHAT_ACTION ); + if ( XWApp.CHAT_SUPPORTED ) { + m_toolbar.setListener( Toolbar.BUTTON_CHAT, + R.string.not_again_chat, + R.string.key_notagain_chat, + CHAT_ACTION ); + } } // populateToolbar private OnDismissListener makeODLforBlocking( final int id ) @@ -1988,9 +1996,11 @@ public class BoardActivity extends XWActivity private void startChatActivity() { - Intent intent = new Intent( this, ChatActivity.class ); - intent.putExtra( GameUtils.INTENT_KEY_ROWID, m_rowid ); - startActivityForResult( intent, CHAT_REQUEST ); + if ( XWApp.CHAT_SUPPORTED ) { + Intent intent = new Intent( this, ChatActivity.class ); + intent.putExtra( GameUtils.INTENT_KEY_ROWID, m_rowid ); + startActivityForResult( intent, CHAT_REQUEST ); + } } private void waitCloseGame( boolean save ) @@ -2034,7 +2044,7 @@ public class BoardActivity extends XWActivity private void trySendChats() { - if ( null != m_jniThread ) { + if ( XWApp.CHAT_SUPPORTED && null != m_jniThread ) { Iterator iter = m_pendingChats.iterator(); while ( iter.hasNext() ) { m_jniThread.handle( JNICmd.CMD_SENDCHAT, iter.next() ); @@ -2081,7 +2091,8 @@ public class BoardActivity extends XWActivity m_toolbar.update( Toolbar.BUTTON_UNDO, m_gsi.canRedo ); m_toolbar.update( Toolbar.BUTTON_HINT_PREV, m_gsi.canHint ); m_toolbar.update( Toolbar.BUTTON_HINT_NEXT, m_gsi.canHint ); - m_toolbar.update( Toolbar.BUTTON_CHAT, m_gsi.canChat ); + m_toolbar.update( Toolbar.BUTTON_CHAT, + XWApp.CHAT_SUPPORTED && m_gsi.canChat ); m_toolbar.update( Toolbar.BUTTON_BROWSE_DICT, null != m_gi.dictName( m_view.getCurPlayer() ) ); } @@ -2103,7 +2114,8 @@ public class BoardActivity extends XWActivity hideShowItem( menu, R.id.board_menu_undo_current, m_gsi.canRedo ); hideShowItem( menu, R.id.board_menu_hint_prev, m_gsi.canHint ); hideShowItem( menu, R.id.board_menu_hint_next, m_gsi.canHint ); - hideShowItem( menu, R.id.board_menu_chat, m_gsi.canChat ); + hideShowItem( menu, R.id.board_menu_chat, + XWApp.CHAT_SUPPORTED && m_gsi.canChat ); } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWApp.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWApp.java index 795517028..d82cd45e2 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWApp.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWApp.java @@ -31,6 +31,7 @@ public class XWApp extends Application { public static final boolean BTSUPPORTED = false; public static final boolean SMSSUPPORTED = true; public static final boolean GCMSUPPORTED = true; + public static final boolean CHAT_SUPPORTED = false; public static final boolean ATTACH_SUPPORTED = true; public static final boolean REMATCH_SUPPORTED = false; public static final boolean DEBUG = false; diff --git a/xwords4/common/server.c b/xwords4/common/server.c index afee1c88c..5eb7c3860 100644 --- a/xwords4/common/server.c +++ b/xwords4/common/server.c @@ -2495,6 +2495,7 @@ endGameInternal( ServerCtxt* server, GameEndReason XP_UNUSED(why), XP_S16 quitte XWStreamCtxt* stream; stream = messageStreamWithHeader( server, SERVER_DEVICE, XWPROTO_CLIENT_REQ_END_GAME ); + putQuitter( server, stream, quitter ); stream_destroy( stream ); /* Do I want to change the state I'm in? I don't think so.... */