浏览代码

phone info on sent mail
disable creation of old log file

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>

tobiasKaminsky 5 年之前
父节点
当前提交
56a4ac290b

+ 1 - 2
src/main/java/com/nextcloud/client/logger/LegacyLoggerAdapter.kt

@@ -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) {

+ 14 - 0
src/main/java/com/nextcloud/client/logger/ui/LogsEmailSender.kt

@@ -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
+    }
 }

+ 0 - 1
src/main/java/com/owncloud/android/MainApp.java

@@ -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");
         }