Move SpacePeekResult to api package, and cleanup

This commit is contained in:
Benoit Marty 2022-04-08 17:51:16 +02:00 committed by Benoit Marty
parent b4dbb389b1
commit 73d22d0622
5 changed files with 18 additions and 18 deletions

View File

@ -22,7 +22,7 @@ import org.matrix.android.sdk.api.session.events.model.Event
import org.matrix.android.sdk.api.session.room.RoomSortOrder
import org.matrix.android.sdk.api.session.room.RoomSummaryQueryParams
import org.matrix.android.sdk.api.session.room.model.RoomSummary
import org.matrix.android.sdk.internal.session.space.peeking.SpacePeekResult
import org.matrix.android.sdk.api.session.space.peeking.SpacePeekResult
typealias SpaceSummaryQueryParams = RoomSummaryQueryParams

View File

@ -14,11 +14,18 @@
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.space.peeking
package org.matrix.android.sdk.api.session.space.peeking
import org.matrix.android.sdk.api.session.room.peeking.PeekResult
// TODO Move to api package
sealed class SpacePeekResult {
abstract class SpacePeekError : SpacePeekResult()
data class FailedToResolve(val spaceId: String, val roomPeekResult: PeekResult) : SpacePeekError()
data class NotSpaceType(val spaceId: String) : SpacePeekError()
data class Success(val summary: SpacePeekSummary) : SpacePeekResult()
}
data class SpacePeekSummary(
val idOrAlias: String,
val roomPeekResult: PeekResult.Success,
@ -28,30 +35,18 @@ data class SpacePeekSummary(
interface ISpaceChild {
val id: String
val roomPeekResult: PeekResult
// val default: Boolean?
val order: String?
}
data class SpaceChildPeekResult(
override val id: String,
override val roomPeekResult: PeekResult,
// override val default: Boolean? = null,
override val order: String? = null
) : ISpaceChild
data class SpaceSubChildPeekResult(
override val id: String,
override val roomPeekResult: PeekResult,
// override val default: Boolean?,
override val order: String?,
val children: List<ISpaceChild>
) : ISpaceChild
sealed class SpacePeekResult {
abstract class SpacePeekError : SpacePeekResult()
data class FailedToResolve(val spaceId: String, val roomPeekResult: PeekResult) : SpacePeekError()
data class NotSpaceType(val spaceId: String) : SpacePeekError()
data class Success(val summary: SpacePeekSummary) : SpacePeekResult()
}

View File

@ -43,6 +43,7 @@ import org.matrix.android.sdk.api.session.space.SpaceService
import org.matrix.android.sdk.api.session.space.SpaceSummaryQueryParams
import org.matrix.android.sdk.api.session.space.model.SpaceChildContent
import org.matrix.android.sdk.api.session.space.model.SpaceParentContent
import org.matrix.android.sdk.api.session.space.peeking.SpacePeekResult
import org.matrix.android.sdk.internal.di.UserId
import org.matrix.android.sdk.internal.session.room.RoomGetter
import org.matrix.android.sdk.internal.session.room.SpaceGetter
@ -51,7 +52,6 @@ import org.matrix.android.sdk.internal.session.room.membership.leaving.LeaveRoom
import org.matrix.android.sdk.internal.session.room.state.StateEventDataSource
import org.matrix.android.sdk.internal.session.room.summary.RoomSummaryDataSource
import org.matrix.android.sdk.internal.session.space.peeking.PeekSpaceTask
import org.matrix.android.sdk.internal.session.space.peeking.SpacePeekResult
import javax.inject.Inject
internal class DefaultSpaceService @Inject constructor(

View File

@ -23,6 +23,11 @@ import org.matrix.android.sdk.api.session.room.model.RoomType
import org.matrix.android.sdk.api.session.room.model.create.RoomCreateContent
import org.matrix.android.sdk.api.session.room.peeking.PeekResult
import org.matrix.android.sdk.api.session.space.model.SpaceChildContent
import org.matrix.android.sdk.api.session.space.peeking.ISpaceChild
import org.matrix.android.sdk.api.session.space.peeking.SpaceChildPeekResult
import org.matrix.android.sdk.api.session.space.peeking.SpacePeekResult
import org.matrix.android.sdk.api.session.space.peeking.SpacePeekSummary
import org.matrix.android.sdk.api.session.space.peeking.SpaceSubChildPeekResult
import org.matrix.android.sdk.internal.session.room.peeking.PeekRoomTask
import org.matrix.android.sdk.internal.session.room.peeking.ResolveRoomStateTask
import org.matrix.android.sdk.internal.task.Task

View File

@ -35,8 +35,8 @@ import org.matrix.android.sdk.api.session.Session
import org.matrix.android.sdk.api.session.room.model.RoomType
import org.matrix.android.sdk.api.session.room.peeking.PeekResult
import org.matrix.android.sdk.api.session.space.JoinSpaceResult
import org.matrix.android.sdk.internal.session.space.peeking.SpacePeekResult
import org.matrix.android.sdk.internal.session.space.peeking.SpaceSubChildPeekResult
import org.matrix.android.sdk.api.session.space.peeking.SpacePeekResult
import org.matrix.android.sdk.api.session.space.peeking.SpaceSubChildPeekResult
import timber.log.Timber
class SpacePreviewViewModel @AssistedInject constructor(