Add App version info

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2019-07-30 09:24:27 +02:00
parent eca49155c5
commit 61685e2ee9
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
2 changed files with 25 additions and 2 deletions

View file

@ -21,7 +21,7 @@ package com.nextcloud.client.appinfo;
import com.owncloud.android.BuildConfig;
class AppInfoImpl implements AppInfo {
public class AppInfoImpl implements AppInfo {
@Override
public String getFormattedVersionCode() {

View file

@ -25,6 +25,9 @@ import android.app.Activity
import android.content.Intent
import android.os.Build
import android.util.Log
import com.nextcloud.client.appinfo.AppInfoImpl
import com.owncloud.android.BuildConfig
import com.owncloud.android.R
import java.io.PrintWriter
import java.io.StringWriter
import kotlin.system.exitProcess
@ -54,9 +57,29 @@ class ExceptionHandler(private val context: Activity) : Thread.UncaughtException
}
private fun generateErrorReport(stackTrace: String): String {
val appInfo = AppInfoImpl()
val buildNumber = context.resources.getString(R.string.buildNumber)
var buildNumberString = ""
if (buildNumber.isNotEmpty()) {
buildNumberString = " (build #$buildNumber)"
}
return "************ CAUSE OF ERROR ************\n\n" +
stackTrace +
"\n************ DEVICE INFORMATION ***********" +
"\n************ APP INFORMATION ************" +
LINE_SEPARATOR +
"ID: " +
BuildConfig.APPLICATION_ID +
LINE_SEPARATOR +
"Version: " +
appInfo.formattedVersionCode +
buildNumberString +
LINE_SEPARATOR +
"Build flavor: " +
BuildConfig.FLAVOR +
LINE_SEPARATOR +
"\n************ DEVICE INFORMATION ************" +
LINE_SEPARATOR +
"Brand: " +
Build.BRAND +