[Architecture] clean up

This commit is contained in:
ganfra 2023-03-02 18:06:31 +01:00
parent c581f0b383
commit d1cbd907e7
3 changed files with 17 additions and 18 deletions

View file

@ -30,7 +30,6 @@ anvil {
generateDaggerFactories.set(true) generateDaggerFactories.set(true)
} }
dependencies { dependencies {
implementation(projects.libraries.core) implementation(projects.libraries.core)
implementation(projects.libraries.elementresources) implementation(projects.libraries.elementresources)

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2022 New Vector Ltd * Copyright (c) 2023 New Vector Ltd
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -39,7 +39,7 @@ public class BugReporterMultipartBody extends RequestBody {
/** /**
* Upload listener * Upload listener
* *
* @param totalWritten total written bytes * @param totalWritten total written bytes
* @param contentLength content length * @param contentLength content length
*/ */
void onWrite(long totalWritten, long contentLength); void onWrite(long totalWritten, long contentLength);
@ -132,24 +132,24 @@ public class BugReporterMultipartBody extends RequestBody {
if (headers != null) { if (headers != null) {
for (int h = 0, headerCount = headers.size(); h < headerCount; h++) { for (int h = 0, headerCount = headers.size(); h < headerCount; h++) {
sink.writeUtf8(headers.name(h)) sink.writeUtf8(headers.name(h))
.write(COLONSPACE) .write(COLONSPACE)
.writeUtf8(headers.value(h)) .writeUtf8(headers.value(h))
.write(CRLF); .write(CRLF);
} }
} }
MediaType contentType = body.contentType(); MediaType contentType = body.contentType();
if (contentType != null) { if (contentType != null) {
sink.writeUtf8("Content-Type: ") sink.writeUtf8("Content-Type: ")
.writeUtf8(contentType.toString()) .writeUtf8(contentType.toString())
.write(CRLF); .write(CRLF);
} }
int contentLength = (int) body.contentLength(); int contentLength = (int) body.contentLength();
if (contentLength != -1) { if (contentLength != -1) {
sink.writeUtf8("Content-Length: ") sink.writeUtf8("Content-Length: ")
.writeUtf8(contentLength + "") .writeUtf8(contentLength + "")
.write(CRLF); .write(CRLF);
} else if (countBytes) { } else if (countBytes) {
// We can't measure the body's size without the sizes of its components. // We can't measure the body's size without the sizes of its components.
byteCountBuffer.clear(); byteCountBuffer.clear();

View file

@ -260,15 +260,15 @@ class DefaultBugReporter @Inject constructor(
?.toUri() ?.toUri()
?.toFile() ?.toFile()
?.let { screenshotFile -> ?.let { screenshotFile ->
try { try {
builder.addFormDataPart( builder.addFormDataPart(
"file", "file",
screenshotFile.name, screenshotFile.asRequestBody(MimeTypes.OctetStream.toMediaTypeOrNull()) screenshotFile.name, screenshotFile.asRequestBody(MimeTypes.OctetStream.toMediaTypeOrNull())
) )
} catch (e: Exception) { } catch (e: Exception) {
Timber.e(e, "## sendBugReport() : fail to write screenshot") Timber.e(e, "## sendBugReport() : fail to write screenshot")
}
} }
}
} }
// add some github labels // add some github labels