Merge pull request #3030 from element-hq/feature/bma/codeCleanup
Code cleanup and store badges
This commit is contained in:
@@ -50,7 +50,6 @@ dependencies {
|
||||
implementation(projects.libraries.permissions.api)
|
||||
implementation(projects.libraries.permissions.noop)
|
||||
implementation(projects.services.toolbox.api)
|
||||
implementation(projects.services.toolbox.test)
|
||||
|
||||
testImplementation(libs.test.junit)
|
||||
testImplementation(libs.coroutines.test)
|
||||
@@ -63,6 +62,7 @@ dependencies {
|
||||
testImplementation(projects.libraries.permissions.test)
|
||||
testImplementation(projects.libraries.preferences.test)
|
||||
testImplementation(projects.features.lockscreen.test)
|
||||
testImplementation(projects.services.toolbox.test)
|
||||
testImplementation(projects.tests.testutils)
|
||||
|
||||
ksp(libs.showkase.processor)
|
||||
|
||||
@@ -58,6 +58,6 @@ dependencies {
|
||||
testImplementation(projects.libraries.cryptography.test)
|
||||
testImplementation(projects.libraries.cryptography.impl)
|
||||
testImplementation(projects.libraries.featureflag.test)
|
||||
implementation(projects.libraries.sessionStorage.test)
|
||||
implementation(projects.services.appnavstate.test)
|
||||
testImplementation(projects.libraries.sessionStorage.test)
|
||||
testImplementation(projects.services.appnavstate.test)
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2023 New Vector Ltd
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<manifest>
|
||||
|
||||
</manifest>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<!-- TODO Delete those 2 strings (replaced by action_sign_out) -->
|
||||
<!--string name="screen_signout_confirmation_dialog_submit">"Sign out"</string>
|
||||
<string name="screen_signout_preference_item">"Sign out"</string-->
|
||||
</resources>
|
||||
@@ -21,12 +21,11 @@ import android.os.Build
|
||||
import androidx.core.net.toFile
|
||||
import androidx.core.net.toUri
|
||||
import com.squareup.anvil.annotations.ContributesBinding
|
||||
import io.element.android.appconfig.ApplicationConfig
|
||||
import io.element.android.appconfig.RageshakeConfig
|
||||
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.BugReporterListener
|
||||
import io.element.android.features.rageshake.api.screenshot.ScreenshotHolder
|
||||
import io.element.android.features.rageshake.impl.R
|
||||
import io.element.android.libraries.androidutils.file.compressFile
|
||||
import io.element.android.libraries.androidutils.file.safeDelete
|
||||
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
|
||||
@@ -139,7 +138,7 @@ class DefaultBugReporter @Inject constructor(
|
||||
// build the multi part request
|
||||
val builder = BugReporterMultipartBody.Builder()
|
||||
.addFormDataPart("text", bugDescription)
|
||||
.addFormDataPart("app", context.getString(R.string.bug_report_app_name))
|
||||
.addFormDataPart("app", RageshakeConfig.BUG_REPORT_APP_NAME)
|
||||
.addFormDataPart("user_agent", userAgentProvider.provide())
|
||||
.addFormDataPart("user_id", userId?.toString() ?: "undefined")
|
||||
.addFormDataPart("can_contact", canContact.toString())
|
||||
@@ -178,7 +177,7 @@ class DefaultBugReporter @Inject constructor(
|
||||
val requestBody = file.asRequestBody(MimeTypes.OctetStream.toMediaTypeOrNull())
|
||||
totalUploadedSize += requestBody.contentLength()
|
||||
// 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")
|
||||
break
|
||||
}
|
||||
@@ -375,7 +374,7 @@ class DefaultBugReporter @Inject constructor(
|
||||
val separator = System.lineSeparator()
|
||||
logcatProcess.inputStream
|
||||
.reader()
|
||||
.buffered(ApplicationConfig.MAX_LOG_UPLOAD_SIZE.toInt())
|
||||
.buffered(RageshakeConfig.MAX_LOG_UPLOAD_SIZE.toInt())
|
||||
.forEachLine { line ->
|
||||
streamWriter.append(line)
|
||||
streamWriter.append(separator)
|
||||
|
||||
@@ -17,18 +17,15 @@
|
||||
package io.element.android.features.rageshake.impl.reporter
|
||||
|
||||
import com.squareup.anvil.annotations.ContributesBinding
|
||||
import io.element.android.features.rageshake.impl.R
|
||||
import io.element.android.appconfig.RageshakeConfig
|
||||
import io.element.android.libraries.di.AppScope
|
||||
import io.element.android.services.toolbox.api.strings.StringProvider
|
||||
import okhttp3.HttpUrl
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import javax.inject.Inject
|
||||
|
||||
@ContributesBinding(AppScope::class)
|
||||
class DefaultBugReporterUrlProvider @Inject constructor(
|
||||
private val stringProvider: StringProvider
|
||||
) : BugReporterUrlProvider {
|
||||
class DefaultBugReporterUrlProvider @Inject constructor() : BugReporterUrlProvider {
|
||||
override fun provide(): HttpUrl {
|
||||
return stringProvider.getString(R.string.bug_report_url).toHttpUrl()
|
||||
return RageshakeConfig.BUG_REPORT_URL.toHttpUrl()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2022 New Vector Ltd
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<!-- Rageshake configuration -->
|
||||
<string name="bug_report_url" translatable="false">https://riot.im/bugreports/submit</string>
|
||||
<!--
|
||||
As per https://github.com/matrix-org/rageshake
|
||||
bug_report_app_name: Identifier for the application (eg 'riot-web').
|
||||
Should correspond to a mapping configured in the configuration file for github issue reporting to work.
|
||||
-->
|
||||
<string name="bug_report_app_name" translatable="false">element-x-android</string>
|
||||
|
||||
|
||||
</resources>
|
||||
@@ -17,15 +17,15 @@
|
||||
package io.element.android.features.rageshake.impl.reporter
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import io.element.android.services.toolbox.test.strings.FakeStringProvider
|
||||
import io.element.android.appconfig.RageshakeConfig
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import org.junit.Test
|
||||
|
||||
class DefaultBugReporterUrlProviderTest {
|
||||
@Test
|
||||
fun `test DefaultBugReporterUrlProvider`() {
|
||||
val sut = DefaultBugReporterUrlProvider(FakeStringProvider("https://example.org"))
|
||||
val sut = DefaultBugReporterUrlProvider()
|
||||
val result = sut.provide()
|
||||
assertThat(result).isEqualTo("https://example.org".toHttpUrl())
|
||||
assertThat(result).isEqualTo(RageshakeConfig.BUG_REPORT_URL.toHttpUrl())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user