Move MAX_LOG_UPLOAD_SIZE to RageshakeConfig
This commit is contained in:
parent
a6fe0ddc9b
commit
580622da9a
3 changed files with 6 additions and 8 deletions
|
|
@ -40,9 +40,4 @@ object ApplicationConfig {
|
||||||
* For Element, the value is "Element". We use the same name for desktop and mobile for now.
|
* For Element, the value is "Element". We use the same name for desktop and mobile for now.
|
||||||
*/
|
*/
|
||||||
const val DESKTOP_APPLICATION_NAME: String = "Element"
|
const val DESKTOP_APPLICATION_NAME: String = "Element"
|
||||||
|
|
||||||
/**
|
|
||||||
* The maximum size of the upload request. Default value is just below CloudFlare's max request size.
|
|
||||||
*/
|
|
||||||
const val MAX_LOG_UPLOAD_SIZE = 50 * 1024 * 1024L
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,4 +19,8 @@ package io.element.android.appconfig
|
||||||
object RageshakeConfig {
|
object RageshakeConfig {
|
||||||
const val BUG_REPORT_URL = "https://riot.im/bugreports/submit"
|
const val BUG_REPORT_URL = "https://riot.im/bugreports/submit"
|
||||||
const val BUG_REPORT_APP_NAME = "element-x-android"
|
const val BUG_REPORT_APP_NAME = "element-x-android"
|
||||||
|
/**
|
||||||
|
* The maximum size of the upload request. Default value is just below CloudFlare's max request size.
|
||||||
|
*/
|
||||||
|
const val MAX_LOG_UPLOAD_SIZE = 50 * 1024 * 1024L
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import android.os.Build
|
||||||
import androidx.core.net.toFile
|
import androidx.core.net.toFile
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
import com.squareup.anvil.annotations.ContributesBinding
|
import com.squareup.anvil.annotations.ContributesBinding
|
||||||
import io.element.android.appconfig.ApplicationConfig
|
|
||||||
import io.element.android.appconfig.RageshakeConfig
|
import io.element.android.appconfig.RageshakeConfig
|
||||||
import io.element.android.features.rageshake.api.crash.CrashDataStore
|
import io.element.android.features.rageshake.api.crash.CrashDataStore
|
||||||
import io.element.android.features.rageshake.api.reporter.BugReporter
|
import io.element.android.features.rageshake.api.reporter.BugReporter
|
||||||
|
|
@ -178,7 +177,7 @@ class DefaultBugReporter @Inject constructor(
|
||||||
val requestBody = file.asRequestBody(MimeTypes.OctetStream.toMediaTypeOrNull())
|
val requestBody = file.asRequestBody(MimeTypes.OctetStream.toMediaTypeOrNull())
|
||||||
totalUploadedSize += requestBody.contentLength()
|
totalUploadedSize += requestBody.contentLength()
|
||||||
// If we are about to upload more than the max request size, stop here
|
// If we are about to upload more than the max request size, stop here
|
||||||
if (totalUploadedSize > ApplicationConfig.MAX_LOG_UPLOAD_SIZE) {
|
if (totalUploadedSize > RageshakeConfig.MAX_LOG_UPLOAD_SIZE) {
|
||||||
Timber.e("Could not upload file ${file.name} because it would exceed the max request size")
|
Timber.e("Could not upload file ${file.name} because it would exceed the max request size")
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
@ -375,7 +374,7 @@ class DefaultBugReporter @Inject constructor(
|
||||||
val separator = System.lineSeparator()
|
val separator = System.lineSeparator()
|
||||||
logcatProcess.inputStream
|
logcatProcess.inputStream
|
||||||
.reader()
|
.reader()
|
||||||
.buffered(ApplicationConfig.MAX_LOG_UPLOAD_SIZE.toInt())
|
.buffered(RageshakeConfig.MAX_LOG_UPLOAD_SIZE.toInt())
|
||||||
.forEachLine { line ->
|
.forEachLine { line ->
|
||||||
streamWriter.append(line)
|
streamWriter.append(line)
|
||||||
streamWriter.append(separator)
|
streamWriter.append(separator)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue