Merge pull request #5805 from vector-im/task/eric/format-project

Formats project with new code style
This commit is contained in:
Eric Decanini 2022-04-21 12:43:28 +02:00 committed by GitHub
commit c21ec983e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
225 changed files with 850 additions and 817 deletions

1
changelog.d/5805.misc Normal file
View File

@ -0,0 +1 @@
Autoformats entire project

View File

@ -108,12 +108,14 @@ class FlowRoom(private val room: Room) {
room.getAllThreadSummaries() room.getAllThreadSummaries()
} }
} }
fun liveThreadList(): Flow<List<ThreadRootEvent>> { fun liveThreadList(): Flow<List<ThreadRootEvent>> {
return room.getAllThreadsLive().asFlow() return room.getAllThreadsLive().asFlow()
.startWith(room.coroutineDispatchers.io) { .startWith(room.coroutineDispatchers.io) {
room.getAllThreads() room.getAllThreads()
} }
} }
fun liveLocalUnreadThreadList(): Flow<List<ThreadRootEvent>> { fun liveLocalUnreadThreadList(): Flow<List<ThreadRootEvent>> {
return room.getMarkedThreadNotificationsLive().asFlow() return room.getMarkedThreadNotificationsLive().asFlow()
.startWith(room.coroutineDispatchers.io) { .startWith(room.coroutineDispatchers.io) {

View File

@ -110,11 +110,13 @@ class XSigningTest : InstrumentedTest {
} }
}, it) }, it)
} }
testHelper.doSync<Unit> { bobSession.cryptoService().crossSigningService().initializeCrossSigning(object : UserInteractiveAuthInterceptor { testHelper.doSync<Unit> {
bobSession.cryptoService().crossSigningService().initializeCrossSigning(object : UserInteractiveAuthInterceptor {
override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation<UIABaseAuth>) { override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation<UIABaseAuth>) {
promise.resume(bobAuthParams) promise.resume(bobAuthParams)
} }
}, it) } }, it)
}
// Check that alice can see bob keys // Check that alice can see bob keys
testHelper.doSync<MXUsersDevicesMap<CryptoDeviceInfo>> { aliceSession.cryptoService().downloadKeys(listOf(bobSession.myUserId), true, it) } testHelper.doSync<MXUsersDevicesMap<CryptoDeviceInfo>> { aliceSession.cryptoService().downloadKeys(listOf(bobSession.myUserId), true, it) }
@ -149,16 +151,20 @@ class XSigningTest : InstrumentedTest {
password = TestConstants.PASSWORD password = TestConstants.PASSWORD
) )
testHelper.doSync<Unit> { aliceSession.cryptoService().crossSigningService().initializeCrossSigning(object : UserInteractiveAuthInterceptor { testHelper.doSync<Unit> {
aliceSession.cryptoService().crossSigningService().initializeCrossSigning(object : UserInteractiveAuthInterceptor {
override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation<UIABaseAuth>) { override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation<UIABaseAuth>) {
promise.resume(aliceAuthParams) promise.resume(aliceAuthParams)
} }
}, it) } }, it)
testHelper.doSync<Unit> { bobSession.cryptoService().crossSigningService().initializeCrossSigning(object : UserInteractiveAuthInterceptor { }
testHelper.doSync<Unit> {
bobSession.cryptoService().crossSigningService().initializeCrossSigning(object : UserInteractiveAuthInterceptor {
override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation<UIABaseAuth>) { override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation<UIABaseAuth>) {
promise.resume(bobAuthParams) promise.resume(bobAuthParams)
} }
}, it) } }, it)
}
// Check that alice can see bob keys // Check that alice can see bob keys
val bobUserId = bobSession.myUserId val bobUserId = bobSession.myUserId

View File

@ -43,6 +43,7 @@ interface SyncStatusService {
val rooms: Int, val rooms: Int,
val toDevice: Int val toDevice: Int
) : IncrementalSyncStatus() ) : IncrementalSyncStatus()
object IncrementalSyncError : IncrementalSyncStatus() object IncrementalSyncError : IncrementalSyncStatus()
object IncrementalSyncDone : IncrementalSyncStatus() object IncrementalSyncDone : IncrementalSyncStatus()
} }

View File

@ -24,7 +24,8 @@ import io.realm.annotations.LinkingObjects
import org.matrix.android.sdk.internal.extensions.assertIsManaged import org.matrix.android.sdk.internal.extensions.assertIsManaged
import org.matrix.android.sdk.internal.extensions.clearWith import org.matrix.android.sdk.internal.extensions.clearWith
internal open class ChunkEntity(@Index var prevToken: String? = null, internal open class ChunkEntity(
@Index var prevToken: String? = null,
// Because of gaps we can have several chunks with nextToken == null // Because of gaps we can have several chunks with nextToken == null
@Index var nextToken: String? = null, @Index var nextToken: String? = null,
var prevChunk: ChunkEntity? = null, var prevChunk: ChunkEntity? = null,

View File

@ -48,8 +48,10 @@ internal open class RoomEntity(@PrimaryKey var roomId: String = "",
set(value) { set(value) {
membersLoadStatusStr = value.name membersLoadStatusStr = value.name
} }
companion object companion object
} }
internal fun RoomEntity.removeThreadSummaryIfNeeded(eventId: String) { internal fun RoomEntity.removeThreadSummaryIfNeeded(eventId: String) {
assertIsManaged() assertIsManaged()
threadSummaries.findRootOrLatest(eventId)?.let { threadSummaries.findRootOrLatest(eventId)?.let {

View File

@ -56,18 +56,21 @@ internal fun ChunkEntity.Companion.findLastForwardChunkOfRoom(realm: Realm, room
.equalTo(ChunkEntityFields.IS_LAST_FORWARD, true) .equalTo(ChunkEntityFields.IS_LAST_FORWARD, true)
.findFirst() .findFirst()
} }
internal fun ChunkEntity.Companion.findLastForwardChunkOfThread(realm: Realm, roomId: String, rootThreadEventId: String): ChunkEntity? { internal fun ChunkEntity.Companion.findLastForwardChunkOfThread(realm: Realm, roomId: String, rootThreadEventId: String): ChunkEntity? {
return where(realm, roomId) return where(realm, roomId)
.equalTo(ChunkEntityFields.ROOT_THREAD_EVENT_ID, rootThreadEventId) .equalTo(ChunkEntityFields.ROOT_THREAD_EVENT_ID, rootThreadEventId)
.equalTo(ChunkEntityFields.IS_LAST_FORWARD_THREAD, true) .equalTo(ChunkEntityFields.IS_LAST_FORWARD_THREAD, true)
.findFirst() .findFirst()
} }
internal fun ChunkEntity.Companion.findEventInThreadChunk(realm: Realm, roomId: String, event: String): ChunkEntity? { internal fun ChunkEntity.Companion.findEventInThreadChunk(realm: Realm, roomId: String, event: String): ChunkEntity? {
return where(realm, roomId) return where(realm, roomId)
.`in`(ChunkEntityFields.TIMELINE_EVENTS.EVENT_ID, arrayListOf(event).toTypedArray()) .`in`(ChunkEntityFields.TIMELINE_EVENTS.EVENT_ID, arrayListOf(event).toTypedArray())
.equalTo(ChunkEntityFields.IS_LAST_FORWARD_THREAD, true) .equalTo(ChunkEntityFields.IS_LAST_FORWARD_THREAD, true)
.findFirst() .findFirst()
} }
internal fun ChunkEntity.Companion.findAllIncludingEvents(realm: Realm, eventIds: List<String>): RealmResults<ChunkEntity> { internal fun ChunkEntity.Companion.findAllIncludingEvents(realm: Realm, eventIds: List<String>): RealmResults<ChunkEntity> {
return realm.where<ChunkEntity>() return realm.where<ChunkEntity>()
.`in`(ChunkEntityFields.TIMELINE_EVENTS.EVENT_ID, eventIds.toTypedArray()) .`in`(ChunkEntityFields.TIMELINE_EVENTS.EVENT_ID, eventIds.toTypedArray())

View File

@ -39,9 +39,11 @@ internal fun ThreadSummaryEntity.Companion.getOrCreate(realm: Realm, roomId: Str
this.rootThreadEventId = rootThreadEventId this.rootThreadEventId = rootThreadEventId
} }
} }
internal fun ThreadSummaryEntity.Companion.getOrNull(realm: Realm, roomId: String, rootThreadEventId: String): ThreadSummaryEntity? { internal fun ThreadSummaryEntity.Companion.getOrNull(realm: Realm, roomId: String, rootThreadEventId: String): ThreadSummaryEntity? {
return where(realm, roomId, rootThreadEventId).findFirst() return where(realm, roomId, rootThreadEventId).findFirst()
} }
internal fun RealmList<ThreadSummaryEntity>.find(rootThreadEventId: String): ThreadSummaryEntity? { internal fun RealmList<ThreadSummaryEntity>.find(rootThreadEventId: String): ThreadSummaryEntity? {
return this.where() return this.where()
.equalTo(ThreadSummaryEntityFields.ROOT_THREAD_EVENT_ID, rootThreadEventId) .equalTo(ThreadSummaryEntityFields.ROOT_THREAD_EVENT_ID, rootThreadEventId)

View File

@ -15,6 +15,7 @@
*/ */
package org.matrix.android.sdk.internal.network package org.matrix.android.sdk.internal.network
import org.matrix.android.sdk.internal.network.executeRequest as internalExecuteRequest import org.matrix.android.sdk.internal.network.executeRequest as internalExecuteRequest
internal interface RequestExecutor { internal interface RequestExecutor {

View File

@ -49,7 +49,8 @@ import java.util.concurrent.atomic.AtomicBoolean
* It does mainly listen to the db timeline events. * It does mainly listen to the db timeline events.
* It also triggers pagination to the server when needed, or dispatch to the prev or next chunk if any. * It also triggers pagination to the server when needed, or dispatch to the prev or next chunk if any.
*/ */
internal class TimelineChunk(private val chunkEntity: ChunkEntity, internal class TimelineChunk(
private val chunkEntity: ChunkEntity,
private val timelineSettings: TimelineSettings, private val timelineSettings: TimelineSettings,
private val roomId: String, private val roomId: String,
private val timelineId: String, private val timelineId: String,

View File

@ -39,6 +39,7 @@ internal enum class SyncPresence(val value: String) {
PresenceEnum.UNAVAILABLE -> Unavailable PresenceEnum.UNAVAILABLE -> Unavailable
} }
} }
fun from(s: String?): SyncPresence? = values().find { it.value == s } fun from(s: String?): SyncPresence? = values().find { it.value == s }
} }
} }

View File

@ -75,6 +75,7 @@ class MessageMenuRobot(
clickOn(R.string.reply_in_thread) clickOn(R.string.reply_in_thread)
autoClosed = true autoClosed = true
} }
fun viewInRoom() { fun viewInRoom() {
clickOn(R.string.view_in_room) clickOn(R.string.view_in_room)
autoClosed = true autoClosed = true

View File

@ -32,6 +32,7 @@ abstract class SasEmojiItem : VectorEpoxyModel<SasEmojiItem.Holder>() {
@EpoxyAttribute @EpoxyAttribute
var index: Int = 0 var index: Int = 0
@EpoxyAttribute @EpoxyAttribute
lateinit var emojiRepresentation: EmojiRepresentation lateinit var emojiRepresentation: EmojiRepresentation

View File

@ -27,6 +27,7 @@ sealed class VectorCallViewEvents : VectorViewEvents {
val available: Set<CallAudioManager.Device>, val available: Set<CallAudioManager.Device>,
val current: CallAudioManager.Device val current: CallAudioManager.Device
) : VectorCallViewEvents() ) : VectorCallViewEvents()
object ShowDialPad : VectorCallViewEvents() object ShowDialPad : VectorCallViewEvents()
object ShowCallTransferScreen : VectorCallViewEvents() object ShowCallTransferScreen : VectorCallViewEvents()
object FailToTransfer : VectorCallViewEvents() object FailToTransfer : VectorCallViewEvents()

View File

@ -35,7 +35,8 @@ internal class API23AudioDeviceDetector(private val audioManager: AudioManager,
AudioDeviceInfo.TYPE_BLUETOOTH_SCO -> devices.add(CallAudioManager.Device.WirelessHeadset(info.productName.toString())) AudioDeviceInfo.TYPE_BLUETOOTH_SCO -> devices.add(CallAudioManager.Device.WirelessHeadset(info.productName.toString()))
AudioDeviceInfo.TYPE_BUILTIN_EARPIECE -> devices.add(CallAudioManager.Device.Phone) AudioDeviceInfo.TYPE_BUILTIN_EARPIECE -> devices.add(CallAudioManager.Device.Phone)
AudioDeviceInfo.TYPE_BUILTIN_SPEAKER -> devices.add(CallAudioManager.Device.Speaker) AudioDeviceInfo.TYPE_BUILTIN_SPEAKER -> devices.add(CallAudioManager.Device.Speaker)
AudioDeviceInfo.TYPE_WIRED_HEADPHONES, AudioDeviceInfo.TYPE_WIRED_HEADSET, TYPE_USB_HEADSET -> devices.add(CallAudioManager.Device.Headset) AudioDeviceInfo.TYPE_WIRED_HEADPHONES,
AudioDeviceInfo.TYPE_WIRED_HEADSET, TYPE_USB_HEADSET -> devices.add(CallAudioManager.Device.Headset)
} }
} }
callAudioManager.replaceDevices(devices) callAudioManager.replaceDevices(devices)

View File

@ -132,6 +132,7 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec
mediaData: ImageContentRenderer.Data, mediaData: ImageContentRenderer.Data,
view: View, view: View,
inMemory: List<AttachmentData>) inMemory: List<AttachmentData>)
fun onVideoMessageClicked(messageVideoContent: MessageVideoContent, mediaData: VideoContentRenderer.Data, view: View) fun onVideoMessageClicked(messageVideoContent: MessageVideoContent, mediaData: VideoContentRenderer.Data, view: View)
// fun onFileMessageClicked(eventId: String, messageFileContent: MessageFileContent) // fun onFileMessageClicked(eventId: String, messageFileContent: MessageFileContent)

View File

@ -127,9 +127,11 @@ abstract class MessageAudioItem : AbsMessageItem<MessageAudioItem.Holder>() {
(duration * (progress.toFloat() / 100)).toInt() (duration * (progress.toFloat() / 100)).toInt()
) )
} }
override fun onStartTrackingTouch(seekBar: SeekBar) { override fun onStartTrackingTouch(seekBar: SeekBar) {
isUserSeeking = true isUserSeeking = true
} }
override fun onStopTrackingTouch(seekBar: SeekBar) { override fun onStopTrackingTouch(seekBar: SeekBar) {
isUserSeeking = false isUserSeeking = false
val percentage = seekBar.progress.toFloat() / 100 val percentage = seekBar.progress.toFloat() / 100

View File

@ -122,6 +122,7 @@ class ThreadListFragment @Inject constructor(
bugReporter.openBugReportScreen(requireActivity(), reportType = ReportType.THREADS_BETA_FEEDBACK) bugReporter.openBugReportScreen(requireActivity(), reportType = ReportType.THREADS_BETA_FEEDBACK)
} }
} }
override fun invalidate() = withState(threadListViewModel) { state -> override fun invalidate() = withState(threadListViewModel) { state ->
invalidateOptionsMenu() invalidateOptionsMenu()
renderEmptyStateIfNeeded(state) renderEmptyStateIfNeeded(state)

View File

@ -20,8 +20,8 @@ import android.os.Parcelable
import kotlinx.parcelize.Parcelize import kotlinx.parcelize.Parcelize
import org.matrix.android.sdk.api.auth.data.SsoIdentityProvider import org.matrix.android.sdk.api.auth.data.SsoIdentityProvider
sealed class LoginMode : Parcelable sealed class LoginMode : Parcelable { // Parcelable because persist state
/** because persist state */ {
@Parcelize object Unknown : LoginMode() @Parcelize object Unknown : LoginMode()
@Parcelize object Password : LoginMode() @Parcelize object Password : LoginMode()
@Parcelize data class Sso(val ssoIdentityProviders: List<SsoIdentityProvider>?) : LoginMode() @Parcelize data class Sso(val ssoIdentityProviders: List<SsoIdentityProvider>?) : LoginMode()

View File

@ -28,6 +28,7 @@ import im.vector.app.core.extensions.configureWith
import im.vector.app.core.platform.VectorBaseFragment import im.vector.app.core.platform.VectorBaseFragment
import im.vector.app.databinding.FragmentGenericRecyclerBinding import im.vector.app.databinding.FragmentGenericRecyclerBinding
import javax.inject.Inject import javax.inject.Inject
class OutgoingKeyRequestListFragment @Inject constructor( class OutgoingKeyRequestListFragment @Inject constructor(
private val epoxyController: OutgoingKeyRequestPagedController private val epoxyController: OutgoingKeyRequestPagedController
) : VectorBaseFragment<FragmentGenericRecyclerBinding>() { ) : VectorBaseFragment<FragmentGenericRecyclerBinding>() {

View File

@ -29,7 +29,8 @@ enum class NotificationIndex {
* Given a push rule determine the NotificationIndex by comparing it to the static push rule definitions. * Given a push rule determine the NotificationIndex by comparing it to the static push rule definitions.
* Used when determining the selected state of the PushRulePreference. * Used when determining the selected state of the PushRulePreference.
*/ */
val PushRule.notificationIndex: NotificationIndex? get() = val PushRule.notificationIndex: NotificationIndex?
get() =
NotificationIndex.values().firstOrNull { NotificationIndex.values().firstOrNull {
// Get the actions for the index // Get the actions for the index
val standardAction = getStandardAction(this.ruleId, it) ?: return@firstOrNull false val standardAction = getStandardAction(this.ruleId, it) ?: return@firstOrNull false

View File

@ -75,6 +75,7 @@ class ThreePidsSettingsFragment @Inject constructor(
reAuthActivityResultLauncher.launch(intent) reAuthActivityResultLauncher.launch(intent)
} }
} }
private val reAuthActivityResultLauncher = registerStartForActivityResult { activityResult -> private val reAuthActivityResultLauncher = registerStartForActivityResult { activityResult ->
if (activityResult.resultCode == Activity.RESULT_OK) { if (activityResult.resultCode == Activity.RESULT_OK) {
when (activityResult.data?.extras?.getString(ReAuthActivity.RESULT_FLOW_TYPE)) { when (activityResult.data?.extras?.getString(ReAuthActivity.RESULT_FLOW_TYPE)) {

View File

@ -33,9 +33,9 @@ data class CreateSpaceState(
val aliasManuallyModified: Boolean = false, val aliasManuallyModified: Boolean = false,
val aliasVerificationTask: Async<Boolean> = Uninitialized, val aliasVerificationTask: Async<Boolean> = Uninitialized,
val nameInlineError: String? = null, val nameInlineError: String? = null,
val defaultRooms: Map<Int /** position in form */, String?>? = null, val defaultRooms: Map<Int, String?>? = null, // Int: position in form
val default3pidInvite: Map<Int /** position in form */, String?>? = null, val default3pidInvite: Map<Int, String?>? = null, // Int: position in form
val emailValidationResult: Map<Int /** position in form */, Boolean>? = null, val emailValidationResult: Map<Int, Boolean>? = null, // Int: position in form
val creationResult: Async<String> = Uninitialized, val creationResult: Async<String> = Uninitialized,
val canInviteByMail: Boolean = false val canInviteByMail: Boolean = false
) : MavericksState { ) : MavericksState {

View File

@ -24,6 +24,7 @@ enum class ManageType {
Settings, Settings,
ManageRooms ManageRooms
} }
data class SpaceManageViewState( data class SpaceManageViewState(
val spaceId: String = "", val spaceId: String = "",
val manageType: ManageType val manageType: ManageType