remove compile-time enabling of chat: it's not coming out

This commit is contained in:
Eric House 2016-07-29 07:32:50 -07:00
parent 36f127fb18
commit ec96a00b46
7 changed files with 66 additions and 98 deletions

View file

@ -134,7 +134,7 @@ dependencies {
task genVers(type: Exec) {
workingDir '../'
commandLine '../scripts/genvers.sh', '--variant', VARIANT_NAME,
'--client-vers', INITIAL_CLIENT_VERS, '--chat-enabled', CHAT_ENABLED,
'--client-vers', INITIAL_CLIENT_VERS,
'--thumbnail-enabled', THUMBNAIL_ENABLED,
'--vers-outfile', "assets/gitvers.txt"
}

View file

@ -38,6 +38,7 @@ LOCAL_DEFINES += \
-DHASH_STREAM \
-DXWFEATURE_BASE64 \
-DXWFEATURE_DEVID \
-DXWFEATURE_CHAT \
-DCOMMON_LAYOUT \
-DNATIVE_NLI \
-DCOMMS_VERSION=1 \
@ -46,10 +47,6 @@ LOCAL_DEFINES += \
-DRELAY_ROOM_DEFAULT=\"\" \
-D__LITTLE_ENDIAN \
ifeq ($(CHAT_ENABLED),true)
LOCAL_DEFINES += -DXWFEATURE_CHAT
endif
# -DXWFEATURE_SCOREONEPASS \
LOCAL_SRC_FILES += \

View file

@ -540,9 +540,7 @@ public class BoardDelegate extends DelegateBase
{
getBundledData( savedInstanceState );
if ( BuildConstants.CHAT_SUPPORTED ) {
m_pendingChats = new ArrayList<String>();
}
m_pendingChats = new ArrayList<String>();
m_utils = new BoardUtilCtxt();
m_jniu = JNIUtilsImpl.get( m_activity );
@ -788,8 +786,7 @@ public class BoardDelegate extends DelegateBase
Utils.setItemVisible( menu, R.id.board_menu_hint_next,
m_gsi.canHint );
Utils.setItemVisible( menu, R.id.board_menu_chat,
BuildConstants.CHAT_SUPPORTED
&& m_gsi.canChat );
m_gsi.canChat );
Utils.setItemVisible( menu, R.id.board_menu_tray,
!inTrade && m_gsi.canHideRack );
Utils.setItemVisible( menu, R.id.board_menu_trade,
@ -2013,18 +2010,16 @@ public class BoardDelegate extends DelegateBase
public void showChat( final String msg, final int fromIndx,
String fromPlayer )
{
if ( BuildConstants.CHAT_SUPPORTED ) {
runOnUiThread( new Runnable() {
public void run() {
DBUtils.appendChatHistory( m_activity, m_rowid, msg,
fromIndx );
if ( ! ChatDelegate.append( m_rowid, msg,
fromIndx ) ) {
startChatActivity();
}
runOnUiThread( new Runnable() {
public void run() {
DBUtils.appendChatHistory( m_activity, m_rowid, msg,
fromIndx );
if ( ! ChatDelegate.append( m_rowid, msg,
fromIndx ) ) {
startChatActivity();
}
} );
}
}
} );
}
} // class BoardUtilCtxt
@ -2247,12 +2242,10 @@ public class BoardDelegate extends DelegateBase
R.string.not_again_undo,
R.string.key_notagain_undo,
Action.UNDO_ACTION );
if ( BuildConstants.CHAT_SUPPORTED ) {
m_toolbar.setListener( Toolbar.BUTTON_CHAT,
R.string.not_again_chat,
R.string.key_notagain_chat,
Action.CHAT_ACTION );
}
m_toolbar.setListener( Toolbar.BUTTON_CHAT,
R.string.not_again_chat,
R.string.key_notagain_chat,
Action.CHAT_ACTION );
}
} // populateToolbar
@ -2340,13 +2333,11 @@ public class BoardDelegate extends DelegateBase
private void startChatActivity()
{
if ( BuildConstants.CHAT_SUPPORTED ) {
int curPlayer = XwJNI.board_getSelPlayer( m_jniGamePtr );
String[] names = m_gi.playerNames();
boolean[] locs = m_gi.playersLocal(); // to convert old histories
ChatDelegate.start( getDelegator(), m_rowid, curPlayer,
names, locs );
}
int curPlayer = XwJNI.board_getSelPlayer( m_jniGamePtr );
String[] names = m_gi.playerNames();
boolean[] locs = m_gi.playersLocal(); // to convert old histories
ChatDelegate.start( getDelegator(), m_rowid, curPlayer,
names, locs );
}
private void closeIfFinishing( boolean force )
@ -2414,13 +2405,11 @@ public class BoardDelegate extends DelegateBase
private void trySendChats()
{
if ( BuildConstants.CHAT_SUPPORTED && null != m_jniThread ) {
Iterator<String> iter = m_pendingChats.iterator();
while ( iter.hasNext() ) {
handleViaThread( JNICmd.CMD_SENDCHAT, iter.next() );
}
m_pendingChats.clear();
Iterator<String> iter = m_pendingChats.iterator();
while ( iter.hasNext() ) {
handleViaThread( JNICmd.CMD_SENDCHAT, iter.next() );
}
m_pendingChats.clear();
}
private void tryInvites()
@ -2492,8 +2481,7 @@ public class BoardDelegate extends DelegateBase
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,
BuildConstants.CHAT_SUPPORTED && m_gsi.canChat );
m_toolbar.update( Toolbar.BUTTON_CHAT, m_gsi.canChat );
m_toolbar.update( Toolbar.BUTTON_BROWSE_DICT,
null != m_gi.dictName( m_view.getCurPlayer() ) );
}

View file

@ -27,9 +27,7 @@ public class ChatActivity extends XWActivity {
@Override
public void onCreate( Bundle savedInstanceState )
{
if ( BuildConstants.CHAT_SUPPORTED ) {
ChatDelegate dlgt = new ChatDelegate( this, savedInstanceState );
super.onCreate( savedInstanceState, dlgt );
}
ChatDelegate dlgt = new ChatDelegate( this, savedInstanceState );
super.onCreate( savedInstanceState, dlgt );
}
}

View file

@ -1268,32 +1268,30 @@ public class DBUtils {
boolean[] playersLocal )
{
HistoryPair[] result = null;
if ( BuildConstants.CHAT_SUPPORTED ) {
String[] columns = { DBHelper.SENDER, DBHelper.MESSAGE };
String selection = String.format( "%s=%d", DBHelper.ROW, rowid );
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
Cursor cursor = db.query( DBHelper.TABLE_NAME_CHAT, columns,
selection, null, null, null, null );
if ( 0 < cursor.getCount() ) {
result = new HistoryPair[cursor.getCount()];
int msgIndex = cursor.getColumnIndex( DBHelper.MESSAGE );
int plyrIndex = cursor.getColumnIndex( DBHelper.SENDER );
for ( int ii = 0; cursor.moveToNext(); ++ii ) {
String msg = cursor.getString( msgIndex );
int plyr = cursor.getInt( plyrIndex );
HistoryPair pair = new HistoryPair(msg, plyr );
result[ii] = pair;
}
String[] columns = { DBHelper.SENDER, DBHelper.MESSAGE };
String selection = String.format( "%s=%d", DBHelper.ROW, rowid );
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
Cursor cursor = db.query( DBHelper.TABLE_NAME_CHAT, columns,
selection, null, null, null, null );
if ( 0 < cursor.getCount() ) {
result = new HistoryPair[cursor.getCount()];
int msgIndex = cursor.getColumnIndex( DBHelper.MESSAGE );
int plyrIndex = cursor.getColumnIndex( DBHelper.SENDER );
for ( int ii = 0; cursor.moveToNext(); ++ii ) {
String msg = cursor.getString( msgIndex );
int plyr = cursor.getInt( plyrIndex );
HistoryPair pair = new HistoryPair(msg, plyr );
result[ii] = pair;
}
cursor.close();
db.close();
}
cursor.close();
db.close();
}
if ( null == result ) {
result = convertChatString( context, rowid, playersLocal );
}
if ( null == result ) {
result = convertChatString( context, rowid, playersLocal );
}
return result;
}
@ -1792,24 +1790,22 @@ public class DBUtils {
private static String getChatHistoryStr( Context context, long rowid )
{
String result = null;
if ( BuildConstants.CHAT_SUPPORTED ) {
String[] columns = { DBHelper.CHAT_HISTORY };
String selection = String.format( ROW_ID_FMT, rowid );
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
String[] columns = { DBHelper.CHAT_HISTORY };
String selection = String.format( ROW_ID_FMT, rowid );
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
if ( 1 == cursor.getCount() && cursor.moveToFirst() ) {
result =
cursor.getString( cursor
.getColumnIndex(DBHelper
.CHAT_HISTORY));
}
cursor.close();
db.close();
Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
if ( 1 == cursor.getCount() && cursor.moveToFirst() ) {
result =
cursor.getString( cursor
.getColumnIndex(DBHelper
.CHAT_HISTORY));
}
cursor.close();
db.close();
}
return result;
}

View file

@ -27,12 +27,10 @@
<arg value="${build.target}"/>
</exec>
<property name="CHAT_ENABLED" value="true" />
<exec dir="." executable="../scripts/ndkbuild.sh" failonerror="true">
<arg value="BUILD_TARGET=${build.target}" />
<arg value="-j3"/>
<arg value="INITIAL_CLIENT_VERS=${INITIAL_CLIENT_VERS}" />
<arg value="CHAT_ENABLED=${CHAT_ENABLED}" />
<arg value="VARIANT=${VARIANT_NAME}" />
<arg value="V=1" />
</exec>
@ -59,14 +57,12 @@
<arg value="${VARIANT_NAME}"/>
</exec>
<exec dir="." executable="../scripts/genvers.sh" output="/dev/null"
<exec dir="." executable="../scripts/genvers.sh" output="/dev/null"
failonerror="true">
<arg value="--variant" />
<arg value="${VARIANT_NAME}" />
<arg value="--client-vers" />
<arg value="${INITIAL_CLIENT_VERS}" />
<arg value="--chat-enabled"/>
<arg value="${CHAT_ENABLED}" />
<arg value="--vers-outfile" />
<arg value="./assets/gitvers.txt" />
</exec>

View file

@ -6,13 +6,11 @@ STRINGS_HASH=""
OUT_PATH=""
VARIANT=""
CLIENT_VERS_RELAY=""
CHAT_SUPPORTED=""
GCM_SENDER_ID=${GCM_SENDER_ID:-""}
CRITTERCISM_APP_ID=${CRITTERCISM_APP_ID:-""}
usage() {
echo "usage: $0 --variant <variant> --client-vers <relay_vers> \\"
echo " --chat-enabled <trueOrFalse> <trueOrFalse> \\"
echo " [--vers-outfile path/to/versout.txt]"
exit 1
}
@ -28,10 +26,6 @@ while [ $# -gt 0 ]; do
CLIENT_VERS_RELAY=$2
shift
;;
--chat-enabled)
CHAT_SUPPORTED=$2
shift
;;
--vers-outfile)
OUT_PATH=$2
shift
@ -43,7 +37,7 @@ while [ $# -gt 0 ]; do
shift
done
[ -n "$VARIANT" -a -n "$CLIENT_VERS_RELAY" -a -n "$CHAT_SUPPORTED" ] || usage
[ -n "$VARIANT" -a -n "$CLIENT_VERS_RELAY" ] || usage
BUILD_DIR=$(basename $(pwd))
cd $(dirname $0)
@ -114,7 +108,6 @@ public class BuildConstants {
public static final String GIT_REV = "$SHORTVERS";
public static final String STRINGS_HASH = "$STRINGS_HASH";
public static final short CLIENT_VERS_RELAY = $CLIENT_VERS_RELAY;
public static final boolean CHAT_SUPPORTED = $CHAT_SUPPORTED;
public static final long BUILD_STAMP = $(date +'%s');
public static final String DBG_TAG = "$DBG_TAG";
public static final String VARIANT = "$VARIANT";