Merge pull request #1520 from johnjohndoe/random-housekeeping

Random housekeeping indicated by Lint
This commit is contained in:
Benoit Marty 2020-06-22 14:11:08 +02:00 committed by GitHub
commit 957ceff87c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 10 additions and 9 deletions

View File

@ -22,7 +22,8 @@ Build 🧱:
- SDK is now API level 21 minimum, and so RiotX (#405)
Other changes:
-
- Fix self-assignment of callback in `DefaultRoomPushRuleService#setRoomNotificationState` (#1520)
- Random housekeeping clean-ups indicated by Lint (#1520)
Changes in RiotX 0.22.0 (2020-06-15)
===================================================

View File

@ -252,7 +252,7 @@ class KeyShareTests : InstrumentedTest {
}
})
val txId: String = "m.testVerif12"
val txId = "m.testVerif12"
aliceVerificationService2.beginKeyVerification(VerificationMethod.SAS, aliceSession1.myUserId, aliceSession1.sessionParams.deviceId
?: "", txId)

View File

@ -69,7 +69,7 @@ data class HomeServerConnectionConfig(
*/
fun withHomeServerUri(hsUri: Uri): Builder {
if (hsUri.scheme != "http" && hsUri.scheme != "https") {
throw RuntimeException("Invalid home server URI: " + hsUri)
throw RuntimeException("Invalid home server URI: $hsUri")
}
// ensure trailing /
val hsString = hsUri.toString().ensureTrailingSlash()

View File

@ -28,7 +28,7 @@ import kotlin.math.ceil
*/
object HkdfSha256 {
public fun deriveSecret(inputKeyMaterial: ByteArray, salt: ByteArray?, info: ByteArray, outputLength: Int): ByteArray {
fun deriveSecret(inputKeyMaterial: ByteArray, salt: ByteArray?, info: ByteArray, outputLength: Int): ByteArray {
return expand(extract(salt, inputKeyMaterial), info, outputLength)
}

View File

@ -85,7 +85,7 @@ internal class SendVerificationMessageWorker(context: Context,
private const val OUTPUT_KEY_FAILED = "failed"
fun hasFailed(outputData: Data): Boolean {
return outputData.getBoolean(SendVerificationMessageWorker.OUTPUT_KEY_FAILED, false)
return outputData.getBoolean(OUTPUT_KEY_FAILED, false)
}
}
}

View File

@ -33,7 +33,7 @@ data class Fingerprint(
@Throws(CertificateException::class)
fun matchesCert(cert: X509Certificate): Boolean {
var o: Fingerprint? = when (hashType) {
val o: Fingerprint? = when (hashType) {
HashType.SHA256 -> newSha256Fingerprint(cert)
HashType.SHA1 -> newSha1Fingerprint(cert)
}

View File

@ -51,7 +51,7 @@ internal class DefaultRoomPushRuleService @AssistedInject constructor(@Assisted
override fun setRoomNotificationState(roomNotificationState: RoomNotificationState, matrixCallback: MatrixCallback<Unit>): Cancelable {
return setRoomNotificationStateTask
.configureWith(SetRoomNotificationStateTask.Params(roomId, roomNotificationState)) {
this.callback = callback
this.callback = matrixCallback
}
.executeBy(taskExecutor)
}

View File

@ -37,7 +37,7 @@ internal class MarkdownParser @Inject constructor(
fun parse(text: String): TextContent {
// If no special char are detected, just return plain text
if (text.contains(mdSpecialChars).not()) {
return TextContent(text.toString())
return TextContent(text)
}
val document = parser.parse(text)
@ -56,7 +56,7 @@ internal class MarkdownParser @Inject constructor(
val plainText = textContentRenderer.render(document)
TextContent(plainText, cleanHtmlText.postTreatment())
} else {
TextContent(text.toString())
TextContent(text)
}
}