SES1628 - Add git commit details to version info (#1459)

* Fixes #1458

* Addressed PR feedback
This commit is contained in:
AL-Session 2024-05-02 12:55:24 +10:00 committed by GitHub
parent d8daf6175e
commit fbc82d7831
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 2 deletions

View File

@ -41,6 +41,17 @@ def abiPostFix = ['armeabi-v7a' : 1,
'x86_64' : 4, 'x86_64' : 4,
'universal' : 5] 'universal' : 5]
// Function to get the current git commit hash so we can embed it along w/ the build version.
// Note: This is visible in the SettingsActivity, right at the bottom (R.id.versionTextView).
def getGitHash = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine "git", "rev-parse", "--short", "HEAD"
standardOutput = stdout
}
return stdout.toString().trim()
}
android { android {
compileSdkVersion androidCompileSdkVersion compileSdkVersion androidCompileSdkVersion
namespace 'network.loki.messenger' namespace 'network.loki.messenger'
@ -94,6 +105,7 @@ android {
project.ext.set("archivesBaseName", "session") project.ext.set("archivesBaseName", "session")
buildConfigField "long", "BUILD_TIMESTAMP", getLastCommitTimestamp() + "L" buildConfigField "long", "BUILD_TIMESTAMP", getLastCommitTimestamp() + "L"
buildConfigField "String", "GIT_HASH", "\"$getGitHash\""
buildConfigField "String", "CONTENT_PROXY_HOST", "\"contentproxy.signal.org\"" buildConfigField "String", "CONTENT_PROXY_HOST", "\"contentproxy.signal.org\""
buildConfigField "int", "CONTENT_PROXY_PORT", "443" buildConfigField "int", "CONTENT_PROXY_PORT", "443"
buildConfigField "String", "USER_AGENT", "\"OWA\"" buildConfigField "String", "USER_AGENT", "\"OWA\""

View File

@ -37,6 +37,7 @@ import org.session.libsession.snode.SnodeAPI
import org.session.libsession.utilities.* import org.session.libsession.utilities.*
import org.session.libsession.utilities.SSKEnvironment.ProfileManagerProtocol import org.session.libsession.utilities.SSKEnvironment.ProfileManagerProtocol
import org.session.libsession.utilities.recipients.Recipient import org.session.libsession.utilities.recipients.Recipient
import org.session.libsignal.utilities.getProperty
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
import org.thoughtcrime.securesms.avatar.AvatarSelection import org.thoughtcrime.securesms.avatar.AvatarSelection
import org.thoughtcrime.securesms.components.ProfilePictureView import org.thoughtcrime.securesms.components.ProfilePictureView
@ -107,7 +108,9 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
helpButton.setOnClickListener { showHelp() } helpButton.setOnClickListener { showHelp() }
seedButton.setOnClickListener { showSeed() } seedButton.setOnClickListener { showSeed() }
clearAllDataButton.setOnClickListener { clearAllData() } clearAllDataButton.setOnClickListener { clearAllData() }
versionTextView.text = String.format(getString(R.string.version_s), "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})")
val gitCommitFirstSixChars = BuildConfig.GIT_HASH.take(6)
versionTextView.text = String.format(getString(R.string.version_s), "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE} - $gitCommitFirstSixChars)")
} }
} }

View File

@ -7,7 +7,7 @@
<string name="ban">مسدود</string> <string name="ban">مسدود</string>
<string name="save">ذخیره</string> <string name="save">ذخیره</string>
<string name="note_to_self">یادداشت به خود</string> <string name="note_to_self">یادداشت به خود</string>
<string name="version_s">نسخه</string> <string name="version_s">%s نسخه</string>
<!-- AbstractNotificationBuilder --> <!-- AbstractNotificationBuilder -->
<string name="AbstractNotificationBuilder_new_message">پیام جدید</string> <string name="AbstractNotificationBuilder_new_message">پیام جدید</string>
<!-- AlbumThumbnailView --> <!-- AlbumThumbnailView -->