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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

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