Formats entire project

This commit is contained in:
ericdecanini 2022-04-21 11:50:15 +02:00
parent 7f3e72b9cb
commit de899bbb18
224 changed files with 853 additions and 815 deletions

View File

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

View File

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

View File

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

View File

@ -47,7 +47,7 @@ data class CallNegotiateContent(
*/
@Json(name = "version") override val version: String?
) : CallSignalingContent {
) : CallSignalingContent {
@JsonClass(generateAdapter = true)
data class Description(
/**

View File

@ -24,7 +24,7 @@ import org.matrix.android.sdk.internal.crypto.verification.VerificationInfoReque
@JsonClass(generateAdapter = true)
data class MessageVerificationRequestContent(
@Json(name = MessageContent.MSG_TYPE_JSON_KEY)override val msgType: String = MessageType.MSGTYPE_VERIFICATION_REQUEST,
@Json(name = MessageContent.MSG_TYPE_JSON_KEY) override val msgType: String = MessageType.MSGTYPE_VERIFICATION_REQUEST,
@Json(name = "body") override val body: String,
@Json(name = "from_device") override val fromDevice: String?,
@Json(name = "methods") override val methods: List<String>,

View File

@ -27,7 +27,7 @@ data class MessageVideoContent(
/**
* Required. Must be 'm.video'.
*/
@Json(name = MessageContent.MSG_TYPE_JSON_KEY)override val msgType: String,
@Json(name = MessageContent.MSG_TYPE_JSON_KEY) override val msgType: String,
/**
* Required. A description of the video e.g. 'Gangnam style', or some kind of content description for accessibility e.g. 'video attachment'.

View File

@ -31,7 +31,7 @@ internal open class CryptoRoomEntity(
// a security to ensure that a room will never revert to not encrypted
// even if a new state event with empty encryption, or state is reset somehow
var wasEncryptedOnce: Boolean? = false
) :
) :
RealmObject() {
companion object

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.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
@Index var nextToken: String? = null,
var prevChunk: ChunkEntity? = null,

View File

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

View File

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

View File

@ -15,6 +15,7 @@
*/
package org.matrix.android.sdk.internal.network
import org.matrix.android.sdk.internal.network.executeRequest as internalExecuteRequest
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 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 roomId: String,
private val timelineId: String,

View File

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

View File

@ -52,7 +52,7 @@ internal class DefaultWidgetService @Inject constructor(private val widgetManage
return widgetManager.getWidgetComputedUrl(widget, isLightTheme)
}
override fun getRoomWidgetsLive(
override fun getRoomWidgetsLive(
roomId: String,
widgetId: QueryStringValue,
widgetTypes: Set<String>?,

View File

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

View File

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

View File

@ -34,7 +34,7 @@ data class E2EMessageDetected(
val senderDeviceId: String,
val senderKey: String,
val sessionId: String
) {
) {
companion object {
fun fromEvent(event: Event, roomId: String): E2EMessageDetected {
@ -109,9 +109,9 @@ class UISIDetector : LiveEventListener {
timer.schedule(timeoutTask, timeoutMillis)
}
override fun onLiveEvent(roomId: String, event: Event) { }
override fun onLiveEvent(roomId: String, event: Event) {}
override fun onPaginatedEvent(roomId: String, event: Event) { }
override fun onPaginatedEvent(roomId: String, event: Event) {}
private fun trackerId(eventId: String, roomId: String): String = "$roomId-$eventId"

View File

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

View File

@ -62,5 +62,5 @@ class CallTransferViewModel @AssistedInject constructor(@Assisted initialState:
call?.removeListener(callListener)
}
override fun handle(action: EmptyAction) { }
override fun handle(action: EmptyAction) {}
}

View File

@ -37,7 +37,7 @@ sealed class BootstrapActions : VectorViewModelAction {
data class UpdateCandidatePassphrase(val pass: String) : BootstrapActions()
data class UpdateConfirmCandidatePassphrase(val pass: String) : BootstrapActions()
// data class ReAuth(val pass: String) : BootstrapActions()
// data class ReAuth(val pass: String) : BootstrapActions()
object RecoveryKeySaved : BootstrapActions()
object Completed : BootstrapActions()
object SaveReqQueryStarted : BootstrapActions()

View File

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

View File

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

View File

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

View File

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

View File

@ -23,9 +23,9 @@ import kotlin.reflect.KProperty
* This is a simple hack for having some Session scope dependencies.
* Probably a temporary solution waiting for refactoring the Dagger management of Session.
* You should use it with an extension property :
val Session.myProperty: MyProperty by SessionScopedProperty {
init code
}
val Session.myProperty: MyProperty by SessionScopedProperty {
init code
}
*
*/
class SessionScopedProperty<T : Any>(val initializer: (Session) -> T) {

View File

@ -23,7 +23,7 @@ sealed class DevicesAction : VectorViewModelAction {
object Refresh : DevicesAction()
data class Delete(val deviceId: String) : DevicesAction()
// data class Password(val password: String) : DevicesAction()
// data class Password(val password: String) : DevicesAction()
data class Rename(val deviceId: String, val newName: String) : DevicesAction()
data class PromptRename(val deviceId: String) : DevicesAction()

View File

@ -29,7 +29,7 @@ import org.matrix.android.sdk.api.session.crypto.model.DeviceInfo
sealed class DevicesViewEvents : VectorViewEvents {
data class Loading(val message: CharSequence? = null) : DevicesViewEvents()
// object HideLoading : DevicesViewEvents()
// object HideLoading : DevicesViewEvents()
data class Failure(val throwable: Throwable) : DevicesViewEvents()
// object RequestPassword : DevicesViewEvents()

View File

@ -28,6 +28,7 @@ import im.vector.app.core.extensions.configureWith
import im.vector.app.core.platform.VectorBaseFragment
import im.vector.app.databinding.FragmentGenericRecyclerBinding
import javax.inject.Inject
class OutgoingKeyRequestListFragment @Inject constructor(
private val epoxyController: OutgoingKeyRequestPagedController
) : 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.
* Used when determining the selected state of the PushRulePreference.
*/
val PushRule.notificationIndex: NotificationIndex? get() =
val PushRule.notificationIndex: NotificationIndex?
get() =
NotificationIndex.values().firstOrNull {
// Get the actions for the index
val standardAction = getStandardAction(this.ruleId, it) ?: return@firstOrNull false

View File

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

View File

@ -22,6 +22,6 @@ import org.matrix.android.sdk.api.auth.registration.RegistrationFlowResponse
sealed class ThreePidsSettingsViewEvents : VectorViewEvents {
data class Failure(val throwable: Throwable) : ThreePidsSettingsViewEvents()
// object RequestPassword : ThreePidsSettingsViewEvents()
// object RequestPassword : ThreePidsSettingsViewEvents()
data class RequestReAuth(val registrationFlowResponse: RegistrationFlowResponse, val lastErrorCode: String?) : ThreePidsSettingsViewEvents()
}

View File

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

View File

@ -19,6 +19,6 @@ package im.vector.app.features.spaces.manage
import im.vector.app.core.platform.VectorViewEvents
sealed class SpaceManageRoomViewEvents : VectorViewEvents {
// object BulkActionSuccess: SpaceManageRoomViewEvents()
// object BulkActionSuccess: SpaceManageRoomViewEvents()
data class BulkActionFailure(val errorList: List<Throwable>) : SpaceManageRoomViewEvents()
}

View File

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