Merge pull request #610 from vector-im/feature/warnings

Fix all warnings and ensure they will not come back
This commit is contained in:
Benoit Marty 2019-10-10 10:37:49 +02:00 committed by GitHub
commit 1e11d4492b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
951 changed files with 1854 additions and 3324 deletions

View file

@ -54,4 +54,13 @@ steps:
# Code quality # Code quality
- label: "Code quality" - label: "Code quality"
command: "./tools/check/check_code_quality.sh" command:
- "./tools/check/check_code_quality.sh"
- label: "ktlint"
command:
- "curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.34.2/ktlint && chmod a+x ktlint"
- "./ktlint --android --experimental -v"
plugins:
- docker#v3.1.0:
image: "openjdk"

32
.editorconfig Normal file
View file

@ -0,0 +1,32 @@
# For ktlint configuration. Ref: https://ktlint.github.io/
[*.{kt,kts}]
# possible values: number (e.g. 2), "unset" (makes ktlint ignore indentation completely)
indent_size=unset
# true (recommended) / false
insert_final_newline=true
# possible values: number (e.g. 120) (package name, imports & comments are ignored), "off"
# it's automatically set to 100 on `ktlint --android ...` (per Android Kotlin Style Guide)
max_line_length=off
# Comma-separated list of rules to disable (Since 0.34.0)
# Note that rules in any ruleset other than the standard ruleset will need to be prefixed
# by the ruleset identifier.
disabled_rules=no-wildcard-imports,no-multi-spaces,colon-spacing,chain-wrapping,import-ordering,experimental:annotation
# The following (so far identified) rules are kept:
# no-blank-line-before-rbrace
# final-newline
# no-consecutive-blank-lines
# comment-spacing
# filename
# comma-spacing
# paren-spacing
# op-spacing
# string-template
# no-unused-imports
# curly-spacing
# no-semi
# no-empty-class-body
# experimental:multiline-if-else
# experimental:no-empty-first-line-in-method-block

2
.gitignore vendored
View file

@ -12,3 +12,5 @@
.externalNativeBuild .externalNativeBuild
/tmp /tmp
ktlint

View file

@ -42,6 +42,15 @@ Make sure the following commands execute without any error:
> ./tools/check/check_code_quality.sh > ./tools/check/check_code_quality.sh
> curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.34.2/ktlint && chmod a+x ktlint
> ./ktlint --android -v
Note that you can run
> ./ktlint --android -v -F
For ktlint to fix some detected errors for you
> ./gradlew lintGplayRelease > ./gradlew lintGplayRelease
### Unit tests ### Unit tests

View file

@ -1,5 +1,3 @@
import javax.tools.JavaCompiler
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
@ -12,7 +10,7 @@ buildscript {
} }
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.5.0' classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.2' classpath 'com.google.gms:google-services:4.3.2'
classpath "com.airbnb.okreplay:gradle-plugin:1.5.0" classpath "com.airbnb.okreplay:gradle-plugin:1.5.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
@ -61,6 +59,11 @@ allprojects {
] ]
} }
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
// Warnings are potential errors, so stop ignoring them
kotlinOptions.allWarningsAsErrors = true
}
afterEvaluate { afterEvaluate {
extensions.findByName("kapt")?.arguments { extensions.findByName("kapt")?.arguments {
arg("dagger.gradle.incremental", "enabled") arg("dagger.gradle.incremental", "enabled")

View file

@ -5,8 +5,6 @@ apply plugin: 'kotlin-kapt'
android { android {
compileSdkVersion 28 compileSdkVersion 28
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 28 targetSdkVersion 28
@ -14,7 +12,6 @@ android {
versionName "1.0" versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {

View file

@ -59,4 +59,4 @@ private class LiveDataObservable<T>(
fun <T> LiveData<T>.asObservable(): Observable<T> { fun <T> LiveData<T>.asObservable(): Observable<T> {
return LiveDataObservable(this).observeOn(Schedulers.computation()) return LiveDataObservable(this).observeOn(Schedulers.computation())
} }

View file

@ -19,7 +19,6 @@ package im.vector.matrix.rx
import im.vector.matrix.android.api.MatrixCallback import im.vector.matrix.android.api.MatrixCallback
import im.vector.matrix.android.api.util.Cancelable import im.vector.matrix.android.api.util.Cancelable
import io.reactivex.CompletableEmitter import io.reactivex.CompletableEmitter
import io.reactivex.SingleEmitter
internal class MatrixCallbackCompletable<T>(private val completableEmitter: CompletableEmitter) : MatrixCallback<T> { internal class MatrixCallbackCompletable<T>(private val completableEmitter: CompletableEmitter) : MatrixCallback<T> {
@ -36,4 +35,4 @@ fun Cancelable.toCompletable(completableEmitter: CompletableEmitter) {
completableEmitter.setCancellable { completableEmitter.setCancellable {
this.cancel() this.cancel()
} }
} }

View file

@ -35,4 +35,4 @@ fun <T> Cancelable.toSingle(singleEmitter: SingleEmitter<T>) {
singleEmitter.setCancellable { singleEmitter.setCancellable {
this.cancel() this.cancel()
} }
} }

View file

@ -21,4 +21,4 @@ import io.reactivex.Observable
fun <T : Any> Observable<Optional<T>>.unwrap(): Observable<T> { fun <T : Any> Observable<Optional<T>>.unwrap(): Observable<T> {
return filter { it.hasValue() }.map { it.get() } return filter { it.hasValue() }.map { it.get() }
} }

View file

@ -67,9 +67,8 @@ class RxRoom(private val room: Room) {
fun liveDrafts(): Observable<List<UserDraft>> { fun liveDrafts(): Observable<List<UserDraft>> {
return room.getDraftsLive().asObservable() return room.getDraftsLive().asObservable()
} }
} }
fun Room.rx(): RxRoom { fun Room.rx(): RxRoom {
return RxRoom(this) return RxRoom(this)
} }

View file

@ -71,9 +71,8 @@ class RxSession(private val session: Session) {
fun joinRoom(roomId: String, viaServers: List<String> = emptyList()): Single<Unit> = Single.create { fun joinRoom(roomId: String, viaServers: List<String> = emptyList()): Single<Unit> = Single.create {
session.joinRoom(roomId, viaServers, MatrixCallbackSingle(it)).toSingle(it) session.joinRoom(roomId, viaServers, MatrixCallbackSingle(it)).toSingle(it)
} }
} }
fun Session.rx(): RxSession { fun Session.rx(): RxSession {
return RxSession(this) return RxSession(this)
} }

View file

@ -28,4 +28,4 @@ interface InstrumentedTest {
fun cacheDir(): File { fun cacheDir(): File {
return context().cacheDir return context().cacheDir
} }
} }

View file

@ -29,4 +29,4 @@ class OkReplayRuleChainNoActivity(
return RuleChain.outerRule(PermissionRule(configuration)) return RuleChain.outerRule(PermissionRule(configuration))
.around(RecorderRule(configuration)) .around(RecorderRule(configuration))
} }
} }

View file

@ -19,4 +19,4 @@ package im.vector.matrix.android
import im.vector.matrix.android.internal.util.MatrixCoroutineDispatchers import im.vector.matrix.android.internal.util.MatrixCoroutineDispatchers
import kotlinx.coroutines.Dispatchers.Main import kotlinx.coroutines.Dispatchers.Main
internal val testCoroutineDispatchers = MatrixCoroutineDispatchers(Main, Main, Main, Main, Main) internal val testCoroutineDispatchers = MatrixCoroutineDispatchers(Main, Main, Main, Main, Main)

View file

@ -28,7 +28,6 @@ import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class) @RunWith(AndroidJUnit4::class)
internal class AuthenticatorTest : InstrumentedTest { internal class AuthenticatorTest : InstrumentedTest {
@ -50,7 +49,6 @@ internal class AuthenticatorTest : InstrumentedTest {
@UiThreadTest @UiThreadTest
@OkReplay(tape = "auth", mode = TapeMode.READ_WRITE) @OkReplay(tape = "auth", mode = TapeMode.READ_WRITE)
fun auth() { fun auth() {
} }
companion object { companion object {
@ -59,6 +57,4 @@ internal class AuthenticatorTest : InstrumentedTest {
val grantExternalStoragePermissionRule: GrantPermissionRule = val grantExternalStoragePermissionRule: GrantPermissionRule =
GrantPermissionRule.grant(android.Manifest.permission.WRITE_EXTERNAL_STORAGE) GrantPermissionRule.grant(android.Manifest.permission.WRITE_EXTERNAL_STORAGE)
} }
}
}

View file

@ -41,4 +41,4 @@ internal class CryptoStoreHelper {
refreshToken = null, refreshToken = null,
deviceId = "deviceId_sample" deviceId = "deviceId_sample"
) )
} }

View file

@ -114,4 +114,4 @@ class CryptoStoreTest {
olmAccount1.releaseAccount() olmAccount1.releaseAccount()
olmAccount2.releaseAccount() olmAccount2.releaseAccount()
} }
} }

View file

@ -62,8 +62,6 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
JsonCanonicalizer.canonicalize("{\"a\":\"\\\"\"}")) JsonCanonicalizer.canonicalize("{\"a\":\"\\\"\"}"))
} }
/* ========================================================================================== /* ==========================================================================================
* Test from https://matrix.org/docs/spec/appendices.html#examples * Test from https://matrix.org/docs/spec/appendices.html#examples
* ========================================================================================== */ * ========================================================================================== */
@ -74,7 +72,6 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
JsonCanonicalizer.canonicalize("""{}""")) JsonCanonicalizer.canonicalize("""{}"""))
} }
@Test @Test
fun matrixOrg002Test() { fun matrixOrg002Test() {
assertEquals("""{"one":1,"two":"Two"}""", assertEquals("""{"one":1,"two":"Two"}""",
@ -84,7 +81,6 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
}""")) }"""))
} }
@Test @Test
fun matrixOrg003Test() { fun matrixOrg003Test() {
assertEquals("""{"a":"1","b":"2"}""", assertEquals("""{"a":"1","b":"2"}""",
@ -94,14 +90,12 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
}""")) }"""))
} }
@Test @Test
fun matrixOrg004Test() { fun matrixOrg004Test() {
assertEquals("""{"a":"1","b":"2"}""", assertEquals("""{"a":"1","b":"2"}""",
JsonCanonicalizer.canonicalize("""{"b":"2","a":"1"}""")) JsonCanonicalizer.canonicalize("""{"b":"2","a":"1"}"""))
} }
@Test @Test
fun matrixOrg005Test() { fun matrixOrg005Test() {
assertEquals("""{"auth":{"mxid":"@john.doe:example.com","profile":{"display_name":"John Doe","three_pids":[{"address":"john.doe@example.org","medium":"email"},{"address":"123456789","medium":"msisdn"}]},"success":true}}""", assertEquals("""{"auth":{"mxid":"@john.doe:example.com","profile":{"display_name":"John Doe","three_pids":[{"address":"john.doe@example.org","medium":"email"},{"address":"123456789","medium":"msisdn"}]},"success":true}}""",
@ -126,7 +120,6 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
}""")) }"""))
} }
@Test @Test
fun matrixOrg006Test() { fun matrixOrg006Test() {
assertEquals("""{"a":"日本語"}""", assertEquals("""{"a":"日本語"}""",
@ -135,7 +128,6 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
}""")) }"""))
} }
@Test @Test
fun matrixOrg007Test() { fun matrixOrg007Test() {
assertEquals("""{"日":1,"本":2}""", assertEquals("""{"日":1,"本":2}""",
@ -145,7 +137,6 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
}""")) }"""))
} }
@Test @Test
fun matrixOrg008Test() { fun matrixOrg008Test() {
assertEquals("""{"a":"日"}""", assertEquals("""{"a":"日"}""",
@ -159,4 +150,4 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
"a": null "a": null
}""")) }"""))
} }
} }

View file

@ -35,7 +35,6 @@ import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class) @RunWith(AndroidJUnit4::class)
internal class ChunkEntityTest : InstrumentedTest { internal class ChunkEntityTest : InstrumentedTest {
@ -48,7 +47,6 @@ internal class ChunkEntityTest : InstrumentedTest {
monarchy = Monarchy.Builder().setRealmConfiguration(testConfig).build() monarchy = Monarchy.Builder().setRealmConfiguration(testConfig).build()
} }
@Test @Test
fun add_shouldAdd_whenNotAlreadyIncluded() { fun add_shouldAdd_whenNotAlreadyIncluded() {
monarchy.runTransactionSync { realm -> monarchy.runTransactionSync { realm ->
@ -194,5 +192,4 @@ internal class ChunkEntityTest : InstrumentedTest {
chunk1.nextToken shouldEqual nextToken chunk1.nextToken shouldEqual nextToken
} }
} }
}
}

View file

@ -32,6 +32,4 @@ internal class FakeGetContextOfEventTask constructor(private val tokenChunkEvent
) )
return tokenChunkEventPersistor.insertInDb(tokenChunkEvent, params.roomId, PaginationDirection.BACKWARDS) return tokenChunkEventPersistor.insertInDb(tokenChunkEvent, params.roomId, PaginationDirection.BACKWARDS)
} }
}
}

View file

@ -28,6 +28,4 @@ internal class FakePaginationTask @Inject constructor(private val tokenChunkEven
val tokenChunkEvent = FakeTokenChunkEvent(params.from, Random.nextLong(System.currentTimeMillis()).toString(), fakeEvents) val tokenChunkEvent = FakeTokenChunkEvent(params.from, Random.nextLong(System.currentTimeMillis()).toString(), fakeEvents)
return tokenChunkEventPersistor.insertInDb(tokenChunkEvent, params.roomId, params.direction) return tokenChunkEventPersistor.insertInDb(tokenChunkEvent, params.roomId, params.direction)
} }
} }

View file

@ -23,4 +23,4 @@ internal data class FakeTokenChunkEvent(override val start: String?,
override val end: String?, override val end: String?,
override val events: List<Event> = emptyList(), override val events: List<Event> = emptyList(),
override val stateEvents: List<Event> = emptyList() override val stateEvents: List<Event> = emptyList()
) : TokenChunkEvent ) : TokenChunkEvent

View file

@ -88,6 +88,4 @@ object RoomDataHelper {
roomEntity.addOrUpdate(chunkEntity) roomEntity.addOrUpdate(chunkEntity)
} }
} }
}
}

View file

@ -81,6 +81,4 @@ internal class TimelineTest : InstrumentedTest {
// timelineEvents.size shouldEqual initialLoad + paginationCount // timelineEvents.size shouldEqual initialLoad + paginationCount
// timeline.dispose() // timeline.dispose()
// } // }
}
}

View file

@ -51,7 +51,6 @@ class FormattedJsonHttpLogger : HttpLoggingInterceptor.Logger {
// Finally this is not a JSON string... // Finally this is not a JSON string...
Timber.e(e) Timber.e(e)
} }
} else if (message.startsWith("[")) { } else if (message.startsWith("[")) {
// JSON Array detected // JSON Array detected
try { try {
@ -61,7 +60,6 @@ class FormattedJsonHttpLogger : HttpLoggingInterceptor.Logger {
// Finally not JSON... // Finally not JSON...
Timber.e(e) Timber.e(e)
} }
} }
// Else not a json string to log // Else not a json string to log
} }
@ -73,4 +71,4 @@ class FormattedJsonHttpLogger : HttpLoggingInterceptor.Logger {
Timber.v(s) Timber.v(s)
} }
} }
} }

View file

@ -38,7 +38,6 @@ data class MatrixConfiguration(
interface Provider { interface Provider {
fun providesMatrixConfiguration(): MatrixConfiguration fun providesMatrixConfiguration(): MatrixConfiguration
} }
} }
/** /**
@ -98,5 +97,4 @@ class Matrix private constructor(context: Context, matrixConfiguration: MatrixCo
return BuildConfig.VERSION_NAME + " (" + BuildConfig.GIT_SDK_REVISION + ")" return BuildConfig.VERSION_NAME + " (" + BuildConfig.GIT_SDK_REVISION + ")"
} }
} }
} }

View file

@ -27,7 +27,7 @@ interface MatrixCallback<in T> {
* @param data the data successfully returned from the async function * @param data the data successfully returned from the async function
*/ */
fun onSuccess(data: T) { fun onSuccess(data: T) {
//no-op // no-op
} }
/** /**
@ -35,7 +35,6 @@ interface MatrixCallback<in T> {
* @param failure the failure data returned from the async function * @param failure the failure data returned from the async function
*/ */
fun onFailure(failure: Throwable) { fun onFailure(failure: Throwable) {
//no-op // no-op
} }
}
}

View file

@ -16,7 +16,6 @@
package im.vector.matrix.android.api package im.vector.matrix.android.api
/** /**
* This class contains pattern to match the different Matrix ids * This class contains pattern to match the different Matrix ids
*/ */
@ -154,6 +153,5 @@ object MatrixPatterns {
return if (index == -1) { return if (index == -1) {
null null
} else matrixId.substring(index + 1) } else matrixId.substring(index + 1)
} }
} }

View file

@ -68,4 +68,4 @@ interface Authenticator {
* Create a session after a SSO successful login * Create a session after a SSO successful login
*/ */
fun createSessionFromSso(credentials: Credentials, homeServerConnectionConfig: HomeServerConnectionConfig): Session fun createSessionFromSso(credentials: Credentials, homeServerConnectionConfig: HomeServerConnectionConfig): Session
} }

View file

@ -253,13 +253,5 @@ data class HomeServerConnectionConfig(
forceUsageTlsVersions forceUsageTlsVersions
) )
} }
} }
} }

View file

@ -37,4 +37,4 @@ object DatedObjectComparators {
(datedObject2.date - datedObject1.date).toInt() (datedObject2.date - datedObject1.date).toInt()
} }
} }
} }

View file

@ -29,7 +29,6 @@ fun MXDeviceInfo.getFingerprintHumanReadable() = fingerprint()
?.chunked(4) ?.chunked(4)
?.joinToString(separator = " ") ?.joinToString(separator = " ")
fun List<DeviceInfo>.sortByLastSeen() { fun List<DeviceInfo>.sortByLastSeen() {
Collections.sort(this, DatedObjectComparators.descComparator) Collections.sort(this, DatedObjectComparators.descComparator)
} }

View file

@ -19,4 +19,4 @@ package im.vector.matrix.android.api.failure
// This data class will be sent to the bus // This data class will be sent to the bus
data class ConsentNotGivenError( data class ConsentNotGivenError(
val consentUri: String val consentUri: String
) )

View file

@ -42,5 +42,4 @@ sealed class Failure(cause: Throwable? = null) : Throwable(cause = cause) {
data class CryptoError(val error: MXCryptoError) : Failure(error) data class CryptoError(val error: MXCryptoError) : Failure(error)
abstract class FeatureFailure : Failure() abstract class FeatureFailure : Failure()
}
}

View file

@ -33,7 +33,6 @@ data class MatrixError(
@Json(name = "limit_type") val limitType: String? = null, @Json(name = "limit_type") val limitType: String? = null,
@Json(name = "admin_contact") val adminUri: String? = null) { @Json(name = "admin_contact") val adminUri: String? = null) {
companion object { companion object {
const val FORBIDDEN = "M_FORBIDDEN" const val FORBIDDEN = "M_FORBIDDEN"
const val UNKNOWN = "M_UNKNOWN" const val UNKNOWN = "M_UNKNOWN"
@ -64,4 +63,4 @@ data class MatrixError(
// Possible value for "limit_type" // Possible value for "limit_type"
const val LIMIT_TYPE_MAU = "monthly_active_user" const val LIMIT_TYPE_MAU = "monthly_active_user"
} }
} }

View file

@ -25,4 +25,4 @@ interface ProgressListener {
* @param total * @param total
*/ */
fun onProgress(progress: Int, total: Int) fun onProgress(progress: Int, total: Int)
} }

View file

@ -31,4 +31,4 @@ interface StepProgressListener {
* @param step The current step, containing progress data if available. Else you should consider progress as indeterminate * @param step The current step, containing progress data if available. Else you should consider progress as indeterminate
*/ */
fun onStepProgress(step: Step) fun onStepProgress(step: Step)
} }

View file

@ -51,5 +51,4 @@ object MatrixLinkify {
} }
return hasMatch return hasMatch
} }
}
}

View file

@ -35,6 +35,4 @@ class MatrixPermalinkSpan(private val url: String,
override fun onClick(widget: View) { override fun onClick(widget: View) {
callback?.onUrlClicked(url) callback?.onUrlClicked(url)
} }
}
}

View file

@ -33,5 +33,4 @@ sealed class PermalinkData {
data class GroupLink(val groupId: String) : PermalinkData() data class GroupLink(val groupId: String) : PermalinkData()
data class FallbackLink(val uri: Uri) : PermalinkData() data class FallbackLink(val uri: Uri) : PermalinkData()
} }

View file

@ -51,7 +51,6 @@ object PermalinkFactory {
return if (TextUtils.isEmpty(id)) { return if (TextUtils.isEmpty(id)) {
null null
} else MATRIX_TO_URL_BASE + escape(id) } else MATRIX_TO_URL_BASE + escape(id)
} }
/** /**
@ -78,10 +77,8 @@ object PermalinkFactory {
return if (isSupported) { return if (isSupported) {
url!!.substring(MATRIX_TO_URL_BASE.length) url!!.substring(MATRIX_TO_URL_BASE.length)
} else null } else null
} }
/** /**
* Escape '/' in id, because it is used as a separator * Escape '/' in id, because it is used as a separator
* *

View file

@ -72,5 +72,4 @@ object PermalinkParser {
else -> PermalinkData.FallbackLink(uri) else -> PermalinkData.FallbackLink(uri)
} }
} }
}
}

View file

@ -18,7 +18,6 @@ package im.vector.matrix.android.api.pushrules
import im.vector.matrix.android.api.pushrules.rest.PushRule import im.vector.matrix.android.api.pushrules.rest.PushRule
import timber.log.Timber import timber.log.Timber
sealed class Action { sealed class Action {
object Notify : Action() object Notify : Action()
object DoNotNotify : Action() object DoNotNotify : Action()
@ -26,7 +25,6 @@ sealed class Action {
data class Highlight(val highlight: Boolean) : Action() data class Highlight(val highlight: Boolean) : Action()
} }
private const val ACTION_NOTIFY = "notify" private const val ACTION_NOTIFY = "notify"
private const val ACTION_DONT_NOTIFY = "dont_notify" private const val ACTION_DONT_NOTIFY = "dont_notify"
private const val ACTION_COALESCE = "coalesce" private const val ACTION_COALESCE = "coalesce"
@ -80,7 +78,6 @@ fun PushRule.getActions(): List<Action> {
} }
// When the value is not there, default sound (not specified by the spec) // When the value is not there, default sound (not specified by the spec)
?: Action.Sound(ACTION_OBJECT_VALUE_VALUE_DEFAULT) ?: Action.Sound(ACTION_OBJECT_VALUE_VALUE_DEFAULT)
} }
ACTION_OBJECT_SET_TWEAK_VALUE_HIGHLIGHT -> { ACTION_OBJECT_SET_TWEAK_VALUE_HIGHLIGHT -> {
(actionStrOrObj[ACTION_OBJECT_VALUE_KEY] as? Boolean)?.let { boolValue -> (actionStrOrObj[ACTION_OBJECT_VALUE_KEY] as? Boolean)?.let { boolValue ->
@ -104,7 +101,5 @@ fun PushRule.getActions(): List<Action> {
} }
} }
return result return result
} }

View file

@ -35,9 +35,7 @@ abstract class Condition(val kind: Kind) {
else -> UNRECOGNIZE else -> UNRECOGNIZE
} }
} }
} }
} }
abstract fun isSatisfied(conditionResolver: ConditionResolver): Boolean abstract fun isSatisfied(conditionResolver: ConditionResolver): Boolean
@ -45,4 +43,4 @@ abstract class Condition(val kind: Kind) {
open fun technicalDescription(): String { open fun technicalDescription(): String {
return "Kind: $kind" return "Kind: $kind"
} }
} }

View file

@ -25,4 +25,4 @@ interface ConditionResolver {
fun resolveRoomMemberCountCondition(roomMemberCountCondition: RoomMemberCountCondition): Boolean fun resolveRoomMemberCountCondition(roomMemberCountCondition: RoomMemberCountCondition): Boolean
fun resolveSenderNotificationPermissionCondition(senderNotificationPermissionCondition: SenderNotificationPermissionCondition): Boolean fun resolveSenderNotificationPermissionCondition(senderNotificationPermissionCondition: SenderNotificationPermissionCondition): Boolean
fun resolveContainsDisplayNameCondition(containsDisplayNameCondition: ContainsDisplayNameCondition) : Boolean fun resolveContainsDisplayNameCondition(containsDisplayNameCondition: ContainsDisplayNameCondition) : Boolean
} }

View file

@ -38,7 +38,7 @@ class ContainsDisplayNameCondition : Condition(Kind.contains_display_name) {
EventType.MESSAGE -> { EventType.MESSAGE -> {
event.content.toModel<MessageContent>() event.content.toModel<MessageContent>()
} }
//TODO the spec says: // TODO the spec says:
// Matches any message whose content is unencrypted and contains the user's current display name // Matches any message whose content is unencrypted and contains the user's current display name
// EventType.ENCRYPTED -> { // EventType.ENCRYPTED -> {
// event.root.getClearContent()?.toModel<MessageContent>() // event.root.getClearContent()?.toModel<MessageContent>()
@ -49,7 +49,6 @@ class ContainsDisplayNameCondition : Condition(Kind.contains_display_name) {
return caseInsensitiveFind(displayName, message.body) return caseInsensitiveFind(displayName, message.body)
} }
companion object { companion object {
/** /**
* Returns whether a string contains an occurrence of another, as a standalone word, regardless of case. * Returns whether a string contains an occurrence of another, as a standalone word, regardless of case.
@ -76,4 +75,4 @@ class ContainsDisplayNameCondition : Condition(Kind.contains_display_name) {
return res return res
} }
} }
} }

View file

@ -29,28 +29,25 @@ class EventMatchCondition(val key: String, val pattern: String) : Condition(Kind
return "'$key' Matches '$pattern'" return "'$key' Matches '$pattern'"
} }
fun isSatisfied(event: Event): Boolean { fun isSatisfied(event: Event): Boolean {
//TODO encrypted events? // TODO encrypted events?
val rawJson = MoshiProvider.providesMoshi().adapter(Event::class.java).toJsonValue(event) as? Map<*, *> val rawJson = MoshiProvider.providesMoshi().adapter(Event::class.java).toJsonValue(event) as? Map<*, *>
?: return false ?: return false
val value = extractField(rawJson, key) ?: return false val value = extractField(rawJson, key) ?: return false
//Patterns with no special glob characters should be treated as having asterisks prepended // Patterns with no special glob characters should be treated as having asterisks prepended
// and appended when testing the condition. // and appended when testing the condition.
try { try {
val modPattern = if (hasSpecialGlobChar(pattern)) simpleGlobToRegExp(pattern) else simpleGlobToRegExp("*$pattern*") val modPattern = if (hasSpecialGlobChar(pattern)) simpleGlobToRegExp(pattern) else simpleGlobToRegExp("*$pattern*")
val regex = Regex(modPattern, RegexOption.DOT_MATCHES_ALL) val regex = Regex(modPattern, RegexOption.DOT_MATCHES_ALL)
return regex.containsMatchIn(value) return regex.containsMatchIn(value)
} catch (e: Throwable) { } catch (e: Throwable) {
//e.g PatternSyntaxException // e.g PatternSyntaxException
Timber.e(e, "Failed to evaluate push condition") Timber.e(e, "Failed to evaluate push condition")
return false return false
} }
} }
private fun extractField(jsonObject: Map<*, *>, fieldPath: String): String? { private fun extractField(jsonObject: Map<*, *>, fieldPath: String): String? {
val fieldParts = fieldPath.split(".") val fieldParts = fieldPath.split(".")
if (fieldParts.isEmpty()) return null if (fieldParts.isEmpty()) return null
@ -77,9 +74,9 @@ class EventMatchCondition(val key: String, val pattern: String) : Condition(Kind
return glob.contains("*") || glob.contains("?") return glob.contains("*") || glob.contains("?")
} }
//Very simple glob to regexp converter // Very simple glob to regexp converter
private fun simpleGlobToRegExp(glob: String): String { private fun simpleGlobToRegExp(glob: String): String {
var out = ""//"^" var out = "" // "^"
for (i in 0 until glob.length) { for (i in 0 until glob.length) {
val c = glob[i] val c = glob[i]
when (c) { when (c) {
@ -90,8 +87,8 @@ class EventMatchCondition(val key: String, val pattern: String) : Condition(Kind
else -> out += c else -> out += c
} }
} }
out += ""//'$'.toString() out += "" // '$'.toString()
return out return out
} }
} }
} }

View file

@ -27,10 +27,10 @@ interface PushRuleService {
*/ */
fun fetchPushRules(scope: String = RuleScope.GLOBAL) fun fetchPushRules(scope: String = RuleScope.GLOBAL)
//TODO get push rule set // TODO get push rule set
fun getPushRules(scope: String = RuleScope.GLOBAL): List<PushRule> fun getPushRules(scope: String = RuleScope.GLOBAL): List<PushRule>
//TODO update rule // TODO update rule
fun updatePushRuleEnableStatus(kind: RuleKind, pushRule: PushRule, enabled: Boolean, callback: MatrixCallback<Unit>): Cancelable fun updatePushRuleEnableStatus(kind: RuleKind, pushRule: PushRule, enabled: Boolean, callback: MatrixCallback<Unit>): Cancelable
@ -47,4 +47,4 @@ interface PushRuleService {
fun onEventRedacted(redactedEventId: String) fun onEventRedacted(redactedEventId: String)
fun batchFinish() fun batchFinish()
} }
} }

View file

@ -62,6 +62,5 @@ class RoomMemberCountCondition(val iz: String) : Condition(Kind.room_member_coun
Timber.d(t) Timber.d(t)
} }
return null return null
} }
} }

View file

@ -18,7 +18,6 @@ package im.vector.matrix.android.api.pushrules
import im.vector.matrix.android.api.session.events.model.Event import im.vector.matrix.android.api.session.events.model.Event
import im.vector.matrix.android.api.session.room.model.PowerLevels import im.vector.matrix.android.api.session.room.model.PowerLevels
class SenderNotificationPermissionCondition(val key: String) : Condition(Kind.sender_notification_permission) { class SenderNotificationPermissionCondition(val key: String) : Condition(Kind.sender_notification_permission) {
override fun isSatisfied(conditionResolver: ConditionResolver): Boolean { override fun isSatisfied(conditionResolver: ConditionResolver): Boolean {
@ -29,8 +28,7 @@ class SenderNotificationPermissionCondition(val key: String) : Condition(Kind.se
return "User power level <$key>" return "User power level <$key>"
} }
fun isSatisfied(event: Event, powerLevels: PowerLevels): Boolean { fun isSatisfied(event: Event, powerLevels: PowerLevels): Boolean {
return event.senderId != null && powerLevels.getUserPowerLevel(event.senderId) >= powerLevels.notificationLevel(key) return event.senderId != null && powerLevels.getUserPowerLevel(event.senderId) >= powerLevels.notificationLevel(key)
} }
} }

View file

@ -76,4 +76,4 @@ data class PushCondition(
} }
} }
} }
} }

View file

@ -19,7 +19,6 @@ package im.vector.matrix.android.api.pushrules.rest
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true) @JsonClass(generateAdapter = true)
data class PushRule( data class PushRule(
/** /**
@ -47,4 +46,3 @@ data class PushRule(
*/ */
val pattern: String? = null val pattern: String? = null
) )

View file

@ -24,4 +24,4 @@ data class Ruleset(
val room: List<PushRule>? = null, val room: List<PushRule>? = null,
val sender: List<PushRule>? = null, val sender: List<PushRule>? = null,
val underride: List<PushRule>? = null val underride: List<PushRule>? = null
) )

View file

@ -26,4 +26,4 @@ interface InitialSyncProgressService {
@StringRes val statusText: Int, @StringRes val statusText: Int,
val percentProgress: Int = 0 val percentProgress: Int = 0
) )
} }

View file

@ -68,7 +68,6 @@ interface Session :
val myUserId: String val myUserId: String
get() = sessionParams.credentials.userId get() = sessionParams.credentials.userId
/** /**
* This method allow to open a session. It does start some service on the background. * This method allow to open a session. It does start some service on the background.
*/ */
@ -145,7 +144,5 @@ interface Session :
* A M_CONSENT_NOT_GIVEN error has been received from the homeserver * A M_CONSENT_NOT_GIVEN error has been received from the homeserver
*/ */
fun onConsentNotGivenError(consentNotGivenError: ConsentNotGivenError) fun onConsentNotGivenError(consentNotGivenError: ConsentNotGivenError)
} }
}
}

View file

@ -27,5 +27,4 @@ interface CacheService {
* Clear the whole cached data, except credentials. Once done, the session is closed and has to be opened again * Clear the whole cached data, except credentials. Once done, the session is closed and has to be opened again
*/ */
fun clearCache(callback: MatrixCallback<Unit>) fun clearCache(callback: MatrixCallback<Unit>)
}
}

View file

@ -40,5 +40,4 @@ data class ContentAttachmentData(
AUDIO, AUDIO,
VIDEO VIDEO
} }
}
}

View file

@ -35,4 +35,4 @@ interface ContentUploadStateTracker {
object Success : State() object Success : State()
data class Failure(val throwable: Throwable) : State() data class Failure(val throwable: Throwable) : State()
} }
} }

View file

@ -44,4 +44,4 @@ interface ContentUrlResolver {
* @return the URL to access the described resource, or null if the url is invalid. * @return the URL to access the described resource, or null if the url is invalid.
*/ */
fun resolveThumbnail(contentUrl: String?, width: Int, height: Int, method: ThumbnailMethod): String? fun resolveThumbnail(contentUrl: String?, width: Int, height: Int, method: ThumbnailMethod): String?
} }

View file

@ -112,5 +112,4 @@ interface CryptoService {
fun addNewSessionListener(newSessionListener: NewSessionListener) fun addNewSessionListener(newSessionListener: NewSessionListener)
fun removeSessionListener(listener: NewSessionListener) fun removeSessionListener(listener: NewSessionListener)
}
}

View file

@ -90,4 +90,4 @@ sealed class MXCryptoError : Throwable() {
const val NO_MORE_ALGORITHM_REASON = "Room was previously configured to use encryption, but is no longer." + const val NO_MORE_ALGORITHM_REASON = "Room was previously configured to use encryption, but is no longer." +
" Perhaps the homeserver is hiding the configuration event." " Perhaps the homeserver is hiding the configuration event."
} }
} }

View file

@ -210,5 +210,4 @@ interface KeysBackupService {
val isEnabled: Boolean val isEnabled: Boolean
val isStucked: Boolean val isStucked: Boolean
val state: KeysBackupState val state: KeysBackupState
}
}

View file

@ -72,4 +72,4 @@ enum class KeysBackupState {
WillBackUp, WillBackUp,
// e2e keys are being sent to the homeserver // e2e keys are being sent to the homeserver
BackingUp BackingUp
} }

View file

@ -23,4 +23,4 @@ interface KeysBackupStateListener {
* @param newState the new state * @param newState the new state
*/ */
fun onStateChange(newState: KeysBackupState) fun onStateChange(newState: KeysBackupState)
} }

View file

@ -30,4 +30,4 @@ enum class CancelCode(val value: String, val humanReadable: String) {
fun safeValueOf(code: String?): CancelCode { fun safeValueOf(code: String?): CancelCode {
return CancelCode.values().firstOrNull { code == it.value } ?: CancelCode.User return CancelCode.values().firstOrNull { code == it.value } ?: CancelCode.User
} }

View file

@ -19,4 +19,4 @@ package im.vector.matrix.android.api.session.crypto.sas
import androidx.annotation.StringRes import androidx.annotation.StringRes
data class EmojiRepresentation(val emoji: String, data class EmojiRepresentation(val emoji: String,
@StringRes val nameResId: Int) @StringRes val nameResId: Int)

View file

@ -31,4 +31,4 @@ interface IncomingSasVerificationTransaction {
CANCELLED_BY_ME, CANCELLED_BY_ME,
CANCELLED_BY_OTHER CANCELLED_BY_OTHER
} }
} }

View file

@ -29,4 +29,4 @@ interface OutgoingSasVerificationRequest {
CANCELLED_BY_ME, CANCELLED_BY_ME,
CANCELLED_BY_OTHER CANCELLED_BY_OTHER
} }
} }

View file

@ -19,4 +19,4 @@ package im.vector.matrix.android.api.session.crypto.sas
object SasMode { object SasMode {
const val DECIMAL = "decimal" const val DECIMAL = "decimal"
const val EMOJI = "emoji" const val EMOJI = "emoji"
} }

View file

@ -36,4 +36,4 @@ interface SasVerificationService {
fun transactionUpdated(tx: SasVerificationTransaction) fun transactionUpdated(tx: SasVerificationTransaction)
fun markedAsManuallyVerified(userId: String, deviceId: String) fun markedAsManuallyVerified(userId: String, deviceId: String)
} }
} }

View file

@ -47,4 +47,4 @@ interface SasVerificationTransaction {
* both short codes do match * both short codes do match
*/ */
fun userHasVerifiedShortCode() fun userHasVerifiedShortCode()
} }

View file

@ -43,7 +43,7 @@ enum class SasVerificationTxState {
Verifying, Verifying,
Verified, Verified,
//Global: The verification has been cancelled (by me or other), see cancelReason for details // Global: The verification has been cancelled (by me or other), see cancelReason for details
Cancelled, Cancelled,
OnCancelled OnCancelled
} }

View file

@ -34,9 +34,9 @@ import com.squareup.moshi.JsonClass
*/ */
@JsonClass(generateAdapter = true) @JsonClass(generateAdapter = true)
data class AggregatedAnnotation ( data class AggregatedAnnotation(
override val limited: Boolean? = false, override val limited: Boolean? = false,
override val count: Int? = 0, override val count: Int? = 0,
val chunk: List<RelationChunkInfo>? = null val chunk: List<RelationChunkInfo>? = null
) : UnsignedRelationInfo ) : UnsignedRelationInfo

View file

@ -50,4 +50,4 @@ import com.squareup.moshi.JsonClass
data class AggregatedRelations( data class AggregatedRelations(
@Json(name = "m.annotation") val annotations: AggregatedAnnotation? = null, @Json(name = "m.annotation") val annotations: AggregatedAnnotation? = null,
@Json(name = "m.reference") val references: DefaultUnsignedRelationInfo? = null @Json(name = "m.reference") val references: DefaultUnsignedRelationInfo? = null
) )

View file

@ -23,4 +23,4 @@ data class DefaultUnsignedRelationInfo(
override val count: Int? = 0, override val count: Int? = 0,
val chunk: List<Map<String, Any>>? = null val chunk: List<Map<String, Any>>? = null
) : UnsignedRelationInfo ) : UnsignedRelationInfo

View file

@ -81,7 +81,6 @@ data class Event(
@Json(name = "redacts") val redacts: String? = null @Json(name = "redacts") val redacts: String? = null
) { ) {
@Transient @Transient
var mxDecryptionResult: OlmDecryptionResult? = null var mxDecryptionResult: OlmDecryptionResult? = null
@ -91,7 +90,6 @@ data class Event(
@Transient @Transient
var sendState: SendState = SendState.UNKNOWN var sendState: SendState = SendState.UNKNOWN
/** /**
* Check if event is a state event. * Check if event is a state event.
* @return true if event is state event. * @return true if event is state event.
@ -100,9 +98,9 @@ data class Event(
return EventType.isStateEvent(getClearType()) return EventType.isStateEvent(getClearType())
} }
//============================================================================================================== // ==============================================================================================================
// Crypto // Crypto
//============================================================================================================== // ==============================================================================================================
/** /**
* @return true if this event is encrypted. * @return true if this event is encrypted.
@ -136,6 +134,7 @@ data class Event(
* @return the event content * @return the event content
*/ */
fun getClearContent(): Content? { fun getClearContent(): Content? {
@Suppress("UNCHECKED_CAST")
return mxDecryptionResult?.payload?.get("content") as? Content ?: content return mxDecryptionResult?.payload?.get("content") as? Content ?: content
} }
@ -194,10 +193,8 @@ data class Event(
result = 31 * result + sendState.hashCode() result = 31 * result + sendState.hashCode()
return result return result
} }
} }
fun Event.isTextMessage(): Boolean { fun Event.isTextMessage(): Boolean {
return getClearType() == EventType.MESSAGE return getClearType() == EventType.MESSAGE
&& when (getClearContent()?.toModel<MessageContent>()?.type) { && when (getClearContent()?.toModel<MessageContent>()?.type) {
@ -214,4 +211,4 @@ fun Event.isImageMessage(): Boolean {
MessageType.MSGTYPE_IMAGE -> true MessageType.MSGTYPE_IMAGE -> true
else -> false else -> false
} }
} }

View file

@ -16,7 +16,6 @@
package im.vector.matrix.android.api.session.events.model package im.vector.matrix.android.api.session.events.model
/** /**
* Constants defining known event types from Matrix specifications. * Constants defining known event types from Matrix specifications.
*/ */
@ -93,7 +92,6 @@ object EventType {
STATE_PINNED_EVENT STATE_PINNED_EVENT
) )
fun isStateEvent(type: String): Boolean { fun isStateEvent(type: String): Boolean {
return STATE_EVENTS.contains(type) return STATE_EVENTS.contains(type)
} }

View file

@ -15,7 +15,6 @@
*/ */
package im.vector.matrix.android.api.session.events.model package im.vector.matrix.android.api.session.events.model
/** /**
* Constants defining known event relation types from Matrix specifications * Constants defining known event relation types from Matrix specifications
*/ */
@ -27,5 +26,4 @@ object RelationType {
const val REPLACE = "m.replace" const val REPLACE = "m.replace"
/** Lets you define an event which references an existing event.*/ /** Lets you define an event which references an existing event.*/
const val REFERENCE = "m.reference" const val REFERENCE = "m.reference"
}
}

View file

@ -26,4 +26,4 @@ data class UnsignedData(
@Json(name = "transaction_id") val transactionId: String? = null, @Json(name = "transaction_id") val transactionId: String? = null,
@Json(name = "prev_content") val prevContent: Map<String, Any>? = null, @Json(name = "prev_content") val prevContent: Map<String, Any>? = null,
@Json(name = "m.relations") val relations: AggregatedRelations? = null @Json(name = "m.relations") val relations: AggregatedRelations? = null
) )

View file

@ -15,8 +15,7 @@
*/ */
package im.vector.matrix.android.api.session.events.model package im.vector.matrix.android.api.session.events.model
interface UnsignedRelationInfo { interface UnsignedRelationInfo {
val limited : Boolean? val limited : Boolean?
val count: Int? val count: Int?
} }

View file

@ -20,7 +20,6 @@ import im.vector.matrix.android.api.MatrixCallback
import im.vector.matrix.android.internal.crypto.attachments.ElementToDecrypt import im.vector.matrix.android.internal.crypto.attachments.ElementToDecrypt
import java.io.File import java.io.File
/** /**
* This interface defines methods to get files. * This interface defines methods to get files.
*/ */
@ -49,4 +48,4 @@ interface FileService {
url: String?, url: String?,
elementToDecrypt: ElementToDecrypt?, elementToDecrypt: ElementToDecrypt?,
callback: MatrixCallback<File>) callback: MatrixCallback<File>)
} }

View file

@ -21,4 +21,4 @@ package im.vector.matrix.android.api.session.group
*/ */
interface Group { interface Group {
val groupId: String val groupId: String
} }

View file

@ -19,7 +19,6 @@ package im.vector.matrix.android.api.session.group
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import im.vector.matrix.android.api.session.group.model.GroupSummary import im.vector.matrix.android.api.session.group.model.GroupSummary
/** /**
* This interface defines methods to get groups. It's implemented at the session level. * This interface defines methods to get groups. It's implemented at the session level.
*/ */
@ -37,4 +36,4 @@ interface GroupService {
* @return the [LiveData] of [GroupSummary] * @return the [LiveData] of [GroupSummary]
*/ */
fun liveGroupSummaries(): LiveData<List<GroupSummary>> fun liveGroupSummaries(): LiveData<List<GroupSummary>>
} }

View file

@ -30,4 +30,4 @@ data class GroupSummary(
val avatarUrl: String = "", val avatarUrl: String = "",
val roomIds: List<String> = emptyList(), val roomIds: List<String> = emptyList(),
val userIds: List<String> = emptyList() val userIds: List<String> = emptyList()
) )

View file

@ -25,5 +25,4 @@ interface HomeServerCapabilitiesService {
* Get the HomeServer capabilities * Get the HomeServer capabilities
*/ */
fun getHomeServerCapabilities(): HomeServerCapabilities fun getHomeServerCapabilities(): HomeServerCapabilities
} }

View file

@ -39,4 +39,4 @@ enum class PusherState {
data class PusherData( data class PusherData(
val url: String? = null, val url: String? = null,
val format: String? = null val format: String? = null
) )

View file

@ -19,7 +19,6 @@ import androidx.lifecycle.LiveData
import im.vector.matrix.android.api.MatrixCallback import im.vector.matrix.android.api.MatrixCallback
import java.util.UUID import java.util.UUID
interface PushersService { interface PushersService {
/** /**
@ -53,7 +52,6 @@ interface PushersService {
append: Boolean, append: Boolean,
withEventIdOnly: Boolean): UUID withEventIdOnly: Boolean): UUID
fun removeHttpPusher(pushkey: String, appId: String, callback: MatrixCallback<Unit>) fun removeHttpPusher(pushkey: String, appId: String, callback: MatrixCallback<Unit>)
companion object { companion object {
@ -63,4 +61,4 @@ interface PushersService {
fun livePushers(): LiveData<List<Pusher>> fun livePushers(): LiveData<List<Pusher>>
fun pushers() : List<Pusher> fun pushers() : List<Pusher>
} }

View file

@ -53,5 +53,4 @@ interface Room :
fun getRoomSummaryLive(): LiveData<Optional<RoomSummary>> fun getRoomSummaryLive(): LiveData<Optional<RoomSummary>>
fun roomSummary(): RoomSummary? fun roomSummary(): RoomSummary?
}
}

View file

@ -42,5 +42,4 @@ interface RoomDirectoryService {
* Includes both the available protocols and all fields required for queries against each protocol. * Includes both the available protocols and all fields required for queries against each protocol.
*/ */
fun getThirdPartyProtocol(callback: MatrixCallback<Map<String, ThirdPartyProtocol>>): Cancelable fun getThirdPartyProtocol(callback: MatrixCallback<Map<String, ThirdPartyProtocol>>): Cancelable
}
}

View file

@ -53,5 +53,4 @@ interface RoomService {
* @return the [LiveData] of [RoomSummary] * @return the [LiveData] of [RoomSummary]
*/ */
fun liveRoomSummaries(): LiveData<List<RoomSummary>> fun liveRoomSummaries(): LiveData<List<RoomSummary>>
}
}

View file

@ -23,4 +23,4 @@ interface RoomCryptoService {
fun encryptionAlgorithm(): String? fun encryptionAlgorithm(): String?
fun shouldEncryptForInvitedMembers(): Boolean fun shouldEncryptForInvitedMembers(): Boolean
} }

View file

@ -21,5 +21,4 @@ import im.vector.matrix.android.api.failure.Failure
sealed class CreateRoomFailure : Failure.FeatureFailure() { sealed class CreateRoomFailure : Failure.FeatureFailure() {
object CreatedWithTimeout: CreateRoomFailure() object CreatedWithTimeout: CreateRoomFailure()
}
}

View file

@ -21,5 +21,4 @@ import im.vector.matrix.android.api.failure.Failure
sealed class JoinRoomFailure : Failure.FeatureFailure() { sealed class JoinRoomFailure : Failure.FeatureFailure() {
object JoinedWithTimeout : JoinRoomFailure() object JoinedWithTimeout : JoinRoomFailure()
}
}

View file

@ -64,5 +64,4 @@ interface MembershipService {
* Leave the room, or reject an invitation. * Leave the room, or reject an invitation.
*/ */
fun leave(callback: MatrixCallback<Unit>): Cancelable fun leave(callback: MatrixCallback<Unit>): Cancelable
}
}

View file

@ -19,4 +19,4 @@ data class EventAnnotationsSummary(
var eventId: String, var eventId: String,
var reactionsSummary: List<ReactionAggregatedSummary>, var reactionsSummary: List<ReactionAggregatedSummary>,
var editSummary: EditAggregatedSummary? var editSummary: EditAggregatedSummary?
) )

View file

@ -27,4 +27,4 @@ data class Invite(
@Json(name = "display_name") val displayName: String, @Json(name = "display_name") val displayName: String,
@Json(name = "signed") val signed: Signed @Json(name = "signed") val signed: Signed
) )

View file

@ -43,5 +43,4 @@ enum class Membership(val value: String) {
fun isLeft(): Boolean { fun isLeft(): Boolean {
return this == KNOCK || this == LEAVE || this == BAN return this == KNOCK || this == LEAVE || this == BAN
} }
} }

View file

@ -78,7 +78,6 @@ data class PowerLevels(
return if (!TextUtils.isEmpty(eventTypeString) && !TextUtils.isEmpty(userId)) { return if (!TextUtils.isEmpty(eventTypeString) && !TextUtils.isEmpty(userId)) {
getUserPowerLevel(userId) >= minimumPowerLevelForSendingEventAsMessage(eventTypeString) getUserPowerLevel(userId) >= minimumPowerLevelForSendingEventAsMessage(eventTypeString)
} else false } else false
} }
/** /**
@ -113,7 +112,6 @@ data class PowerLevels(
return events[eventTypeString] ?: stateDefault return events[eventTypeString] ?: stateDefault
} }
/** /**
* Get the notification level for a dedicated key. * Get the notification level for a dedicated key.
* *
@ -134,4 +132,4 @@ data class PowerLevels(
return 50 return 50
} }
} }

View file

@ -23,4 +23,4 @@ data class ReactionAggregatedSummary(
val firstTimestamp: Long, // unix timestamp val firstTimestamp: Long, // unix timestamp
val sourceEvents: List<String>, val sourceEvents: List<String>,
val localEchoEvents: List<String> val localEchoEvents: List<String>
) )

Some files were not shown because too many files have changed in this diff Show more