phone info on sent mail

disable creation of old log file

Signed-off-by: tobiasKaminsky <[email protected]>
This commit is contained in:
tobiasKaminsky committed 2019-08-16 09:34:11 +02:00
1 parent de9475ed2c
commit 56a4ac290b
3 files changed
+15 -3

No files matched your search

@@ -20,7 +20,6 @@
package com.nextcloud.client.logger
import com.owncloud.android.lib.common.utils.Log_OC
import java.lang.Exception
/**
* This adapter is used by legacy [Log_OC] logger to redirect logs to custom logger implementation.
@@ -28,7 +27,7 @@ import java.lang.Exception
class LegacyLoggerAdapter(private val logger: Logger) : Log_OC.Adapter {
override fun i(tag: String, message: String) {
logger.d(tag, message)
logger.i(tag, message)
}
override fun d(tag: String, message: String) {
@@ -23,6 +23,7 @@ import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.widget.Toast
import androidx.core.content.FileProvider
import com.nextcloud.client.core.AsyncRunner
@@ -79,8 +80,12 @@ class LogsEmailSender(private val context: Context, private val clock: Clock, pr
task = null
val intent = Intent(Intent.ACTION_SEND_MULTIPLE)
intent.putExtra(Intent.EXTRA_EMAIL, context.getString(R.string.mail_logger))
val subject = context.getString(R.string.log_send_mail_subject).format(context.getString(R.string.app_name))
intent.putExtra(Intent.EXTRA_SUBJECT, subject)
intent.putExtra(Intent.EXTRA_TEXT, getPhoneInfo())
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
intent.type = LOGS_MIME_TYPE
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, arrayListOf(uri))
@@ -90,4 +95,13 @@ class LogsEmailSender(private val context: Context, private val clock: Clock, pr
Toast.makeText(context, R.string.log_send_no_mail_app, Toast.LENGTH_SHORT).show()
}
}
private fun getPhoneInfo(): String {
return "Model: " + Build.MODEL + "\n" +
"Brand: " + Build.BRAND + "\n" +
"Product: " + Build.PRODUCT + "\n" +
"Device: " + Build.DEVICE + "\n" +
"Version-Codename: " + Build.VERSION.CODENAME + "\n" +
"Version-Release: " + Build.VERSION.RELEASE
}
}
@@ -269,7 +269,6 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
if (BuildConfig.DEBUG || getApplicationContext().getResources().getBoolean(R.bool.logger_enabled)) {
// use app writable dir, no permissions needed
Log_OC.setLoggerImplementation(new LegacyLoggerAdapter(logger));
Log_OC.startLogging(getAppContext());
Log_OC.d("Debug", "start logging");
}