Update plugin ktlint to v12.1.0 (#2200)
* Update plugin ktlint to v12.1.0 * Run `./gradlew ktlintFormat` and fix some issues manually. * Fix other issues reproted by Ktlint * Limit false positives, KtLint removes unnecessary curly brace in String templates. * Remove useless Unit * Minor improvements over ktlint changes * Restore `AlertDialogContent` behaviour * Update screenshots --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Benoit Marty <benoit@matrix.org> Co-authored-by: Jorge Martín <jorgem@element.io> Co-authored-by: ElementBot <benoitm+elementbot@element.io>
This commit is contained in:
parent
675cc525cf
commit
7e9cda3aa9
442 changed files with 1091 additions and 1081 deletions
|
|
@ -21,7 +21,7 @@ import io.element.android.services.analyticsproviders.api.trackers.AnalyticsTrac
|
|||
import io.element.android.services.analyticsproviders.api.trackers.ErrorTracker
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface AnalyticsService: AnalyticsTracker, ErrorTracker {
|
||||
interface AnalyticsService : AnalyticsTracker, ErrorTracker {
|
||||
/**
|
||||
* Get the available analytics providers.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ fun Long?.toAnalyticsRoomSize(): JoinedRoom.RoomSize {
|
|||
|
||||
fun MatrixRoom.toAnalyticsJoinedRoom(trigger: JoinedRoom.Trigger?): JoinedRoom {
|
||||
return JoinedRoom(
|
||||
isDM = this.isDirect.orFalse(),
|
||||
isSpace = MatrixPatterns.isSpaceId(this.roomId.value),
|
||||
roomSize = this.joinedMemberCount.toAnalyticsRoomSize(),
|
||||
trigger = trigger
|
||||
isDM = this.isDirect.orFalse(),
|
||||
isSpace = MatrixPatterns.isSpaceId(this.roomId.value),
|
||||
roomSize = this.joinedMemberCount.toAnalyticsRoomSize(),
|
||||
trigger = trigger
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ fun MatrixRoom.toAnalyticsViewRoom(trigger: ViewRoom.Trigger? = null, selectedSp
|
|||
val activeSpace = selectedSpace?.toActiveSpace() ?: ViewRoom.ActiveSpace.Home
|
||||
|
||||
return ViewRoom(
|
||||
isDM = this.isDirect.orFalse(),
|
||||
isSpace = MatrixPatterns.isSpaceId(this.roomId.value),
|
||||
trigger = trigger,
|
||||
activeSpace = activeSpace,
|
||||
viaKeyboard = viaKeyboard
|
||||
isDM = this.isDirect.orFalse(),
|
||||
isSpace = MatrixPatterns.isSpaceId(this.roomId.value),
|
||||
trigger = trigger,
|
||||
activeSpace = activeSpace,
|
||||
viaKeyboard = viaKeyboard
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ import androidx.datastore.preferences.core.booleanPreferencesKey
|
|||
import androidx.datastore.preferences.core.edit
|
||||
import androidx.datastore.preferences.core.stringPreferencesKey
|
||||
import androidx.datastore.preferences.preferencesDataStore
|
||||
import io.element.android.libraries.di.ApplicationContext
|
||||
import io.element.android.libraries.core.bool.orFalse
|
||||
import io.element.android.libraries.di.ApplicationContext
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
|
@ -42,23 +42,23 @@ private val Context.dataStore: DataStore<Preferences> by preferencesDataStore(na
|
|||
* - analytics Id (String).
|
||||
*/
|
||||
class AnalyticsStore @Inject constructor(
|
||||
@ApplicationContext private val context: Context
|
||||
@ApplicationContext private val context: Context
|
||||
) {
|
||||
private val userConsent = booleanPreferencesKey("user_consent")
|
||||
private val didAskUserConsent = booleanPreferencesKey("did_ask_user_consent")
|
||||
private val analyticsId = stringPreferencesKey("analytics_id")
|
||||
|
||||
val userConsentFlow: Flow<Boolean> = context.dataStore.data
|
||||
.map { preferences -> preferences[userConsent].orFalse() }
|
||||
.distinctUntilChanged()
|
||||
.map { preferences -> preferences[userConsent].orFalse() }
|
||||
.distinctUntilChanged()
|
||||
|
||||
val didAskUserConsentFlow: Flow<Boolean> = context.dataStore.data
|
||||
.map { preferences -> preferences[didAskUserConsent].orFalse() }
|
||||
.distinctUntilChanged()
|
||||
.map { preferences -> preferences[didAskUserConsent].orFalse() }
|
||||
.distinctUntilChanged()
|
||||
|
||||
val analyticsIdFlow: Flow<String> = context.dataStore.data
|
||||
.map { preferences -> preferences[analyticsId].orEmpty() }
|
||||
.distinctUntilChanged()
|
||||
.map { preferences -> preferences[analyticsId].orEmpty() }
|
||||
.distinctUntilChanged()
|
||||
|
||||
suspend fun setUserConsent(newUserConsent: Boolean) {
|
||||
context.dataStore.edit { settings ->
|
||||
|
|
|
|||
|
|
@ -30,8 +30,7 @@ import javax.inject.Inject
|
|||
|
||||
@SingleIn(AppScope::class)
|
||||
@ContributesBinding(AppScope::class)
|
||||
class NoopAnalyticsService @Inject constructor(
|
||||
) : AnalyticsService {
|
||||
class NoopAnalyticsService @Inject constructor() : AnalyticsService {
|
||||
override fun getAvailableAnalyticsProviders(): Set<AnalyticsProvider> = emptySet()
|
||||
override fun getUserConsent(): Flow<Boolean> = flowOf(false)
|
||||
override suspend fun setUserConsent(userConsent: Boolean) = Unit
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
|||
class FakeAnalyticsService(
|
||||
isEnabled: Boolean = false,
|
||||
didAskUserConsent: Boolean = false
|
||||
): AnalyticsService {
|
||||
) : AnalyticsService {
|
||||
|
||||
private val isEnabledFlow = MutableStateFlow(isEnabled)
|
||||
private val didAskUserConsentFlow = MutableStateFlow(didAskUserConsent)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package io.element.android.services.analyticsproviders.api
|
|||
import io.element.android.services.analyticsproviders.api.trackers.AnalyticsTracker
|
||||
import io.element.android.services.analyticsproviders.api.trackers.ErrorTracker
|
||||
|
||||
interface AnalyticsProvider: AnalyticsTracker, ErrorTracker {
|
||||
interface AnalyticsProvider : AnalyticsTracker, ErrorTracker {
|
||||
/**
|
||||
* User friendly name.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package io.element.android.services.analyticsproviders.posthog.extensions
|
|||
import im.vector.app.features.analytics.plan.Interaction
|
||||
|
||||
fun Interaction.Name.toAnalyticsInteraction(interactionType: Interaction.InteractionType = Interaction.InteractionType.Touch) =
|
||||
Interaction(
|
||||
name = this,
|
||||
interactionType = interactionType
|
||||
)
|
||||
Interaction(
|
||||
name = this,
|
||||
interactionType = interactionType
|
||||
)
|
||||
|
|
|
|||
|
|
@ -23,5 +23,4 @@ interface AppErrorStateService {
|
|||
val appErrorStateFlow: StateFlow<AppErrorState>
|
||||
|
||||
fun showError(title: String, body: String)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ package io.element.android.services.apperror.impl
|
|||
|
||||
import androidx.compose.runtime.Composable
|
||||
import io.element.android.libraries.designsystem.components.dialogs.ErrorDialog
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.services.apperror.api.AppErrorState
|
||||
import io.element.android.services.apperror.api.aAppErrorState
|
||||
|
||||
|
|
|
|||
|
|
@ -68,5 +68,4 @@ internal class DefaultAppErrorStateServiceTest {
|
|||
assertThat(awaitItem()).isInstanceOf(AppErrorState.NoError::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,4 +40,3 @@ interface AppNavigationStateService {
|
|||
fun onNavigateToThread(owner: String, threadId: ThreadId)
|
||||
fun onLeavingThread(owner: String)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,5 +35,4 @@ object AppNavStateModule {
|
|||
@ApplicationContext context: Context
|
||||
): AppForegroundStateService =
|
||||
AppInitializer.getInstance(context).initializeComponent(AppForegroundStateServiceInitializer::class.java)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,9 @@ interface BuildVersionSdkIntProvider {
|
|||
fun <T> whenAtLeast(version: Int, result: () -> T): T? {
|
||||
return if (get() >= version) {
|
||||
result()
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
@ChecksSdkIntAtLeast(parameter = 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue