Enable detekt rules TopLevelPropertyNaming and cleanup the code.
This commit is contained in:
parent
2bd1c75937
commit
8f715cbc92
5 changed files with 16 additions and 17 deletions
|
|
@ -42,8 +42,8 @@ import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
private const val backPaginationEventLimit = 20
|
private const val BACK_PAGINATION_EVENT_LIMIT = 20
|
||||||
private const val backPaginationPageSize = 50
|
private const val BACK_PAGINATION_PAGE_SIZE = 50
|
||||||
|
|
||||||
class TimelinePresenter @Inject constructor(
|
class TimelinePresenter @Inject constructor(
|
||||||
private val timelineItemsFactory: TimelineItemsFactory,
|
private val timelineItemsFactory: TimelineItemsFactory,
|
||||||
|
|
@ -164,6 +164,6 @@ class TimelinePresenter @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun CoroutineScope.paginateBackwards() = launch {
|
private fun CoroutineScope.paginateBackwards() = launch {
|
||||||
timeline.paginateBackwards(backPaginationEventLimit, backPaginationPageSize)
|
timeline.paginateBackwards(BACK_PAGINATION_EVENT_LIMIT, BACK_PAGINATION_PAGE_SIZE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ import org.jsoup.nodes.Element
|
||||||
import org.jsoup.nodes.Node
|
import org.jsoup.nodes.Node
|
||||||
import org.jsoup.nodes.TextNode
|
import org.jsoup.nodes.TextNode
|
||||||
|
|
||||||
private const val chipId = "chip"
|
private const val CHIP_ID = "chip"
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun HtmlDocument(
|
fun HtmlDocument(
|
||||||
|
|
@ -544,13 +544,13 @@ private fun AnnotatedString.Builder.appendLink(link: Element) {
|
||||||
pop()
|
pop()
|
||||||
}
|
}
|
||||||
is PermalinkData.RoomEmailInviteLink -> {
|
is PermalinkData.RoomEmailInviteLink -> {
|
||||||
appendInlineContent(chipId, link.ownText())
|
appendInlineContent(CHIP_ID, link.ownText())
|
||||||
}
|
}
|
||||||
is PermalinkData.RoomLink -> {
|
is PermalinkData.RoomLink -> {
|
||||||
appendInlineContent(chipId, link.ownText())
|
appendInlineContent(CHIP_ID, link.ownText())
|
||||||
}
|
}
|
||||||
is PermalinkData.UserLink -> {
|
is PermalinkData.UserLink -> {
|
||||||
appendInlineContent(chipId, link.ownText())
|
appendInlineContent(CHIP_ID, link.ownText())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,17 +19,17 @@ package io.element.android.features.preferences.impl.about
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import io.element.android.libraries.ui.strings.CommonStrings
|
import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
|
|
||||||
private const val CopyrightUrl = "https://element.io/copyright"
|
private const val COPYRIGHT_URL = "https://element.io/copyright"
|
||||||
private const val UsePolicyUrl = "https://element.io/acceptable-use-policy-terms"
|
private const val USE_POLICY_URL = "https://element.io/acceptable-use-policy-terms"
|
||||||
private const val PrivacyUrl = "https://element.io/privacy"
|
private const val PRIVACY_URL = "https://element.io/privacy"
|
||||||
|
|
||||||
sealed class ElementLegal(
|
sealed class ElementLegal(
|
||||||
@StringRes val titleRes: Int,
|
@StringRes val titleRes: Int,
|
||||||
val url: String,
|
val url: String,
|
||||||
) {
|
) {
|
||||||
object Copyright : ElementLegal(CommonStrings.common_copyright, CopyrightUrl)
|
object Copyright : ElementLegal(CommonStrings.common_copyright, COPYRIGHT_URL)
|
||||||
object AcceptableUsePolicy : ElementLegal(CommonStrings.common_acceptable_use_policy, UsePolicyUrl)
|
object AcceptableUsePolicy : ElementLegal(CommonStrings.common_acceptable_use_policy, USE_POLICY_URL)
|
||||||
object PrivacyPolicy : ElementLegal(CommonStrings.common_privacy_policy, PrivacyUrl)
|
object PrivacyPolicy : ElementLegal(CommonStrings.common_privacy_policy, PRIVACY_URL)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getAllLegals(): List<ElementLegal> {
|
fun getAllLegals(): List<ElementLegal> {
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
private const val extendedRangeSize = 40
|
private const val EXTENDED_RANGE_SIZE = 40
|
||||||
|
|
||||||
class RoomListPresenter @Inject constructor(
|
class RoomListPresenter @Inject constructor(
|
||||||
private val client: MatrixClient,
|
private val client: MatrixClient,
|
||||||
|
|
@ -130,7 +130,7 @@ class RoomListPresenter @Inject constructor(
|
||||||
|
|
||||||
private fun updateVisibleRange(range: IntRange) {
|
private fun updateVisibleRange(range: IntRange) {
|
||||||
if (range.isEmpty()) return
|
if (range.isEmpty()) return
|
||||||
val midExtendedRangeSize = extendedRangeSize / 2
|
val midExtendedRangeSize = EXTENDED_RANGE_SIZE / 2
|
||||||
val extendedRangeStart = (range.first - midExtendedRangeSize).coerceAtLeast(0)
|
val extendedRangeStart = (range.first - midExtendedRangeSize).coerceAtLeast(0)
|
||||||
// Safe to give bigger size than room list
|
// Safe to give bigger size than room list
|
||||||
val extendedRangeEnd = range.last + midExtendedRangeSize
|
val extendedRangeEnd = range.last + midExtendedRangeSize
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,7 @@ naming:
|
||||||
VariableNaming:
|
VariableNaming:
|
||||||
active: true
|
active: true
|
||||||
TopLevelPropertyNaming:
|
TopLevelPropertyNaming:
|
||||||
# TODO Enable it
|
active: true
|
||||||
active: false
|
|
||||||
FunctionNaming:
|
FunctionNaming:
|
||||||
active: true
|
active: true
|
||||||
ignoreAnnotated: ['Composable']
|
ignoreAnnotated: ['Composable']
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue