add latest commit log to About (debug only)

This commit is contained in:
Eric House 2022-05-07 08:14:14 -07:00
parent a5d6512ab2
commit f32e0fbba4
2 changed files with 19 additions and 0 deletions

View file

@ -22,6 +22,7 @@ def INITIAL_CLIENT_VERS = 10
def VERSION_CODE_BASE = 184
def VERSION_NAME = '4.4.187'
def BUILD_INFO_NAME = "build-info.txt"
def LAST_COMMIT_FILE = "last-commit.txt"
// Trying to support older devices (pre KitKat) while moving KitKat and beyond
// to the newer version of the Paho MQTT client library that, with luck, will
@ -133,6 +134,7 @@ android {
buildConfigField "boolean", "HAVE_PASSWORD", "false"
buildConfigField "boolean", "NO_NEW_RELAY", "true"
buildConfigField "boolean", "LOCUTILS_ENABLED", "false"
buildConfigField "String", "LAST_COMMIT_FILE", "\"$LAST_COMMIT_FILE\""
}
xw4GPlay {
@ -454,6 +456,11 @@ task makeBuildAssets() {
if (diff) {
out += "\n" + diff
}
new File(path).write(out)
// Now the latest commit
path = new File(assetsDir, LAST_COMMIT_FILE).getAbsolutePath()
out = "git log -n 1".execute().text.trim()
new File(path).write(out)
}

View file

@ -25,12 +25,14 @@ import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface;
import android.content.res.AssetManager;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import org.eehouse.android.xw4.jni.XwJNI;
import java.io.InputStream;
import java.text.DateFormat;
import java.util.Date;
@ -80,6 +82,16 @@ public class AboutAlert extends XWDialogFragment {
if ( null != pair && 2 >= pair.length && null != pair[1] ) {
str += "\n\n" + getString( R.string.about_btaddr_fmt, pair[1] );
}
AssetManager am = context.getAssets();
try {
InputStream is = am.open( BuildConfig.LAST_COMMIT_FILE );
byte[] tmp = new byte[2 * 1024];
int nRead = is.read( tmp, 0, tmp.length );
str += "\n\n" + new String( tmp, 0, nRead );
} catch ( Exception ex ) {
Log.ex( TAG, ex );
}
}
((TextView)view.findViewById( R.id.about_build ))
.setText( str );