Fix ktlint issues

This commit is contained in:
Benoit Marty 2024-01-10 19:33:39 +01:00
parent 246c33589a
commit d3830af78b
100 changed files with 66 additions and 158 deletions

View file

@ -58,7 +58,6 @@ import java.io.File
*/ */
@AutoService(CodeGenerator::class) @AutoService(CodeGenerator::class)
class ContributesNodeCodeGenerator : CodeGenerator { class ContributesNodeCodeGenerator : CodeGenerator {
override fun isApplicable(context: AnvilContext): Boolean = true override fun isApplicable(context: AnvilContext): Boolean = true
override fun generateCode(codeGenDir: File, module: ModuleDescriptor, projectFiles: Collection<KtFile>): Collection<GeneratedFile> { override fun generateCode(codeGenDir: File, module: ModuleDescriptor, projectFiles: Collection<KtFile>): Collection<GeneratedFile> {

View file

@ -27,7 +27,6 @@ import io.element.android.x.initializer.CrashInitializer
import io.element.android.x.initializer.TracingInitializer import io.element.android.x.initializer.TracingInitializer
class ElementXApplication : Application(), DaggerComponentOwner { class ElementXApplication : Application(), DaggerComponentOwner {
override val daggerComponent: AppComponent = DaggerAppComponent.factory().create(this) override val daggerComponent: AppComponent = DaggerAppComponent.factory().create(this)
override fun onCreate() { override fun onCreate() {

View file

@ -51,7 +51,6 @@ import timber.log.Timber
private val loggerTag = LoggerTag("MainActivity") private val loggerTag = LoggerTag("MainActivity")
class MainActivity : NodeActivity() { class MainActivity : NodeActivity() {
private lateinit var mainNode: MainNode private lateinit var mainNode: MainNode
private lateinit var appBindings: AppBindings private lateinit var appBindings: AppBindings

View file

@ -48,7 +48,6 @@ class MainNode(
plugins = plugins, plugins = plugins,
), ),
DaggerComponentOwner { DaggerComponentOwner {
override val daggerComponent = (context as DaggerComponentOwner).daggerComponent override val daggerComponent = (context as DaggerComponentOwner).daggerComponent
override fun resolve(navTarget: RootNavTarget, buildContext: BuildContext): Node { override fun resolve(navTarget: RootNavTarget, buildContext: BuildContext): Node {

View file

@ -27,8 +27,12 @@ import io.element.android.libraries.matrix.api.tracing.TracingService
@ContributesTo(AppScope::class) @ContributesTo(AppScope::class)
interface AppBindings { interface AppBindings {
fun snackbarDispatcher(): SnackbarDispatcher fun snackbarDispatcher(): SnackbarDispatcher
fun tracingService(): TracingService fun tracingService(): TracingService
fun bugReporter(): BugReporter fun bugReporter(): BugReporter
fun lockScreenService(): LockScreenService fun lockScreenService(): LockScreenService
fun preferencesStore(): PreferencesStore fun preferencesStore(): PreferencesStore
} }

View file

@ -28,7 +28,6 @@ import io.element.android.libraries.di.SingleIn
@SingleIn(AppScope::class) @SingleIn(AppScope::class)
@MergeComponent(AppScope::class) @MergeComponent(AppScope::class)
interface AppComponent : NodeFactoriesBindings { interface AppComponent : NodeFactoriesBindings {
@Component.Factory @Component.Factory
interface Factory { interface Factory {
fun create( fun create(

View file

@ -46,7 +46,6 @@ import java.io.File
@Module @Module
@ContributesTo(AppScope::class) @ContributesTo(AppScope::class)
object AppModule { object AppModule {
@Provides @Provides
fun providesBaseDirectory(@ApplicationContext context: Context): File { fun providesBaseDirectory(@ApplicationContext context: Context): File {
return File(context.filesDir, "sessions") return File(context.filesDir, "sessions")
@ -82,14 +81,20 @@ object AppModule {
buildType = buildType, buildType = buildType,
applicationName = context.getString(R.string.app_name), applicationName = context.getString(R.string.app_name),
applicationId = BuildConfig.APPLICATION_ID, applicationId = BuildConfig.APPLICATION_ID,
lowPrivacyLoggingEnabled = false, // TODO EAx Config.LOW_PRIVACY_LOG_ENABLE, // TODO EAx Config.LOW_PRIVACY_LOG_ENABLE,
lowPrivacyLoggingEnabled = false,
versionName = BuildConfig.VERSION_NAME, versionName = BuildConfig.VERSION_NAME,
versionCode = BuildConfig.VERSION_CODE, versionCode = BuildConfig.VERSION_CODE,
gitRevision = "TODO", // BuildConfig.GIT_REVISION, // BuildConfig.GIT_REVISION,
gitRevisionDate = "TODO", // BuildConfig.GIT_REVISION_DATE, gitRevision = "TODO",
gitBranchName = "TODO", // BuildConfig.GIT_BRANCH_NAME, // BuildConfig.GIT_REVISION_DATE,
flavorDescription = "TODO", // BuildConfig.FLAVOR_DESCRIPTION, gitRevisionDate = "TODO",
flavorShortDescription = "TODO", // BuildConfig.SHORT_FLAVOR_DESCRIPTION, // BuildConfig.GIT_BRANCH_NAME,
gitBranchName = "TODO",
// BuildConfig.FLAVOR_DESCRIPTION,
flavorDescription = "TODO",
// BuildConfig.SHORT_FLAVOR_DESCRIPTION,
flavorShortDescription = "TODO",
) )
@Provides @Provides

View file

@ -26,7 +26,6 @@ import javax.inject.Inject
class DefaultRoomComponentFactory @Inject constructor( class DefaultRoomComponentFactory @Inject constructor(
private val roomComponentBuilder: RoomComponent.Builder private val roomComponentBuilder: RoomComponent.Builder
) : RoomComponentFactory { ) : RoomComponentFactory {
override fun create(room: MatrixRoom): Any { override fun create(room: MatrixRoom): Any {
return roomComponentBuilder.room(room).build() return roomComponentBuilder.room(room).build()
} }

View file

@ -26,7 +26,6 @@ import javax.inject.Inject
class DefaultSessionComponentFactory @Inject constructor( class DefaultSessionComponentFactory @Inject constructor(
private val sessionComponentBuilder: SessionComponent.Builder private val sessionComponentBuilder: SessionComponent.Builder
) : SessionComponentFactory { ) : SessionComponentFactory {
override fun create(client: MatrixClient): Any { override fun create(client: MatrixClient): Any {
return sessionComponentBuilder.client(client).build() return sessionComponentBuilder.client(client).build()
} }

View file

@ -29,7 +29,6 @@ import io.element.android.libraries.matrix.api.room.MatrixRoom
@SingleIn(RoomScope::class) @SingleIn(RoomScope::class)
@MergeSubcomponent(RoomScope::class) @MergeSubcomponent(RoomScope::class)
interface RoomComponent : NodeFactoriesBindings { interface RoomComponent : NodeFactoriesBindings {
@Subcomponent.Builder @Subcomponent.Builder
interface Builder { interface Builder {
@BindsInstance @BindsInstance

View file

@ -29,7 +29,6 @@ import io.element.android.libraries.matrix.api.MatrixClient
@SingleIn(SessionScope::class) @SingleIn(SessionScope::class)
@MergeSubcomponent(SessionScope::class) @MergeSubcomponent(SessionScope::class)
interface SessionComponent : NodeFactoriesBindings { interface SessionComponent : NodeFactoriesBindings {
@Subcomponent.Builder @Subcomponent.Builder
interface Builder { interface Builder {
@BindsInstance @BindsInstance

View file

@ -21,7 +21,6 @@ import androidx.startup.Initializer
import io.element.android.features.rageshake.impl.crash.VectorUncaughtExceptionHandler import io.element.android.features.rageshake.impl.crash.VectorUncaughtExceptionHandler
class CrashInitializer : Initializer<Unit> { class CrashInitializer : Initializer<Unit> {
override fun create(context: Context) { override fun create(context: Context) {
VectorUncaughtExceptionHandler(context).activate() VectorUncaughtExceptionHandler(context).activate()
} }

View file

@ -31,7 +31,6 @@ import io.element.android.x.di.AppBindings
import timber.log.Timber import timber.log.Timber
class TracingInitializer : Initializer<Unit> { class TracingInitializer : Initializer<Unit> {
override fun create(context: Context) { override fun create(context: Context) {
val appBindings = context.bindings<AppBindings>() val appBindings = context.bindings<AppBindings>()
val tracingService = appBindings.tracingService() val tracingService = appBindings.tracingService()

View file

@ -31,7 +31,6 @@ import org.robolectric.RuntimeEnvironment
@RunWith(RobolectricTestRunner::class) @RunWith(RobolectricTestRunner::class)
class IntentProviderImplTest { class IntentProviderImplTest {
@Test @Test
fun `test getViewRoomIntent with Session`() { fun `test getViewRoomIntent with Session`() {
val sut = createIntentProviderImpl() val sut = createIntentProviderImpl()

View file

@ -46,7 +46,6 @@ data class LockScreenConfig(
@ContributesTo(AppScope::class) @ContributesTo(AppScope::class)
@Module @Module
object LockScreenConfigModule { object LockScreenConfigModule {
@Provides @Provides
fun providesLockScreenConfig(): LockScreenConfig = LockScreenConfig( fun providesLockScreenConfig(): LockScreenConfig = LockScreenConfig(
isPinMandatory = false, isPinMandatory = false,

View file

@ -17,6 +17,6 @@
package io.element.android.appconfig package io.element.android.appconfig
object MatrixConfiguration { object MatrixConfiguration {
const val matrixToPermalinkBaseUrl: String = "https://matrix.to/#/" const val MATRIX_TO_PERMALINK_BASE_URL: String = "https://matrix.to/#/"
val clientPermalinkBaseUrl: String? = null val clientPermalinkBaseUrl: String? = null
} }

View file

@ -18,8 +18,8 @@ package io.element.android.appconfig
object NotificationConfig { object NotificationConfig {
// TODO EAx Implement and set to true at some point // TODO EAx Implement and set to true at some point
const val supportMarkAsReadAction = false const val SUPPORT_MARK_AS_READ_ACTION = false
// TODO EAx Implement and set to true at some point // TODO EAx Implement and set to true at some point
const val supportQuickReplyAction = false const val SUPPORT_QUICK_REPLY_ACTION = false
} }

View file

@ -20,5 +20,5 @@ object PushConfig {
/** /**
* Note: pusher_app_id cannot exceed 64 chars. * Note: pusher_app_id cannot exceed 64 chars.
*/ */
const val pusher_app_id: String = "im.vector.app.android" const val PUSHER_APP_ID: String = "im.vector.app.android"
} }

View file

@ -17,8 +17,8 @@
package io.element.android.appconfig package io.element.android.appconfig
object RoomListConfig { object RoomListConfig {
const val showInviteMenuItem = false const val SHOW_INVITE_MENU_ITEM = false
const val showReportProblemMenuItem = false const val SHOW_REPORT_PROBLEM_MENU_ITEM = false
const val hasDropdownMenu = showInviteMenuItem || showReportProblemMenuItem const val HAS_DROP_DOWN_MENU = SHOW_INVITE_MENU_ITEM || SHOW_REPORT_PROBLEM_MENU_ITEM
} }

View file

@ -17,5 +17,5 @@
package io.element.android.appconfig package io.element.android.appconfig
object SecureBackupConfig { object SecureBackupConfig {
const val LearnMoreUrl: String = "https://element.io/help#encryption5" const val LEARN_MORE_URL: String = "https://element.io/help#encryption5"
} }

View file

@ -17,5 +17,5 @@
package io.element.android.appconfig package io.element.android.appconfig
object TimelineConfig { object TimelineConfig {
const val maxReadReceiptToDisplay = 3 const val MAX_READ_RECEIPT_TO_DISPLAY = 3
} }

View file

@ -36,7 +36,6 @@ class LoggedInEventProcessor @Inject constructor(
roomMembershipObserver: RoomMembershipObserver, roomMembershipObserver: RoomMembershipObserver,
sessionVerificationService: SessionVerificationService, sessionVerificationService: SessionVerificationService,
) { ) {
private var observingJob: Job? = null private var observingJob: Job? = null
private val displayLeftRoomMessage = roomMembershipObserver.updates private val displayLeftRoomMessage = roomMembershipObserver.updates

View file

@ -111,7 +111,6 @@ class LoggedInFlowNode @AssistedInject constructor(
buildContext = buildContext, buildContext = buildContext,
plugins = plugins plugins = plugins
) { ) {
interface Callback : Plugin { interface Callback : Plugin {
fun onOpenBugReport() fun onOpenBugReport()
} }

View file

@ -81,7 +81,6 @@ class RootFlowNode @AssistedInject constructor(
buildContext = buildContext, buildContext = buildContext,
plugins = plugins plugins = plugins
) { ) {
override fun onBuilt() { override fun onBuilt() {
matrixClientsHolder.restoreWithSavedState(buildContext.savedStateMap) matrixClientsHolder.restoreWithSavedState(buildContext.savedStateMap)
super.onBuilt() super.onBuilt()

View file

@ -37,7 +37,6 @@ private const val SAVE_INSTANCE_KEY = "io.element.android.x.di.MatrixClientsHold
@SingleIn(AppScope::class) @SingleIn(AppScope::class)
@ContributesBinding(AppScope::class) @ContributesBinding(AppScope::class)
class MatrixClientsHolder @Inject constructor(private val authenticationService: MatrixAuthenticationService) : MatrixClientProvider { class MatrixClientsHolder @Inject constructor(private val authenticationService: MatrixAuthenticationService) : MatrixClientProvider {
private val sessionIdsToMatrixClient = ConcurrentHashMap<SessionId, MatrixClient>() private val sessionIdsToMatrixClient = ConcurrentHashMap<SessionId, MatrixClient>()
private val restoreMutex = Mutex() private val restoreMutex = Mutex()

View file

@ -1,21 +0,0 @@
/*
* 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.
*/
package io.element.android.appnav.loggedin
// sealed interface LoggedInEvents {
// data object MyEvent : LoggedInEvents
// }

View file

@ -35,7 +35,6 @@ class LoggedInNode @AssistedInject constructor(
buildContext = buildContext, buildContext = buildContext,
plugins = plugins plugins = plugins
) { ) {
@Composable @Composable
override fun View(modifier: Modifier) { override fun View(modifier: Modifier) {
val loggedInState = loggedInPresenter.present() val loggedInState = loggedInPresenter.present()

View file

@ -35,7 +35,6 @@ class LoggedInPresenter @Inject constructor(
private val networkMonitor: NetworkMonitor, private val networkMonitor: NetworkMonitor,
private val pushService: PushService, private val pushService: PushService,
) : Presenter<LoggedInState> { ) : Presenter<LoggedInState> {
@Composable @Composable
override fun present(): LoggedInState { override fun present(): LoggedInState {
LaunchedEffect(Unit) { LaunchedEffect(Unit) {

View file

@ -47,7 +47,6 @@ open class LoadingRoomStateProvider : PreviewParameterProvider<LoadingRoomState>
@SingleIn(SessionScope::class) @SingleIn(SessionScope::class)
class LoadingRoomStateFlowFactory @Inject constructor(private val matrixClient: MatrixClient) { class LoadingRoomStateFlowFactory @Inject constructor(private val matrixClient: MatrixClient) {
fun create(lifecycleScope: CoroutineScope, roomId: RoomId): StateFlow<LoadingRoomState> = fun create(lifecycleScope: CoroutineScope, roomId: RoomId): StateFlow<LoadingRoomState> =
getRoomFlow(roomId) getRoomFlow(roomId)
.map { room -> .map { room ->

View file

@ -66,7 +66,6 @@ class RoomFlowNode @AssistedInject constructor(
buildContext = buildContext, buildContext = buildContext,
plugins = plugins plugins = plugins
) { ) {
data class Inputs( data class Inputs(
val roomId: RoomId, val roomId: RoomId,
val initialElement: RoomLoadedFlowNode.NavTarget = RoomLoadedFlowNode.NavTarget.Messages, val initialElement: RoomLoadedFlowNode.NavTarget = RoomLoadedFlowNode.NavTarget.Messages,

View file

@ -71,7 +71,6 @@ class RoomLoadedFlowNode @AssistedInject constructor(
buildContext = buildContext, buildContext = buildContext,
plugins = plugins, plugins = plugins,
), DaggerComponentOwner { ), DaggerComponentOwner {
interface Callback : Plugin { interface Callback : Plugin {
fun onOpenRoom(roomId: RoomId) fun onOpenRoom(roomId: RoomId)
fun onForwardedToSingleRoom(roomId: RoomId) fun onForwardedToSingleRoom(roomId: RoomId)

View file

@ -41,7 +41,6 @@ class RootNavStateFlowFactory @Inject constructor(
private val matrixClientsHolder: MatrixClientsHolder, private val matrixClientsHolder: MatrixClientsHolder,
private val loginUserStory: LoginUserStory, private val loginUserStory: LoginUserStory,
) { ) {
private var currentCacheIndex = 0 private var currentCacheIndex = 0
fun create(savedStateMap: SavedStateMap?): Flow<RootNavState> { fun create(savedStateMap: SavedStateMap?): Flow<RootNavState> {

View file

@ -30,7 +30,6 @@ class RootPresenter @Inject constructor(
private val rageshakeDetectionPresenter: RageshakeDetectionPresenter, private val rageshakeDetectionPresenter: RageshakeDetectionPresenter,
private val appErrorStateService: AppErrorStateService, private val appErrorStateService: AppErrorStateService,
) : Presenter<RootState> { ) : Presenter<RootState> {
@Composable @Composable
override fun present(): RootState { override fun present(): RootState {
val rageshakeDetectionState = rageshakeDetectionPresenter.present() val rageshakeDetectionState = rageshakeDetectionPresenter.present()

View file

@ -41,7 +41,6 @@ import org.junit.Rule
import org.junit.Test import org.junit.Test
class RoomFlowNodeTest { class RoomFlowNodeTest {
@get:Rule @get:Rule
val instantTaskExecutorRule = InstantTaskExecutorRule() val instantTaskExecutorRule = InstantTaskExecutorRule()
@ -49,7 +48,6 @@ class RoomFlowNodeTest {
val mainDispatcherRule = MainDispatcherRule() val mainDispatcherRule = MainDispatcherRule()
private class FakeMessagesEntryPoint : MessagesEntryPoint { private class FakeMessagesEntryPoint : MessagesEntryPoint {
var nodeId: String? = null var nodeId: String? = null
var callback: MessagesEntryPoint.Callback? = null var callback: MessagesEntryPoint.Callback? = null
@ -68,12 +66,10 @@ class RoomFlowNodeTest {
} }
private class FakeRoomDetailsEntryPoint : RoomDetailsEntryPoint { private class FakeRoomDetailsEntryPoint : RoomDetailsEntryPoint {
var nodeId: String? = null var nodeId: String? = null
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): RoomDetailsEntryPoint.NodeBuilder { override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): RoomDetailsEntryPoint.NodeBuilder {
return object : RoomDetailsEntryPoint.NodeBuilder { return object : RoomDetailsEntryPoint.NodeBuilder {
override fun params(params: RoomDetailsEntryPoint.Params): RoomDetailsEntryPoint.NodeBuilder { override fun params(params: RoomDetailsEntryPoint.Params): RoomDetailsEntryPoint.NodeBuilder {
return this return this
} }

View file

@ -36,7 +36,6 @@ import org.junit.Rule
import org.junit.Test import org.junit.Test
class LoggedInPresenterTest { class LoggedInPresenterTest {
@get:Rule @get:Rule
val warmUpRule = WarmUpRule() val warmUpRule = WarmUpRule()

View file

@ -28,7 +28,6 @@ import kotlinx.coroutines.test.runTest
import org.junit.Test import org.junit.Test
class LoadingRoomStateFlowFactoryTest { class LoadingRoomStateFlowFactoryTest {
@Test @Test
fun `flow should emit Loading and then Loaded when there is a room in cache`() = runTest { fun `flow should emit Loading and then Loaded when there is a room in cache`() = runTest {
val room = FakeMatrixRoom(sessionId = A_SESSION_ID, roomId = A_ROOM_ID) val room = FakeMatrixRoom(sessionId = A_SESSION_ID, roomId = A_ROOM_ID)

View file

@ -100,8 +100,8 @@ allprojects {
kotlinOptions.allWarningsAsErrors = project.properties["allWarningsAsErrors"] == "true" kotlinOptions.allWarningsAsErrors = project.properties["allWarningsAsErrors"] == "true"
kotlinOptions { kotlinOptions {
// Uncomment to suppress Compose Kotlin compiler compatibility warning
/* /*
// Uncomment to suppress Compose Kotlin compiler compatibility warning
freeCompilerArgs += listOf( freeCompilerArgs += listOf(
"-P", "-P",
"plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true" "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true"
@ -194,7 +194,7 @@ subprojects {
// Workaround for https://github.com/airbnb/Showkase/issues/335 // Workaround for https://github.com/airbnb/Showkase/issues/335
subprojects { subprojects {
tasks.withType<KspTask>() { tasks.withType<KspTask> {
doLast { doLast {
fileTree(layout.buildDirectory).apply { include("**/*ShowkaseExtension*.kt") }.files.forEach { file -> fileTree(layout.buildDirectory).apply { include("**/*ShowkaseExtension*.kt") }.files.forEach { file ->
ReplaceRegExp().apply { ReplaceRegExp().apply {

View file

@ -30,7 +30,6 @@ import io.element.android.features.call.ui.ElementCallActivity
import io.element.android.libraries.designsystem.utils.CommonDrawables import io.element.android.libraries.designsystem.utils.CommonDrawables
class CallForegroundService : Service() { class CallForegroundService : Service() {
companion object { companion object {
fun start(context: Context) { fun start(context: Context) {
val intent = Intent(context, CallForegroundService::class.java) val intent = Intent(context, CallForegroundService::class.java)

View file

@ -28,7 +28,6 @@ data class WidgetMessage(
@SerialName("action") val action: Action, @SerialName("action") val action: Action,
@SerialName("data") val data: JsonElement? = null, @SerialName("data") val data: JsonElement? = null,
) { ) {
@Serializable @Serializable
enum class Direction { enum class Direction {
@SerialName("fromWidget") @SerialName("fromWidget")

View file

@ -63,7 +63,6 @@ class CallScreenPresenter @AssistedInject constructor(
private val matrixClientsProvider: MatrixClientProvider, private val matrixClientsProvider: MatrixClientProvider,
private val appCoroutineScope: CoroutineScope, private val appCoroutineScope: CoroutineScope,
) : Presenter<CallScreenState> { ) : Presenter<CallScreenState> {
@AssistedFactory @AssistedFactory
interface Factory { interface Factory {
fun create(callType: CallType, navigator: CallScreenNavigator): CallScreenPresenter fun create(callType: CallType, navigator: CallScreenNavigator): CallScreenPresenter

View file

@ -20,7 +20,6 @@ import android.net.Uri
import javax.inject.Inject import javax.inject.Inject
class CallIntentDataParser @Inject constructor() { class CallIntentDataParser @Inject constructor() {
private val validHttpSchemes = sequenceOf("https") private val validHttpSchemes = sequenceOf("https")
fun parse(data: String?): String? { fun parse(data: String?): String? {

View file

@ -28,7 +28,6 @@ import kotlinx.coroutines.flow.MutableSharedFlow
class WebViewWidgetMessageInterceptor( class WebViewWidgetMessageInterceptor(
private val webView: WebView, private val webView: WebView,
) : WidgetMessageInterceptor { ) : WidgetMessageInterceptor {
companion object { companion object {
// We call both the WebMessageListener and the JavascriptInterface objects in JS with this // We call both the WebMessageListener and the JavascriptInterface objects in JS with this
// 'listenerName' so they can both receive the data from the WebView when // 'listenerName' so they can both receive the data from the WebView when

View file

@ -20,7 +20,6 @@ import io.element.android.features.call.data.WidgetMessage
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
object WidgetMessageSerializer { object WidgetMessageSerializer {
private val coder = Json { ignoreUnknownKeys = true } private val coder = Json { ignoreUnknownKeys = true }
fun deserialize(message: String): Result<WidgetMessage> { fun deserialize(message: String): Result<WidgetMessage> {

View file

@ -23,7 +23,6 @@ import io.element.android.features.call.ui.mapWebkitPermissions
import org.junit.Test import org.junit.Test
class MapWebkitPermissionsTest { class MapWebkitPermissionsTest {
@Test @Test
fun `given Webkit's RESOURCE_AUDIO_CAPTURE returns Android's RECORD_AUDIO permission`() { fun `given Webkit's RESOURCE_AUDIO_CAPTURE returns Android's RECORD_AUDIO permission`() {
val permission = mapWebkitPermissions(arrayOf(PermissionRequest.RESOURCE_AUDIO_CAPTURE)) val permission = mapWebkitPermissions(arrayOf(PermissionRequest.RESOURCE_AUDIO_CAPTURE))

View file

@ -48,7 +48,6 @@ import org.junit.Rule
import org.junit.Test import org.junit.Test
class CallScreenPresenterTest { class CallScreenPresenterTest {
@get:Rule @get:Rule
val warmUpRule = WarmUpRule() val warmUpRule = WarmUpRule()

View file

@ -24,7 +24,6 @@ import java.net.URLEncoder
@RunWith(RobolectricTestRunner::class) @RunWith(RobolectricTestRunner::class)
class CallIntentDataParserTest { class CallIntentDataParserTest {
private val callIntentDataParser = CallIntentDataParser() private val callIntentDataParser = CallIntentDataParser()
@Test @Test

View file

@ -32,7 +32,6 @@ import kotlinx.coroutines.test.runTest
import org.junit.Test import org.junit.Test
class DefaultCallWidgetProviderTest { class DefaultCallWidgetProviderTest {
@Test @Test
fun `getWidget - fails if the session does not exist`() = runTest { fun `getWidget - fails if the session does not exist`() = runTest {
val provider = createProvider(matrixClientProvider = FakeMatrixClientProvider { Result.failure(Exception("Session not found")) }) val provider = createProvider(matrixClientProvider = FakeMatrixClientProvider { Result.failure(Exception("Session not found")) })

View file

@ -25,7 +25,6 @@ class FakeCallWidgetProvider(
private val widgetDriver: FakeWidgetDriver = FakeWidgetDriver(), private val widgetDriver: FakeWidgetDriver = FakeWidgetDriver(),
private val url: String = "https://call.element.io", private val url: String = "https://call.element.io",
) : CallWidgetProvider { ) : CallWidgetProvider {
var getWidgetCalled = false var getWidgetCalled = false
private set private set

View file

@ -152,7 +152,7 @@ private fun ReadReceiptsAvatars(
contentAlignment = Alignment.CenterEnd, contentAlignment = Alignment.CenterEnd,
) { ) {
receipts receipts
.take(TimelineConfig.maxReadReceiptToDisplay) .take(TimelineConfig.MAX_READ_RECEIPT_TO_DISPLAY)
.reversed() .reversed()
.forEachIndexed { index, readReceiptData -> .forEachIndexed { index, readReceiptData ->
Box( Box(
@ -170,9 +170,9 @@ private fun ReadReceiptsAvatars(
} }
} }
} }
if (receipts.size > TimelineConfig.maxReadReceiptToDisplay) { if (receipts.size > TimelineConfig.MAX_READ_RECEIPT_TO_DISPLAY) {
Text( Text(
text = "+" + (receipts.size - TimelineConfig.maxReadReceiptToDisplay), text = "+" + (receipts.size - TimelineConfig.MAX_READ_RECEIPT_TO_DISPLAY),
style = ElementTheme.typography.fontBodyXsRegular, style = ElementTheme.typography.fontBodyXsRegular,
color = ElementTheme.colors.textSecondary, color = ElementTheme.colors.textSecondary,
) )

View file

@ -229,7 +229,7 @@ private fun DefaultRoomListTopBar(
contentDescription = stringResource(CommonStrings.action_search), contentDescription = stringResource(CommonStrings.action_search),
) )
} }
if (RoomListConfig.hasDropdownMenu) { if (RoomListConfig.HAS_DROP_DOWN_MENU) {
var showMenu by remember { mutableStateOf(false) } var showMenu by remember { mutableStateOf(false) }
IconButton( IconButton(
onClick = { showMenu = !showMenu } onClick = { showMenu = !showMenu }
@ -243,7 +243,7 @@ private fun DefaultRoomListTopBar(
expanded = showMenu, expanded = showMenu,
onDismissRequest = { showMenu = false } onDismissRequest = { showMenu = false }
) { ) {
if (RoomListConfig.showInviteMenuItem) { if (RoomListConfig.SHOW_INVITE_MENU_ITEM) {
DropdownMenuItem( DropdownMenuItem(
onClick = { onClick = {
showMenu = false showMenu = false
@ -259,7 +259,7 @@ private fun DefaultRoomListTopBar(
} }
) )
} }
if (RoomListConfig.showReportProblemMenuItem) { if (RoomListConfig.SHOW_REPORT_PROBLEM_MENU_ITEM) {
DropdownMenuItem( DropdownMenuItem(
onClick = { onClick = {
showMenu = false showMenu = false

View file

@ -69,7 +69,7 @@ class SecureBackupRootNode @AssistedInject constructor(
} }
private fun onLearnMoreClicked(uriHandler: UriHandler) { private fun onLearnMoreClicked(uriHandler: UriHandler) {
uriHandler.openUri(SecureBackupConfig.LearnMoreUrl) uriHandler.openUri(SecureBackupConfig.LEARN_MORE_URL)
} }
@Composable @Composable

View file

@ -31,7 +31,6 @@ import javax.inject.Inject
class AndroidClipboardHelper @Inject constructor( class AndroidClipboardHelper @Inject constructor(
@ApplicationContext private val context: Context, @ApplicationContext private val context: Context,
) : ClipboardHelper { ) : ClipboardHelper {
private val clipboardManager = requireNotNull(context.getSystemService<ClipboardManager>()) private val clipboardManager = requireNotNull(context.getSystemService<ClipboardManager>())
override fun copyPlainText(text: String) { override fun copyPlainText(text: String) {

View file

@ -17,7 +17,6 @@
package io.element.android.libraries.androidutils.clipboard package io.element.android.libraries.androidutils.clipboard
class FakeClipboardHelper : ClipboardHelper { class FakeClipboardHelper : ClipboardHelper {
var clipboardContents: Any? = null var clipboardContents: Any? = null
override fun copyPlainText(text: String) { override fun copyPlainText(text: String) {

View file

@ -26,7 +26,6 @@ internal class DefaultDiffCallback<T>(
private val newList: List<T>, private val newList: List<T>,
private val areItemsTheSame: (oldItem: T?, newItem: T?) -> Boolean, private val areItemsTheSame: (oldItem: T?, newItem: T?) -> Boolean,
) : DiffUtil.Callback() { ) : DiffUtil.Callback() {
override fun getOldListSize(): Int { override fun getOldListSize(): Int {
return oldList.size return oldList.size
} }

View file

@ -40,7 +40,6 @@ interface MutableDiffCache<E> : DiffCache<E> {
* *
*/ */
class MutableListDiffCache<E>(private val mutableList: MutableList<E?> = ArrayList()) : MutableDiffCache<E> { class MutableListDiffCache<E>(private val mutableList: MutableList<E?> = ArrayList()) : MutableDiffCache<E> {
override fun removeAt(index: Int): E? { override fun removeAt(index: Int): E? {
return mutableList.removeAt(index) return mutableList.removeAt(index)
} }

View file

@ -36,7 +36,6 @@ interface DiffCacheInvalidator<T> {
* It invalidates the cache by setting values to null. * It invalidates the cache by setting values to null.
*/ */
class DefaultDiffCacheInvalidator<T> : DiffCacheInvalidator<T> { class DefaultDiffCacheInvalidator<T> : DiffCacheInvalidator<T> {
override fun onChanged(position: Int, count: Int, cache: MutableDiffCache<T>) { override fun onChanged(position: Int, count: Int, cache: MutableDiffCache<T>) {
for (i in position until position + count) { for (i in position until position + count) {
// Invalidate cache // Invalidate cache

View file

@ -36,7 +36,6 @@ class DiffCacheUpdater<ListItem, CachedItem>(
private val cacheInvalidator: DiffCacheInvalidator<CachedItem> = DefaultDiffCacheInvalidator(), private val cacheInvalidator: DiffCacheInvalidator<CachedItem> = DefaultDiffCacheInvalidator(),
private val areItemsTheSame: (oldItem: ListItem?, newItem: ListItem?) -> Boolean, private val areItemsTheSame: (oldItem: ListItem?, newItem: ListItem?) -> Boolean,
) { ) {
private val lock = Object() private val lock = Object()
private var prevOriginalList: List<ListItem> = emptyList() private var prevOriginalList: List<ListItem> = emptyList()

View file

@ -27,7 +27,6 @@ import kotlin.contracts.contract
*/ */
@Stable @Stable
sealed interface AsyncAction<out T> { sealed interface AsyncAction<out T> {
/** /**
* Represents an uninitialized operation (i.e. yet to be run by the user). * Represents an uninitialized operation (i.e. yet to be run by the user).
*/ */

View file

@ -27,7 +27,6 @@ import kotlin.contracts.contract
*/ */
@Stable @Stable
sealed interface AsyncData<out T> { sealed interface AsyncData<out T> {
/** /**
* Represents a failed operation. * Represents a failed operation.
* *

View file

@ -25,7 +25,6 @@ import kotlinx.coroutines.flow.map
class HideOverlayBackPressHandler<NavTarget : Any> : class HideOverlayBackPressHandler<NavTarget : Any> :
BaseBackPressHandlerStrategy<NavTarget, BackStack.State>() { BaseBackPressHandlerStrategy<NavTarget, BackStack.State>() {
override val canHandleBackPressFlow: Flow<Boolean> by lazy { override val canHandleBackPressFlow: Flow<Boolean> by lazy {
navModel.elements.map(::areThereElements) navModel.elements.map(::areThereElements)
} }

View file

@ -40,7 +40,6 @@ class Overlay<NavTarget : Any>(
savedStateMap = savedStateMap, savedStateMap = savedStateMap,
key = key, key = key,
) { ) {
override val initialElements: NavElements<NavTarget, BackStack.State> override val initialElements: NavElements<NavTarget, BackStack.State>
get() = emptyList() get() = emptyList()
} }

View file

@ -24,7 +24,6 @@ import kotlinx.parcelize.Parcelize
@Parcelize @Parcelize
class Hide<T : Any> : OverlayOperation<T> { class Hide<T : Any> : OverlayOperation<T> {
override fun isApplicable(elements: BackStackElements<T>): Boolean = override fun isApplicable(elements: BackStackElements<T>): Boolean =
elements.any { it.targetState == BackStack.State.ACTIVE } elements.any { it.targetState == BackStack.State.ACTIVE }

View file

@ -29,7 +29,6 @@ import kotlinx.parcelize.RawValue
data class Show<T : Any>( data class Show<T : Any>(
private val element: @RawValue T private val element: @RawValue T
) : OverlayOperation<T> { ) : OverlayOperation<T> {
override fun isApplicable(elements: BackStackElements<T>): Boolean = override fun isApplicable(elements: BackStackElements<T>): Boolean =
element != elements.activeElement element != elements.activeElement

View file

@ -84,7 +84,6 @@ class AsyncDataKtTest {
private class TestableMutableState<T>( private class TestableMutableState<T>(
value: T value: T
) : MutableState<T> { ) : MutableState<T> {
@Suppress("ktlint:standard:property-naming") @Suppress("ktlint:standard:property-naming")
private val _deque = ArrayDeque<T>(listOf(value)) private val _deque = ArrayDeque<T>(listOf(value))

View file

@ -21,7 +21,6 @@ package io.element.android.libraries.core.cache
* This class is not thread safe. * This class is not thread safe.
*/ */
class CircularCache<T : Any>(cacheSize: Int, factory: (Int) -> Array<T?>) { class CircularCache<T : Any>(cacheSize: Int, factory: (Int) -> Array<T?>) {
companion object { companion object {
inline fun <reified T : Any> create(cacheSize: Int) = CircularCache(cacheSize) { Array<T?>(cacheSize) { null } } inline fun <reified T : Any> create(cacheSize: Int) = CircularCache(cacheSize) { Array<T?>(cacheSize) { null } }
} }

View file

@ -26,20 +26,6 @@ inline fun <T> T.ooi(block: (T) -> Unit): T = also(block)
*/ */
fun CharSequence?.orEmpty() = this ?: "" fun CharSequence?.orEmpty() = this ?: ""
/**
* Check if a CharSequence is a phone number.
*/
/*
fun CharSequence.isMsisdn(): Boolean {
return try {
PhoneNumberUtil.getInstance().parse(ensurePrefix("+"), null)
true
} catch (e: NumberParseException) {
false
}
}
*/
/** /**
* Useful to append a String at the end of a filename but before the extension if any * Useful to append a String at the end of a filename but before the extension if any
* Ex: * Ex:

View file

@ -23,7 +23,6 @@ package io.element.android.libraries.core.log.logger
* Timber.tag(loggerTag.value).v("My log message") * Timber.tag(loggerTag.value).v("My log message")
*/ */
open class LoggerTag(name: String, parentTag: LoggerTag? = null) { open class LoggerTag(name: String, parentTag: LoggerTag? = null) {
object PushLoggerTag : LoggerTag("Push") object PushLoggerTag : LoggerTag("Push")
object NotificationLoggerTag : LoggerTag("Notification", PushLoggerTag) object NotificationLoggerTag : LoggerTag("Notification", PushLoggerTag)

View file

@ -20,7 +20,6 @@ import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
class BasicExtensionsTest { class BasicExtensionsTest {
@Test(expected = IllegalArgumentException::class) @Test(expected = IllegalArgumentException::class)
fun `test ellipsize at 0`() { fun `test ellipsize at 0`() {
"1234567890".ellipsize(0) "1234567890".ellipsize(0)

View file

@ -20,7 +20,6 @@ import com.google.common.truth.Truth.assertThat
import org.junit.Test import org.junit.Test
class ResultTest { class ResultTest {
@Test @Test
fun testFlatMap() { fun testFlatMap() {
val initial = Result.success("initial") val initial = Result.success("initial")

View file

@ -23,7 +23,6 @@ import io.element.android.libraries.matrix.test.A_THREAD_ID
import org.junit.Test import org.junit.Test
class DeepLinkCreatorTest { class DeepLinkCreatorTest {
@Test @Test
fun room() { fun room() {
val sut = DeepLinkCreator() val sut = DeepLinkCreator()

View file

@ -25,7 +25,6 @@ data class AvatarData(
val url: String? = null, val url: String? = null,
val size: AvatarSize, val size: AvatarSize,
) { ) {
val initial by lazy { val initial by lazy {
(name?.takeIf { it.isNotBlank() } ?: id) (name?.takeIf { it.isNotBlank() } ?: id)
.let { dn -> .let { dn ->

View file

@ -29,7 +29,6 @@ import io.element.android.libraries.designsystem.theme.components.TextButton
*/ */
@Immutable @Immutable
sealed interface ButtonVisuals { sealed interface ButtonVisuals {
val action: () -> Unit val action: () -> Unit
/** /**

View file

@ -29,7 +29,8 @@ import androidx.lifecycle.Lifecycle
* Inspired from https://stackoverflow.com/questions/68847559/how-can-i-detect-keyboard-opening-and-closing-in-jetpack-compose * Inspired from https://stackoverflow.com/questions/68847559/how-can-i-detect-keyboard-opening-and-closing-in-jetpack-compose
*/ */
enum class Keyboard { enum class Keyboard {
Opened, Closed Opened,
Closed
} }
// Note: it does not work as expected... // Note: it does not work as expected...

View file

@ -95,7 +95,6 @@ private fun PreferenceTopAppBar(
overflow = TextOverflow.Ellipsis overflow = TextOverflow.Ellipsis
) )
} }
) )
} }

View file

@ -55,7 +55,7 @@ fun PreferenceTextField(
style: ListItemStyle = ListItemStyle.Default, style: ListItemStyle = ListItemStyle.Default,
) { ) {
var displayTextFieldDialog by rememberSaveable { mutableStateOf(false) } var displayTextFieldDialog by rememberSaveable { mutableStateOf(false) }
val valueToDisplay = if (displayValue(value)) { value } else supportingText val valueToDisplay = if (displayValue(value)) value else supportingText
ListItem( ListItem(
modifier = modifier, modifier = modifier,

View file

@ -259,11 +259,14 @@ sealed interface IconSource {
} }
enum class ButtonSize { enum class ButtonSize {
Medium, Large Medium,
Large
} }
internal enum class ButtonStyle { internal enum class ButtonStyle {
Filled, Outlined, Text; Filled,
Outlined,
Text;
@Composable @Composable
fun getColors(destructive: Boolean): ButtonColors = when (this) { fun getColors(destructive: Boolean): ButtonColors = when (this) {

View file

@ -38,7 +38,8 @@ import io.element.android.libraries.designsystem.preview.PreviewGroup
fun FloatingActionButton( fun FloatingActionButton(
onClick: () -> Unit, onClick: () -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
shape: Shape = CircleShape, // FloatingActionButtonDefaults.shape, // FloatingActionButtonDefaults.shape
shape: Shape = CircleShape,
containerColor: Color = FloatingActionButtonDefaults.containerColor, containerColor: Color = FloatingActionButtonDefaults.containerColor,
contentColor: Color = contentColorFor(containerColor), contentColor: Color = contentColorFor(containerColor),
elevation: FloatingActionButtonElevation = FloatingActionButtonDefaults.elevation(), elevation: FloatingActionButtonElevation = FloatingActionButtonDefaults.elevation(),

View file

@ -378,7 +378,6 @@ internal fun ListItemDisabledWithIconPreview() = PreviewItems.OneLineListItemPre
@Suppress("ModifierMissing") @Suppress("ModifierMissing")
private object PreviewItems { private object PreviewItems {
@Composable @Composable
fun ThreeLinesListItemPreview( fun ThreeLinesListItemPreview(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,

View file

@ -81,7 +81,6 @@ fun ListSupportingText(
} }
object ListSupportingTextDefaults { object ListSupportingTextDefaults {
/** Specifies the padding to use for the supporting text. */ /** Specifies the padding to use for the supporting text. */
@Immutable @Immutable
sealed interface Padding { sealed interface Padding {

View file

@ -151,7 +151,6 @@ fun <T> SearchBar(
} }
object ElementSearchBarDefaults { object ElementSearchBarDefaults {
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
fun inactiveColors() = SearchBarDefaults.colors( fun inactiveColors() = SearchBarDefaults.colors(

View file

@ -37,7 +37,7 @@ fun Slider(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
enabled: Boolean = true, enabled: Boolean = true,
valueRange: ClosedFloatingPointRange<Float> = 0f..1f, valueRange: ClosedFloatingPointRange<Float> = 0f..1f,
/*@IntRange(from = 0)*/ // @IntRange(from = 0)
steps: Int = 0, steps: Int = 0,
onValueChangeFinished: (() -> Unit)? = null, onValueChangeFinished: (() -> Unit)? = null,
colors: SliderColors = SliderDefaults.colors(), colors: SliderColors = SliderDefaults.colors(),

View file

@ -282,11 +282,13 @@ private fun CustomStandardBottomSheet(
if (anchoredDraggableState.anchors.size > 1 && sheetSwipeEnabled) { if (anchoredDraggableState.anchors.size > 1 && sheetSwipeEnabled) {
if (currentValue == SheetValue.PartiallyExpanded) { if (currentValue == SheetValue.PartiallyExpanded) {
expand(expandActionLabel) { expand(expandActionLabel) {
scope.launch { expand() }; true scope.launch { expand() }
true
} }
} else { } else {
collapse(partialExpandActionLabel) { collapse(partialExpandActionLabel) {
scope.launch { partialExpand() }; true scope.launch { partialExpand() }
true
} }
} }
if (!state.skipHiddenState) { if (!state.skipHiddenState) {
@ -314,7 +316,6 @@ private fun CustomStandardBottomSheet(
*/ */
@ExperimentalFoundationApi @ExperimentalFoundationApi
class DraggableAnchorsConfig<T> { class DraggableAnchorsConfig<T> {
internal val anchors = mutableMapOf<T, Float>() internal val anchors = mutableMapOf<T, Float>()
/** /**
@ -344,7 +345,6 @@ internal fun <T : Any> DraggableAnchors(
): DraggableAnchors<T> = MapDraggableAnchors(DraggableAnchorsConfig<T>().apply(builder).anchors) ): DraggableAnchors<T> = MapDraggableAnchors(DraggableAnchorsConfig<T>().apply(builder).anchors)
private class MapDraggableAnchors<T>(private val anchors: Map<T, Float>) : DraggableAnchors<T> { private class MapDraggableAnchors<T>(private val anchors: Map<T, Float>) : DraggableAnchors<T> {
override fun positionOf(value: T): Float = anchors[value] ?: Float.NaN override fun positionOf(value: T): Float = anchors[value] ?: Float.NaN
override fun hasAnchorFor(value: T) = anchors.containsKey(value) override fun hasAnchorFor(value: T) = anchors.containsKey(value)

View file

@ -51,7 +51,6 @@ constructor(
confirmValueChange: (SheetValue) -> Boolean = { true }, confirmValueChange: (SheetValue) -> Boolean = { true },
internal val skipHiddenState: Boolean = false, internal val skipHiddenState: Boolean = false,
) { ) {
/** /**
* State of a sheet composable, such as [ModalBottomSheet] * State of a sheet composable, such as [ModalBottomSheet]
* *

View file

@ -30,7 +30,8 @@ import io.element.android.libraries.designsystem.theme.components.Snackbar
fun SnackbarHost(hostState: SnackbarHostState, modifier: Modifier = Modifier) { fun SnackbarHost(hostState: SnackbarHostState, modifier: Modifier = Modifier) {
androidx.compose.material3.SnackbarHost(hostState, modifier) { data -> androidx.compose.material3.SnackbarHost(hostState, modifier) { data ->
Snackbar( Snackbar(
modifier = Modifier.padding(12.dp), // Add default padding // Add default padding
modifier = Modifier.padding(12.dp),
message = data.visuals.message, message = data.visuals.message,
action = data.visuals.actionLabel?.let { ButtonVisuals.Text(it, data::performAction) }, action = data.visuals.actionLabel?.let { ButtonVisuals.Text(it, data::performAction) },
dismissAction = if (data.visuals.withDismissAction) { dismissAction = if (data.visuals.withDismissAction) {

View file

@ -22,7 +22,6 @@ import io.element.android.compound.theme.avatarColorsLight
import org.junit.Test import org.junit.Test
class AvatarColorsTest { class AvatarColorsTest {
@Test @Test
fun `ensure the size of the avatar color are equal for light and dark theme`() { fun `ensure the size of the avatar color are equal for light and dark theme`() {
assertThat(avatarColorsDark.size).isEqualTo(avatarColorsLight.size) assertThat(avatarColorsDark.size).isEqualTo(avatarColorsLight.size)

View file

@ -22,7 +22,6 @@ import kotlinx.coroutines.test.runTest
import org.junit.Test import org.junit.Test
class SnackbarDispatcherTests { class SnackbarDispatcherTests {
@Test @Test
fun `given an empty queue the flow emits a null item`() = runTest { fun `given an empty queue the flow emits a null item`() = runTest {
val snackbarDispatcher = SnackbarDispatcher() val snackbarDispatcher = SnackbarDispatcher()

View file

@ -33,7 +33,6 @@ class RandomSecretPassphraseProvider(
private val file: File, private val file: File,
private val secretSize: Int = 256, private val secretSize: Int = 256,
) : PassphraseProvider { ) : PassphraseProvider {
override fun getPassphrase(): ByteArray { override fun getPassphrase(): ByteArray {
val encryptedFile = EncryptedFileFactory(context).create(file) val encryptedFile = EncryptedFileFactory(context).create(file)
return if (!file.exists()) { return if (!file.exists()) {

View file

@ -36,7 +36,6 @@ internal class MapApplier(
val style: Style, val style: Style,
val symbolManager: SymbolManager, val symbolManager: SymbolManager,
) : AbstractApplier<MapNode>(MapNodeRoot) { ) : AbstractApplier<MapNode>(MapNodeRoot) {
private val decorations = mutableListOf<MapNode>() private val decorations = mutableListOf<MapNode>()
override fun onClear() { override fun onClear() {

View file

@ -42,7 +42,6 @@ internal class MapPropertiesNode(
cameraPositionState: CameraPositionState, cameraPositionState: CameraPositionState,
locationSettings: MapLocationSettings, locationSettings: MapLocationSettings,
) : MapNode { ) : MapNode {
init { init {
map.locationComponent.activateLocationComponent( map.locationComponent.activateLocationComponent(
LocationComponentActivationOptions.Builder(context, style) LocationComponentActivationOptions.Builder(context, style)

View file

@ -34,7 +34,7 @@ object MatrixToConverter {
*/ */
fun convert(uri: Uri): Uri? { fun convert(uri: Uri): Uri? {
val uriString = uri.toString() val uriString = uri.toString()
val baseUrl = MatrixConfiguration.matrixToPermalinkBaseUrl val baseUrl = MatrixConfiguration.MATRIX_TO_PERMALINK_BASE_URL
return when { return when {
// URL is already a matrix.to // URL is already a matrix.to

View file

@ -26,7 +26,7 @@ object PermalinkBuilder {
private const val ROOM_PATH = "room/" private const val ROOM_PATH = "room/"
private const val USER_PATH = "user/" private const val USER_PATH = "user/"
private val permalinkBaseUrl get() = (MatrixConfiguration.clientPermalinkBaseUrl ?: MatrixConfiguration.matrixToPermalinkBaseUrl).also { private val permalinkBaseUrl get() = (MatrixConfiguration.clientPermalinkBaseUrl ?: MatrixConfiguration.MATRIX_TO_PERMALINK_BASE_URL).also {
var baseUrl = it var baseUrl = it
if (!baseUrl.endsWith("/")) { if (!baseUrl.endsWith("/")) {
baseUrl += "/" baseUrl += "/"
@ -80,7 +80,7 @@ object PermalinkBuilder {
private fun escapeId(value: String) = value.replace("/", "%2F") private fun escapeId(value: String) = value.replace("/", "%2F")
private fun isMatrixTo(): Boolean = permalinkBaseUrl.startsWith(MatrixConfiguration.matrixToPermalinkBaseUrl) private fun isMatrixTo(): Boolean = permalinkBaseUrl.startsWith(MatrixConfiguration.MATRIX_TO_PERMALINK_BASE_URL)
} }
sealed class PermalinkBuilderError : Throwable() { sealed class PermalinkBuilderError : Throwable() {

View file

@ -136,7 +136,13 @@ fun AttachmentThumbnail(
@Parcelize @Parcelize
enum class AttachmentThumbnailType : Parcelable { enum class AttachmentThumbnailType : Parcelable {
Image, Video, File, Audio, Location, Voice, Poll Image,
Video,
File,
Audio,
Location,
Voice,
Poll,
} }
@Parcelize @Parcelize

View file

@ -41,7 +41,6 @@ internal class CoilMediaFetcher(
private val mediaData: MediaRequestData?, private val mediaData: MediaRequestData?,
private val options: Options private val options: Options
) : Fetcher { ) : Fetcher {
override suspend fun fetch(): FetchResult? { override suspend fun fetch(): FetchResult? {
if (mediaData?.source == null) return null if (mediaData?.source == null) return null
return when (mediaData.kind) { return when (mediaData.kind) {
@ -126,9 +125,7 @@ internal class CoilMediaFetcher(
class AvatarFactory( class AvatarFactory(
private val context: Context, private val context: Context,
private val client: MatrixClient private val client: MatrixClient
) : ) : Fetcher.Factory<AvatarData> {
Fetcher.Factory<AvatarData> {
override fun create( override fun create(
data: AvatarData, data: AvatarData,
options: Options, options: Options,

View file

@ -33,7 +33,6 @@ data class MediaRequestData(
val source: MediaSource?, val source: MediaSource?,
val kind: Kind val kind: Kind
) { ) {
sealed interface Kind { sealed interface Kind {
data object Content : Kind data object Content : Kind
data class File(val body: String?, val mimeType: String) : Kind data class File(val body: String?, val mimeType: String) : Kind

View file

@ -26,7 +26,6 @@ import org.robolectric.RobolectricTestRunner
@RunWith(RobolectricTestRunner::class) @RunWith(RobolectricTestRunner::class)
class ToHtmlDocumentTest { class ToHtmlDocumentTest {
@Test @Test
fun `toHtmlDocument - returns null if format is not HTML`() { fun `toHtmlDocument - returns null if format is not HTML`() {
val body = FormattedBody( val body = FormattedBody(

View file

@ -28,7 +28,6 @@ import org.robolectric.RobolectricTestRunner
@RunWith(RobolectricTestRunner::class) @RunWith(RobolectricTestRunner::class)
class ToPlainTextTest { class ToPlainTextTest {
@Test @Test
fun `Document toPlainText - returns a plain text version of the document`() { fun `Document toPlainText - returns a plain text version of the document`() {
val document = Jsoup.parse( val document = Jsoup.parse(

View file

@ -25,7 +25,6 @@ import timber.log.Timber
internal class FormattedJsonHttpLogger( internal class FormattedJsonHttpLogger(
private val level: HttpLoggingInterceptor.Level private val level: HttpLoggingInterceptor.Level
) : HttpLoggingInterceptor.Logger { ) : HttpLoggingInterceptor.Logger {
companion object { companion object {
private const val INDENT_SPACE = 2 private const val INDENT_SPACE = 2
} }

View file

@ -50,7 +50,7 @@ class PushersManager @Inject constructor(
pushGatewayNotifyRequest.execute( pushGatewayNotifyRequest.execute(
PushGatewayNotifyRequest.Params( PushGatewayNotifyRequest.Params(
url = "TODO", // unifiedPushHelper.getPushGateway() ?: return, url = "TODO", // unifiedPushHelper.getPushGateway() ?: return,
appId = PushConfig.pusher_app_id, appId = PushConfig.PUSHER_APP_ID,
pushKey = "TODO", // unifiedPushHelper.getEndpointOrToken().orEmpty(), pushKey = "TODO", // unifiedPushHelper.getEndpointOrToken().orEmpty(),
eventId = TEST_EVENT_ID eventId = TEST_EVENT_ID
) )
@ -85,7 +85,7 @@ class PushersManager @Inject constructor(
): SetHttpPusherData = ): SetHttpPusherData =
SetHttpPusherData( SetHttpPusherData(
pushKey = pushKey, pushKey = pushKey,
appId = PushConfig.pusher_app_id, appId = PushConfig.PUSHER_APP_ID,
profileTag = DEFAULT_PUSHER_FILE_TAG + "_" /* TODO + abs(activeSessionHolder.getActiveSession().myUserId.hashCode())*/, profileTag = DEFAULT_PUSHER_FILE_TAG + "_" /* TODO + abs(activeSessionHolder.getActiveSession().myUserId.hashCode())*/,
lang = "en", // TODO localeProvider.current().language, lang = "en", // TODO localeProvider.current().language,
appDisplayName = buildMeta.applicationName, appDisplayName = buildMeta.applicationName,

View file

@ -38,7 +38,7 @@ class MarkAsReadActionFactory @Inject constructor(
private val clock: SystemClock, private val clock: SystemClock,
) { ) {
fun create(roomInfo: RoomEventGroupInfo): NotificationCompat.Action? { fun create(roomInfo: RoomEventGroupInfo): NotificationCompat.Action? {
if (!NotificationConfig.supportMarkAsReadAction) return null if (!NotificationConfig.SUPPORT_MARK_AS_READ_ACTION) return null
val sessionId = roomInfo.sessionId.value val sessionId = roomInfo.sessionId.value
val roomId = roomInfo.roomId.value val roomId = roomInfo.roomId.value
val intent = Intent(context, NotificationBroadcastReceiver::class.java) val intent = Intent(context, NotificationBroadcastReceiver::class.java)

View file

@ -43,7 +43,7 @@ class QuickReplyActionFactory @Inject constructor(
private val clock: SystemClock, private val clock: SystemClock,
) { ) {
fun create(roomInfo: RoomEventGroupInfo, threadId: ThreadId?): NotificationCompat.Action? { fun create(roomInfo: RoomEventGroupInfo, threadId: ThreadId?): NotificationCompat.Action? {
if (!NotificationConfig.supportQuickReplyAction) return null if (!NotificationConfig.SUPPORT_QUICK_REPLY_ACTION) return null
val sessionId = roomInfo.sessionId val sessionId = roomInfo.sessionId
val roomId = roomInfo.roomId val roomId = roomInfo.roomId
return buildQuickReplyIntent(sessionId, roomId, threadId)?.let { replyPendingIntent -> return buildQuickReplyIntent(sessionId, roomId, threadId)?.let { replyPendingIntent ->