Sync: makes SyncResponse in public API

This commit is contained in:
ganfra 2021-08-23 16:46:13 +02:00
parent fce50adca6
commit ebe1e28689
34 changed files with 70 additions and 64 deletions

View file

@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.sync.model
package org.matrix.android.sdk.api.session.sync.model
import com.squareup.moshi.JsonClass
@ -21,7 +22,7 @@ import com.squareup.moshi.JsonClass
* This class describes the device list response from a sync request
*/
@JsonClass(generateAdapter = true)
internal data class DeviceListResponse(
data class DeviceListResponse(
// user ids list which have new crypto devices
val changed: List<String> = emptyList(),
// List of user ids who are no more tracked.

View file

@ -14,12 +14,12 @@
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.sync.model
package org.matrix.android.sdk.api.session.sync.model
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
internal data class DeviceOneTimeKeysCountSyncResponse(
data class DeviceOneTimeKeysCountSyncResponse(
@Json(name = "signed_curve25519") val signedCurve25519: Int? = null
)

View file

@ -14,13 +14,13 @@
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.sync.model
package org.matrix.android.sdk.api.session.sync.model
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
internal data class GroupSyncProfile(
data class GroupSyncProfile(
/**
* The name of the group, if any. May be nil.
*/

View file

@ -14,13 +14,13 @@
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.sync.model
package org.matrix.android.sdk.api.session.sync.model
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
internal data class GroupsSyncResponse(
data class GroupsSyncResponse(
/**
* Joined groups: An array of groups ids.
*/

View file

@ -14,13 +14,13 @@
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.sync.model
package org.matrix.android.sdk.api.session.sync.model
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
internal data class InvitedGroupSync(
data class InvitedGroupSync(
/**
* The identifier of the inviter.
*/

View file

@ -13,14 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.sync.model
package org.matrix.android.sdk.api.session.sync.model
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
// InvitedRoomSync represents a room invitation during server sync v2.
@JsonClass(generateAdapter = true)
internal data class InvitedRoomSync(
data class InvitedRoomSync(
/**
* The state of a room that the user has been invited to. These state events may only have the 'sender', 'type', 'state_key'

View file

@ -1,11 +1,11 @@
/*
* Copyright (c) 2021 The Matrix.org Foundation C.I.C.
* Copyright 2020 The Matrix.org Foundation C.I.C.
*
* 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
* 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,
@ -14,12 +14,12 @@
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.sync.model
package org.matrix.android.sdk.api.session.sync.model
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = false)
internal sealed class LazyRoomSyncEphemeral {
sealed class LazyRoomSyncEphemeral {
data class Parsed(val _roomSyncEphemeral: RoomSyncEphemeral) : LazyRoomSyncEphemeral()
object Stored : LazyRoomSyncEphemeral()
}

View file

@ -14,14 +14,14 @@
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.sync.model
package org.matrix.android.sdk.api.session.sync.model
import com.squareup.moshi.JsonClass
import org.matrix.android.sdk.api.session.events.model.Event
// PresenceSyncResponse represents the updates to the presence status of other users during server sync v2.
@JsonClass(generateAdapter = true)
internal data class PresenceSyncResponse(
data class PresenceSyncResponse(
/**
* List of presence events (array of Event with type m.presence).

View file

@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.sync.model
package org.matrix.android.sdk.api.session.sync.model
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@ -21,7 +22,7 @@ import org.matrix.android.sdk.api.session.events.model.Event
// RoomInviteState represents the state of a room that the user has been invited to.
@JsonClass(generateAdapter = true)
internal data class RoomInviteState(
data class RoomInviteState(
/**
* List of state events (array of MXEvent).

View file

@ -13,14 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.sync.model
package org.matrix.android.sdk.api.session.sync.model
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
// RoomSync represents the response for a room during server sync v2.
@JsonClass(generateAdapter = true)
internal data class RoomSync(
data class RoomSync(
/**
* The state updates for the room.
*/

View file

@ -14,14 +14,14 @@
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.sync.model
package org.matrix.android.sdk.api.session.sync.model
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import org.matrix.android.sdk.api.session.events.model.Event
@JsonClass(generateAdapter = true)
internal data class RoomSyncAccountData(
data class RoomSyncAccountData(
/**
* List of account data events (array of Event).
*/

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.sync.model
package org.matrix.android.sdk.api.session.sync.model
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@ -22,7 +22,7 @@ import org.matrix.android.sdk.api.session.events.model.Event
// RoomSyncEphemeral represents the ephemeral events in the room that aren't recorded in the timeline or state of the room (e.g. typing).
@JsonClass(generateAdapter = true)
internal data class RoomSyncEphemeral(
data class RoomSyncEphemeral(
/**
* List of ephemeral events (array of Event).
*/

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.sync.model
package org.matrix.android.sdk.api.session.sync.model
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@ -22,7 +22,7 @@ import org.matrix.android.sdk.api.session.events.model.Event
// RoomSyncState represents the state updates for a room during server sync v2.
@JsonClass(generateAdapter = true)
internal data class RoomSyncState(
data class RoomSyncState(
/**
* List of state events (array of Event). The resulting state corresponds to the *start* of the timeline.

View file

@ -14,13 +14,13 @@
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.sync.model
package org.matrix.android.sdk.api.session.sync.model
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
internal data class RoomSyncSummary(
data class RoomSyncSummary(
/**
* Present only if the room has no m.room.name or m.room.canonical_alias.

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.sync.model
package org.matrix.android.sdk.api.session.sync.model
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@ -22,7 +22,7 @@ import org.matrix.android.sdk.api.session.events.model.Event
// RoomSyncTimeline represents the timeline of messages and state changes for a room during server sync v2.
@JsonClass(generateAdapter = true)
internal data class RoomSyncTimeline(
data class RoomSyncTimeline(
/**
* List of events (array of Event).

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.sync.model
package org.matrix.android.sdk.api.session.sync.model
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@ -24,7 +24,7 @@ import org.matrix.android.sdk.api.session.events.model.Event
* `MXRoomSyncUnreadNotifications` represents the unread counts for a room.
*/
@JsonClass(generateAdapter = true)
internal data class RoomSyncUnreadNotifications(
data class RoomSyncUnreadNotifications(
/**
* List of account data events (array of Event).
*/

View file

@ -13,14 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.sync.model
package org.matrix.android.sdk.api.session.sync.model
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
// RoomsSyncResponse represents the rooms list in server sync v2 response.
@JsonClass(generateAdapter = true)
internal data class RoomsSyncResponse(
data class RoomsSyncResponse(
/**
* Joined rooms: keys are rooms ids.
*/

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.sync.model
package org.matrix.android.sdk.api.session.sync.model
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@ -22,7 +22,7 @@ import org.matrix.android.sdk.internal.session.sync.model.accountdata.UserAccoun
// SyncResponse represents the request response for server sync v2.
@JsonClass(generateAdapter = true)
internal data class SyncResponse(
data class SyncResponse(
/**
* The user private data.
*/

View file

@ -14,14 +14,14 @@
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.sync.model
package org.matrix.android.sdk.api.session.sync.model
import com.squareup.moshi.JsonClass
import org.matrix.android.sdk.api.session.events.model.Event
// ToDeviceSyncResponse represents the data directly sent to one of user's devices.
@JsonClass(generateAdapter = true)
internal data class ToDeviceSyncResponse(
data class ToDeviceSyncResponse(
/**
* List of direct-to-device events.

View file

@ -87,7 +87,7 @@ import org.matrix.android.sdk.internal.di.UserId
import org.matrix.android.sdk.internal.extensions.foldToCallback
import org.matrix.android.sdk.internal.session.SessionScope
import org.matrix.android.sdk.internal.session.room.membership.LoadRoomMembersTask
import org.matrix.android.sdk.internal.session.sync.model.SyncResponse
import org.matrix.android.sdk.api.session.sync.model.SyncResponse
import org.matrix.android.sdk.internal.task.TaskExecutor
import org.matrix.android.sdk.internal.task.TaskThread
import org.matrix.android.sdk.internal.task.configureWith

View file

@ -19,7 +19,7 @@ package org.matrix.android.sdk.internal.session.notification
import org.matrix.android.sdk.api.pushrules.rest.PushRule
import org.matrix.android.sdk.api.session.events.model.EventType
import org.matrix.android.sdk.internal.di.UserId
import org.matrix.android.sdk.internal.session.sync.model.RoomsSyncResponse
import org.matrix.android.sdk.api.session.sync.model.RoomsSyncResponse
import org.matrix.android.sdk.internal.task.Task
import timber.log.Timber
import javax.inject.Inject

View file

@ -61,8 +61,8 @@ import org.matrix.android.sdk.internal.session.room.accountdata.RoomAccountDataD
import org.matrix.android.sdk.internal.session.room.membership.RoomDisplayNameResolver
import org.matrix.android.sdk.internal.session.room.membership.RoomMemberHelper
import org.matrix.android.sdk.internal.session.room.relationship.RoomChildRelationInfo
import org.matrix.android.sdk.internal.session.sync.model.RoomSyncSummary
import org.matrix.android.sdk.internal.session.sync.model.RoomSyncUnreadNotifications
import org.matrix.android.sdk.api.session.sync.model.RoomSyncSummary
import org.matrix.android.sdk.api.session.sync.model.RoomSyncUnreadNotifications
import timber.log.Timber
import javax.inject.Inject
import kotlin.system.measureTimeMillis

View file

@ -27,8 +27,8 @@ import org.matrix.android.sdk.internal.crypto.algorithms.olm.OlmDecryptionResult
import org.matrix.android.sdk.internal.crypto.model.event.OlmEventContent
import org.matrix.android.sdk.internal.crypto.verification.DefaultVerificationService
import org.matrix.android.sdk.internal.session.initsync.ProgressReporter
import org.matrix.android.sdk.internal.session.sync.model.SyncResponse
import org.matrix.android.sdk.internal.session.sync.model.ToDeviceSyncResponse
import org.matrix.android.sdk.api.session.sync.model.SyncResponse
import org.matrix.android.sdk.api.session.sync.model.ToDeviceSyncResponse
import timber.log.Timber
import javax.inject.Inject

View file

@ -25,8 +25,8 @@ import org.matrix.android.sdk.internal.database.query.getOrCreate
import org.matrix.android.sdk.internal.database.query.where
import org.matrix.android.sdk.internal.session.initsync.ProgressReporter
import org.matrix.android.sdk.internal.session.initsync.mapWithProgress
import org.matrix.android.sdk.internal.session.sync.model.GroupsSyncResponse
import org.matrix.android.sdk.internal.session.sync.model.InvitedGroupSync
import org.matrix.android.sdk.api.session.sync.model.GroupsSyncResponse
import org.matrix.android.sdk.api.session.sync.model.InvitedGroupSync
import javax.inject.Inject
internal class GroupSyncHandler @Inject constructor() {

View file

@ -21,7 +21,7 @@ import com.squareup.moshi.Moshi
import okio.buffer
import okio.source
import org.matrix.android.sdk.internal.di.SessionFilesDirectory
import org.matrix.android.sdk.internal.session.sync.model.RoomSyncEphemeral
import org.matrix.android.sdk.api.session.sync.model.RoomSyncEphemeral
import org.matrix.android.sdk.internal.util.md5
import timber.log.Timber
import java.io.File

View file

@ -58,10 +58,10 @@ import org.matrix.android.sdk.internal.session.room.summary.RoomSummaryUpdater
import org.matrix.android.sdk.internal.session.room.timeline.PaginationDirection
import org.matrix.android.sdk.internal.session.room.timeline.TimelineInput
import org.matrix.android.sdk.internal.session.room.typing.TypingEventContent
import org.matrix.android.sdk.internal.session.sync.model.InvitedRoomSync
import org.matrix.android.sdk.internal.session.sync.model.LazyRoomSyncEphemeral
import org.matrix.android.sdk.internal.session.sync.model.RoomSync
import org.matrix.android.sdk.internal.session.sync.model.RoomsSyncResponse
import org.matrix.android.sdk.api.session.sync.model.InvitedRoomSync
import org.matrix.android.sdk.api.session.sync.model.LazyRoomSyncEphemeral
import org.matrix.android.sdk.api.session.sync.model.RoomSync
import org.matrix.android.sdk.api.session.sync.model.RoomsSyncResponse
import org.matrix.android.sdk.internal.session.sync.parsing.RoomSyncAccountDataHandler
import org.matrix.android.sdk.internal.util.computeBestChunkSize
import timber.log.Timber

View file

@ -19,7 +19,7 @@ package org.matrix.android.sdk.internal.session.sync
import okhttp3.ResponseBody
import org.matrix.android.sdk.internal.network.NetworkConstants
import org.matrix.android.sdk.internal.network.TimeOutInterceptor
import org.matrix.android.sdk.internal.session.sync.model.SyncResponse
import org.matrix.android.sdk.api.session.sync.model.SyncResponse
import retrofit2.Call
import retrofit2.http.GET
import retrofit2.http.Header

View file

@ -30,9 +30,9 @@ import org.matrix.android.sdk.internal.session.group.GetGroupDataWorker
import org.matrix.android.sdk.internal.session.initsync.ProgressReporter
import org.matrix.android.sdk.internal.session.initsync.reportSubtask
import org.matrix.android.sdk.internal.session.notification.ProcessEventForPushTask
import org.matrix.android.sdk.internal.session.sync.model.GroupsSyncResponse
import org.matrix.android.sdk.internal.session.sync.model.RoomsSyncResponse
import org.matrix.android.sdk.internal.session.sync.model.SyncResponse
import org.matrix.android.sdk.api.session.sync.model.GroupsSyncResponse
import org.matrix.android.sdk.api.session.sync.model.RoomsSyncResponse
import org.matrix.android.sdk.api.session.sync.model.SyncResponse
import org.matrix.android.sdk.internal.util.awaitTransaction
import org.matrix.android.sdk.internal.worker.WorkerParamsFactory
import timber.log.Timber

View file

@ -28,7 +28,8 @@ import org.matrix.android.sdk.internal.session.filter.FilterRepository
import org.matrix.android.sdk.internal.session.homeserver.GetHomeServerCapabilitiesTask
import org.matrix.android.sdk.internal.session.initsync.DefaultInitialSyncProgressService
import org.matrix.android.sdk.internal.session.initsync.reportSubtask
import org.matrix.android.sdk.internal.session.sync.model.LazyRoomSyncEphemeral
import org.matrix.android.sdk.api.session.sync.model.LazyRoomSyncEphemeral
import org.matrix.android.sdk.api.session.sync.model.SyncResponse
import org.matrix.android.sdk.internal.session.sync.parsing.InitialSyncResponseParser
import org.matrix.android.sdk.internal.session.user.UserStore
import org.matrix.android.sdk.internal.task.Task

View file

@ -48,7 +48,7 @@ import org.matrix.android.sdk.internal.di.UserId
import org.matrix.android.sdk.internal.session.room.RoomAvatarResolver
import org.matrix.android.sdk.internal.session.room.membership.RoomDisplayNameResolver
import org.matrix.android.sdk.internal.session.room.membership.RoomMemberHelper
import org.matrix.android.sdk.internal.session.sync.model.InvitedRoomSync
import org.matrix.android.sdk.api.session.sync.model.InvitedRoomSync
import org.matrix.android.sdk.internal.session.sync.model.accountdata.BreadcrumbsContent
import org.matrix.android.sdk.internal.session.sync.model.accountdata.DirectMessagesContent
import org.matrix.android.sdk.internal.session.sync.model.accountdata.IgnoredUsersContent

View file

@ -21,6 +21,6 @@ import com.squareup.moshi.JsonClass
import org.matrix.android.sdk.api.session.accountdata.UserAccountDataEvent
@JsonClass(generateAdapter = true)
internal data class UserAccountDataSync(
data class UserAccountDataSync(
@Json(name = "events") val list: List<UserAccountDataEvent> = emptyList()
)

View file

@ -23,8 +23,8 @@ import com.squareup.moshi.JsonWriter
import com.squareup.moshi.ToJson
import org.matrix.android.sdk.internal.session.sync.InitialSyncStrategy
import org.matrix.android.sdk.internal.session.sync.RoomSyncEphemeralTemporaryStore
import org.matrix.android.sdk.internal.session.sync.model.LazyRoomSyncEphemeral
import org.matrix.android.sdk.internal.session.sync.model.RoomSyncEphemeral
import org.matrix.android.sdk.api.session.sync.model.LazyRoomSyncEphemeral
import org.matrix.android.sdk.api.session.sync.model.RoomSyncEphemeral
import timber.log.Timber
internal class DefaultLazyRoomSyncEphemeralJsonAdapter {

View file

@ -21,7 +21,7 @@ import okio.buffer
import okio.source
import org.matrix.android.sdk.internal.session.sync.InitialSyncStrategy
import org.matrix.android.sdk.internal.session.sync.RoomSyncEphemeralTemporaryStore
import org.matrix.android.sdk.internal.session.sync.model.SyncResponse
import org.matrix.android.sdk.api.session.sync.model.SyncResponse
import timber.log.Timber
import java.io.File
import javax.inject.Inject

View file

@ -29,7 +29,7 @@ import org.matrix.android.sdk.internal.database.query.getOrCreate
import org.matrix.android.sdk.internal.session.room.read.FullyReadContent
import org.matrix.android.sdk.internal.session.sync.RoomFullyReadHandler
import org.matrix.android.sdk.internal.session.sync.RoomTagHandler
import org.matrix.android.sdk.internal.session.sync.model.RoomSyncAccountData
import org.matrix.android.sdk.api.session.sync.model.RoomSyncAccountData
import javax.inject.Inject
internal class RoomSyncAccountDataHandler @Inject constructor(private val roomTagHandler: RoomTagHandler,